text:
Q: Manage Visibility of button in Horizontal Recycler list view I have a horizontal center zoom image list in which i want to display play icon and text for center scale view only
I am able to scale center Imageview but getting position problem while managing it through model.
But sometimes it displays and sometimes not. but i am getting position of center imageview perfectly in class onScrollStateChanged method.
Following class i have used for layout manager and scrollview in my activity
  mAdapter = new ContactScreenAdapter(ContactScreenActivity.this, mContext, listFavoriteContact);
        scrollZoomLayoutManager = new ScrollZoomLayoutManager(this, Dp2px(25));
        recyclerFavoriteList.setLayoutManager(scrollZoomLayoutManager);
        recyclerFavoriteList.setAdapter(mAdapter);
        recyclerFavoriteList.addOnScrollListener(new RecyclerView.OnScrollListener() {

            @Override
            public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
                super.onScrollStateChanged(recyclerView, newState);
                final RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager();
                if (!(layoutManager instanceof CircleLayoutManager) && !(layoutManager instanceof ScrollZoomLayoutManager)) {
                    mAutoSet = true;
                    return;
                }

                if (!mAutoSet) {
                    if (newState == RecyclerView.SCROLL_STATE_IDLE) {
                        final int dx;
                        if (layoutManager instanceof CircleLayoutManager) {
                            dx = ((CircleLayoutManager) layoutManager).getOffsetCenterView();
                        } else {
                            dx = ((ScrollZoomLayoutManager) layoutManager).getOffsetCenterView();
                        }
                        recyclerView.smoothScrollBy(dx, 0);
                        Log.d(TAG,"####  dx : "+ ((ScrollZoomLayoutManager) layoutManager).getCurrentPosition());
                        mAdapter.setSelecteditem(((ScrollZoomLayoutManager) layoutManager).getCurrentPosition());

                    }
                    mAutoSet = true;
                }
                if (newState == RecyclerView.SCROLL_STATE_DRAGGING || newState == RecyclerView.SCROLL_STATE_SETTLING) {
                    mAutoSet = false;
                }
            }
        });

and i am updating my model in adapter method
  public void setSelecteditem(int selecteditem) {
    this.selectedItem = selecteditem;

    for (int i=0;i<moviesList.size();i++){
        moviesList.get(i).setCenterSelected(false);
        Log.d("CSA","##  moviesList.get(i).isCenterSelected() : "+ moviesList.get(i).isCenterSelected());
    }
    moviesList.get(selecteditem).setCenterSelected(true);

    notifyDataSetChanged();
}

Thank you for help in advance.


text:
Q: Generic way to ask which browser they're using? I would like a text input with the question "what browser are you using" above it. Then when a form is submitted, I'd like to compare their answer to their User-Agent HTTP header.
I am stumped on how to reliably make this work.
I could ask them to spell it out instead of using acronyms like IE or FF, but Internet Explorer uses "MSIE" as its' identifier doesn't it?
Another thought I had was to keep a pool of User-Agent strings, then present them with a select element that has theirs inserted randomly among 4 or so other random strings and asking them to select theirs. I fear non-tech-savy users would bungle this enough times for it to be a problem though. I suppose I could use some logic to make sure there's only one of each browser type among the options, but I'm leery about even that.

A: Why would You want to ask user about its User-Agent?
Pulling appropriate http header - as you've mentioned, should be enough.
But if you need that badly, I'd go for

*

*regular expressions - for checking http user-agent header and cutting out unimportant info from that header

*present possible match based on the previous step

*ask user if the match is correct, if not, let him enter its own answer

*then I'd try to match what he entered to some dictionary values, so as to be able to enter IE and MSIE and get the same result.

The above seems vague enough :) and abstract, maybe you could provide an explanation - why you want that? maybe there is some other way?

A: Remember: The client sends the HTTP header and potentially the user can put anything in User Agent. So if you want to catch people who "lie about" the browser they are using, you will only catch those who cannot modify the HTTP header before they send it.

A: You can neither 100% trust the user input nor the string that the browser sends in the HTTP headers...

A: The obvious question is why you want to ask the user what browser they are using?
But given that:
a) Normalise the user string: lower-case, remove spaces, remove numbers?
b) Build a map between the normalised strings, and user-agent strings.
When you do a lookup, if the normalised string, or the user-agent string is not in the map, pass it to a human to add to the map with appropriate mapping.
Possibly you'll want to normalise the user-agent in some way as well?

redpajama_set_name: RedPajamaStackExchange


text:
Q: Get a notification when an AWS EC2 instance has been running for a specific amount of time? We have some AWS machines that get automatically launched, used for tests, and dismantled (by a system we made using the AWS API).
It can happen that something goes wrong and that the machine doesn't get dismantled, and just sits there, running 24/7, until someone notices it.
We're thinking about setting up some kind of system to notify us when this happens.
Is there any way to set up a notification system when an instance matching specific criteria has been running for a set amount of time?
It would be best if it was something already integrated in EC2/AWS that doesn't involve third party tools, but I'm open to any solution.

A: Is it your question?
My answer:
I believe this task is for Lambda:

*

*use aws ec2 describe-instances equivalent using lambda to get Launchtime

*lambda function crawl across those metrics. If any instance runs longer than needed then the same lambda function can stop it, send message or whatever you want.

*profit! :)

A: There is nothing pre-made in AWS that does this, however it's trivial to write a small script that you can run via cron (or Lambda even) that gathers information on your instances and emails you if certain conditions are met.


text:
Q: how to create new file, file name incremental i have written codes to generate random ID and store to file. then send the data which data contains the stored ID.
Then I set it to loop 3 times.
The data sent sucessfully 3 times, but there is only one file and contains LAST ID only.
I wanted to have 3 files, named 1,2,3.
for (int i = 1; i <= 3; i++) {
//test data using dynamic Id at order Id
String RandomOrderId = CustomKeywords.'test.RandomStringUUID.getUuid'()
println(RandomOrderId)

//store the OrderId to file
def OrderId = new File(RunConfiguration.getProjectDir() + "/Data Files/OrderId.txt")
OrderId .newWriter().withWriter { it << RandomOrderId }
println OrderId.text

def exceldata = CustomKeywords.'test.excelfile.ReadExcelData'('Data Files/1.xlsx', 'testdata', 'Test case1', 'Json Data 1')
exceldata = exceldata.replace("<OrderId>", OrderId.text)

Order.Message('message',exceldata)

}

A: the problem that File.newWriter() overwrites content of the file.
replace this line:
OrderId.newWriter().withWriter { it << RandomOrderId }

with the following one:
OrderId.newWriter(true).withWriter { it << RandomOrderId << '\n' }

or with:
OrderId.withWriterAppend{ it << RandomOrderId << '\n' }

or with:
OrderId.append( RandomOrderId + '\n' )

read more about file methods here:
http://docs.groovy-lang.org/latest/html/groovy-jdk/java/io/File.html


text:
Q: Почему функция ругается на двумерный массив (в параметре функции)? (Функция для заполнения двумерного массива случайными числами) При создании программы заполнения двумерного массива случайными числами, столкнулся с проблемой. Не могу передать массив для функции. В параметрах функции выдает ошибку возле массива: "Массив не может содержать элементы этого типа".
Подскажите что я сделал неправильно.
void ArrFill(int arr[][], int rows, int cols)
{
srand(time(NULL));
for (int i = 0; i < rows; i++)
{
    for (int j = 0; j < cols; j++)
    {
        arr[i][j] = 30 + rand() % 60;
        cout << arr[i][j] << "/t";
    }
    cout << endl;

}

A: Данное объявление двумерного массива в качестве параметра
void ArrFill(int arr[][], int rows, int cols)
             ^^^^^^^^^^^

некорректное.
Все размерности массива кроме крайней левой должны быть указаны и быть константными значениями. C++ к тому же не поддерживает массивы переменной длины.
Вы могли бы объявить функцию следующим образом:
const size_t Cols = /*...*/;
void ArrFill( int arr[][Cols], size_t rows );

Кроме того символ табуляции - это не этот символ '/t', а этот символ '\t'.
Вы можете себе значительно упростить жизнь, если объявите шаблонную функцию вида
template <size_t Rows, size_t Cols>
void ArrFill( int ( &arr )[Rows][Cols], std::pair<int, int> range )
{
    std::srand( std::time( nullptr ) );

    for ( auto &row : arr )
    {
        for ( auto &item : row )
        {
            item = range.first + std::rand() % ( range.second - range.first );
            std::cout << item << '\t';
        }
        std::cout << '\n';
    }
}

Например,
#include <iostream>
#include <utility>
#include <cstdlib>
#include <ctime>

template <size_t Rows, size_t Cols>
void ArrFill( int ( &arr )[Rows][Cols], std::pair<int, int> range )
{
    std::srand( std::time( nullptr ) );

    for ( auto &row : arr )
    {
        for ( auto &item : row )
        {
            item = range.first + std::rand() % ( range.second - range.first );
            std::cout << item << '\t';
        }
        std::cout << '\n';
    }
}

int main()
{
    const size_t Rows = 10, Cols = 10;
    int arr[Rows][Cols];

    ArrFill( arr, { 30, 90 } );

    return 0;
}

вывод программы на консоль может выглядеть, к примеру, следующим образом:
84  44  65  61  72  62  87  30  88  72
84  85  72  49  46  63  67  71  37  35
73  32  49  57  61  63  47  64  67  76
81  53  30  48  84  73  80  82  65  71
56  60  66  38  71  74  63  40  56  62
45  31  64  56  50  35  30  67  62  59
53  45  82  54  64  76  89  46  60  64
87  86  86  55  86  68  40  59  78  58
31  86  59  58  52  79  63  44  49  87
73  72  43  65  88  77  44  87  33  74


text:
Q: Atribuição de valor variável Javascript Tenho o código JS abaixo e o retorno do JSON não atribui o valor a variável texto. Fiz um teste com alert(data.frase) e a mensagem veio normalmente.
Alguem saberia dizer o porque a var texto não recebe o valor de data.frase?
var texto=null;
var cod = { cod: codFrase };
$.ajax({
    url: "/Motivos/Getfrase",
    type: 'Post',
    contentType: 'application/json',
    dataType: 'json',
    data: JSON.stringify(cod),
    success: function (data) {
        if (data.success) {
            texto = data.frase;
        }
    }
});

Obrigado

A: Você provavelmente tem um problema de assíncronia.
Tudo que ocorre dento do $.ajax sai da fila padrão de execução do seu javascript e roda assíncronamente.
Ou seja, quando você tenta acessar a variável texto o seu código Ajax ainda não foi executado. Já que ele é executado em paralelo.
Você só vai conseguir usar a variável texto dentro do success do Ajax, que é quando o Ajax é finalizado.
Caso não queria ficar com o código preso ali, você pode criar uma função que recebe a variável texto e executá-la dentro do success passando o valor como parâmetro.
var usaTexto = function(texto) {
  // ... aqui você pode fazer o que quiser com a variável texto
}
var cod = { cod: codFrase };
$.ajax({
    url: "/Motivos/Getfrase",
    type: 'Post',
    contentType: 'application/json',
    dataType: 'json',
    data: JSON.stringify(cod),
    success: function (data) {
    if (data.success) {
        usaTexto(data.frase);
    }
}
});

A: Não recomendo a utilização deste método e não sei se funcionará em seu projeto C# MVC. Já tive essa necessidade e resolvi da seguinte forma:
var cod = { cod: codFrase };
$.ajax({
   url: "/Motivos/Getfrase",
   type: 'Post',
   contentType: 'application/json',
   dataType: 'json',
   data: JSON.stringify(cod),
   async: 0,
   success: function (data) {
       if (data.success) {
           retorno = "<script> texto = '"+data.frase+"'; </script>";
           $("#retorno").html(retorno);
       }
   }
});

A opção "async" irá segurar a execução do seu código, retorne a variável no DOM.


text:
Q: "Broken packages" installation error in Ubuntu When I'm trying to install subversion on a Ubuntu machine using command sudo apt-get install subversion, it's throwing the follwoing error.
~$ sudo apt-get install subversion
[sudo] password for hwsui:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
  subversion: Depends: libsvn1 (= 1.6.5dfsg-1ubuntu1~jaunty1~andersk1) but it is                                                                                not going to be installed
              Depends: libapr1 but it is not installable
              Depends: libaprutil1 but it is not installable
              Depends: libmysqlclient15off (>= 5.0.27-1) but it is not installab                                                                                le
              Depends: libneon27-gnutls (>= 0.28.2) but it is not installable
              Depends: libpq5 (>= 8.3~beta1) but it is not installable
E: Broken packages

A: You can try to run the apt -get with a -f parameter to attempt to correct a system with broken dependencies.


text:
Q: open xml tables in excel I am trying to open an xml file to excel using power query. But, the issue is it keeps on going in loop and created more then 1 million rows and file size grows to 100 gb.
The code I used is
let
Source = Xml.Tables(File.Contents("C:\Users\anujk\Downloads\stock_export_full_for_anujkundu.xml")),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Attribute:file_format", type text}, {"Attribute:version", type number}, {"Attribute:generated", type datetime}, {"Attribute:extensions", type text}}),
#"Expanded products" = Table.ExpandTableColumn(#"Changed Type", "products", {"product", "Attribute:language", "Attribute:currency"}, {"products.product", "products.Attribute:language", "products.Attribute:currency"}),
#"Expanded products.product" = Table.ExpandTableColumn(#"Expanded products", "products.product", {"producer", "category", "http://www.iai-shop.com/developers/iof/extensions.phtml", "unit", "series", "card", "description", "price", "srp", "sizes", "images", "parameters", "group", "attachments", "Attribute:id", "Attribute:vat", "Attribute:type", "Attribute:producer_code_standard", "Attribute:code_on_card", "strikethrough_retail_price"}, {"products.product.producer", "products.product.category", "products.product.http://www.iai-shop.com/developers/iof/extensions.phtml", "products.product.unit", "products.product.series", "products.product.card", "products.product.description", "products.product.price", "products.product.srp", "products.product.sizes", "products.product.images", "products.product.parameters", "products.product.group", "products.product.attachments", "products.product.Attribute:id", "products.product.Attribute:vat", "products.product.Attribute:type", "products.product.Attribute:producer_code_standard", "products.product.Attribute:code_on_card", "products.product.strikethrough_retail_price"}),
#"Expanded products.product.category" = Table.ExpandTableColumn(#"Expanded products.product", "products.product.category", {"Attribute:id", "Attribute:name"}, {"products.product.category.Attribute:id", "products.product.category.Attribute:name"}),
#"Expanded products.product.http://www.iai-shop.com/developers/iof/extensions.phtml" = Table.ExpandTableColumn(#"Expanded products.product.category", "products.product.http://www.iai-shop.com/developers/iof/extensions.phtml", {"iai_category"}, {"products.product.http://www.iai-shop.com/developers/iof/extensions.phtml.iai_cat"}),
#"Expanded products.product.http://www.iai-shop.com/developers/iof/extensions.phtml.iai_cat" = Table.ExpandTableColumn(#"Expanded products.product.http://www.iai-shop.com/developers/iof/extensions.phtml", "products.product.http://www.iai-shop.com/developers/iof/extensions.phtml.iai_cat", {"Attribute:id", "Attribute:path"}, {"products.product.http://www.iai-shop.com/developers/iof/extensions.phtml.iai_c.1", "products.product.http://www.iai-shop.com/developers/iof/extensions.phtml.iai_c.2"}),
#"Expanded products.product.series" = Table.ExpandTableColumn(#"Expanded products.product.http://www.iai-shop.com/developers/iof/extensions.phtml.iai_cat", "products.product.series", {"Attribute:id", "Attribute:name"}, {"products.product.series.Attribute:id", "products.product.series.Attribute:name"}),
#"Expanded products.product.card" = Table.ExpandTableColumn(#"Expanded products.product.series", "products.product.card", {"Attribute:url"}, {"products.product.card.Attribute:url"}),
#"Expanded products.product.description" = Table.ExpandTableColumn(#"Expanded products.product.card", "products.product.description", {"name", "version", "long_desc", "short_desc"}, {"products.product.description.name", "products.product.description.version", "products.product.description.long_desc", "products.product.description.short_desc"}),
#"Expanded products.product.description.name" = Table.ExpandTableColumn(#"Expanded products.product.description", "products.product.description.name", {"Element:Text", "http://www.w3.org/XML/1998/namespace"}, {"products.product.description.name.Element:Text", "products.product.description.name.http://www.w3.org/XML/1998/namespace"}),
#"Expanded products.product.description.name.http://www.w3.org/XML/1998/namespace" = Table.ExpandTableColumn(#"Expanded products.product.description.name", "products.product.description.name.http://www.w3.org/XML/1998/namespace", {"Attribute:lang"}, {"products.product.description.name.http://www.w3.org/XML/1998/namespace.Attribute"}),
#"Expanded products.product.description.version" = Table.ExpandTableColumn(#"Expanded products.product.description.name.http://www.w3.org/XML/1998/namespace", "products.product.description.version", {"Element:Text", "http://www.w3.org/XML/1998/namespace"}, {"products.product.description.version.Element:Text", "products.product.description.version.http://www.w3.org/XML/1998/namespace"}),
#"Expanded products.product.description.version.http://www.w3.org/XML/1998/namespace" = Table.ExpandTableColumn(#"Expanded products.product.description.version", "products.product.description.version.http://www.w3.org/XML/1998/namespace", {"Attribute:lang"}, {"products.product.description.version.http://www.w3.org/XML/1998/namespace.Attrib"}),
#"Expanded products.product.description.long_desc" = Table.ExpandTableColumn(#"Expanded products.product.description.version.http://www.w3.org/XML/1998/namespace", "products.product.description.long_desc", {"Element:Text", "http://www.w3.org/XML/1998/namespace"}, {"products.product.description.long_desc.Element:Text", "products.product.description.long_desc.http://www.w3.org/XML/1998/namespace"}),
#"Expanded products.product.description.long_desc.http://www.w3.org/XML/1998/namespace" = Table.ExpandTableColumn(#"Expanded products.product.description.long_desc", "products.product.description.long_desc.http://www.w3.org/XML/1998/namespace", {"Attribute:lang"}, {"products.product.description.long_desc.http://www.w3.org/XML/1998/namespace.Attr"}),
#"Expanded products.product.description.short_desc" = Table.ExpandTableColumn(#"Expanded products.product.description.long_desc.http://www.w3.org/XML/1998/namespace", "products.product.description.short_desc", {"Element:Text", "http://www.w3.org/XML/1998/namespace"}, {"products.product.description.short_desc.Element:Text", "products.product.description.short_desc.http://www.w3.org/XML/1998/namespace"}),
#"Expanded products.product.description.short_desc.http://www.w3.org/XML/1998/namespace" = Table.ExpandTableColumn(#"Expanded products.product.description.short_desc", "products.product.description.short_desc.http://www.w3.org/XML/1998/namespace", {"Attribute:lang"}, {"products.product.description.short_desc.http://www.w3.org/XML/1998/namespace.Att"}),
#"Expanded products.product.price" = Table.ExpandTableColumn(#"Expanded products.product.description.short_desc.http://www.w3.org/XML/1998/namespace", "products.product.price", {"Attribute:gross", "Attribute:net"}, {"products.product.price.Attribute:gross", "products.product.price.Attribute:net"}),
#"Expanded products.product.srp" = Table.ExpandTableColumn(#"Expanded products.product.price", "products.product.srp", {"Attribute:gross", "Attribute:net"}, {"products.product.srp.Attribute:gross", "products.product.srp.Attribute:net"}),
#"Expanded products.product.sizes" = Table.ExpandTableColumn(#"Expanded products.product.srp", "products.product.sizes", {"size"}, {"products.product.sizes.size"}),
#"Expanded products.product.sizes.size" = Table.ExpandTableColumn(#"Expanded products.product.sizes", "products.product.sizes.size", {"stock", "price", "srp", "Attribute:id", "Attribute:text_id", "Attribute:code_producer", "Attribute:code", "Attribute:weight"}, {"products.product.sizes.size.stock", "products.product.sizes.size.price", "products.product.sizes.size.srp", "products.product.sizes.size.Attribute:id", "products.product.sizes.size.Attribute:text_id", "products.product.sizes.size.Attribute:code_producer", "products.product.sizes.size.Attribute:code", "products.product.sizes.size.Attribute:weight"}),
#"Expanded products.product.sizes.size.stock" = Table.ExpandTableColumn(#"Expanded products.product.sizes.size", "products.product.sizes.size.stock", {"Attribute:id", "Attribute:quantity", "http://www.iai-shop.com/developers/iof/extensions.phtml"}, {"products.product.sizes.size.stock.Attribute:id", "products.product.sizes.size.stock.Attribute:quantity", "products.product.sizes.size.stock.http://www.iai-shop.com/developers/iof/extensi"}),
#"Expanded products.product.sizes.size.stock.http://www.iai-shop.com/developers/iof/extensi" = Table.ExpandTableColumn(#"Expanded products.product.sizes.size.stock", "products.product.sizes.size.stock.http://www.iai-shop.com/developers/iof/extensi", {"Attribute:location_id", "Attribute:location_text_id"}, {"products.product.sizes.size.stock.http://www.iai-shop.com/developers/iof/exten.1", "products.product.sizes.size.stock.http://www.iai-shop.com/developers/iof/exten.2"}),
#"Expanded products.product.sizes.size.price" = Table.ExpandTableColumn(#"Expanded products.product.sizes.size.stock.http://www.iai-shop.com/developers/iof/extensi", "products.product.sizes.size.price", {"Attribute:gross", "Attribute:net"}, {"products.product.sizes.size.price.Attribute:gross", "products.product.sizes.size.price.Attribute:net"}),
#"Expanded products.product.sizes.size.srp" = Table.ExpandTableColumn(#"Expanded products.product.sizes.size.price", "products.product.sizes.size.srp", {"Attribute:gross", "Attribute:net"}, {"products.product.sizes.size.srp.Attribute:gross", "products.product.sizes.size.srp.Attribute:net"}),
#"Expanded products.product.images" = Table.ExpandTableColumn(#"Expanded products.product.sizes.size.srp", "products.product.images", {"large", "icons"}, {"products.product.images.large", "products.product.images.icons"}),
#"Expanded products.product.images.large" = Table.ExpandTableColumn(#"Expanded products.product.images", "products.product.images.large", {"image"}, {"products.product.images.large.image"}),
#"Expanded products.product.images.large.image" = Table.ExpandTableColumn(#"Expanded products.product.images.large", "products.product.images.large.image", {"Attribute:url", "Attribute:date_changed", "Attribute:hash", "Attribute:width", "Attribute:height"}, {"products.product.images.large.image.Attribute:url", "products.product.images.large.image.Attribute:date_changed", "products.product.images.large.image.Attribute:hash", "products.product.images.large.image.Attribute:width", "products.product.images.large.image.Attribute:height"}),
#"Expanded products.product.parameters" = Table.ExpandTableColumn(#"Expanded products.product.images.large.image", "products.product.parameters", {"parameter"}, {"products.product.parameters.parameter"}),
#"Expanded products.product.parameters.parameter" = Table.ExpandTableColumn(#"Expanded products.product.parameters", "products.product.parameters.parameter", {"value", "Attribute:type", "Attribute:id", "Attribute:priority", "Attribute:name"}, {"products.product.parameters.parameter.value", "products.product.parameters.parameter.Attribute:type", "products.product.parameters.parameter.Attribute:id", "products.product.parameters.parameter.Attribute:priority", "products.product.parameters.parameter.Attribute:name"}),
#"Expanded products.product.parameters.parameter.value" = Table.ExpandTableColumn(#"Expanded products.product.parameters.parameter", "products.product.parameters.parameter.value", {"Attribute:id", "Attribute:priority", "Attribute:name"}, {"products.product.parameters.parameter.value.Attribute:id", "products.product.parameters.parameter.value.Attribute:priority", "products.product.parameters.parameter.value.Attribute:name"}),
#"Expanded products.product.group" = Table.ExpandTableColumn(#"Expanded products.product.parameters.parameter.value", "products.product.group", {"group_by_parameter", "Attribute:id", "Attribute:first_product_id"}, {"products.product.group.group_by_parameter", "products.product.group.Attribute:id", "products.product.group.Attribute:first_product_id"}),
#"Expanded products.product.group.group_by_parameter" = Table.ExpandTableColumn(#"Expanded products.product.group", "products.product.group.group_by_parameter", {"name", "product_value", "Attribute:id"}, {"products.product.group.group_by_parameter.name", "products.product.group.group_by_parameter.product_value", "products.product.group.group_by_parameter.Attribute:id"}),
#"Expanded products.product.group.group_by_parameter.name" = Table.ExpandTableColumn(#"Expanded products.product.group.group_by_parameter", "products.product.group.group_by_parameter.name", {"Element:Text", "http://www.w3.org/XML/1998/namespace"}, {"products.product.group.group_by_parameter.name.Element:Text", "products.product.group.group_by_parameter.name.http://www.w3.org/XML/1998/namesp"}),
#"Expanded products.product.group.group_by_parameter.name.http://www.w3.org/XML/1998/namesp" = Table.ExpandTableColumn(#"Expanded products.product.group.group_by_parameter.name", "products.product.group.group_by_parameter.name.http://www.w3.org/XML/1998/namesp", {"Attribute:lang"}, {"products.product.group.group_by_parameter.name.http://www.w3.org/XML/1998/name.1"}),
#"Expanded products.product.group.group_by_parameter.product_value" = Table.ExpandTableColumn(#"Expanded products.product.group.group_by_parameter.name.http://www.w3.org/XML/1998/namesp", "products.product.group.group_by_parameter.product_value", {"name", "Attribute:id"}, {"products.product.group.group_by_parameter.product_value.name", "products.product.group.group_by_parameter.product_value.Attribute:id"}),
#"Expanded products.product.attachments" = Table.ExpandTableColumn(#"Expanded products.product.group.group_by_parameter.product_value", "products.product.attachments", {"file"}, {"products.product.attachments.file"}),
#"Expanded products.product.attachments.file" = Table.ExpandTableColumn(#"Expanded products.product.attachments", "products.product.attachments.file", {"name", "Attribute:url", "Attribute:priority", "Attribute:attachment_file_extension", "http://www.iai-shop.com/developers/iof/extensions.phtml"}, {"products.product.attachments.file.name", "products.product.attachments.file.Attribute:url", "products.product.attachments.file.Attribute:priority", "products.product.attachments.file.Attribute:attachment_file_extension", "products.product.attachments.file.http://www.iai-shop.com/developers/iof/extensi"}),
#"Expanded products.product.attachments.file.name" = Table.ExpandTableColumn(#"Expanded products.product.attachments.file", "products.product.attachments.file.name", {"Element:Text", "http://www.w3.org/XML/1998/namespace"}, {"products.product.attachments.file.name.Element:Text", "products.product.attachments.file.name.http://www.w3.org/XML/1998/namespace"}),
#"Expanded products.product.attachments.file.name.http://www.w3.org/XML/1998/namespace" = Table.ExpandTableColumn(#"Expanded products.product.attachments.file.name", "products.product.attachments.file.name.http://www.w3.org/XML/1998/namespace", {"Attribute:lang"}, {"products.product.attachments.file.name.http://www.w3.org/XML/1998/namespace.Attr"}),
#"Expanded products.product.attachments.file.http://www.iai-shop.com/developers/iof/extensi" = Table.ExpandTableColumn(#"Expanded products.product.attachments.file.name.http://www.w3.org/XML/1998/namespace", "products.product.attachments.file.http://www.iai-shop.com/developers/iof/extensi", {"Attribute:enable", "Attribute:attachment_file_type", "Attribute:download_log"}, {"products.product.attachments.file.http://www.iai-shop.com/developers/iof/exten.1", "products.product.attachments.file.http://www.iai-shop.com/developers/iof/exten.2", "products.product.attachments.file.http://www.iai-shop.com/developers/iof/exten.3"})
in
#"Expanded products.product.attachments.file.http://www.iai-shop.com/developers/iof/extensi"


text:
Q: Play custom sound(texturepack) that doesn't exist in Minecraft Well, I am working on a custom texture pack for my very big map. And I found that after I replaced all the sound(like sound of taking damage, open door etc.) to custom sound for the map, it is still not enough. I need to have 3 more audio to add into the texture pack.
So my question is... Can I put a custom sound that doesn't exists in Minecraft into the texture pack and play the sound in game with the texture pack by /playsound. ? Or there is some way else to add more custom sound?

A: You could utilize the playSound command if you change a specific sound to one of the ones you need to add. For example, you may not need the ambient.cave sound, so you could replace that sound with one of the new ones you wish to add and then use /playsound ambient.cave to play it.
Here is a link to all of the possible sounds that you can use playsound to play.
Just pick any one you don't need, replace it, and then play it through playsound!

A: Using resource packs, you can add your own sounds to the game. However, they must be in .ogg format.
Just drop your sound in the /sounds/ directory of your resource pack and move it to anywhere.
In game, the code will be the directory of it after /sounds/ with slashes replaced with periods.


text:
Q: PDFBox 1.8.10: Fill and Sign PDF produces invalid signatures I fill (programatically) a form (AcroPdf) in a PDF document and sign the document afterwards. I start with doc.pdf, create doc_filled.pdf, using the setFields.java example of PDFBox. Then I sign doc_filled.pdf, creating doc?filled_signed.pdf, using some code, based on the signature examples and open the pdf in the Acrobat Reader. The entered Field data is visible and the signature panel tells me
"There are errors in the formatting or information contained in this signature (The signature byte array is invalid)"
So far, I know that:

*

*the signature code applied alone (i.e. directly creating some doc_signed.pdf) creates a valid signature

*the problem exists for "invisible signatures", visible signatures and visible signatures, being added to existing signature fields.

*the problem even occurs, if I do not fill the form, but only open it and save it, i.e.:
PDDocument doc = PDDocument.load(new File("doc.pdf"));
doc.save(new File("doc_filled.pdf"));
doc.close();

suffices to break the afterwards applied signing code.
On the other hand, if I take the same doc.pdf, enter the field's values manually in Adobe, the signing code produces valid signatures.
What am I doing wrong?
Update:
@mkl asked me to provide the files, i am talking about (I do not have enough reputation currently, to post all files as links, sorry for that inconvenience):

*

*odc.pdf: https://www.dropbox.com/s/ev8x9q48w5l0hof/doc.pdf?dl=0

*doc_filled.pdf: https://www.dropbox.com/s/fxn4gyneizs1zzb/doc_filled.pdf?dl=0

*doc_filled_signed.pdf: https://www.dropbox.com/s/xm846sj8f9kiga9/doc_filled_signed.pdf?dl=0

*doc_filled_and_signed.pdf: https://www.dropbox.com/s/5jftje6ke87jedr/doc_filled_and_signed.pdf?dl=0
the last one was created, by signing and filling the document in one go, using
    doc.saveIncremental();

As I already wrote in the comment, some
    setNeedToBeUpdate(true);

seems to be missing, though.
With reference to @mkl 's second comment, I found this
SO question: Saved Text Field value is not displayed properly in PDF generated using PDFBOX, which also covers to some entered text not being show. I gave it a first try, applying
    setBoolean(COSName.getPDFName("NeedAppearances"), true);

to the field's and form's dictionary, which then shows the fields context, but the signature does not get added in the end. Still I have to look further into that.
Update:
The story continues here: PDFBox 1.8.10: Fill and Sign Document, Filling again fails

A: The cause of the OP's original problem, i.e. that after loading his PDF (for form fill-in) with PDFBox and then saving it, this new PDF cannot be successfully signed using PDFBox signing code, has already been explained in detail in this answer, in short:

*

*When saving documents regularly, PDFBox does so using a cross reference table.

*

*If the document to save regularly had been loaded from a PDF with a cross reference stream, all entries of the cross reference stream dictionary are saved in the trailer dictionary.

*When saving documents in the process of applying a signature, PDFBox creates an incremental update; as such incremental updates require that the update uses the same kind of cross reference as the original revision, PDFBox in this case tries to use the same technique.

*

*For recognizing the technique originally used PDFBox looks at the Type entry of the dictionary in its document representation into which trailer or cross reference stream dictionary had been loaded: If there is a Type entry with value XRef (which is so specified for cross reference streams), a stream is assumed, otherwise a table.

Thus, in the case of the OP's original PDF doc.pdf which has a cross reference stream:

*

*After loading and form fill-in the document is saved regularly, i.e. using a cross reference table, but all the former cross reference stream entries, among them the Type, are copied to the trailer. (doc_filled.pdf)

*After loading this saved PDF with a cross reference table for signing, it is saved again using an incremental update. PDFBox assumes (due to the Type trailer entry) that the existing file has a cross reference stream and, therefore, uses a cross reference stream at the end of the incremental update, too. (doc_filled_signed.pdf)

*Thus, in the end the filled-in, then signed PDF has two revisions, the inner one with a cross reference table, the outer one with a cross reference stream.

*As this is not valid, Adobe Reader upon loading the PDF, repairs this in its internal document representation. Repairing changes the document bytes. Thus, the signature in Adobe Reader's eyes is broken.

*Most other signature validators don't attempt such repairs but check the signature of the document as is. They validate the signature successfully.
The answer referenced above also offers some ways around this:

*

*A: After loading the PDF for form fill-in, remove the Type entry from the trailer before saving regularly. If signing is applied to this file, PDFBox will assume a cross reference table (because the misleading Type entry is not there. Thus, the signature incremental update will be valid.

*B: Use an incremental update for saving the form fill-in changes, too, either in a separate run or in the same run as signing. This also results in a valid incremental update.
Generally I would propose the latter option because the former option likely will break if the PDFBox saving routines ever are made compatible with each other.
Unfortunately, though, the latter option requires marking the added and changed objects as updated, including a path from the document catalog. If this is not possible or at least too cumbersome, the first option might be preferable.

In the case at hand the OP tried the latter option (doc_filled_and_signed.pdf):

At the Moment the text box's content is only visible, when the text box is selected (with Acrobat reader and Preview the same behaviour). I flag the PDField, all of its parents, the AcroForm, the Catalog as well as the page where it is displayed.

He marked the changed field as updated but not the associated appearance stream which automatically is generated by PDFBox when setting the form field value.
Thus, in the result PDF file the field has the new value but the old, empty appearance stream. Only when clicking into the field, Adobe Reader creates a new appearance based on the value for editing.
Thus, the OP also has to mark the new normal appearance stream (the form field dictionary contains an entry AP referencing a dictionary in which N references the normal appearance stream). Alternatively (if finding the changed or added entries becomes too cumbersome) he might try the other option.


text:
Q: The CDF from the characteristic function I have the characteristic function (CF) of a random variable $X$, $\psi_X(t)$, and I want to find the cumulative distribution function (CDF) of that random variable from its CF. I know that I can find the PDF directly from the CF by taking the inverse Fourier transform of the CF, and I can then integrate the PDF to get the CDF. But, I am looking for a more direct way to get the CDF from the CF, because in my case the integration to get the PDF, then the CDF are both numerical, and I want to reduce the numerical integrations from 2 to 1.
Is there a formula to derive the CDF from CF directly?


text:
Q: Lost RAID 1 on 3ware controller. Good drive booted up with old data Server is running Windows 2008R2.  Drive failed and reported degraded, but restarted and OS loaded.  The good drive is a copy from 5/2021 almost 8 months ago.
Is it possible the drive stopped copying data on 5/21?  The failed drive could it still have data from after that date?  We boot up the old drive with the controller and it shows a config error.
Yes, we have a backup using wbadmin, but the OS is reporting last backup from 5/21 and using wbadmin list versions does not show anymore versions from the external drive.
We would like to send the failed drive in for repair.  It still powers up and shows an error in the 3ware controller.  Don't have equipment to put into a non raid controller.

A: You should not only have both RAID and backups, but also constantly monitor the RAID health and backups state. Without that, neither would help. For instance, if you were monitoring your system, you were to know the RAID broke in 5/2021, not now when another drive failed, and had a plenty of time to take necessary measures.
Now, your only hope is a data recovery service who'll might be able to pull the remaining data from the "bad" drive. You'll need to pay them, but this is the price you pay for the negligence of well known best practices.


text:
Q: How to determine number of profile in a dataset derivated from repeated measures? I'm currently working on datasets which have been derivated from repeated measures over time (blood concentrations). Actually the descriptors of these datasets are descripting the shape of the curves (concentrations over time) for each individual. The purpose is to distinguish if there are only one type of curve shape or two signing equivalence or not between two products.
The hypothesis is :

*

*if there is only one type of shape the products are equivalent

*if there is more than one type of shape, the products are inequivalent

Indeed, I had to generate synthetic data (which follow the tendency of the real datas). I have generated datasets in which there are equivalence between products and some where there are no equivalence.
In first intention I tried to work on PCA and Kmeans clustering, searching for the optimal number of cluster to know if there products are equivalent. The fact is that this technic doesn't work at all.
Now I plan to work with some classifiers like Random Forests, SVMs or ANN, trained on synthetic datas, in order to estimate the number of shape type of a real dataset. The problem is the labelling of the datas. Indeed, in this case I can't use labeled from individuals beacause the question is not to classify individuals but datasets in their integrity.
I've heard about SOM and Growing Neural Gas but I don't really know how to use them in that way. I also tried to extract features from the dataset like means, sd but it doesn't seem relevant.
Does someone has already worked on this type of problems ?

A: Several considerations here pertain to the background upon which the question is based rather than the text of the question itself. As the say in Maine, "You can't get there from here." In simplest terms, one must first have shape information in order to test for shape, and there isn't any shape information to test, as follows.
1) Concentrations are not random variables and the best method of fitting concentrations is to take a density function and scale that to fit the data. Although we typically call density functions pdf, there is no 'p' for probability in one for matching concentration. pdf can be $f(x)$ or $f(t)$ and can be used to model random variables, but are not themselves random variables. This can cause confusion, e.g., see What is a good name for a density function that does not relate to probability?.
2) Remembering this, one can use pdf notation anyway and then $C(t)= \kappa\, \text{pdf}(t)$ becomes our fit equation, where $\kappa=\text{AUC},$ the area under the concentration curve from $t=0,\infty$.
3) The pdf used either have shape parameters in them or there will not be derivative fitting or shape fitting, and all the shapes fit will be indistinguishable.
4) The usual functions used for fitting concentrations are sums of exponential terms (SET). As pdf these are mixture distribution models (not of random variables, but of concentrations). Mixture models are always some $f(t)$  or $f(x)$ and this can cause confusion, as mixture models do not have to be models of random variables, e.g., see this answer, and for modeling concentration the density functions  do  not model probability. SET models have no shape parameters, as the exponential distribution from which these models arise have no shape parameters.
5) Much better derivative fitting is achieved using gamma distributions, or gamma distribution convolutions, where the latter has no less than two shape parameters and allows for very high precision concentration and shape fitting for data up to about four hours for at least some drugs.
6)  Once one has a model that actually follows the shape of the concentration curve, one should be able to just inspect the shape parameter(s) to see if they are statistically different for the two cases you are considering.
This is a topic that I am actively researching, and there are multiple conclusions that I cannot reveal at this time. However, I would also suggest reading this to develop a broader background on how these problems should be treated.
Edit More information on fit procedures, shape determination, etc. Consider, for example, that fitting with minimizing proportional error (or indeed any error minimization) is not robust for biexponential, E2, (and higher SET) models. Approximately 2% of those models converge to any one of $n$-tuple solutions in the complex plane. Also, shape information from Tikhonov regularization that minimizes AUC error over the whole ill-posed curve for gamma distributions to GFR markers allows one to extract more exact clearance (CL) and volume of distribution (V$_{\text{d}}$) information, such that unlike for SET functions, there is no correlation (i.e., no contamination) between fluid disturbance and CL. However, that is insufficient to separate the shape information from the total duration of sample collection, such that any comparisons of shapes would have to be undertaken under the same sample-time collection regimen.
Finally, a full model of concentration that may obviate the necessity of using regularization, that is, a full bore well posed model, must contend with the actual shape of the right hand tail function, as well as eliminate all instant mixing assumptions. Indeed, there is probably more evidence to support power function right hand tails than exponential ones. I am working on such a model, and it is not trivial. For one thing, it necessitates variable volume modelling as well as half-life as a function of time. Most people have difficulty understanding that a half-life for a density function other than a memoryless exponential is not a constant, but 1) is a function of time and 2) is negative when concentration is increasing. Newton must be turning over in his grave that people do not generally understand the slope at a point in time of a logarithm of a nonexponential density function.
Maybe some other approach would be of interest to you, depending on what exactly it is you are doing. For example, take a look at this article.


text:
Q: Copy cells and paste contents into a text box I have 2 worksheets - 'Venn Diagram Helper' consisting of a series of named ranges of data - and 'Venn Diagram' with a number of text boxes over a Venn Diagram image.
I have a drop-down list on the Venn Diagram worksheet in cell C5 which I wish to use to trigger the copying and pasting of specific ranges into specific text boxes.
I would like the user to select from the drop down list - the options are 'End of Phase 1', 'End of Phase 2' or 'End of Year' and for the names of the individuals in the appropriate named range to be copied and pasted into the text box with a ';' separating each name.
I have started to write the code but, as I am a novice at VBA and I have been trying to adapt examples I have found online, it doesn't work. Can any of you spare the time to help me out with the 'reading' text box please? I am confident that, once I have the model code, I will be able to adapt it to fill the remaining text boxes.
This is what I have so far:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Not Intersect(Target, Range("C5")) Is Nothing Then

Dim Helper As Worksheet
Dim Venn As Worksheet
Dim EoP1Rdg As Range
Dim EoP2Rdg As Range
Dim EoYRdg As Range
Dim Rdg_TxtBox As OLEObject

Set Helper = ThisWorkbook.Worksheets("RWM Venn Diagram Helper")
Set Venn = ThisWorkbook.Worksheets("RWM Venn Diagram")
Set Rdg_TxtBox = Venn.OLEObjects("Rdg_TxtBox")

With Helper
    Set EoP1Rdg = .Range("AQ4:AQ103")
    Set EoP2Rdg = .Range("AX4:AX103")
    Set EoYRdg = .Range("BE4:BE103")
End With

If Intersect(Target, Range("C5")) = "End of Phase 1" Then
        With Helper
            .Select ("EoP1Rdg")
            .Copy
        End With

        With Venn
            .Select Rdg_TxtBox
            .Paste
        End With
End If

End If

End Sub

Thank you in advance!
EDIT: 25/9 5pm
I have changed the data validated drop down list to a combobox as advised below. I have rewritten the code but it still does not work correctly (no text is copied into the textbox). Can anyone advise me further please?
Sub DropDown5_Change()

Dim Helper As Worksheet
Dim Venn As Worksheet
Dim EoP1Rdg As Range

Set Helper = Sheets("RWM Venn Diagram Helper")
Set Venn = Sheets("RWM Venn Diagram")
Set EoP1Rdg = Range("EoP1Rdg")

If DropDown5 = "End of Phase 1" Then

Sheets("RWM Venn Diagram Helper").Select
    Range("AQ4:AQ103").Select
    Selection.Copy
    Sheets("RWM Venn Diagram").Select
    ActiveSheet.Shapes.Range(Array("TextBox 7")).Select
    Application.CutCopyMode = False
    Selection.ShapeRange(1).TextFrame2.TextRange.Characters.Text = _
        "Name 15" & Chr(13) & "Name 16"

End If

End Sub

Many thanks

A: I'm guessing that you are using the in-cell drop down list from the Data Tab->Data Validation.  You've selected a Worksheet event, which gets fired every time you click on a cell or make a selection of a group of cells (a range).  The event will not fire when selecting a value in the Data Validation drop down.
You want to go to the Developer Tab, and click on Insert button, and insert a Combobox.  See the picture below:

The ComboBox is the second button in the first row under the Forms Control section.  You'll want to avoid the Active X Controls, until you become more proficient with VBA.
You should review Microsoft's Overview of forms, Form controls, and ActiveX controls on a worksheet.
Once you drag, drop, and resize the ComboBox, you can click on "View Code" found on the button bar to the right of "Insert".  This will open up the VBE code editor, and this is where you'd want to write the code that handles the change event.
I don't have your workbook, so I can't show you everything that might need to be changed.
In the code below, I've attempted to show the difference between Recording a macro and programming in VBA.  The big change is the statement just before the End If where you assign the text string to the Shape.
If DropDown5 = "End of Phase 1" Then

    'This piece of code shows you clicking on the RWM Venn Diagram Helper sheet
    'Which if you're writing the code, you need to do the following
    'Declare and set an object variable to the Workbook
    Dim wb As Workbook
    Set wb = ThisWorkbook

    'Declare and set an object variable to the Helper worksheet
    'in this case source (srcWS)
    Dim srcWS As Worksheet
    Set srcWS = wb.Sheets("RWM Venn Diagram Helper")

    'Declare and set an object variable to the Digram worksheet
    'in this case target (tarWS)
    Dim tarWS As Worksheet
    Set tarWS = wb.Sheets("RWM Venn Diagram")

    'Sheets("RWM Venn Diagram Helper").Select
    srcWS.Activate

    Range("AQ4:AQ103").Select
    Selection.Copy

    'Sheets("RWM Venn Diagram").Select
    tarWS.Activate

    'ActiveSheet.Shapes.Range(Array("TextBox 7")).Select
    tarWS.Shapes.Range(Array("TextBox 7")).Select

    'This statement is used by the macro generator to clear the
    'clip board when you complete the paste operation
    'Application.CutCopyMode = False
    'I haven't seen any paste function at this point.

    'Change this to the statement that follows
    'Selection.ShapeRange(1).TextFrame2.TextRange.Characters.Text = _
        "Name 15" & Chr(13) & "Name 16"
    'This assumes that the Venn Diagram is on target sheet
    'That it is shape 1 - if there's only one shape, probably
    tarWS.Shapes(1).TextFrame2.TextRange.Text = "Name 15" & Chr(13) & "Name 16"

End If

A: I've not used any code that pastes on textbox, but I have used code to run when a cell with data validation is changed.
Your script was correct, how ever to my (very limited knowledge) you have to add the intersect part directly on the worksheet where you have the data validation. and have it call a sub in a separate module. At least that has worked for me in the past.
It could be something like this:
(on the worksheet)
Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Range("C5")) Is Nothing Then
    Call DropDown5_Change
    End If

End Sub

(on a module)
Sub DropDown5_Change()

Dim Helper As Worksheet
Dim Venn As Worksheet
Dim EoP1Rdg As Range
Dim EoP2Rdg As Range
Dim EoYRdg As Range
Dim Rdg_TxtBox As OLEObject

Set Helper = ThisWorkbook.Worksheets("RWM Venn Diagram Helper")
Set Venn = ThisWorkbook.Worksheets("RWM Venn Diagram")
Set Rdg_TxtBox = Venn.OLEObjects("Rdg_TxtBox")

With Helper
    Set EoP1Rdg = .Range("AQ4:AQ103")
    Set EoP2Rdg = .Range("AX4:AX103")
    Set EoYRdg = .Range("BE4:BE103")
End With

If Range("C5") = "End of Phase 1" Then
        With Helper
            .Select ("EoP1Rdg")
            .Copy
        End With

        With Venn
            .Select Rdg_TxtBox
            .Paste
        End With
End If
End Sub

Hope this helps


text:
Q: Selecting a record where data in anouther column is at min I need to get the record of two numbers in two columns. But I need to find where the min value is of one of the columns. And find the number that is aligned to that min number.
Right now I have the following:
$sql = "SELECT ID, MIN(price) AS minPrice FROM my_table";
$result = $conn->query($sql);
$row = $result->fetch_assoc();

echo $row["minPrice"]; // This works
echo $row["ID"]; // This is not the number that is in the record where minPrice is.

A: If you are looking for one row, the simplest method is order by and limit:
select t.*
from t
order by t.col2 asc
limit 1;

A: You need to use subqueries.
Select ID from my_table t, (select min(price) as minPrice from my_table) where t.price =minPrice;

Didn't tested it, but it should work.
It returns all the ids with the minimal price.


text:
Q: Node js Multer file upload with extra text input fields I am trying to upload a file to disk using multer. Here is my code:
 const multer  = require('multer');

var storage = multer.diskStorage({
    destination: (req, file, cb) => {
      cb(null, __basedir + '/uploads/')
    },
    filename: (req, file, cb) => {
      cb(null, file.fieldname + "-" + Date.now() + "-" + file.originalname)
    }
});

var upload = multer({storage: storage});

And here goes my form to collect the file and some extra input fields
<form  method="post" enctype="multipart/form-data" action="/uploadfile">
<input name="cate" type="hidden" value="<%= category %>" id="cate" name="cate"></input>

<input type="file" name="uploadfile"  class="btn-success" value="Select Source">
        <input  type="submit" class="btn-success"  > Add a new Source</input>

This function uploads public/img/bg.jpg to my database, thou i would like the file to be picked by the user. How can i get the filepath string in req.files object
fs.createReadStream('public/img/bg.jpg')
  .pipe(fileUpload.createWriteStream())
  .on('error', function(err) {
console.log("fail");})
  .on('finish', function() {
    console.log("success");
  });
  });


text:
Q: Mac OS X: brew services list status yellow Hi why my brew services are turning to yellow status. Even a simple logrotate utility is now turned to yellow state in brew. Not able to figure out from googling.
Not only me, lot of my friends also facing the same issue.

How should i debug and find what causing this errors.
Note:
Steps already taken

*

*brew uninstall logrotate kibana logstash

*brew install logrotate kibana logstash

*Restarted my MAC Book

*Upgraded my brew services


text:
Q: How to work with variables in DOCKERFILE I am creating NGINX container. I want to write all logs into a mounted volume rather than the default volume. This I can achieve by updating nginx.conf file by pointing access_log and error_log to a folder in mounted volume. The twist is that I want each container to write to container specific folder within the mounted volume.
For eg:
Container image name: mycontainerapp
Mounted volume: /logdirectory
Then I want:
/var/log to point to /logdirectory/mycontainerapp/{containerID}/log
This way, I can have multiple containers log to the common mounted volume.
AFAIK, I can get container ID from /proc/1/cpuset
I am not sure of any other way to get the container ID
Question is, how can I read that containerID and use it to create the mounted volume (with folder name) using DOCKERFILE?
Also, if there is a better approach to what I am trying to achieve, please do let me know as I am a newbie to docker.

A: Docker has a logging mechanism included which removes standard log files from the equation. All data sent to stdout and stderr will be captured by Dockers logging interface.
There are a number of logging drivers that can then ship logs from your Docker host to a central logging service (Graylog, Syslog, AWS CloudWatch, ETW, Fluentd, Google Cloud, Splunk). The json driver is the default which is locally stored on the Docker host. journald will also be stored and accessible locally.
In nginx config, or any container for that matter, send the access log stdout or /dev/fd/1 and send the error log to stderr or /dev/fd/2
daemon off;
error_log /dev/fd/2 info;

http {
  access_log /dev/fd/1;
  ...
}

Once you start applying this concept to all containers, any log management requirements are removed from the container/application level and pushed up to the host. Container meta data can be attached to logs. It becomes easier to move or change the logging mechanism. Moving to clustered setups like Swarm becomes less of a hassle. This all ties into the 1 process per container idea of the world that Docker pushes.


text:
Q: MySQL - Query to return repetitive values associated with multi table I have two tables Name & Zip, and i want a query to return the zip codes which are having more than 2 plans associated with one different name
+------+------+     +------+------+
| TABLE: NAME |     |  TABLE: ZIP |
+------+------+     +------+------+
| Plan | NAME |     | Plan |  ZIP |
+------+------+     +------+------+
|123   |DAVE  |     |123   |11021 |
+------+------+     +------+------+
|456   |TOM   |     |456   |11021 |
+------+------+     +------+------+
|789   |STEVE |     |789   |21021 |
+------+------+     +------+------+
|321   |PAM   |     |321   |78210 |
+------+------+     +------+------+
|654   |JACK  |     |654   |21021 |
+------+------+     +------+------+

I would like to get the answers as below
+------+------+
| NAME | ZIP  |
+------+------+
|DAVE  | 11021|
+------+------+
|TOM   | 11021|
+------+------+
|PAM   | 21021|
+------+------+
|JACK  | 21021|
+------+------+

Can anyone help me to get this query?

A: Or you could do:
SELECT n.NAME, z.ZIP
FROM (
    SELECT *, COUNT(*) OVER (PARTITION BY ZIP) AS num
    FROM ZIP
) z
JOIN NAME n ON z.Plan = n.Plan
WHERE z.num > 1

db<>fiddle
This uses COUNT() as a window function. PARTITION BY works similarly to GROUP BY but without collapsing the rows.
I think your expected result is wrong. It should be DAVE, TOM, STEVE and JACK.

A: You can do it using two inner join, first one to join tables based on the Plan, and the second one is to make sure ZIP having 2 or more Plans :
with cte as (
  select Zip
  from Zip
  group by Zip
  having count(1) > 1
)
select n.Name, z.Zip
from Name n
inner join Zip z on z.Plan = n.Plan
inner join cte c on c.Zip = z.Zip;

Demo here


text:
Q: How can I get the first item in a list using free marker? I have the following code which contains about 12 items but I only need to retrieve the first item. How can I display the first item in my list?
My code is:
<#list analysttest.rss.channel.item as item>

${item.title}

                  ${item.author}
                  ${item.pubDate}

${item.description}

      </#list>

A: <#assign item = analysttest.rss.channel.item[0]>

${item.title}

  ${item.author}
  ${item.pubDate}

${item.description}

A: analysttest.rss.channel.item[0] gives the fist item, which you can #assign to a shorther name for convenience. Note that at least 1 item must exist, or else you get an error. (Or, you can do something like <#assign item = analysttest.rss.channel.item[0]!someDefault>, where someDefault is like '', [], {}, etc, depending on what you need. There's even a shorter <#assign item = analysttest.rss.channel.item[0]!> form, which uses a multi-typed "generic nothing" value as the default... see in the Manual.)
Listing is also possible, though odd for only one item: <#list analysttest.rss.channel.item[0..*1] as item>, where *1 means at most length of 1 (requires FreeMarker 2.3.21 or later). This works (and outputs nothing) even if you have 0 items.


text:
Q: Passing a byte array to a function I apologize for the question(completely newbie), the following function is available in the USPS website for generating barcodes. the documentation shows this:
USPS_MSB_Math_CRC11GenerateFrameCheckSequence(016907B2A24ABC16A2E5C004B1(HEX)) = 751(HEX)
I've tried many things(passing the hexadecimals, puting 0x in front, passing binary) but I can get the correct result, how am I suppossed to pass the hexadecimal values to the function? any ideas/suggestions/corrections please... thank you very very much!
/*Inputs: ByteArrayPtr is the address of a 13 byte array holding 102 bits which
 are right justified - ie: the leftmost 2 bits of the first byte do not
 hold data and must be set to zero.

 Outputs: Outputs:return unsigned short - 11 bit Frame Check Sequence (right justified)
*/

extern unsigned short
USPS_MSB_Math_CRC11GenerateFrameCheckSequence( unsigned char *ByteArrayPtr )
{
unsigned short  GeneratorPolynomial = 0x0F35;
unsigned short  FrameCheckSequence  = 0x07FF;
unsigned short  Data;
int             ByteIndex,Bit;

/* Do most significant byte skipping the 2 most significant bits */
Data = *ByteArrayPtr << 5;
ByteArrayPtr++;

for ( Bit = 2; Bit < 8; Bit++ ) {
    if ( (FrameCheckSequence ^ Data) & 0x400 )
        FrameCheckSequence = (FrameCheckSequence << 1) ^ GeneratorPolynomial;
    else
        FrameCheckSequence = (FrameCheckSequence << 1);
    FrameCheckSequence &= 0x7FF;
    Data <<= 1;
}

/* Do rest of the bytes */
for ( ByteIndex = 1; ByteIndex < 13; ByteIndex++ ) {
    Data = *ByteArrayPtr << 3;
    ByteArrayPtr++;
    for ( Bit = 0; Bit < 8; Bit++ ) {
        if ( (FrameCheckSequence ^ Data) & 0x0400 )
            FrameCheckSequence = (FrameCheckSequence << 1) ^ GeneratorPolynomial;
        else
            FrameCheckSequence = (FrameCheckSequence << 1);

        FrameCheckSequence &= 0x7FF;
        Data <<= 1;
    }
}

return FrameCheckSequence;
}

A: You're supposed to make an array and then pass it in - just like the comment at the top there says.
For your example:
unsigned char array[] = { 0x01, 0x69, 0x07, 0xB2, 0xA2, 0x4A, 0xBC,
                          0x16, 0xA2, 0xE5, 0xC0, 0x04, 0xB1
                        };
unsigned short myCRC = USPS_MSB_Math_CRC11GenerateFrameCheckSequence(array);


text:
Q: Server-Sent Events vs AJAX Polling vs WebSockets for Notifications I am building simple notificiation system and I just wanted to know what is the best technique to use to do the job, right now I am doing AJAX requests to server every 30 secs per user to check for new notifications.Since this will be entertainment site it is not crucial for notifications to be pulled in realtime. My main concern is browser support, conserving server resources and scalability, so which technique would best fit the job?

A: Try SignalR
http://www.hanselman.com/blog/AsynchronousScalableWebApplicationsWithRealtimePersistentLongrunningConnectionsWithSignalR.aspx


text:
Q: Как получить значение запроса, в котором есть пробел Имею url по типу
../upload?tag=..
Нужно получить значение тега
Что есть сейчас:
route.HandleFunc("/upload", Handler.Upload).Methods(http.MethodPost)

И далее в функции вытаскиваю тег так:
tag := r.URL.Query().Get("tag")

Работает только в том случае, если передается тег без пробела.
Как можно решить проблему?
Весь код с ошибкой:
main:
func NewServer(settings *config.Settings) *Server {
    return &Server{
        settings: settings,
    }
}

type Server struct {
    server   *http.Server
    settings *config.Settings
}

func (s *Server) StartServer() {
    mux := NewMux()
    route := mux.StartRouter()

    s.server = &http.Server{
        Addr:    fmt.Sprintf(":%d", s.settings.Port),
        Handler: route,
    }

    go s.server.ListenAndServe()
    fmt.Printf("HTTP server started on %d\n", s.settings.Port)
}

func (s *Server) StopServer() {
    s.server.Close()
    fmt.Printf("HTTP server stopped\n")
}

mux:
func NewMux() *Mux {
    return &Mux{
    }
}

type Mux struct {
}

func (m *Mux) StartRouter() *mux.Router {
    route := mux.NewRouter()
    handler := handlers.NewHandler()
    route.HandleFunc("/upload", handler.Upload).Methods(http.MethodPost)
    return route
}

handler:
type Handler struct {
}

func NewHandler() *Handler {
    return &Handler{
    }
}

func (h *Handler) Upload(w http.ResponseWriter, r *http.Request) {
    tag := r.URL.Query().Get("tag")
    if tag != "" {

    }
}

Если тэг без пробела - ок, если с пробелом - 500
(Например ошибка при такой ссылке: ../upload?tag=f%20f


text:
Q: GSM module working when powered by laptop via USB but keeps restarting when powered by battery I am using a sim900 module in the following link and I connect it to my laptop using USB to TTL converter and the module works properly. But, when I connect the same module to 9V DC battery the module keeps restarting, and also if I power the module from my laptop via usb cable it also keeps restarting. So, please, help me out.

A: A USB device can only draw 100mA by default, during enumeration you need to request the maximum of 500mA for USB 2 and below during device enumeration. So when connected directly to the power pins you can only draw 100mA. I couldn't see a current specification for that board but most GSM modules are closer to 500mA than 100mA.
For a Energizer 522 Alkaline battery the maximum current draw appears to be around 500mA so that might be one option although the lifetime will be relatively short. PP3 batteries generally don't have very good current draw characteristics, personally I'd probably look at using something rechargeable like 6 x AA NiMH cells, or maybe AAA if size is a bit of an issue. LiPo packs that are commonly used in remote controlled cars etc may be another option.


text:
Q: Redirecting users to referrer page after logging in using custom login form I am using a custom wordpress login form using the following code. I have this form in the sidebar of my site:
<?php
if ( ! is_user_logged_in() ) { // Display WordPress login form:
    $args = array(
        'redirect' => admin_url(),
        'form_id' => 'loginform-custom',
        'label_username' => __( 'Username' ),
        'label_password' => __( 'Password ),
        'label_remember' => __( 'Remember Me' ),
        'label_log_in' => __( 'Log In' ),
        'remember' => true
    );
    wp_login_form( $args );
} else { // If logged in:
    echo 'you are already logged in';
    wp_loginout( home_url() ); // Display "Log Out" link.
    echo " | ";
    wp_register('', ''); // Display "Site Admin" link.
}
?>

And in the functions.php page, I am using the following code to redirect users to the homepage after they log in:
function my_login_redirect( $redirect_to, $request, $user ){
    //is there a user to check?
    if( isset( $user->roles ) && is_array( $user->roles ) ) {
        //check for admins
        if( in_array( "administrator", $user->roles ) ) {
            // redirect them to the default place
            return $redirect_to;
        } else {
            return home_url();
        }
    }
    else {
        return $redirect_to;
    }
}
add_filter("login_redirect", "my_login_redirect", 10, 3);

My question is:, Is there a way to redirect users to the 'referrer page (page from where they logged in)' after they login by making changes to the above code or perhaps using a better code?
Thanks in advance.

A: The key part is right here-- 'redirect' => admin_url(), in your first block of code. Whatever you set that to is where you will redirect. I don't see a reason for the second block if you are redirecting everyone.
There is no function that I can find for "this page" so you probably want $_SERVER['REQUEST_URI']
$args = array(
    'redirect' => esc_url($_SERVER['REQUEST_URI']),
    'form_id' => 'loginform-custom',
    'label_username' => __( 'Username' ),
    'label_password' => __( 'Password' ),
    'label_remember' => __( 'Remember Me' ),
    'label_log_in' => __( 'Log In' ),
    'remember' => true
);
wp_login_form( $args );

Be careful with $_SERVER vars: http://markjaquith.wordpress.com/2009/09/21/php-server-vars-not-safe-in-forms-or-links/


text:
Q: Sidebars not displaying in Wordpress theme Mantra and header cropping over advised size I have installed Mantra as my WP theme, can't find help to this two issues.
1) Sidebars are not showing. I have a child theme with funtions.php and stylesheet.php folders. The theme comes with possibilities for 1-4 columns and sidebars left, right or both. I was explained can't have sidebars in the frontpage or as theme calls it, presentation page. If I could still add them, I would be extremely happy. However, my main issue is, I can't get sidebars to display in my post pages. I removed the view of pages and I'm using Categories instead since my page is news based. The main theme has sidebar php and action as been called into my child theme. Sidebars do exist since I can insert in the footer. It's just sidebars that are not working. I use for choosing where to display the Jetpack widget visibility. I need the sidebars so visitors can navigate my site between categories and want to display other content as well.
2) I have created an image, to the exact size theme advises and as per theme, it will be posted as is if the image has the exact measurements. However, no matter what I do, it does not displays as is and keeps cropping my image in half when I try to submit it.

A: This may help you to solve sidebar & crop issue

http://wordpress.org/support/theme/mantra


text:
Q: Setting up CUDA on Mac? I'm following the instructions on the NVIDIA website to setup CUDA on my computer. I have completed everything up to "3.2 Install" (http://docs.nvidia.com/cuda/cuda-installation-guide-mac-os-x/index.html#installation). I am not sure how to use the command cuda-install-samples-8.0.sh, it says the command is not found. When I try to run make to compile some samples I get the following message:
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
expr: syntax error
/Developer/NVIDIA/CUDA-8.0/bin/nvcc -ccbin g++ -I../../common/inc  -m64  -Xcompiler -arch -Xcompiler x86_64  -gencode arch=compute_20,code=sm_20 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_37,code=sm_37 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_60,code=compute_60 -o vectorAdd.o -c vectorAdd.cu
nvcc warning : The 'compute_20', 'sm_20', and 'sm_21' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
nvcc fatal   : GNU C/C++ compiler is no longer supported as a host compiler on Mac OS X.
make: *** [vectorAdd.o] Error 1

I'm hoping this just has to do with me not setting the environment variables. I have a MacBook Pro with a NVIDIA GeForce GT 650M GPU so I'm pretty sure my computer is compatible with CUDA.
I have installed Xcode, and updated it and made sure the command line tools were installed.
Apple LLVM version 8.0.0 (clang-800.0.42.1)
Target: x86_64-apple-darwin16.1.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

A: Answer could be found in the following link https://github.com/nodejs/node-gyp/issues/569#issuecomment-255589932 (bergerjac's answer). Also another error might pop up that could be something along the lines of
Unable to open output file 'vectorAdd.o': 'Error opening output file 'vectorAdd.o': Permission denied

and so for that I ran the following command
sudo chown -R your-user-name /Developer/NVIDIA/CUDA-7.0/samples
and I believe it works fine.


text:
Q: point moves when switching buffers in emacs (Aquamacs) Like every emacs user I am constantly switching between buffers, and it's pretty important that the point (cursor) stays where I last edited the file.  However, every now and then emacs enters a state where switching between buffers jumps the point to a different location. That is, I'm editing buffer A at line 3043, I switch to buffer B (C-x b), switch back to A, point is now at line 200 (or whatever).
The only solution I have found is to restart emacs (Aquamacs), which is obviously less than ideal.  Any ideas on how to fix this, or even where the point position information is stored by emacs?

A: My first guess would be what @legoscia mentioned: multiple windows for the same buffer, with different window points.  Experiment to see if this isn't what is happening. See the
Other than that, yes, @Lindydancer is right in recommending that you narrow this down to something reproducible starting with emacs -Q (no init file). There might well be an Emacs bug or an Aquamacs bug, but you first have to rule out something else coming from your init file (~/.emacs).
Narrow it down (e.g., by bisecting your init file recursively, if you cannot repro the problem without the init file). Then, if it is an Emacs problem, report it to Emacs Dev: M-x report-emacs-bug. If it is an Aquamacs but then report it to the Aquamacs maintainers.
As it stands now, your question is too broad for people here to help much. But please do follow up, not only to solve your problem but, if there is a bug, to report it and get it fixed at the source.
FWIW, I've filed an Emacs doc bug report about this, asking that the Emacs manual be more clear about the notion of window-point.


text:
Q: 'getOptionLabel' method of Autocomplete returned object ([object Object]) I am using an MUI Autocomplete to act as an employee search field.  A user will start entering the name of an employee which queries an API request on each keystroke.  Clicking on an employee name from the search results throws the following error message The 'getOptionLabel' method of Autocomplete returned object ([object Object]) instead of a string for {"Badge":"1234567","Name":"Doe, John[John.Doe@gmail.com]"}.  I want to display the employee name in the field after clicking.  After clicking on a name, I want to send the Badge number to my on change function as event (e).  I need to send the badge as two employees may have the same name, but will always have unique badge numbers.
const { onChange, badge, taxonomyid, label, id, disabled, style, status, ...other } = props;
const [employees, setemployees] = useState([]);

useEffect(() => {
    const fetchEmployees = async () => {
        var url = `/api/employeesearch?taxonomyid=${taxonomyid}`;
        if (badge && +badge) {
            url = url + `&badge=${badge}`;
            const resp = await fetch(url);
            const emp = await resp.json();
            setemployees(emp);
        }
    };
    fetchEmployees();
}, [badge, taxonomyid]);

const onNameChange = async (e) => {
    e.preventDefault();
    var value = e.target.value;
    var url = `/api/employeesearch?taxonomyid=${taxonomyid}`;
    if (value) {
        url = url + `&name=${value}`;
        const resp = await fetch(url);
        const emp = await resp.json();
        if (resp.ok) {
            setemployees(emp);
        } else {
            return null;
        }
        console.log(value);
    }
};

const onBadgeChange = (e) => {
    e.preventDefault();
    console.log(e.target.value);
    console.log(e.target.name);
    onChange(e);
};
...
<Autocomplete
    id="search-select"
    // value={employees?.employees?.Name}
    // inputValue={badge}  //JSON.stringify(option.Name)
    label={badge}
    options={employees.employees}
    getOptionLabel={(option, i) => (
        <div key={i} onClick={(e) => /* onBadgeChange(e) */ setVal(option.Badge)} value={option.Name.toString()}>
            {option.Name}
        </div>
    )}
    onInputChange={(e) => onNameChange(e)}
    onChange={onBadgeChange}
    filterOptions={(x) => x}
    variant="outlined"
    size="small"
    name={id || "Person"}
    InputProps={{
        classes: {
            input: classes.fields,
        },
    }}
    renderInput={(params) => <TextField {...params} label={badge} variant="outlined" />}
/>

Here is a quick example of my employee data:
{
  "employees": [
    {
      "Badge": "1234567",
      "Name": "Doe, John[John.Doe@gmail.com]"
    }
  ]
}


text:
Q: Change div background by clicking numbers

input[type=radio],input[type=checkbox] {
   position: absolute;
   top: -9999px;
   left: -9999px;
}
.slider_wrap{
  max-width:600px;
  margin: 0 auto;
  text-align:center;
  font-size: 33px;
}
label:hover{
  cursor:pointer;
  color:#e26a63;
}

.slider{
  height: 200px;
}

#button-1:checked ~ .slider {
  background:blue;
}
#button-1:checked ~ #label1 {
color:#e26a63;
}

#button-2:checked ~ .slider {
   background: yellow;
}
#button-2:checked ~ #label2 {
color:#e26a63;
}

#button-3:checked ~ .slider {
   background: orange;
}
#button-3:checked ~ #label3 {
color:#e26a63;
}

#button-4:checked ~ .slider {
   background: cyan;
}
#button-4:checked ~ #label4 {
color:#e26a63;
}
#button-5:checked ~ .slider {
   background: black;
}
#button-5:checked ~ #label5 {
color:#e26a63;
}
#button-6:checked ~ .slider {
   background: grey;
}
#button-6:checked ~ #label6 {
color:#e26a63;
}
#button-7:checked ~ .slider {
   background: green;
}
#button-7:checked ~ #label7 {
color:#e26a63;
}
#button-8:checked ~ .slider {
   background: brown;
}
#button-8:checked ~ #label8 {
color:#e26a63;
}
#button-9:checked ~ .slider {
   background: red;
}
#button-9:checked ~ #label9 {
color:#e26a63;
}
#button-10:checked ~ .slider {
   background: green;
}
#button-10:checked ~ #label10 {
color:#e26a63;
}

<input value="10" type="checkbox" id="button-10" name="controls"  checked>
<input value="0" type="radio" id="button-1" name="controls">
<input value="1" type="radio" id="button-2" name="controls">
<input value="2" type="radio" id="button-3" name="controls">
<input value="3" type="radio" id="button-4" name="controls">
<input value="4" type="radio" id="button-5" name="controls">
<input value="5" type="radio" id="button-6" name="controls">
<input value="6" type="radio" id="button-7" name="controls">
<input value="7" type="radio" id="button-8" name="controls">
<input value="8" type="radio" id="button-9" name="controls">
<input value="9" type="radio" id="button-10" name="controls">

1
2
3
4
5
6
7
8
9
10

I have a 10 button changing div box background, but I encounter some problems. The first one would be that it starts from 10. And even more, if I don't uncheck it my background will not change. So, the number 10 needs to be unchecked and checked manually, because it doesn't change when I click other number, like the others do. This is a modification made by me to this one: https://codepen.io/anon/pen/qErZEg. I am quite novice and I can't figure out what I did (modified) wrong. Also, if I want to use instead a block of text, not change background, what would be the correct way? At this point I would modify the backgrounds. :/

A: you have two labels with id="label-10", one with no content and one displaying the number 10.  You also have two inputs with id="button-10".

A: you would probably want to do this with jQuery using the onclick function
$(document).ready(function(){

$( "#id of the number" ).click(function() {
   $("#id of div").css("background-color","yellow");
});
});

addional logic could be added to make the color of the div dependent on the number clicked in that same function.


text:
Q: Heroku build fails on uglifier My minimal app runs locally and I have no bundle errors. When I push to heroku, however, the build fails during assets:precompile step:
...
Bundle completed (3.24s)
Cleaning up the bundler cache.
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompole
rake aborted!
LoadError: cannot load such file -- uglifier
(in /tmp/build_.../app/assets/javascripts/application.js)

Notes:
1. I am not using the uglifier gem locally
2. I do not have a file app/assets/javascripts/application.js
I have tried these Gemfile solutions:
A) adding the uglifier gem
B) adding uglifier to the assets group
C) removing uglifier completely from Gemfile and rake uninstall all versions
What's next?

A: If you're interested in continuing to use uglifier, you can add it to your Gemfile (and install with Bundler) -- as explained by @mindtonic.
Also, if you're using ES6, you'll need to switch:
config.assets.js_compressor = :uglifier

to:
config.assets.js_compressor = Uglifier.new(harmony: true)

As explained in https://github.com/lautis/uglifier/issues/127

A: A better solution, if you want to compress your assets, is to add uglifier to your GEMFILE:
gem 'uglifier'

A: Comment this line in config/environments/production.rb
config.assets.js_compressor = :uglifier

A: You have to focus on two points:
Point 1. Version of the Gem: This should be 4.2
gem 'uglifier', '~> 4.2'

Point 2. Use js compressor now
config.assets.js_compressor = Uglifier.new(harmony: true)


text:
Q: ftplib timeout continuously prevents script from running through I have a question, which probably identifies me as beginner in programming, which I am indeed.
I wrote a script, that downloads many netcdf files, each file is about 500 mb in size and there are many hundred files. The script would run for several days if all files were downloaded. The problem is, that the script regularly stops with the error message:
TimeoutError: [Errno 60] Operation timed out

This is annoying, because I would like to start the script and come back some days later when the task of downloading is done. Like this I would have to check if the script is still running at least every hour.
I found in the manual, that the timeout of the ftp-connection can be set manually.
I set it really high
ftp = FTP("rancmems.mercator-ocean.fr", timeout=10000)

My question is is this the line, where the problem comes from and is there any chance to solve the problem?
Thank you for helping :-)


text:
Q: Bash: Using filenames as commands with the wildcard I was playing around in my terminal earlier and discovered that I can execute single word commands ('ls','cat','python2.7','exit') by making a file or directory named the same thing as the command. However, I can't execute 'multi-word' commands ('rm\ -rf *','ls -a', 'python2.7\ test.py') (which also led me to discover that you can't remove directories named '-rf' with 'rm -rf *') UNLESS the arguments are in alphabetic order. Seemingly, when you just pass in * to bash it reads the names of the files/directories in alphabetical order, passing each successive name in as an argument to the previous command. Example:
$ mkdir cat
$ touch dog
$ vim dog # at this point I put 'Hello!' into dog
$ *
Hello!

Why does the wildcard character not allow me to execute commands of files with spaces in them but does allow me to execute commands of multiple file names? Thanks!
EDIT: Also aliases don't work for some reason. Example:
$ alias lsa='ls -a'
$ mkdir lsa
$ *
No command 'lsa' found, did you mean:
  ...
lsa: command not found

Anyone know why this is?

A: Every command bash processes is subject to several varieties of expansions before bash interprets and acts on the result.  The last of those is pathname expansion, wherein bash examines the words of the command (as produced by previous expansions and word splitting) for any that contain any of the unquoted special characters *, ?, and [, and interprets those words as patterns representing file names.  After all expansions are performed, any redirections and variable assignments in the expanded command are performed and removed from the command.  If any words remain, the first is taken as the name of a command to run.  The provenance of that word does not matter.
In pathname expansion, the * matches any string, including the empty string.  When bash performs pathname expansion on the word consisting of only *, it expands to the names of all the files in the working directory, except those beginning with a dot (.).
Thus, if your working directory contains just a single file named ls, and you execute the command *, bash expands that command to ls and executes it, producing the output ls.  Similarly, if the contents of the directory are echo, Hello,, and World!, then when you execute the command * bash expands it to the equivalent of echo Hello, 'World!', and the command outputs Hello, World!.
That doesn't work as you thought it would for filenames with spaces in them because each file name matching a pattern is expanded to a single word.  These are not subsequently split.  (Bash does perform "word splitting" as part of the expansion process, but that happens before pathname expansion.)  This is normally what you want, for otherwise commands such as rm * would not reliably do what you expect.
That doesn't work with aliases because bash expands aliases when it reads commands, not when it executes them.  That has several implications, but one of them is that aliases are interpreted before any expansions are performed.  Another is that the replacement text of an alias is subject to all the normal expansions.


text:
Q: ExtJS 5 Using a Combobox with a trigger in CellEditing Grid I am having a issue when using a cell editing grid that has a field that opens a window. The issue is when you open the editor for the field and click on one of the combobox triggers, a window opens, which causes the field to fire validateedit, resulting in the editor closing. I am looking for a way to prevent this. The reason that I am opening a window is that I am giving the user the ability to quickly add a new record to the combobox, without having to go to another place in the system. I am able to get this functionality to work with row editing but my customer does not like they way row editing works.
Here is my fiddle example.


text:
Q: Round Android Wear Emulator is using rect layouts Unfortunately Moto360 is not avail to Europe yet...
I'm running a Round Android Wear Emulator and this is working fine.
However when I run my Android Wear Activity (which uses a WatchViewStub) the layout being used is the rect_activy_layout and not the round layout
Anyone else have this issue or resolved when running Round Emulator?
Thanks

A: There are many problems with inflating layouts that are caused by not correctly using WatchViewStub. I don't see any code to know exactly, but one common issue is when you register a listener for watch insets so you can check if it is round or square inside your onApplyWindowInsets handler:
    final WatchViewStub stub = (WatchViewStub) findViewById(R.id.watch_view_stub);
    stub.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() {
        @Override
        public WindowInsets onApplyWindowInsets(View view, WindowInsets windowInsets) {
            // Need to also call the original insets since we have overridden the original
            // https://developer.android.com/reference/android/view/View.OnApplyWindowInsetsListener.html
            stub.onApplyWindowInsets(windowInsets);

            // this is where you would check the WindowInsets for isRound()

            return windowInsets;
        }
    });

I see cases where people forget to return the windowInsets, or forget to call stub.onApplyWindowInsets(). This has the effect of giving a square layout instead of a round layout.
Also, there was a bug with the AndroidWearRound emulator built into the SDK. There were three of them, and if you created the wrong one, it would actually create a square emulator. Make sure if you have three emulators, that you pick the second one. This bug has been fixed in the latest Android SDK Tools 23.0.4, but it might be that you have an older version.
Can you show us the code you are doing around the WatchViewStub?

A: One easy fix is to upgrade the Wear Round emulator to API level 22, which is out now. I have in general found the Wear Round emulator at API level 21 to have some buggy behaviour, while so far have not found any problems with the Round emulator at API level 22. I think this will fix the issue, as I had the same problem myself at some point (and it was NOT a setup problem of the emulator).


text:
Q: how to create custom capabilities for custom user role I have create a new user role.
add_role('lln_assessor', 'LLN Assessor', array(
'read' => true,
));

this role will access a custom admin menu page .
add_action( 'admin_init', 'my_remove_menu_pages' );
function my_remove_menu_pages() {

    global $user_ID;

    if ( current_user_can( 'lln_assessor' ) ) {
        add_menu_page('Axcelerate LLN','LLN Datas','read_assess_lln', 'Axcelerate_Link_Admin_lln_data','axcelerate_link_admin_lln_data_fn','','1.0' );
    }
}

but first I must create a custom capability for it.
$role_object = get_role( 'lln_assessor' );

// add $cap capability to this role object
$role_object->add_cap( 'read_assess_lln');

but the issue when I try to access the 'LLN Datas' menu in the admin dashboard I got this error.
You do not have sufficient permissions to access this page.
I think the error was on the custom capability but I have no idea on how to fix it. please help.

A: Try changing the current_user_can from lln_assessor to read_assess_lln
if ( current_user_can( 'read_assess_lln' ) ) {
        add_menu_page('Axcelerate LLN','LLN Datas','read_assess_lln', 'Axcelerate_Link_Admin_lln_data','axcelerate_link_admin_lln_data_fn','','1.0' );
    }

And make sure you are logged in as lln_assessor instead of admin.


text:
Q: Registers working I hope i am not making this question out of scope , i am a programmer guy and i always do consult with this site whenever i am stucked
so The question is that i don't know about registers and how they work i only know one thing that registers are small amount of memory inside cpu
but i want to know more how like how to convert a registers value from assembly to hex this seems knida noob but i hav'nt learnt this thing
if i have an assembly like this
mov dl,oah
mov ah,oaah
mov bh,0010b

know here some stuff is being moved to  dl,ah,and bh i just want to know how to calculate there address and hex values is there any table which i can use to find out this or a good way to calculate this

A: A way to think of registers is as storage on the CPU.  Different processors have different numbers and types of registers. Registers typically are the width of the processor.  So a 32 bit processor will have mostly 32 bit wide registers.  Registers can be loaded with absolute values, or with memory addresses.  The disassembler or debugger that you use to list assembly instructions will show what is happening.  The assembler codes will most often show values in hexadecimal, but other formats are possible.  It depends on your CPU/debugger/disassembler.  You should look for some assembly language tutorials for the CPU you are interested in.

A: Registers themselves generally do not have an address, they are normally not accessible through the memory space.  There are a few processors where this was actually the case but that is the exception not the rule.
The slight notion of an address that a register has is the value used in the machine code.  You have chosen here to use x86 which doesnt necessarily follow that notion but if you look at something like arm or mips or a number of others, it is a lot more obvious. r0 will have a bit pattern of 0b0000, r1 0b0001, r2 0b0010 and so on in the machine code in the instruction itself.  And there is likely a ram in the guts of the processor that may use these register bits modified or not, but that ram is not accessible in any other way to the programmer than as a place where register contents are held.
For any processor go to the processor vendors website or do some googling for the instruction set for that processor.  the vendor docs usually include an opcode map or basically the machine code for each instruction, per instruction.  Some non-vendor websites may only have the syntax as a programmers reference and not the machine code, so those wont help you.  The one or few processors whose registers are memory mapped will also have documentation (the one I am thinking of is old enough though that you might not find the original vendor documentation).


text:
Q: Disable "unsigned driver" warning in Windows 7 Embedded I am trying to automate a process in the course of which unsigned drivers have to be installed. I need to suppress the request since obviously it is not desirable to require user interaction in an automated process. The system in question is Windows 7.
I think I ran across a registry key once the changing of which accomplished exactly what I wanted without requiring a reboot, but my research did not turn up anything helpful this time.
As of technologies, I can utilize the command line tools that come with windows as well as .NET 4. I do not want a third party solution.


text:
Q: Can you change the node name of an xml using jquery? I know we could get the node name by using nodeName, but is it possible to set the nodeName using jquery as well? basically i wanted to chnage the casing of node name from uppercase to lowercase.
Thanks a lot

A: I believe that in order to do this properly, you need to replace that tag as described here:
jQuery: how to change tag name?
Unfortunately, this would require you to replace the entire element and not just the tag name, so if you want to replace the tag name, you need to find a way to preserve both the tag's attributes as well as the code within.
Fortunately, I had an extra few minutes, so I created function that does just that:
function change_tag_name(selector,tagname){
    var old_elm = $(selector);
    //Create a jquery element based on selector
    var original_elements = old_elm.get();
    //Get the array of original dom objects
    //Note: We get the original dom objects because jQuery objects do not provide access to the attributes array
    for(var i=0; i< original_elements.length; i+=1){
        var original_element = original_elements[i];
        //Create reference to original element in dom
        var new_elm = $(document.createElement(tagname));
        //Create new element with desired tagname
        new_elm.html($(original_element).html());
        //Add original element's inner elements to new element

        var original_attributes = original_element.attributes;
        //Create an array of the original element's attributes;
        var attributes = new Object();
        //Create a new generic object that will hold the attributes for the new element

        for(var j=0; j<original_attributes.length; j+=1){
            var attribute = original_attributes[j];
            var name = attribute.nodeName;
            //Note: The attributes "nodeName","localName",and "name" appear to have the same value, so I just chose one. It's entirely possible that these could have different values in different contexts...
            //var name = attribute.localName;
            //var name = attribute.name;
            var value = attribute.nodeValue;
            //Note: The attributes "nodeValue","textContext",and "value" appear to have the same value, so I just chose one. It's entirely possible that these could have different values in different contexts...
            //var value = attribute.textContext;
            //var value = attribute.value;
            attributes[name]=value;
        }
        //Populate attributes object
        new_elm.attr(attributes);
        //Assign attributes from old element to new element
        $(original_element).replaceWith(new_elm);
        //Replace old_element with new element
    }
}

Also, I don't think that there's a way to guarantee that attributes are in the original order.

A: You can't change the nodeName, but you could create a new node with the different name, copy attributes across, then replace one with the other.
jQuery makes it hard to distinguish between attributes and properties, you may be able to use the IE proprietary outerHTML property (which is supported in a few other browsers) and string manipulation, but that won't work on the web in general.
If there are many such nodes, then a global replace of "


text:
Q: Importing functions from a lib. / dll file I have a library file.
Is it possible to extract its functions in a solution done with Visual Studio?
Is it the same procedure as exporting functions into a dll file?

A: dumpbin utility is probably what you are looking for. It is able to give you information about symbols inside the library files. You can use it from the VS Command Prompt and for further reference, look at Microsoft's referenece: http://support.microsoft.com/kb/177429


text:
Q: Android by HTML5 / CSS3 / JavaScript Can I create Android applications with HTML5, CSS & JavaScript? Such as (News application, books library, 2D & 3D Games and etc) How can I do?
And what is the platform used?

A: A simple platform to use would be the cordova platform.
Simple tutorial found here: https://cordova.apache.org/docs/en/latest/guide/cli/
Install Cordova:
   npm install -g cordova
Create project:
    cordova create CordovaApp
Upon creating the application you will notice a 'www' folder. Inside you will find the html, css and js files and folders. Modify those according to your requirements
Add Target Device Platform:
    cordova platform add ios
or
    cordova platform add android
Build the app:
    cordova build
Run the app:
    cordova run android or cordova run ios


text:
Q: Variable type change How do I change this:
 canvas2.mousedown(function(e){handleMouseDown(e);});

To this functionality :
canvas2.addEventListener('mousedown', **then the functions here**);

I have tried these but they don't work:
 canvas2.addEventListener('mousedown',function(e){handleMouseMove(e);});
 canvas2.addEventListener('mousedown',function(e)handleMouseMove(e));
 canvas2.addEventListener('mousedown',function(e),handleMouseMove(e));

A: If the "from" you've shown works (or worked when you were using jQuery), canvas2 is or was a jQuery object (most likely). The rough equivalent is your first line, but on the DOM element inside it:
canvas2[0].addEventListener('mousedown',function(e){handleMouseMove(e);});

or indeed, simply:
canvas2[0].addEventListener('mousedown', handleMouseMove);

Naturally, if you're trying to migrate code away from jQuery, you'll probably end up changing canvas2 to something else, perhaps a straight DOM object. If so, drop the [0] from the above when you do that. But as the first line of the things you've tried would have worked if that were already done, hopefully the above helps.

Side note: You changed from handleMouseDown to handleMouseMove in your examples. I've faithfully done that above, but do be sure you're using mousedown with handleMouseDown and mousemove with handleMouseMove...