text:
Q: Editar um arquivo XLS já criado Preciso editar um arquivo XLS já criado, porém estou conseguindo apenas se crio um arquivo novo e deleto o antigo, até agora está dando certo porém gostaria de saber se é possível editar o arquivo antigo e não ter que deletar o antigo e criar um novo com o mesmo nome.
    String autEdit = request.getParameter("aut");
    response.setContentType("text/html;charset=UTF-8");
    File file = new File("C:\\Tratados\\4-600dpi.xls");
    Workbook workbook = null;
    try {
        workbook = Workbook.getWorkbook(new File("C:\\teste.xls"));
    } catch (BiffException ex) {
        Logger.getLogger(autorizacao.class.getName()).log(Level.SEVERE, null, ex);
    }
    WritableWorkbook copy = Workbook.createWorkbook(new File("C:\\Teste.xls"), workbook);

    Sheet sheet = workbook.getSheet(0);
    int linhas = sheet.getRows();
    int i = 0, x = 0;
    WritableSheet sheet2 = copy.getSheet(0);
    for (i = x; i < linhas; i++) {
        Cell a1 = sheet.getCell(0, i);
        WritableCell a2 = sheet2.getWritableCell(1, i);
        WritableCell a3 = sheet2.getWritableCell(2, i);

        String as1 = a1.getContents();
        String as2 = a2.getContents();
        String as3 = a3.getContents();

        if ("-".equals(as2)){
            Label l = (Label) a2;
            l.setString(autEdit);
            Label ll = (Label) a3;
            ll.setString("Editado");
            linhas = i - 1;

        }
    }
    copy.write();
    file.delete();
    try {
        copy.close();
    } catch (WriteException ex) {
        Logger.getLogger(autorizacao.class.getName()).log(Level.SEVERE, null, ex);
    }
    workbook.close();

A: Usando a biblioteca Apache Poi você pode fazer de uma das seguintes maneiras:
XSSFWorkbook wb = new XSSFWorkbook(new FileInputStream(caminho));

OU ainda
 Workbook wb = WorkbookFactory.create(new File(caminho));

Onde caminho é uma string com o caminho para o seu arquivo fisico.
Uma vez que tenha o workbook você pode manipular as planilhas, células entre outros atributos como quiser, da maneira que já está fazendo no trecho de código apresentado.
Esta referência possui um link para uma classe java que exemplifica a leitura de um arquivo existente no item "Reading or modifying an existing file": http://poi.apache.org/spreadsheet/how-to.html#user_api

A: Consegui desta forma editar uma planilha já criada:
try {
        HSSFWorkbook workbook;
        try (FileInputStream file = new FileInputStream(new File("C:\\teste.xls"))) {
            workbook = new HSSFWorkbook(file);
            HSSFSheet sheet = workbook.getSheetAt(0);
            for (int i = 0; i < sheet.getPhysicalNumberOfRows(); i++) {

                Row row = sheet.getRow(i);
                org.apache.poi.ss.usermodel.Cell a1 = row.getCell(1);
                org.apache.poi.ss.usermodel.Cell a2 = row.getCell(2);

                String as1 = a1.getStringCellValue();

                if (as1.equals("-")) {
                    a1.setCellValue("teste");
                    a2.setCellValue("EDITADO");
                    i = sheet.getPhysicalNumberOfRows();
                }
            }
            file.close();

            FileOutputStream outFile = new FileOutputStream(new File("C:\\teste.xls"));
            workbook.write(outFile);
            outFile.close();
            System.out.println("Arquivo Excel editado com sucesso!");
        }
    } catch (FileNotFoundException e) {
        System.out.println("Arquivo Excel não encontrado!");
    } catch (IOException e) {
        System.out.println("Erro na edição do arquivo!");
    }

A: isso ai resolve o que precisa
    XSSFWorkbook workbook = null;
File file = new File("C:\\Teste.xls");
FileOutputStream out = null;
XSSFSheet excelSheet = null;
CellStyle style = null;
XSSFFont font = null;
Map<String, Object[]> excelData = new TreeMap<String, Object[]>();
// verifica se o arquivo existe
if (file.exists()) {
    FileInputStream inputStream = new FileInputStream(file);
    workbook = new XSSFWorkbook(inputStream);
    // vefirifica se planilha existe
    if (workbook.getSheet(excelSheetName) != null) {
        excelSheet = workbook.getSheet(excelSheetName);
    } else {
        excelSheet = workbook.createSheet(excelSheetName);
        addIntoCell(excelData, excelSheet, "0", style);
    }
} else {
    workbook = new XSSFWorkbook();
    if (workbook.getSheet(excelSheetName) != null) {
        excelSheet = workbook.getSheet(excelSheetName);
    } else {
        excelSheet = workbook.createSheet(excelSheetName);
       // vefirifica se planilha existe
        addIntoCell(excelData, excelSheet, "0", style);
    }
}

Depois feche os stream abertos


text:
Q: In MySQL, how do you change the value of a column in a table depending on an updated column in another table? I'm attempting to create a trigger that increases the value of a column INCOME in the Salary database by 500 each time the value of WorkYear in the Employee table is increased by one year. For example, if the workYear is 4 and the salary is 1000, the salary should be 1500 if the workYear is increased by one year, 2000 if the workYear is increased by two years, and so on.
I tried to create such trigger and here is my code :

DELIMITER $$
create trigger increment AFTER UPDATE  on employee
for each row
BEGIN
   IF OLD.workYear <> new.workYear THEN
       update salary
     set income = (income + (new.workYear-old.workYear)*500);
   END IF;
END$$

The idea behind this code is that after we update the workYear, the trigger should increase the salary by the difference of years * 500, (new.workYear-old.workYear)*500, but it increases all the rows by the same number, (5500 if we add one year, 27500 if we add two years, etc.) which not what we are looking for .
I am new to MySQL and would appreciate it if someone could assist me with this.
Thanks in advance
FaissalHamdi

A: In MySQL an AFTER trigger can affect the entire table, so you must declare the update scope in the form of criteria or a join.

Create Trigger in MySQL
To distinguish between the value of the columns BEFORE and AFTER the DML has fired, you use the NEW and OLD modifiers.

The concept is similar but each RDBMS has a slightly different syntax for this, be careful to search for help specifically on your RDBMS.

In the original query these special table references were used to evaluate the change condition however the scope of the update was not defined.

Assuming that there is a primary key field called Id on this salary table.

Also note that if you can, the query should be expressed in the form of a set-based operation, instead of static procedural script, this will be more conformant to other database engines.
So lets try this:
DELIMITER $$
create trigger increment AFTER UPDATE on employee
for each row
BEGIN

   UPDATE salary s
   SET income = (income + (new.workYear-old.workYear)*500)
   WHERE s.Id = OLD.Id

END$$

redpajama_set_name: RedPajamaStackExchange


text:
Q: Can we restart an app programmatically in ios when the phone is turned on We have an app that runs in the background, which calls an URL every 15 minutes, but when the phone is turned off and turned on, we want to open the app automatically and resume calling the URL, is this possible???
This is an app that gives a local notification to the user that a website content has changed, when the content has been changed by the admin, that is the reason...
i think this is possible for location services and voip, but what are the conditions before we do this and how to do this?
any help will be much appreciated, thanks in advance...

A: There is a way to do this intended for voip apps by setting your app's UIBackgroundMode to include the voip value. See the Apple Documentation on that for more info, but here is the excerpt about what the voip flag does for you:

The app provides Voice-over-IP services. Apps with this key are
  automatically launched after system boot so that the app can
  reestablish VoIP services. Apps with this key are also allowed to play
  background audio.

If your app is a voip app, then this is what you need. If your app is not a voip app I don't know if this change will make it past Apple's review since that flag is really meant for voip apps.

A: use location services and the app is kept running and is restarted so as to get location infos (but be aware that this drains battery and will not be liked by apple/users :D)
[[CLLocationManager sharedManager] startMonitoringSignificantLocationChanges];


text:
Q: Правильно ли я решил задачу? Решил задачу со следующими условиями:
Сообщения шифруются следующим образом. Для этого они вставляют некоторую перестановку последовательности цифр от 0 до 9, в произвольное место сообщения.
Формат ввода:
В единственной строке входных данных дана строка из десятичных цифр и вопросительных знаков. Длина строки не превышает 2 * 10^5
Формат вывода:
Выведите одно слово "YES" (без кавычек), если такое сообщение мог отправить друг, или "NO" (без кавычек), если это не так.
И пример:
Ввод:
1234??7890

Вывод:
YES

Ввод:
11223344550?2?4?6?80?6677889900

Вывод:
YES

Ввод:
0?2?4?6?802?

Вывод:
NO

Моё решение:
import java.util.Scanner;

public class Main3 {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        String input = scanner.nextLine();
        if (input.startsWith("1") && input.endsWith("0")) {
            System.out.println("YES");
        }else {
            System.out.println("NO");
        }
    }
}

Вопрос в следующем, правильно ли я понял условие, и покроет ли мой код все варианты тестов.
Мне кажется, что суть задачи, сводится к нахождению начала и конца последовательности, но не совсем понимаю, про граничные значения, если перестановка будет в начале и в конце, и нужно ли на это обращать внимания?


text:
Q: Parameters in the page URL are lost when clicking on any button $("#saveNews").click(function() {
                alert("clicked on save");
                alert(idx);
                alert(id);
                alert(type);
                alert(subtype);
                window.location = "'"+'news.html?type=' + type +     '&subtype=' + subtype+'&id='+id+"'";
                toSaveNews(idx);
            });

     function toSaveNews(index) {
            alert("inside saving");
            alert(index);
            var newsFD = new FormData($("#fileinfonews"));
            var news = $("#newsDetails").val();
    alert(customer);
    alert("stop");
            newsFD.append("reqData1", reqData1);
            newsFD.append("reqData2", reqData2);
            if (news == "") {
                bootbox.alert("News can't be empty.Enter something."); else {
                alert('b4 ajax');
                $.ajax({
                    type : "POST",
                    url : "/path1/saveNews",
                    data : newsFD,

                    processData : false,
                    contentType : false,
                    success : function(data) {
                        alert("success!!!!!!!!");

        }

Here I got the alerts even before Ajax. There are 3 buttons Upload, Back and Reset. 'savenews' is the id of Upload button. In back button I put like:
   <button class="btn" id="back" onclick="history.back();">Back</button>

Whenever I click on any of these buttons the URL becomes, localhost:3338/news.html?
I didn't get any parameters. I don't know why. Can you guys please give me the solution?Thanks in advance.

A: window.location = "'"+'news.html?type=' + type +     '&subtype=' + subtype+'&id='+id+"'";

There are to many '' try this:
window.location = 'news.html?type=' + type +     '&subtype=' + subtype+'&id='+id;

Then if there are white spaces in your url, you should decode it.
Is it not possible to change a parameter for a back navigation. The back navigation always points to the last page:
URL: news.html?type=1
-> (navigate to) URL: news.html?type=2
<- (history.back() called) URL: news.html?type=1

A: $("#saveNews").click(function(event) {
                                        event.preventDefault();
                                        toSaveNews(idx);
                                    });
                                    //Basically,what the problem is,the form is being submitted automatically.So,prevent that using preventDefault()


text:
Q: Replacing certain occurence of character with the value of variable using sed I am writing a bash script to create a csv file from a program.
I have a variable named var which is of the form:
var=1,20,40,50,60,70,80

Now ,I want to replace first occurrence of ',' with a no. which is stored in variable named j.
Suppose j now has a value equal to 2.
I want var to finally become:
1,2,20,40,50,60,70,80

I tried doing
var=$(echo var| sed 's/,/*/$j,/')

But what it did was replace first ',' with $j, instead of replacing it with actual value of j.
How to accomplish this?
Thanks

A: Use double quotes instead of single quotes or the shell won't expand $j:
"s/,/*/$j,/"


text:
Q: Remove the empty page before a table I have the following problm. My thesis has a landscape oriented table with \scriptsize as size of font. The problem is that I have an empty page before that I can't remove it. If I change the font size to \tiny, I don't have the empty page but the letters are really tiny. Any solution to remove the empty page?
This is part of the code:
%First page
Table summarizes the above mentioned characteristics of the ......

\vfill
%empty page that has to be removed
%Third page
\newpage

\begin{landscape}
\begin{table}[H]
\scriptsize
\centering

A: Instead of "\begin{landscape}...\end{landscape}" try with the tag "\begin{sidewaystable}...\end{sidewaystable}" which comes with the "rotating" package which can help you to fix the issue


text:
Q: How to use rabbitmqctl to connect to the rabbitmqserver in the docker container? I've used docker to start my rabbitmqserver. How can I use rabbitmqctl to connect to the rabbitmqserver in the docker container?
Port 5672 has been exposed and map to the 5672 port of my host. But I still get the following error:
Status of node rabbit@m2 ...
Error: unable to connect to node rabbit@m2: nodedown

A: Assuming your container is called rabbitmq and is running:
docker exec rabbitmq rabbitmqctl start_app

A: rabbitmqctl uses Erlang Distributed Protocol (EDP) to communicate with RabbitMQ. Port 5672 provides AMQP protocol. You can investigate EDP port that your RabbitMQ instance uses:
$ netstat -uptan | grep beam
tcp        0      0 0.0.0.0:55950           0.0.0.0:*               LISTEN      31446/beam.smp
tcp        0      0 0.0.0.0:15672           0.0.0.0:*               LISTEN      31446/beam.smp
tcp        0      0 0.0.0.0:55672           0.0.0.0:*               LISTEN      31446/beam.smp
tcp        0      0 127.0.0.1:55096         127.0.0.1:4369          ESTABLISHED 31446/beam.smp
tcp6       0      0 :::5672                 :::*                    LISTEN      31446/beam.smp

It means that RabbitMQ:

*

*connected to EPMD (Erlang Port Mapper Daemon) on 127.0.0.1:4369 to make nodes able to see each other

*waits for incoming EDP connection on port 55950

*waits for AMQP connection on port 5672 and 55672

*waits for incoming HTTP management connection on port 15672

To make rabbitmqctl able to connect to RabbitMQ you also have to forward port 55950 and allow RabbitMQ instance connect to 127.0.0.1:4369.
It is possible that RabbitMQ EDP port is dinamic, so to make it static you can try to use ERL_EPMD_PORT variable of Erlang environment variables or use inet_dist_listen_min and inet_dist_listen_max of Erlang Kernel configuration options and apply it with RabbitMQ environment variable - export RABBITMQ_CONFIG_FILE="/path/to/my_rabbitmq.conf
my_rabbitmq.conf
[{kernel,[{inet_dist_listen_min, 55950},{inet_dist_listen_min, 55950}]}].

Or you can use RabbitMQ Management Plugin. It is more functional and simple to setup.

A: I got this error trying to setup RabbitMQ on a cluster on an ubuntu and fedora machine:
el@apollo:/etc/rabbitmq$ sudo rabbitmqctl join_cluster rabbit@192.168.1.8
Clustering node rabbit@apollo with 'rabbit@192.168.1.8' ...
Error: unable to connect to nodes ['rabbit@192.168.1.8']: nodedown

DIAGNOSTICS
===========

attempted to contact: ['rabbit@192.168.1.8']

rabbit@192.168.1.8:
  * unable to connect to epmd (port 4369) on 192.168.1.8: address
    (cannot connect to host/port)

current node details:
- node name: rabbitmqctl7233@apollo
- home dir: /var/lib/rabbitmq
- cookie hash: g0tS9zEdo7OEDSZaDTGirA==

I was able to eliminate this error by opening the 4369 and 59984 port on the 192.168.1.8 machine that is one of the slave nodes of the cluster:
el@defiant ~ $ su -
Password:
[root@defiant ~]# iptables -I INPUT -p tcp --dport 4369 --syn -j ACCEPT
[root@defiant ~]# iptables -I INPUT -p tcp --dport 59984 --syn -j ACCEPT

A: Port 4369 was not enabled on firewall. When I switched firewall 'off'. Everything started working.

A: Just type docker exec -t rabbitmq sh
Then you will get access to the terminal of your docker environment.
Once you are in, type rabbitmqctl to see if it works
Hopefully it can help you.


text:
Q: Quick Question - ContourPlot a Rectangular region I have been using the contourplot command to illustrate the eigenfunctions of a 2x1 rectangle. However, the contourplot scales the y axis to make the region square, which is distorting the image.
The command I have used to plot my eigenfunctions is:
ContourPlot[Evaluate[evIF[[15]][x, y]], {x, y} \[Element] mesh,
 PlotRange -> All, Axes -> None, ImageSize -> 500, PlotPoints -> 40]

Which produces:

However, the region is a 2x1 rectangle, so the plot should actually look like this:

Is there any additional command I can use to prevent the scaling from happening? I am new to mathematica and am still trying to pick up the basics.


text:
Q: Is it possible to overwrite the action-value in a form? is it possible to overwrite the action-value of one searchfield when submitting the value of the second searchfield?
I'm in need of adding a searchfield      <input type="search" id="id2">
      <input type="submit" value="value2" /> to:

  <form method="get" action="/../.." id="search">
    <div>
      <input type="search" id="id1">
      <input type="submit" value="value1" />
  </div>
  </form>
By pressing enter in the second searchfield, I'm forwarded to the link of the first searchfield because it has an action-value.
Can I change this behaviour?

A: Using JavaScript :
    function setAction(){
        document.getElementById('search').setAttribute('action',document.getElementById('id2').value
    }

You need to set onClick event of 'id2' with setAction().


text:
Q: Symfony2: Database schema and entities not updating with changed metadata I am having trouble updating the schema in Symfony2.
I have imported a database into Symfony2 using doctrine and that created all the ORM files in YML.
I have created all the entities from this metadata and it worked great, but if I want to change the database schema using the orm.yml files, It does not update my database or even update the entities when I regenerate them.
The import created the orm.yml files in
/src/{name}/{my}bundle/Resources/config/doctrine/metadata/orm/{table}.orm.yml
It was created with no errors.
When I do:
php app/console doctrine:schema:update --dump-sql

it displays:
ALTER TABLE accounttypes CHANGE description description VARCHAR(45) NOT NULL

So I:
php app/console doctrine:schema:update --force

And:
Updating database schema...
Database schema updated successfully! "1" queries were executed

I can do this over and over again and the same query appears and I execute it and it tells me it is done, but again it shows that it needs to be done again.
I then have gone to the orm.yml files and changed them drastically, but nothing no new queries appear other than the one that is always there when I do this.
The file AccountTypes.orm.yml
Accounttypes:
  type: entity
  table: accounttypes
  fields:
    description:
      id: true
      type: string
      length: 45
      fixed: false
      nullable: false
      generator:
        strategy: IDENTITY
  lifecycleCallbacks: {  }

Change to this:
Accounttypes:
  type: entity
  table: accounttypes
  id:
    id:
      type: integer
      generator: { strategy: AUTO }
  fields:
    description:
      id: true
      type: string
      length: 50
  lifecycleCallbacks: {  }

And it still tells me I need to:
ALTER TABLE accounttypes CHANGE description description VARCHAR(45) NOT NULL

I have also tried using DoctrineMigrationsBundle and the same query shows up needing done. I migrate; It says the query is done and when I use it again the same query shows up.
Does anybody have any idea how this is happening? I am stuck on this, so any help is greatly appreciated.

A: As per @Tomasz, above, make sure that your Symfony2 doesn't try to use annotations to setup database instead of yaml.

A: I had the same problem.
Reason was - a newly created bundle was not yet added to app\config.yml.
Therefor all Entities in this new Bundle got never exported with php app/console doctrine:schema:update --dump-sql


text:
Q: Issue with constraint layout not showing unless I add absolute dimension I have this layout and am trying to switch on a corresponding LL based on a position. However the first Linear Layout will only show up and be drawn if I give the text view inside an absolute dimension such as 200dp for the width, I have tried 0dp with constraints as well.
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/draft_rider_container"
android:layout_width="match_parent"
android:layout_height="100dp"
android:background="#000000"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">

<LinearLayout
    android:id="@+id/header"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#000000"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="30dp"
        android:text="lost"
        android:textColor="@android:color/white"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

</LinearLayout>

<LinearLayout
    android:id="@+id/section"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#000000"
    android:orientation="horizontal"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    android:visibility="gone">

    <TextView
        android:id="@+id/fake"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textAlignment="center"
        tools:text="Andrea Dovizioso's"></TextView>

</LinearLayout>

<LinearLayout
    android:id="@+id/row"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    android:visibility="gone">

    <TextView
        android:id="@+id/rider_name"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textAlignment="center"
        tools:text="Andrea Dovizioso's"></TextView>

</LinearLayout>

This layout is rendered from a recycler view that is on my fragment which is placed like this :
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".roster.RosterFragment">

<androidx.recyclerview.widget.RecyclerView
    android:id="@+id/player_rider_list"
    android:layout_width="0dp"
    android:layout_height="0dp"
    android:background="#ffffff"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent" />

<com.google.android.material.floatingactionbutton.FloatingActionButton
    android:layout_width="56dp"
    android:layout_height="56dp"
    android:layout_marginRight="15dp"
    android:layout_marginBottom="15dp"
    android:src="@drawable/baseline_edit_white_24dp"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:rippleColor="@color/colorPrimary" />

And here is my adapter :
class PlayerRidersAdapter :  RecyclerView.Adapter<PlayerRidersAdapter.ViewHolder>() {

var riderList = ArrayList<Rider>()

override fun onCreateViewHolder(parent: ViewGroup, position: Int): ViewHolder {
    val view = LayoutInflater.from(parent.context).inflate(R.layout.rider_item_layout, null, false)
    return ViewHolder(view)
}

override fun getItemCount(): Int {
    return riderList.count() + 2
}

override fun onBindViewHolder(holder: ViewHolder, position: Int) {
    when(position) {
        0 -> showHeader(holder)
        3 -> showSection(holder)
        else -> showRow(holder)
    }
}

fun showHeader(holder: ViewHolder) {
    holder.headerContainer.visibility = View.VISIBLE
    holder.sectionContainer.visibility = View.GONE
    holder.rowContainer.visibility = View.GONE
}

fun showRow(holder: ViewHolder) {
    holder.headerContainer.visibility = View.GONE
    holder.sectionContainer.visibility = View.GONE
    holder.rowContainer.visibility = View.VISIBLE

    //holder.name.text = rider.name
}

fun showSection(holder: ViewHolder) {
    holder.headerContainer.visibility = View.GONE
    holder.sectionContainer.visibility = View.VISIBLE
    holder.rowContainer.visibility = View.GONE
}

fun addRiders(riders : ArrayList<Rider>){
    riderList.addAll(riders)
    notifyDataSetChanged()
}

class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
    var headerContainer = view.findViewById<LinearLayout>(R.id.header)
    var sectionContainer = view.findViewById<LinearLayout>(R.id.section)
    var rowContainer = view.findViewById<LinearLayout>(R.id.row)
    var name = view.findViewById<TextView>(R.id.rider_name)
}
}

A: In your adapter, specify the following in onCreateViewHolder():
val view = LayoutInflater.from(parent.context).inflate(R.layout.rider_item_layout, parent, false)

Specifying the root argument will let the inflated layout be sized properly. This is most likely your problem.
However, match_parent sometimes has strange behavior when used in ConstraintLayout, so use 0dp instead and remember to constrain the effected sides. It would be nice for ConstraintLayout to either handle this case, report it as an error or, at least, support a Lint check.
An aside: The constraints on the TextViews that are held within a LinearLayout have no effect. Constraints only apply to direct children of ConstraintLayout.


text:
Q: Prove that $M$ is flat $\iff$ each $M_i$ is flat (2.4 Atiyah & MacDonald pg. 31) Here is the question I want to solve:
Let $M_i (i \in I)$ be any family of $A$-modules, let $M$ be their direct sum. Prove that $M$ is flat $\iff$ each $M_i$ is flat.
Here is a solution to it found on the internet:

But I do not understand the following:
1-Why we need to identify $j \otimes id_M$ with a map $h$? also, what criteria should we  use for choosing this map?
Here are the isomorphisms of (2.14 iii*):

And here is (2.22.i*):

A: The takeaway of Proposition 2.22 is that exactness can be checked coordinate wise, in the sense that if a short sequence $\mathsf S: 0\to M'\to M\to M''\to 0$ of morphisms is obtained by taking the direct sum of several short sequences of morphisms $0\to M_i'\to M_i\to M_i''\to 0$, then $\mathsf S$ is exact if and only if each summand sequence is itself exact.
Going to the second-to-last claim, this is saying that if one takes a sequence $\mathsf S$ and if $M$ is the sum of modules $M_i$, then $\mathsf S\otimes_ AM$ is the sum of the sequences $\mathsf{S}_i = \mathsf{S}\otimes_A M_i$. This means that  $\mathsf S\otimes_ AM$ is exact if and only if each $\mathsf{S}_i = \mathsf{S}\otimes_A M_i$ is exact by the first paragraph.
Finally, $\mathsf{S}_i = \mathsf{S}\otimes_A M_i$ is exact for any $\mathsf{S}$ if and only if $M_i$ is flat (by definition, if you would like to) which means that $\mathsf{S}\otimes_A M$ is exact for any $\mathsf{S}$ if and only if each $M_i$ is flat. Thus $M$ is $A$-flat if and only if each $M_i$ is flat.
The map $h$ is simply the unique map that sends a finite sum $\sum_{i\in I}n_i\otimes m_i$ with $n_i\in N'$ and $m_i\in M_i$ to the finite sum $\sum_{i\in I} j(n_i)\otimes m_i$ where now $j(n_i)\in N$. There is a typo in the solutions and the $N'$ in the codomain should be an $N$. The whole motto of this result is that tensor products commute with direct sums: for any family of modules $\{M_i : i\in I\}$ and any module $N$, there is a natural isomorphism
$$ M\otimes N  \longrightarrow \bigoplus_{i\in I} M_i\otimes N
$$
where $M = \left(\bigoplus_{i\in I} M_i\right)$ that sends an element  $m\otimes n$ with $m = \sum_{i\in I} m_i $ to $\sum_{i\in I} m_i\otimes n$. The inverse map sends an element $\sum_{i\in I} m_i\otimes n_i$ to the the sum $\sum_{i\in I} m_ie_i\otimes n_i$ where $m_ie_i\in M$ is the element that is zero everywhere except on the $i$th coordinate where it equals $m_i$.


text:
Q: nuxt: pass data from server plugin to client I have a nuxt behind an auth proxy. A request will get to nuxt (only if) it is authorized, in which case the X-auth-username (and other) headers will be set.
I have found that, using a server plugin, I can read this info on the request. However, the data is not send from the server to the client. How do I get the server to send information headers (in particular the user name) to the client?
My plugin so far:

import { Plugin } from '@nuxt/types'
import { IncomingHttpHeaders } from 'http'

declare module '@nuxt/types' {
  interface NuxtAppOptions {
    $headers: IncomingHttpHeaders
  }
}

const getAuth: Plugin = (context, inject) => {
  const headers = context.req.headers
  inject('headers', headers)
}

export default getAuth

NOTE I am using the nuxt-composition-api, and not vuex.

A: You can use beforeNuxtRender nuxt hook to set properties on server which will be serialized in html and retrievable on client:
// in nuxt plugin
if (process.server) {
    // set property on server
    context.beforeNuxtRender(({ nuxtState }) => {
      nuxtState.headerValue = 'test';
    });
} else {
    // retrieve it on client
    let valueOnClient = context.nuxtState?.headerValue;
}

A: Injected header should be available as $headers in templates or lifecycle methods of components as this.$headers.


text:
Q: NavigationBar appearance() (tint color ..) How can I set a tint color to a specific navigation controller ?
Because by using :
UINavigationBar.appearance().barTintColor = UIColor(red: 0.1, green: 0.22, blue: 0.212, alpha: 1)

The color will be set to all navigation controllers , isn't it ?
I've tried this code but it is not working ! Why ?
let nav = UINavigationController(rootViewController: feedvc)
nav.navigationBar.appearance().barTintColor = UIColor(red: 0.1, green: 0.22, blue: 0.212, alpha: 1)

A: You can set the tint of a specific controller by accessing barTintColor directly:
nav.navigationBar.barTintColor = UIColor(red: 0.1, green: 0.22, blue: 0.212, alpha: 1)

A: appearance() is used for changing things on a global scale and it takes effect for the next instance of something that is created.
So for example if you set it in the viewDidLoad of an object which is of the same type as you are applying appearance() then it is too late as that object has already been created. However in your case you are calling it on an instance not a class and so it wouldn't work anyway as it is a class method not an object method.
That is why it is not working in your code, to change the color just set nav.navigationBar.barTintColor.


text:
Q: How can I portably send a C struct through a network socket? Suppose I have a C struct defined as follows :
typedef struct servData {
    char max_word[MAX_WORD];
    char min_word[MAX_WORD];
    int word_count ;
} servSendData ;

where 'MAX_WORD' could be any value.
Now if I have an instance of this structure :
servSendData  myData ;

And if I populate this instance and then send it over the network, will there be any portability issues here considering that I want my server as well as the client to be running on either a 64-bit system or a 32-bit system.
I am going to send and receive data as follows :
//server side
strcpy(myData.max_word, "some large word") ;
strcpy(myData.min_word, "small") ;
myData.word_count=100 ;
send(sockFd, (char*)&myData, sizeof(myData);

//client side
recv(sockFd, (char*)&myData, sizeof(myData);
printf("large word is %s\n", myData.max_word) ;
printf("small word is %s\n", myData.min_word) ;
printf("total words is %d\n", myData.word_count) ;

A: Yes, there definitely will be portability issues.
Alignment of structure members can be different even among different compilers on the same platform, let alone different platforms. And that's all assuming that sizeof(int) is the same across all of them (though granted, it usually is --- but do you really want to rely on "usually" and hope for the best?).
This holds even if MAX_WORD is the same on both computers (I'll assume they are from here on out; if they're not, then you're in trouble here).
What you need to do is send (and receive) each field separately. There is also a problem with sizeof(int) and endianness, so I've added a call to htonl() to convert from system to network byte order (the inverse function is ntohl()). They both return uint32_t which has a fixed, known, size.
send(sockFd, myData.max_word, sizeof(myData.max_word)); // or just MAX_WORD
send(sockFd, myData.min_word, sizeof(myData.min_word));
uint32_t count = htonl(myData.word_count); // convert to network byte order
send(sockFd, &count, sizeof(count));

// error handling!
if((ret = recv(sockFd, myData.max_word, sizeof(myData.max_word))) != sizeof(myData.max_word))
{
    // handle error or read more data
}
... // and so on
// remember to convert back from network byte order on recv!
// also keep in mind the third field is now `uint32_t`, and not `int` in the stream

A: You have to take care about the endians.
May you should use hton() or ntoh() functions, to convert between little and big endian.

A: As other relies have stated there are real problems in copying a C structure between different machines with different compilers/word size/and endian structure.  One common way to resolve this issue is to transform your data into a machine independent format, transfer it across the network and then transform it back into a structure on the receiver.  This is such a common requirement that multiple technologies already exist to do this - the two that spring to my mind initially are gsoap and rpcgen although there are probably many other options.
I've mostly used gsoap and after you get past the initial learning curve you can develop robust solutions that scale well (with multiple threads) and which handles both the networking and data translations for you.
If you don't want to go down this route then the safest approach is to write routines that convert your data to/from a standard string format (if you have issues with Unicode you'll need to take that into account as well) and then send that across the network.

A: You can use structure packing. With most C compilers, you can enforce a specific structure alignment. It is sometimes used for what you need it - to transfer a struct over a network.
Note that this still leaves endianness issues, so this is not a universal solution.

A: If you are not writing embedded software, sending data between applications without serializing properly is rarely a good idea.
The same goes for using raw sockets, which is not very convenient, and feels a bit like "reinventing the wheel".
Many libraries can help you with both! Of course, you don't have to use them, but reading their documentation, and understanding how they work will help you make better choices. Things you have not yet planned can come out of the box (like, what happens when you want to update your system, and the message format changes?)
For serialization, have a read on those general purpose formats:

*

*Human readable: JSON, XML, YAML, others...

*Binary: Protobuf, TPL, Avro, BSON, MessagePack, and many others

For socket abstraction, look up

*

*Boost ASIO

*ZeroMQ

*nanomsg

*Many others


text:
Q: Developing application using the .NET framework licensing Are there any license requirements when using the .NET framework for creating a commercial application?
Is there everything you need to know in the .NET framework EULA ? (i.e when you install .NET 4) or are there other requirements too ?
Talking about the EULA, it says that you have to have a licensed version of the OS.I do have an XP license but if I want my application to be used on Windows7, should I get a 7 license too?
As far as redistributing the framework,I am not planning to do so but will ask the user to download it

A: Licenses tend to be rather complex legal documents, and I am not a lawyer (nor are most people on this site) so any answers you get her should be viewed only as opinion and not advice.
In general, the license is intended to be rather permissive.  You can't reverse engineer the code, change it, and call it your own.. you can't sue MS for providing it, etc. etc..
The term you refer to about the licensed OS means that your right to use the framework extends only to running it on a licensed version of the OS.  That means, legally you are not allowed to run the code on an unlicensed OS, which of course cannot be legally run either.  That doesn't mean you have to buy a license for Windows 7 if someone else is going to run it on Windows 7.  You only need a license for Windows 7 if YOU are going to run it on Windows 7.
Your end users are responsible for making sure they have a licensed OS, and they aren't allowed to run your program that uses the framework on an unlicensed OS.  But, practically speaking, if they're knowingly using it on an unlicensed OS they probably won't respect the framework license either.
I wouldn't worry too much about the terms of the license, unless you're doing something VERY wrong, then you're using it as Microsoft intended it to be used.


text:
Q: Spark Streaming processing time "sawtooth" When I run a Spark Streaming application, the processing time shows strange behavior, even when there are no incoming data. Processing times are not near zero, and steadily increase until they reach the batch interval value of 10 seconds. They then suddenly drop to a minimum.

Is there an explanation for this strange behavior? I am aware of this question, but I am not using Mesos, but YARN. I have seen similar behavior multiple times with multiple applications.


text:
Q: Msbuild multiple configurations with differing linker settings I've got a large project with multiple configurations. I want to add a configuration to my project with different linker settings (link time code generation), but without recompiling all of the individual source files. Is it possible to have a second configuration with identical compiler settings, different linker settings and to only have MSBuild invoke the linker for the second configuration?
Thanks

A: From the comments above, I was able to set the IntDir and OutDir for both configurations to be the same. This worked, although we decided not to do it in the end.


text:
Q: On which thread is a Swift property's didSet{} being executed? I have defined a property in Swift like:
var foo : String {
  didSet {
    doSomething()
  }
}

So everytime I set foo like foo = "bar" my didSet will be executed.
However I can not find out on which thread didSet is being executed.
For example what happens in this case:
dispatch_async(some_queue, { () -> Void in
     self.foo = "bar"
})

This will cause the didSet code to be executed. Will didSet be run on some_queue or always on the main_queue?

A: The property observers willSet and didSet are directly called from within the setter method, immediately
before/after the new value is stored, so all this executes on the same thread.
You can verify that by setting a breakpoint in didSet and inspecting
the stack backtrace, which would look like this:

* thread #2: tid = 0x4df3, 0x000000010024f9eb swtest2`swtest2.foo.didset : Swift.String(oldValue="foo") + 27 at main.swift:6, queue = 'myQueue', stop reason = breakpoint 1.1
  * frame #0: 0x000000010024f9eb swtest2`swtest2.foo.didset : Swift.String(oldValue="foo") + 27 at main.swift:6
    frame #1: 0x000000010024fb91 swtest2`swtest2.foo.setter : Swift.String(newValue="bar") + 177 at main.swift:4
    frame #2: 0x000000010024fe3a swtest2`swtest2.(closure #1) + 42 at main.swift:13
    ...


text:
Q: builder.build().getShardManager() returns null (JDA Discord Bot) | how do I call the shardmanager? I am new to JDA discord bot and encountered a problem with the builder.build().getShardManager() method.
At some points in my code I need the shardManager but I dont know how to get it.
I found out that getShardManager() can be called on an JDA object (here: JDABuilder.build())
but it only returns a null reference. (The main class crashes at line 4 with a nullpointerexception)
(without the shardmanager the bot works)
How do I obtain the shardmanager correctly?
The main code
this.builder = JDABuilder.createDefault(TOKEN);
builder.addEventListeners(new CommandHandler());
shardManager = this.builder.build().getShardManager();
shardManager.setActivity(Activity.playing("Do smth."));

A: You should use the JDA Object and not the ShardManager.
try something like this:
this.builder = JDABuilder.createDefault(TOKEN);
builder.addEventListeners(new CommandHandler());
JDA jda = this.builder.build();
jda.getPresence().setActivity(Activity.playing("Hello World!"));

You can also set the Activity before building the Bot
this.builder = JDABuilder.createDefault(TOKEN);
builder.addEventListeners(new CommandHandler());
builder.setActivity(Activity.playing("Hello World!"));
JDA jda = this.builder.build();


text:
Q: Pandas: Converting timeseries of values to tracking changes in value I've been stumped on this and - uncharacteristically - the internet has been little help. I am working in Pandas but I feel this must be a general problem for people aiming to store timeseries data efficiently.
I have lots of standard daily time series data where the values happen to change infrequently, like this:
Date        Value
01/02/2014   .1
01/03/2014   .1
01/04/2014   .5
01/05/2014   .5
01/06/2014   .5
01/07/2014   .1
I would convert the data to only track days where a value changes, so the above example should now look like this:
Date        Value
01/02/2014   .1
01/04/2014   .5
01/07/2014   .1
Unfortunately using something like drop_duplicates() would delete required values in a case where a value reverts back to a prior value (like .1 in my example above).

A: Use a combination of shift and all:
In [98]:

import io
temp = """Date,Value
01/02/2014,.1
01/03/2014,.1
01/04/2014,.5
01/05/2014,.5
01/06/2014,.5
01/07/2014,.1"""
df = pd.read_csv(io.StringIO(temp))
df
Out[98]:
         Date  Value
0  01/02/2014    0.1
1  01/03/2014    0.1
2  01/04/2014    0.5
3  01/05/2014    0.5
4  01/06/2014    0.5
5  01/07/2014    0.1

In [99]:

df.loc[(df.shift() != df).all(axis=1)]
Out[99]:
         Date  Value
0  01/02/2014    0.1
2  01/04/2014    0.5
5  01/07/2014    0.1

Here we compare the shifted (by 1 row) dataframe with the original dataframe, we then want to compare each column and use all and pass axis=1 to achieve this.
Further breakdown, if we look at what df.shift() != df returns:
In [100]:

df.shift() != df
Out[100]:
   Date  Value
0  True   True
1  True  False
2  True   True
3  True  False
4  True  False
5  True   True

We get a dataframe with boolean values but we can't use this as a mask as is, we want to check that all rows are True so we use all:
In [101]:

(df.shift() != df).all()
Out[101]:
Date      True
Value    False
dtype: bool

However, by default it checks that the columns are all True, we want to check the row values so we pass axis=1:
In [102]:

(df.shift() != df).all(axis=1)
Out[102]:
0     True
1    False
2     True
3    False
4    False
5     True
dtype: bool

We can now use this as our boolean mask to achieve what we wanted:
In [103]:

df.loc[(df.shift() != df).all(axis=1)]
Out[103]:
         Date  Value
0  01/02/2014    0.1
2  01/04/2014    0.5
5  01/07/2014    0.1


text:
Q: events not emitting on tap in components See the code here https://play.nativescript.org/?template=play-vue&id=AIQOcR&v=165, I would like to make the FabItem component emit a tap so I can build the menu but events are not emitting
Was able to fix it with the following code,
https://play.nativescript.org/?template=play-vue&id=AIQOcR&v=169

A: I think you did a simple copy/paste mistake, you are emitting onButtonTap from FabItem but listening to onFabItemTap in the Main component.


text:
Q: Show / Hide divs individually with same class name I am trying a really easy thing, hiding / showing an info div my mouse-hovering another element. My code structure is similar to:

Info

Info

Info

Image is shown, and there should be a blank space in which I want divInfo to appear.
I am using the following jQuery code to show / hide:
$(function() {
      $('.divInfo').hide();
      $('.divColumn').hover( function() { $('.divInfo').toggle(); } );
});

Of course, this works, but shows / hides all 3 divs in the row at a time. I want to be able to show hide each one separately...
Is this possible using classes? Or do I have to use a different unique ID for each??
Functionality I want is shown here, but I don't know how to do that. :)
http://www.therice-co.com
Regards and thanks

A: $('.divColumn').children('a').hover(function () { // bind it to exact image
    $(this).prev('.divInfo').toggle(); // show previous div
});

will work
jQuery DEMO
but you definetely have too much closing
s
also you can do it with pure CSS if you wrap each info and image in separate div and use :hover on it
PURE CSS DEMO

A: This is what are you trying to achieve

see http://jsfiddle.net/j0aoy47L/
Javascript

CSS

HTML

Image Caption

Some image information

Image Caption

Some image information

Image Caption

Some image information

A: Actually you want the divs to always be there but somehow "not visible" when you are not hovering them. This is as simple as:
.divInfo:not(:hover){
    opacity: 0;
}

Fiddle


text:
Q: How to implement the file download API function using Java Hessian library I am trying to implement the file download api as the Hessian document page mentions:

file download API
package example;
public interface Download {
    public InputStream download(String filename, InputStream data);
  }

But I still could not figure out how to do that?  Why does the download function take an InputStream arguemnt and return another InputStream?
The download method is supposed to read data from a file on the server and send the data out.  What do these two InputStream refer to?
Can someone explain it?  A working example is most appreciated!


text:
Q: Difference between const & const volatile If we declare a variable as volatile every time the fresh value is updated
If we declare a variable as const then the value of that variable will not be changed
Then const volatile int temp;
What is the use of declaring the variable temp as above?
What happens if we declare as const int temp?

A: I've needed to use this in an embedded application where some configuration variables are located in an area of flash memory that can be updated by a bootloader. These config variables are 'constant' during runtime, but without the volatile qualifier the compiler would optimise something like this...
cantx.id = 0x10<<24 | CANID<<12 | 0;

...by precomputing the constant value and using an immediate assembly instruction, or loading the constant from a nearby location, so that any updates to the original CANID value in the config flash area would be ignored. CANID has to be const volatile.

A: You can use const and volatile together. For example, if 0x30 is assumed to be the value of a port
that is changed by external conditions only, the following declaration would prevent any possibility
of accidental side effects:
const volatile char *port = (const volatile char *)0x30;

A: const means that the variable cannot be modified by the c code, not that it cannot change. It means that no instruction can write to the variable, but its value might still change.
volatile means that the variable may change at any time and thus no cached values might be used; each access to the variable has to be executed to its memory address.
Since the question is tagged "embedded" and supposing temp is a user declared variable, not a hardware-related register (since these are usually handled in a separate .h file), consider:
An embedded processor which has both volatile read-write data memory (RAM) and non-volatile read-only data memory, for example FLASH memory in von-Neumann architecture, where data and program space share a common data and address bus.
If you declare const temp to have a value (at least if different from 0), the compiler will assign the variable to an address in FLASH space, because even if it were assigned to a RAM address, it still needs FLASH memory to store the initial value of the variable, making the RAM address a waste of space since all operations are read-only.
In consequence:
int temp;is a variable stored in RAM, initialized to 0 at startup (cstart), cached values may be used.
const int temp;is a variable stored in (read-ony)FLASH, initialized to 0 at compiler time, cached values may be used.
volatile int temp; is a variable stored in RAM, initialized to 0 at startup (cstart), cached values will NOT be used.
const volatile int temp; is a variable stored in (read-ony)FLASH, initialized to 0 at compiler time, cached values will NOT be used
Here comes the usefull part:
Nowadays most Embedded processors have the ability to make changes to their read-only non-volatile  memory by means of a special function module, in which case const int temp can be changed at runtime, altought not directly. Said in another way, a function may modify the value at the address where temp is stored.
A practical example would be to use temp for the device serial number. The first time the embedded processor runs, temp will be equal to 0 (or the declared value) and a function can use this fact to run a test during production and if sucessfull, ask to be assigned a serial number and modify the value of temp by means of a special function. Some processors have a special address range with OTP (one-time programmable) memory just for that.
But here comes the difference:
If const int temp is a modifiable ID instead of a one-time-programmable serial number and is NOT declared volatile, a cached value might be used untill the next boot, meaning the new ID might not be valid untill the next reboot, or even worse, some functions might use the new value while other might use an older cached value untill reboot.
If const int temp IS declared voltaile, the ID change will take effect immediately.

A: *

*volatile will tell the compiler not to optimise code related the variable, usually when we know it can be changed from "outside", e.g. by another thread.

*const will tell the compiler that it is forbidden for the program to modify the variable's value.

*const volatile is a very special thing you'll probably see used exactly 0 times in your life (tm). As is to be expected, it means that the program cannot modify the variable's value, but the value can be modified from the outside, thus no optimisations will be performed on the variable.

A: It is not because the variable is const that it may not have changed between two sequence points.
Constness is a promise you make not to change the value, not that the value won't be changed.

A: This article discusses the scenarios where you want to combine const and volatile qualifiers.
http://embeddedgurus.com/barr-code/2012/01/combining-cs-volatile-and-const-keywords/

A: In simple terms,
Value in 'const volatile' variable cannot be modified programmatically but can be modified by hardware. Volatile here is to prevent any compiler optimisation.

A: An object marked as const volatile will not be permitted to be changed by the code (an error will be raised due to the const qualifier) - at least through that particular name/pointer.
The volatile part of the qualifier means that the compiler cannot optimize or reorder access to the object.
In an embedded system, this is typically used to access hardware registers that can be read and are updated by the hardware, but make no sense to write to (or might be an error to write to).
An example might be the status register for a serial port.  Various bits will indicate if a character is waiting to be read or if the transmit register is ready to accept a new character (ie., - it's empty).  Each read of this status register could result in a different value depending on what else has occurred in the serial port hardware.
It makes no sense to write to the status register (depending on the particular hardware spec), but you need to make sure that each read of the register results in an actual read of the hardware - using a cached value from a previous read won't tell you about changes in the hardware state.
A quick example:
unsigned int const volatile *status_reg; // assume these are assigned to point to the
unsigned char const volatile *recv_reg;  //   correct hardware addresses

#define UART_CHAR_READY 0x00000001

int get_next_char()
{
    while ((*status_reg & UART_CHAR_READY) == 0) {
        // do nothing but spin
    }

    return *recv_reg;
}

If these pointers were not marked as being volatile, a couple problems might occur:

*

*the while loop test might read the status register only once, since the compiler could assume that whatever it pointed to would never change (there's nothing in the while loop test or loop itself that could change it).  If you entered the function when there was no character waiting in UART hardware, you might end up in an infinite loop that never stopped even when a character was received.

*the read of the receive register could be moved by the compiler to before the while loop - again because there's nothing in the function that indicates that *recv_reg is changed by the loop, there's no reason it can't be read before entering the loop.

The volatile qualifiers ensures that these optimizations are not performed by the compiler.

A: In C, const and volatile are type qualifiers and these two are independent.
Basically, const means that the value isn't modifiable by the program.
And volatile means that the value is subject to sudden change (possibly from outside the program).
In fact, the C Standard gives an example of a valid declaration which is both const and volatile. The example is:
extern const volatile int real_time_clock;
where real_time_clock may be modifiable by hardware, but cannot be assigned to, incremented, or decremented.
So we should already treat const and volatile separately. These type qualifiers can be applied to struct, union, enum and typedef as well.

A: We use 'const' keyword for a variable when we don't want to the program to change it. Whereas when we declare a variable 'const volatile' we are telling the program not to change it and the compiler that this variable can be changed unexpectedly from input coming from the outside world.


text:
Q: Gitignore mac alias files I have a fairly simple question I could not find a solution for. I want to ignore all Mac OS X Alias folders I have in my git project. How do I target those? I couldn't figure out their file extension. ".alias" and ".alias-file" doesn't seem to work.
Is there a way to do this? Other than ignoring each one specifically.

A: I don't know anything about git, but this script can find OSX aliases and list them for you, so you could probably pipe the list into git to ignore somehow...
#!/bin/bash
################################################################################
# ListAliases
# Given a directory as parameter, find and output names of all things under
# that directory that are aliases. Not an officially approved technique!
################################################################################
d=${1-$(pwd)}
find "$d" -exec sh -c 'xattr -pl com.apple.FinderInfo "{}" 2> /dev/null | grep -q alisMACS && echo "{}"' \;

Save it in a file called ListAliases, then make it executable like this:
chmod +x ListAliases

and run it like this
./ListAliases

or
./ListAliases /path/to/git/repository

Sample Output
/Users/mark/.Trash/installed.txt alias
/Users/mark/Desktop/installed.txt alias
/Users/mark/Desktop/installed.txt alias 2

A: It sounds like you're assuming that every file needs to have a file extension... that Mac alias files have a ".alias" extension. That's not the case. The Mac OS supports files both with and without extensions. When aliasing folders, there's no file extension involved. You would need to ignore the names of the folders that the aliases point to, which in turn would ignore the aliases themselves, since the aliases share the same name as the folders they point to.

A:
What about aliases to folders?

With regard to folder alias' I tried this and it seemed to work:
*\ alias

In this case for all folder alias'

A: Just create a ".gitignore" file.
Write inside the patterns you want to ignore. (separated by new-line)
In your case that would be:
"
.alias*
"
Then, the "git status" command should not show you files OR directories matching the pattern.
Finish with a 'git add .gitignore' and "git commit -m "Added a gitignore file""
Update: Ok, the answer is very basic but I hadn't any clues.
Check this link : Ignore files that have already been committed to a Git repository


text:
Q: Matlab/Simulink LookupTable with Workspace vectors I am new with Simulink and I am struggling with the Dynamic Lookup Table (inputs : x, xadta, ydata; output: y).
I have several 2D vectors (xdata and ydata) stored in my Workspace and I would like to use them in Simulink in a Dynamic Lookup Table to return a value (y) depending on another variable in Simulink (x).
If I understand how it works I have first to convert my 2D vectors in structures (time,values,dimensions) to be read in Simulink ?
So I did it this way but I got an error :
    vector.time = xdata; % dimension 1x100
    vector.signals.values = ydata; % dimension 1x100
    vector.signals.dimensions = [1 100];
    save('vector.mat','vector')

Error
"The last dimension of each
'signals.values' field must be the same as the number of rows in the 'time' field."
Besides I am not sure that what I am trying to do is appropriate... I use the xdata of my vectors/structures as "time" in the structures to get my vectors readable in Simulink. But I do not think it should have anything to do with time notion. I just want the Dynamic Lookup Table to return the "ydata" value of the vector/structure corresponding to the value of "x"="xdata". Only "x" change with time in the Simulation.

A: It looks like you should just be using the 1D Lookup Table, with your xdata and ydata variables (defined in your MATLAB Workspace) used as the block parameters.
As to the error you're getting, it seems to be related to using the From File block (which it looks like you're using to get data into your model) not the look-up table itself.  To get that to work, define your time vector as a column vector, not a row vector as you've done, and think of each row as a different time point.
At each time point, you'll get a different signal value.  This is like a look-up table itself (looking up the signal value for each different time value), but doesn't sound like what you are really wanting to achieve.


text:
Q: FakeItEasy ReturnLazily with more than 4 arguments method With FakeItEasy, I want to fake an interface method to return some custom list, the method has more than 4 arguments, signature of method is this:
     IList<Employee> FindAll(DateTime dateFrom, DateTime dateTill, Guid locationId, Gender gender, int age);

While FakeItEasy has ReturnsLazily method which has supports till only 4 arguments, so for this 5 arguments method I cannot use ReturnsLazily functionality.
    A.CallTo(() => repAssign.FindAll(A<DateTime>.Ignored,A<DateTime>.Ignored,A<Guid>.Ignored,A<Gender>.Ignored,A<Int>.Ignored))
         .ReturnsLazily((DateTime StartDate, DateTime EndDate, Guid locationId, Gender gender, int age) =>
         return list.Where(...some filters here as per arguments...).ToList();
        );

With FakeItEasy, please suggest how to use ReturnsLazily for methods which has more than 4 arguments.

A: You need to use overload that takes IFakeObjectCall as lambda parameter and extract arguments from there:

If more advanced decision-making is required, or the method has more than 4 parameters, the convenience methods won't work. Use the variant that takes an IFakeObjectCall instead

 A.CallTo(() => repAssign.FindAll(
     A<DateTime>.Ignored,
     A<DateTime>.Ignored,
     A<Guid>.Ignored,
     A<Gender>.Ignored,
     A<Int>.Ignored))
.ReturnsLazily(call =>
    list
        .Where(x => call.GetArgument<Int>(4) > 1)
        .ToList()
);

Arguments can be extracted via GetArgument generic method which takes argument type as generic parameter and argument position (0-based).
On a side note, you should consider refactoring of such method. This many parameters are better wrapped into parameter object class:
var filterParameters = new FilterParameters
{
    LocationGuid = guid,
    Gender = Gender.Female,
};
var result = repo.FindAll(filterParameters);

This will make introduction of new parameters much easier and will help avoid issues like this one.


text:
Q: Retrieving User Uploaded Video Specifications The web app I'm working on allows a user to upload videos. The videos must meet specific criteria as outlined by our client (format, frame size, frame rate, etc) or they will be rejected.  I found the ffmpeg-php library from some googling.  However, I noticed that it doesn't appear to be actively maintained.

*

*What's the current standard library for accessing video data via PHP?

*If this data is retrieved from the video's metadata, can this information be trusted to be accurate?

A: ffmpeg is a good option at: http://ffmpeg-php.sourceforge.net/doc/api/ffmpeg_movie.php
Or you could use a PHP class, here is one i have found which says "Access media metadata without using the ffmpeg-php library.": http://www.phpclasses.org/package/3747-PHP-Manipulate-and-convert-videos-with-ffmpeg-program.html
Like most meta datas, they are likely easily editable and untrustworthy.


text:
Q: Android 8.0 DownloadManager not working in MOBILE DATA I Set this in download manager but it does not work even in WIFI:
request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI | DownloadManager.Request.NETWORK_MOBILE)

And This code below can work: BUT ONLY IN WIFI MODE so that It can NOT download using MOBILE data
request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI)

Is this a bug in Download Manager?

A: Check network availability, especially the wifi/mobile signal icon on statusbar. If a little cross is there, the system will treat it as no net and will not proceed downloading(I've encountered this recently).

A: I have similar problem. But removing line of setAllowedNetworkTypes doesn't work.
My problem can be reproduced on 8.1 emulator. But it works well on a real device.
My solution is to setAllowedOverRoaming(false). I don't know why.

A: Change Android Manifest permission external write permission like below,
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" tools:node="replace"/>

A: As the developer says:
setAllowedNetworkTypes

added in API level 9
public DownloadManager.Request setAllowedNetworkTypes (int flags)
Restrict the types of networks over which this download may proceed. By default, all network types are allowed. Consider using setAllowedOverMetered(boolean) instead, since it's more flexible.

So just remove this line will work.


text:
Q: Is it true that English has no future tense? I'm a native English speaker and I consider myself to have a very competent understanding of English grammar.
Recently, I have started believing that there is no future tense in English grammar.
Here are some examples of sentences that I previously believed were future tense, but now believe are either present tense or invalid (broken) English grammar:

I will do my homework tomorrow.

I say that this is present tense. The full (uncontracted) sentence is

I (have the/a) will to do my homework tomorrow.

Strictly, this sentence refers to the writer's will in the present. The usage seems to have been contracted in recent centuries, but "will" remains a noun and this seems to be the only grammatically-valid interpretation of this sentence.

I am going to the bathroom.

I say that this is present tense.
The only valid interpretation of this sentence is that the speaker is currently going to the bathroom (in the present, right now). Whether "going to the bathroom" means traveling to a bathroom or peeing in their pants is open to interpretation, but this does not affect the tense. The tense is determined by "am", so the tense is present.

I am going to school tomorrow.

I say this is invalid English grammar.
This is as invalid as I am going to school yesterday. The tense is present because of "am", and the sentence can not be validly interpreted as it stands.
In examples such as

We are going to Italy in Spring,

this is invalid for the same reason as above: "are" determines that the tense is present, and then a non-present time period is appended. This is as invalid as

We are going to Italy two years ago.

These are just a couple of examples but I have looked at many examples of future tense usage and I do not believe there is a valid future tense in English grammar.
Question: Is it true that English has no future tense?

A: Allow me to cite an excerpt from an answer posted  back in November 13, 2012.  The Original Post is entitled How many tenses are there in English?

What is a tense?
In linguistic terminology, "tense" is a part of verbal paradigm that refers specifically to the time of an utterance. It is impossible for any language to have more than three tenses in this sense, since any action is either past, present, or future.
In English, we do the basic tenses this way:

*

*Present: I walk to the store.

*Past: I walked to the store.

*Future: I will walk to the store.

  But what is that with the word will there in the future tense example? It turns out that while English can refer to present and past time using inflections on the verb itself, the future tense always requires another word. Furthermore, there are multiple ways of doing this:

*

*I will walk to the store.

*I'm going to walk to the store.

*I'm walking to the store in five minutes.

*I'm about to walk to the store.

  So while English has plenty of ways to refer to future actions, in terms of base verbal morphology there are only two tenses in English: present and past.

User/author: @JSBձոգչ
Barrie England's full answer is also well-worth reading, for any users who are still feeling muddled about the idea of English not possessing a future tense. Here is but a snippet

Almost all grammarians recognize only two tenses in English, present and past. […]
For example, regular verbs have four forms. In the case of walk they are walk, walks, walking, walked. In the third person singular, the present tense is walks and the past tense is walked. A clause such as he is walking is made up of the present tense of be and the present participle of walk and expresses progressive aspect.

In the bottomless ocean that is the Internet, there are multiple references confirming or arguing that the English language has two tenses
Perhaps one of the earliest advocates for the two tenses theorem was Joseph Priestly in his  The Rudiments of English Grammar, 1761

More recently,

Two Tense Approach
  Linguists who favor a binary approach argue that different tenses have to be distinguished morphologically, that is they have to be reflected in inflectional morphology. Accordingly, there are only two tenses, namely 'past' and 'non-past', as this is the only distinction that is reflected morphologically.

*

*He work - s.

*He work - ed.
All other categories of the English tense system are constituted by a combination of one of the two above-mentioned tenses with either a modal verb, or the perfect marker have. The advocates of this approach often conveniently stress the "combinatorial character" (König 1995: 154) of these members by naming them

*

*present perfect

*past perfect

*future perfect
  […]

  The binary approach is found in "many structuralist accounts" (König 1995: 154) such as The Comprehensive Grammar by Quirk et al. (1985).

On the British Council, and BBC's Learning English websites they state respectively

There are two tenses in English – past and present.
  English has only two tenses, the present simple and the past simple.

The world renown linguist and author, David Crystal, belongs firmly in the "two tenses" camp. In The Cambridge Encyclopedia of the English Language, 2003, Crystal explains

[emphasis in bold mine]
  There is therefore a two-way tense contrast in English: I walk vs. I walked–present tense vs past tense. English has no future tense ending, but uses a wide range of other techniques to express future time (such as will/shall, be going to, be about to, and future adverbs). The linguistic facts are uncontroversial. However, people find it extremely difficult to drop the notion of 'future tense' (and related notions, such as imperfect, future perfect, and pluperfect tenses) from their mental vocabulary, and to look for other ways of talking about the grammatical realities of the English verb."

Source: Understanding Verb Tenses

A: "I will do my homework tomorrow" is future tense. The fact that there is a homonym of "will" that means "intention" is irrelevant. That's not the word that we're using here. We're using the word that indicates that indicates future tense. The word "fast" can mean, "to go without eating", but that doesn't make the sentence, "Bob runs fast" nonsensical. That's not the definition of "fast" that is intended in this sentence. And if there is some etymological argument that the word "will" indicating future derived from the word "will" meaning intention, no doubt interesting, but still irrelevant. That's not the word that we are using.
"I shall do my homework tomorrow" is also future tense.
"I am going to school tomorrow" is, I suppose, an ambiguous tense. You could say, "I am going to school now" in which case it is clearly present, or "I am going to school tomorrow" in which case it is future. Maybe we could say that's an idiom.
I see some posters on here discuss the idea of changing the ending of a verb to indicate tense. Perhaps one could make some pedantic case about the definition of the word "tense". But I have never heard an English grammarian say that tense can ONLY be indicated by changing the ending on a word. That is A WAY to indicate tense, used in English for some tenses (e.g. "talk", present; "talked", past) but not for others ("will talk", future; "are talking", present continuous). In some languages it is used for all tenses.
Afterthought
It occurs to me that we can easily demonstrate that "will", as in, "I will do my homework tomorrow", is not a contraction for, "I have a will to do my homework tomorrow." Namely: There are many sentences that use the same construction but clearly do not refer to a present will. For example, if someone says, "The weatherman says it will rain tomorrow", there is no one who is willing it to rain. The weatherman may or may not want it to rain. The clouds are certainly not exercising any volition. Indeed, consider, "If the economy continues to do poorly, I will lose my job." Do you suppose that the speaker WANTS to lose his job? Or that some powerful interest is manipulating the economy just to make this one poor schmuck lose his job? No. There's no "will" in the sense of "intent" here at all. Just a future tense.

A: Strictly speaking, no Germanic language has a future tense, only a present and a preterite. All others are analytic tenses compounded with various auxiliaries. Since the present tense simple in English, unlike in other modern Germanic languages, is never used to describe what's happening right now, perhaps it would be better to call it the non-past. The progressive/continuous form has, for the most part, limited the simple present to 1) habitual/repeated actions, 2) general truths, conditions, and opinions — and, in conjunction with a temporal adverb, 3) future events.
Old English had no future tense and only the beginnings of an analytic one:

Mind that there was no Future tense in the Old English language, and the future action was expressed by the Present forms, just sometimes using verbs of modality, willan (lit. "to wish to do") or sculan (lit. "to have to do").

This parallels other ancient Germanic languages such as Old High German or Gothic: when translators into those languages encountered Latin or Greek future tenses, they either paraphrased or used the present tense.
The modal distinction between volition and agency is preserved in Middle English:

The future tense is formed much the way the future tense is formed in Modern English. The only difference is that shall (used as forms schullen, shallen, etc) and will (forms as willen, wellen, etc) had a difference in meaning. This difference is that will indicated desire or wish (much like High German Wollen), so saying I will go there was similar to I want to go there, and shall was involved indifference of the will, so saying I shall go is similar to I'm gonna go without desire to do so. The verb to go was not used to form the future tense, but the verb to be with an infinitive construction could have been.

Your thesis is that this modality still obtains today and that the so-called future tense is in fact not temporal but modal. If we were still speaking early Middle English, you'd likely be correct. In the transition to Modern English, however, modality began to yield to temporality. The only vestige of modality is the difference some British speakers make between I shall and I will, a nuance which has completely disappeared in American English.
The common way to form what is termed the future in English is will/shall + bare infinitive:

In 3.5 billion years, the sun will be 40 percent brighter than it is right now, which will cause the oceans to boil, the ice caps to permanently melt, and all water vapor in the atmosphere to be lost to space. Under these conditions, life as we know it will be unable to survive anywhere on the surface, and planet Earth will be fully transformed into another hot, dry world, just like Venus.

This description of the future end betrays not a trace of modality, but does strongly suggest that Modern English has a strictly temporal future tense, albeit with a former modal as auxiliary.

A: Short answer: Yes, of course English has future tense ... for everyone except the most technical, and for them it doesn't have a future tense because they define "have a tense" in a non-intuitive way. So you can go ahead and say confidently that English has future tense.
Longer answer:
Most everybody (within the monolingual English speaking community) thinks of "I will do that" or "I am going to do that" are unequivocally future tense. It would be perverse to think otherwise; both those sentences describe a situation that occurs in the future. That's how most people, school teachers, newspaper editors, newspaper readers, most everybody thinks. And that is correct. For the majority of people.
However, language scholars, that very small set of expert thinkers who tend see a lot more theoretically of English and also of other languages, use that phrasing differently. "X has a Y tense" is technical terminology that means "The language X has verb forms that inflect for the Y tense". That is, the verb form itself is modified rather than having extra words around it to convey the tense. You have to use 'will' or 'going to'. English can express future tense grammatically (with 'will'), but technically it doesn't 'have' a future tense (assuming that what is meant is 'future tense inflections'). 'Will' is definitely a grammatical marker for future time. 'Going to' is less definitely a grammatical marker, it might be more accurately and technically referred to as a periphrastic future.
I think that a less misleading way for more pedantic people to express it would be to say that English has only two inflected tenses. That way both insiders and outsiders to the technical community of linguists would both know what is going on.

As to your specific examples, the way you label them doesn't really correspond to what anybody else says, informally or formally. I think you may be taking things too literally, or choosing one aspect of a definition out of the expected context.

I will do my homework tomorrow.

This is not present tense, it is future, whether 'tomorrow' is mentioned or not.

I am going to the bathroom.

Yes, This is present tense. Present continuous. You are in the middle of the action of traveling to the bathroom (or in AmE, it is a euphemism for in the middle of the action of micturating or defecating).

I am going to school tomorrow.

This is totally valid English grammar. The use of tomorrow changes the interpretation of 'going' from 'traveling' to the marker of the future. Or it could be interpreted as a contraction of "I am going to go to school", explicitly the future of 'traveling'

We are going to Italy in Spring

Totally correct usage. Ambiguous tense, but not ambiguous meaning.

We are going to Italy 2 years ago

Obviously wrong. Whether present or future, 2 years ago is contradictory, being in the past.

You might wonder why 'will' isn't considered to definitively say that "English has a future tense" (in the pedantic sense that is. In the less fully formal sense it totally says that English has a future tense). 'Will' is syntactically in the category of 'modal verbs', can may must should etc. Its meaning is certainly future time, but syntactically it is a helper (auxiliary) verb. But pedantically, 'will' is not grammatically about tense (I find this reasoning a bit of a stretch, but that's what being pedantic does).
To compare, French can express the future by either "Je verrai la peinture" (I will see the painting = I see-future the painting) or "Je vais voir la peinture" (I am-going to-see the painting). The first one is a true future tense by having an altered root and an inflection, the second expresses the future by a separate word (just like the English 'going to'). English doesn't have a corresponding inflected form for the future. So linguists say 'French has a future tense but English does not have a future tense'. That's just strange sounding technical language for linguists.
This might seem like cavilling (isn't all technical pedantic terminology there to cavil?) but it is useful terminology for language comparison. Some languages inflect for all tenses, and some don't have any inflections for any grammatical function.
Chinese, for example, is said to have no tense at all. You might wonder how they convey information. How do they wake up in the morning? How do they tie their shoes? Oh my god the Chinese are so inscrutable, with no sense of time they see past and future at once like those aliens in that movie and it's so beautiful and sad at the same time and etc etc
That is of course nonsense. What is the case is that verbs in Chinese (Mandarin) do not inflect for tense at all (or for anything), but they can just as easily express the time of something happening by using ... it's going seem stupid when I say it... it's so obvious... words for time. 'Now', 'next week', 'before my parents met'.
Also, people aren't idiots; context can help determine the sense. Suppose you can't hear how 'die' is conjugated in 'When my great-grandfather [die]' . Did that happen in the past, or in the future? If I am telling you this from my retirement home, it probably happened in the past. If I am visiting a nursing home, it's probably in the (near) future.

Here's a weird thing about English. Consider the sentence "I visit the park on Saturdays". There's no tense there, there's no inflection. But it means that you often go to the park in the past and will likely do so in the future. How do they know when exactly they're doing something? Is anything specified at all? How do they wake up in the morning? Oh my god the English are so inscrutable, how can they know anything, they are timeless and can see equally into the past and the future like time travelers it's so beautiful and sad at the same time etc etc

A: Your belief is incorrect.  "I will do my homework tomorrow" is not a contracted form, and there is no historical "uncontracted" form which matches your assumption.  See Wikipedia entries on future tense and the English use of shall and will
"Will" is an auxiliary verb, which is used to transform other verbs into the necessary tense.  Other European languages have similar auxiliary verbs.  Interestingly, French uses the same auxiliary verbs as English - "avoir" (to have) is used for the past tense in the same way as we say "I have done something", and "aller" (to go) is used for the future tense in the same way as we say "I am going to do something".  German also uses "haben" (to have) for the past tense, but has a separate auxiliary verb "werden" for the future tense.
Originally, "will" did come from the meaning of "intent"; however it was always as a verb, and not as a noun.
As for "I am going to school tomorrow", this is the remnants of Old English not having a future tense and expressing the future by context.

A: Well, yes and no.
First of all, whether English has or doesn't have future tense doesn't affect its ability to clearly express future, in a manner you have pointed out (I shall also add "I am meeting them on Monday" as a third method of expressing future). From there on it depends on how you define tenses.
It is correct that English doesn't express future via inflection of verbs, but that's not something unique to English. Proto-Indo-European language, the ancestor of all Indo-European languages, didn't have a (formal) future tense. Therefore, while Indo-European languages are very similar in terms of how they express the past tense, they differ more noticeably in their expression of the future tense. Some use auxiliary verbs or other tenses, like in the Germanic or Slavic branch, some have developed new inflection for the future tense, like the Romance languages.
Even in the Germanic branch, there are differences - while English uses will as an auxiliary verb, German uses werden, and ich will (from wollen) reflects its original and now archaic meaning - I want. Using this verb to express future is also not limited to Germanic languages, and although many Slavic languages use (something like) ja budu (I will), inflected version of the verb byti (to be), others use (or used) ja hcu from htieti (to want).
The distinction between the ability to express future and having a future tense is not clear. Some linguists have decided that their language has a future tense, others have grouped it together with the present tense to form a "present/future tense", and some claim that their language has no future tense, even though all these languages still express the future in a more or less same way.
However, I think that English does have a future tense. Consider your example:

I will do my homework tomorrow.
I (have the/a) will to do my homework tomorrow.

It reflects the etymology of this usage of will quite well, but it's not a simple ellipsis, and etymology doesn't equal meaning. When someone greets you with "good morning", you know it really means "I wish you a good morning", or "may you have a good morning", but compare this with your sentences.
If I say "We will have a test tomorrow", you cannot expand it to "We will to have a test tomorrow", because that's not what we really will/want, that's simply what will happen regardless of our will. Since this form is used specifically for the future and cannot be expressed in some other tense, I say that English has a formal future tense.


text:
Q: Making change in tpl file doesn't effect on Prestashop I am totally new in Prestashop. I am trying to modify blockcart.tpl which is located in ../theme/module/ folder. But whatever I change it doesn't make no effect in the frontend. Even if I delete the entire code from the bolckcart.tpl, I noticed there is no change in the source code of module block cart section.
I want to add plus-minus quantity button in the block cart. I am actually not sure whether I am editing the correct file or not.


text:
Q: How to process a large delta table with UDF? I have a delta table with about 300 billion rows. Now I am performing some operations on a column using UDF and creating another column
My code is something like this
def my_udf(data):
    return pass

udf_func = udf(my_udf, StringType())
data = spark.sql("""SELECT * FROM large_table """)
data = data.withColumn('new_column', udf_func(data.value))

The issue now is this take a long amount of time as Spark will process all 300 billion rows and then write the output. Is there a way where we can do some Mirco batching and write output of those regularly to the output delta table

A: The first rule usually is to avoid UDFs as much of possible - what kind of transformation do you need to perform that isn't available in the Spark itself?
Second rule - if you can't avoid using UDF, at least use Pandas UDFs that process data in batches, and don't have so big serialization/deserialization overhead - usual UDFs are handling data row by row, encoding & decoding data for each of them.
If your table was built over the time, and consists of many files, you can try to use Spark Structured Streaming with Trigger.AvailableNow (requires DBR 10.3 or 10.4), something like this:
maxNumFiles = 10 # max number of parquet files processed at once
df = spark.readStream \
  .option("maxFilesPerTrigger", maxNumFiles) \
  .table("large_table")
df = df.withColumn('new_column', udf_func(data.value))
df.writeStream \
  .option("checkpointLocation", "/some/path") \
  .trigger(availableNow=True) \
  .toTable("my_destination_table")

this will read the source table chunk by chunk, apply your transformation, and write data into a destination table.


text:
Q: 2013 Collaboration - How to programmatically get a list of all the community sites a user has access to? Is there a way to get a list of all of the community sites that a user has read/write access to, using an API that can be easily consumed by C#?
We would like to get a list of all of the community sites that a user has permission to both read and create posts in.  Using the search API and searching for "WebTemplate:Community" brings up a list of all the communities, but it doesn't necessarily tell whether or not the user can access those communities.

A: You can very well use Search API for getting the list of community sites provided  that you have a good crawl system maintained , probably continous crawl enabled. If you run the KeywordQuery search on current logged in user's context , it will give security trimmed results and so the user will have minimum read permission on the sites returned. Further more if you want to check if the user has contribute permission also , loop throught the result sites and check permissions.
KeywordQuery query = new KeywordQuery(site);
                    query.QueryText = string.Format("Path:{0} AND ContentClass:STS_Web AND WebTemplate:Community", site.Url);
                    query.RowLimit = 500;//max row limit is 500 for KeywordQuery
                    query.ResultsProvider = SearchProvider.Default;
                    query.EnableStemming = true;
                    query.TrimDuplicates = false;
                    query.AuthenticationType = QueryAuthenticationType.PluggableAuthenticatedQuery;
                    query.KeywordInclusion = KeywordInclusion.AllKeywords;
                    SearchExecutor executor = new SearchExecutor();
                    ResultTableCollection resultTableCollection = executor.ExecuteQuery(query);
                    var resultTables = resultTableCollection.Filter("TableType", KnownTableTypes.RelevantResults);
                    var resultTable = resultTables.FirstOrDefault();


text:
Q: In Jsoup, how to create an element without document? Now I use this to create an element

        Document doc = Jsoup.parseBodyFragment("

");
        Elements ols=doc.getElementsByTag("ol");
        Element ol=ols.get(0);

But this is too complex, because I create many dom in the program, if every use three line to create an element, it is not convenient.
Can I create an element without using the document and elements?
like this:

var ol=$('

');

A: Since version 1.10.2, You can use Element's constructor like this:
Element el = new Element("ol");

Constructor and Description:
public Element(String tag)
  Create a new, standalone element.
Parameters:
  tag - tag name

A: Try to use Elements constructor:
Element el = new Element(Tag.valueOf("ol"), "");


text:
Q: Biggest difference in the order statistics of a uniform random sample? Let $U_1, \dots, U_n$ denote independent and identically distributed samples on the unit interval $[0, 1]$.
Let $U_{(i)}$ denote the order statistics, so that $U_{(1)} \leq U_{(2)} \leq \cdots \leq U_{(n)}$. We take $U_{(0)} = 0$.
Now define the differences
$$
D_{j} := U_{(j)} - U_{(j-1)}, \quad \mbox{for}~j = 1, 2, \ldots, n.
$$
Question: What is the distribution of the maximum $\max_j D_j$? In particular, I am interested in its density and the expectation $\mathbb{E}[\max_{j \leq n} D_j]$.
My thoughts: Marginally, I know that $D_j \sim \mathrm{Beta}(1, n)$. Moreover, except for the boundary constraints, $D_j$ should "roughly" behave independently. Additionally for $n$ large,
independent Beta(1, $n$) random variables should concentrate very strongly around the mean, and so my conjecture is that
$$
\mathbb{E}[\max_j D_j] = (1 + o(1)) \frac{1}{n+1}, \quad \mbox{as}~n \to \infty.
$$
I tried to check this by using the formula for the joint density of the order statistics, but had difficulty solving the integral. Any ideas or suggestions? I was thinking there could potentially be an argument based on coupling the dependent random variables $D_j$ to some sequence of independent Beta samples; I tried this but didn't succeed to find a good coupling.


text:
Q: Adding overlay over google maps, leaves bottom part of map showing I am trying to use a google maps location as a background for a page. However, the overlay will not cover the entire map, the bottom of the map will be showing.
Even when I try to set the height of the map-canvas and overlay to 100vh the map still exceeds the overlay.

function initialize() {
  var mapOptions = {
    zoom: 15,
    center: new google.maps.LatLng(0, 0)
  };

  var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
}

function loadScript() {
  var script = document.createElement('script');
  script.type = 'text/javascript';
  script.src = 'https://maps.googleapis.com/maps/api/js?v=3.exp' + '&signed_in=true&callback=initialize';
  document.body.appendChild(script);
}

window.onload = loadScript;
html, body {
  height: 100%;
}
#map-canvas {
  height: 100%;
  width: 100%;
  z-index: 0;
}
.overlay {
  height: 100%;
  width: 100%;
  position: absolute;
  top: 0;
  left: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1;
}

A: By default, browsers add a margin to the body, causing the body to actually take up more than 100% height (100% plus whatever the margin is). Your issue is fixed if you explicitly remove this margin. This is a great example of why CSS resets are popular.

function initialize() {
  var mapOptions = {
    zoom: 15,
    center: new google.maps.LatLng(0, 0)
  };

  var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
}

function loadScript() {
  var script = document.createElement('script');
  script.type = 'text/javascript';
  script.src = 'https://maps.googleapis.com/maps/api/js?v=3.exp' + '&signed_in=true&callback=initialize';
  document.body.appendChild(script);
}

window.onload = loadScript;
html, body {
  height: 100%;
  margin: 0;
}
#map-canvas {
  height: 100%;
  width: 100%;
  z-index: 0;
}
.overlay {
  height: 100%;
  width: 100%;
  position: absolute;
  top: 0;
  left: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1;
}

A: The #map-canvas does have a different position than .overlay, because it's position will be affected by the padding/margin of the page.
You have these options(there may be more):

*

*remove the padding/margin:
html, body {
 height: 100%;
 margin:0;
 padding:0;
}

*when you want to preserve the padding/margin and want the overlay to cover the map regardless of the map-size/position, use the .overlay as child of #map-canvas :

to make it work you must also set the noClear-option of the map to true (otherwise the API will remove the .overlay)

function initialize() {
  var mapOptions = {
    zoom: 15,
    noClear: true,
    center: new google.maps.LatLng(0, 0)
  };

  var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
}

function loadScript() {
  var script = document.createElement('script');
  script.type = 'text/javascript';
  script.src = 'https://maps.googleapis.com/maps/api/js?v=3.exp' + '&signed_in=true&callback=initialize';
  document.body.appendChild(script);
}

window.onload = loadScript;
html,
body {
  height: 100%;
}
#map-canvas {
  height: 80%;
  width: 70%;
  z-index: 0;
}
.overlay {
  height: 100%;
  width: 100%;
  position: absolute;
  top: 0;
  left: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1;
}


text:
Q: Apache Apache/2.4.7 (Ubuntu) ProxyPass I'm trying to configure a simple ProxyPass using this file (as simple as possible) linked in /etc/apache2/sites-enable form sites-avalable (same file seems to work on apache 2.2 but may be i have done other configuration on previous installation and i canìt remember those configuration)
Note i use an IPADDRESS and not a Server Name but i think this is not the problem.
Note 2: i'm not an apache web server expert :)!

ServerName IP_SERVER_ADDRESS

# Redmine
ProxyPass        /redmine   http://IP_SERVER_ADDRESS:8555/redmine

# test1
ProxyPass        "/test1"   "http://IP_SERVER_ADDRESS:9180/test1/"
ProxyPassReverse "/test1"   "http://IP_SERVER_ADDRESS:9180/test1/"

# test2
ProxyPass        /test2   http://IP_SERVER_ADDRESS:8880/test2
ProxyPassReverse /test2   http://IP_SERVER_ADDRESS:8880/test2

DocumentRoot /var/www

But it didn't work, so the url
http://IP_SERVER_ADDRESS:8880/test2

work fine , but the proxied url
http://IP_SERVER_ADDRESS/test2

did not work , with the error
Not Found

The requested URL /redmine was not found on this server

Output of  apache2ctl -S seems strange as apparently no VirtualHost configuration is used (?)
VirtualHost configuration:
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex proxy: using_defaults
Mutex default: dir="/var/lock/apache2" mechanism=fcntl
Mutex watchdog-callback: using_defaults
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33
Group: name="www-data" id=33

Quite sure i'm missing some simple thing but i can't find it!

A: This answer is tested in Apache Apache/2.4.7 (Debian) ProxyPass.
See /etc/apache2/apache2.conf:
# Include the virtual host configurations:
IncludeOptional sites-enabled/*.conf

previous version was
# Include the virtual host configurations:
Include sites-enabled/

So basically in apache 2.4 (Debian and derivated) you must use file with a .conf extension to limit headache....
In Apache 2.2 the  .conf extension in file name is not needed.
Other Details:

*

*In sites-enabled configuration files (a soft link to sites-available) MUST be have an extension .conf so WHATEVER_YOU_WANT.conf

*You MUST use a2ensite to enable a configuration, because if the file in sites-available did not have the "right" extension ".conf" it say "ERROR: Site WHATEVER_YOU_WANT does not exist!". So for example if you use a file named mysite and try to enable the configuration mysite with the command "a2ensite mysite" you receive an error. If you use a file named myfile.conf same command  will work fine... If you manually create a soft link in sites-enabled to a conf file without the "conf" extension , the site will not work!!

*You can create a soft link in sites-available with the right extension (.conf) to a file WITHOUT the right extension alredy peresent in sites-available. In such a case the configuration will work but if you use a2dissite to disable the site it will say "ERROR: Site WHATEVER_YOU_WANT does not exist!"

After finding the solution i found some link around
https://www.linode.com/docs/security/upgrading/updating-virtual-host-settings-from-apache-2-2-to-apache-2-4


text:
Q: How to speed up application publishing to Weblogic from Eclipse I am using Eclipse Kepler with Oracle Enterprise Pack for Eclipse 12.1.2.3 and a Weblogic 12.1.1. When starting the server with an added EAR project from Eclipse the starting stops at
Publishing to Oracle Weblogic Server 12c (12.1.1.) at localhost [project] (3%)

After a minute or so it continues.
What is Weblogic doing? The Eclipse process view says Checking for deployed modules.
Is there any way to speed up the publishing process?