text:
Q: Imprimir sin vista previa en C#, ReportViewer os explico lo que necesito.
Tengo esta vista creada en c#, para una aplicacion de escritorio.

Y como verán tengo otras 3 mas, las cuales las cargo en un reportViewer.

Entonces el proceso para imprimir es el siguiente:

Entonces -> presiono el botón pedido -> sale alerta de confirmación -> abre un nuevo form que contiene el reportViewer -> presiono icono de impresión -> sale la ventanita de impresión -> presiono imprimir -> imprime.

Vale Decir que el proceso de impresión es larga y molesta(eso creo), lo que deseo es que esto cambie a: presiono el botón pedido -> sale alerta de confirmación ->imprime.

Vale, os dejo el evento del botón:
    private void btn_cobrar_Click(object sender, EventArgs e)
    {

        if (lista.Rows.Count == 0) {
            ToastNotification.Show(this, "Añade un producto antes de cobrar.", global::facturacion.Properties.Resources.error, 3000, (eToastGlowColor.Red), (eToastPosition.TopRight));
            return;
        }
  // mensaje de confirmacion
        if(MessageBox.Show("Esta Apunto de Cobrar el monto de " + lb_total_importe.Text + ".", "COBRAR PEDIDO", MessageBoxButtons.YesNo, MessageBoxIcon.Question)==DialogResult.Yes){
                aux = CCliente.Buscar("ci",cb_ci_nit.Text.ToString());
                if (aux.Rows.Count == 1 && lista.Rows.Count > 0)
                {
                    DataRow row_cliente = aux.Rows[0];
                    Numeracion num = new Numeracion();
                    MVentas venta = new MVentas(0, int.Parse(row_cliente["id"].ToString()),int.Parse(Datos.Rows[0]["id"].ToString()), DateTime.Now, Double.Parse(lb_total_importe.Text), num.Convertir(lb_total_importe.Text, true), "pedido", "cancelado");
                    long id_now = CVenta.Insertar(venta, this);
                    if (id_now != (-1))
                    {
                        foreach (DataGridViewRow r in lista.Rows)
                        {
                            string precio_total = r.Cells["total"].Value.ToString();
                            string cantidad = r.Cells["cantidad"].Value.ToString();
                            string unitario = r.Cells["precio"].Value.ToString();
                            string descripcion = r.Cells["descripcion"].Value.ToString();
                            int id = Convert.ToInt32(r.Cells["id"].Value);
                            MDetalleVenta det = new MDetalleVenta(0, id, double.Parse(cantidad), (int)id_now, Double.Parse(precio_total), descripcion, Double.Parse(unitario));
                            if (CDetalleVenta.Insertar(det, this))
                            {

                            }
                        }
                    }
 //aqui llamo al form de impresion
                    form_imprimir ff = new form_imprimir(id_now, "pedido");
                    ff.Visible = true;
                    limpiar();
                }
                else {
                    MessageBox.Show("El CI/Nit no esta registrado.\n Registre el Nombre y guardelo.");
                    btn_guardar.BackColor = System.Drawing.Color.Blue;
                    btn_guardar.Enabled = true;
                    tb_nombreAp.Text = "";
                    tb_nombreAp.Enabled = true;
                    tb_nombreAp.Focus();
                }
        }
    }

Y el Load de mi form de impresion:
    private void FormFactura_Load(object sender, EventArgs e)
    {

        if (tipo.CompareTo("factura") == 0)
        {
            this.reportViewer1.LocalReport.ReportEmbeddedResource = "facturacion.Vistas.Report3.rdlc";
            DataTable factura = CFactura.MostrarID(id_venta);
            DataTable venta = CVenta.MostrarID(id_venta);
            DataTable infomacion = CEmpresa.Mostrar();
            DataTable codigo = CCodigo.ultimoID(int.Parse(factura.Rows[0]["idCodigo"].ToString()));
            DataTable cliente = CCliente.MostrarID(venta.Rows[0]["idCliente"].ToString());
            DataTable customer = CDetalleVenta.Mostrar((int)id_venta);
            this.MDetalleVentaBindingSource.DataSource = customer;
            ReportParameter[] parameters = new ReportParameter[16];
            string path = "file:\\" + Application.StartupPath + infomacion.Rows[0]["logo"];
            string pathqr = "file:\\" + Application.StartupPath + factura.Rows[0]["QR"].ToString();
            parameters[15] = new ReportParameter("Path", @path, true);
            parameters[0] = new ReportParameter("PathQr", @pathqr, true);
            parameters[1] = new ReportParameter("empresa", infomacion.Rows[0]["nombre"].ToString());
            parameters[2] = new ReportParameter("propietario", infomacion.Rows[0]["nomPropietario"].ToString());
            parameters[3] = new ReportParameter("direccion", infomacion.Rows[0]["direccion"].ToString());
            parameters[4] = new ReportParameter("nit", infomacion.Rows[0]["nit"].ToString());
            parameters[5] = new ReportParameter("nro", factura.Rows[0]["numFactura"].ToString());
            parameters[6] = new ReportParameter("autorizacion", codigo.Rows[0]["autorizacion"].ToString());
            parameters[7] = new ReportParameter("telefono", infomacion.Rows[0]["telefono"].ToString());
            parameters[8] = new ReportParameter("literal","Son: "+ venta.Rows[0]["montoLiteral"].ToString());
            parameters[9] = new ReportParameter("nombre_cliente", cliente.Rows[0]["nombre"].ToString());
            parameters[10] = new ReportParameter("ci", cliente.Rows[0]["ci"].ToString());
            parameters[11] = new ReportParameter("fecha", venta.Rows[0]["fecVenta"].ToString());
            parameters[12] = new ReportParameter("total", venta.Rows[0]["montoTotal"].ToString());
            parameters[13] = new ReportParameter("codigo_control", factura.Rows[0]["codControl"].ToString());
            parameters[14] = new ReportParameter("fecha_limite", codigo.Rows[0]["fecFinal"].ToString());
            this.reportViewer1.LocalReport.SetParameters(parameters);
            this.reportViewer1.SetDisplayMode(DisplayMode.PrintLayout);
            this.reportViewer1.RefreshReport();
        }
        else {
            if (tipo.CompareTo("pedido") == 0)
            {
                this.reportViewer1.LocalReport.ReportEmbeddedResource = "facturacion.Vistas.Report1.rdlc";
                DataTable venta = CVenta.MostrarID(id_venta);
                DataTable infomacion = CEmpresa.Mostrar();
                DataTable cliente = CCliente.MostrarID(venta.Rows[0]["idCliente"].ToString());
                DataTable customer = CDetalleVenta.Mostrar((int)id_venta);
                this.MDetalleVentaBindingSource.DataSource = customer;
                ReportParameter[] parameters = new ReportParameter[2];
                string path = "file:\\" + Application.StartupPath + infomacion.Rows[0]["logo"];
                parameters[0] = new ReportParameter("nombre_cliente", cliente.Rows[0]["nombre"].ToString());
                parameters[1] = new ReportParameter("fecha", venta.Rows[0]["fecVenta"].ToString());
                this.reportViewer1.LocalReport.SetParameters(parameters);
                this.reportViewer1.SetDisplayMode(DisplayMode.PrintLayout);
                this.reportViewer1.RefreshReport();
            }
            else {
                this.reportViewer1.LocalReport.ReportEmbeddedResource = "facturacion.Vistas.Report2.rdlc";
                DataTable venta = CVenta.MostrarID(id_venta);
                DataTable infomacion = CEmpresa.Mostrar();
                DataTable cliente = CCliente.MostrarID(venta.Rows[0]["idCliente"].ToString());
                DataTable customer = CDetalleVenta.Mostrar((int)id_venta);
                this.MDetalleVentaBindingSource.DataSource = customer;
                ReportParameter[] parameters = new ReportParameter[10];
                string path = "file:\\" + Application.StartupPath + infomacion.Rows[0]["logo"];
                parameters[0] = new ReportParameter("Path", @path, true);
                parameters[1] = new ReportParameter("empresa", infomacion.Rows[0]["nombre"].ToString());
                parameters[2] = new ReportParameter("propietario", infomacion.Rows[0]["nomPropietario"].ToString());
                parameters[3] = new ReportParameter("direccion", infomacion.Rows[0]["direccion"].ToString());
                parameters[4] = new ReportParameter("telefono", infomacion.Rows[0]["telefono"].ToString());
                parameters[5] = new ReportParameter("nombre_cliente", cliente.Rows[0]["nombre"].ToString());
                parameters[6] = new ReportParameter("ci", cliente.Rows[0]["ci"].ToString());
                parameters[7] = new ReportParameter("fecha", venta.Rows[0]["fecVenta"].ToString());
                parameters[8] = new ReportParameter("total", venta.Rows[0]["montoTotal"].ToString());
                parameters[9] = new ReportParameter("literal", "Son: " + venta.Rows[0]["montoLiteral"].ToString());
                this.reportViewer1.LocalReport.SetParameters(parameters);
                this.reportViewer1.SetDisplayMode(DisplayMode.PrintLayout);
                this.reportViewer1.RefreshReport();

            }
        }
    }

A: De tanto buscar y buscar y buscar...
Encontré una forma de hacerlo, que es implementando una clase de impresión, os explico los detalles en el código:
Lo primero que tenéis que hacer es crear una clase impresión:
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Data;
using System.Windows.Forms;
using Microsoft.Reporting.WinForms;
using System.Drawing.Printing;
using System.Drawing;
using System.Drawing.Imaging;
// el namespace depende de tu proyecto
namespace facturacion.Vistas
{
    public class Impresor : IDisposable
    {
        private int m_currentPageIndex;
        private IList<Stream> m_streams;

        // Stream que nos ayudara a contener el Report.rdlc
        private Stream CreateStream(string name, string fileNameExtension, Encoding encoding, string mimeType, bool willSeek)
        {
            Stream stream = new MemoryStream();
            m_streams.Add(stream);
            return stream;
        }

        // exportacion del archivo-reporte en formato EMF (Enhanced Metafile).
        private void Export(LocalReport report)
        {
           //las siguientes lineas definen el tamaño de la hoja, en mi caso es de tamaño ticket
            //los tamaños pueden ser en pulgadas(in) o en centimetros(cm), quiza aceptan mas formatos pero no los probé.
            string deviceInfo =
              @"<DeviceInfo>
                <OutputFormat>EMF</OutputFormat>
                <PageWidth>7,7cm</PageWidth>
                <PageHeight>35,5cm</PageHeight>
                <MarginTop>0cm</MarginTop>
                <MarginLeft>0,2cm</MarginLeft>
                <MarginRight>0cm</MarginRight>
                <MarginBottom>0cm</MarginBottom>
            </DeviceInfo>";
            Warning[] warnings;
            m_streams = new List<Stream>();
            //renderizamos el reporte
            report.Render("Image", deviceInfo, CreateStream, out warnings);
            foreach (Stream stream in m_streams)
            { stream.Position = 0; }
        }

        // Handler para los eventos PrintPageEvents
        private void PrintPage(object sender, PrintPageEventArgs ev)
        {
            Metafile pageImage = new Metafile(m_streams[m_currentPageIndex]);

            // ajusta el area rectangular con margenes.
            Rectangle adjustedRect = new Rectangle(
                ev.PageBounds.Left - (int)ev.PageSettings.HardMarginX,
                ev.PageBounds.Top - (int)ev.PageSettings.HardMarginY,
                ev.PageBounds.Width,
                ev.PageBounds.Height);

            // Dibuja un fondo blanco para el reporte
            ev.Graphics.FillRectangle(Brushes.White, adjustedRect);

            // Dibuja el contenido del reporte
            ev.Graphics.DrawImage(pageImage, adjustedRect);

            // pasa a la siguiente pagina y comprueba que no se haya terminado el contenido
            m_currentPageIndex++;
            ev.HasMorePages = (m_currentPageIndex < m_streams.Count);
        }

        private void Print()
        {
            PrintDocument printDoc;
            //busca el nombre de la impresora predeterminada
            String printerName = ImpresoraPredeterminada();

            if (m_streams == null || m_streams.Count == 0)
                throw new Exception("Error: No hay datos que imprimir.");

            printDoc = new PrintDocument();
            printDoc.PrinterSettings.PrinterName = printerName;
            if (!printDoc.PrinterSettings.IsValid)
            {
                throw new Exception(String.Format("No puedo encontrar la impresora \"{0}\".", printerName));
            }
            else
            {
                printDoc.PrintPage += new PrintPageEventHandler(PrintPage);
                m_currentPageIndex = 0;
                printDoc.Print();
            }
        }

        private string ImpresoraPredeterminada()
        {
            for (Int32 i = 0; i < PrinterSettings.InstalledPrinters.Count; i++)
            {
                PrinterSettings a = new PrinterSettings();
                a.PrinterName = PrinterSettings.InstalledPrinters[i].ToString();
                if (a.IsDefaultPrinter)
                { return PrinterSettings.InstalledPrinters[i].ToString(); }
            }
            return "";
        }

        // Exporta el reporte a un archivo .emf y lo imprime
        public void Imprime(LocalReport rdlc)
        {
            Export(rdlc);
            Print();
        }

        public void Dispose()
        {
            if (m_streams != null)
            {
                foreach (Stream stream in m_streams)
                    stream.Close();
                m_streams = null;
            }
        }
    }
}

Bueno si no les gusta leer, lo pueden copiar y pegar, luego hacer unos pequeños cambios de hoja y namespace y estara listo.
Ahora paso al evento de mi boton y editare la parte donde llamaba al form_impresion es decir esta parte:
//aqui llamo al form de impresion
form_imprimir ff = new form_imprimir(id_now, "pedido");
ff.Visible = true;

Esa Parte se reemplazara con lo siguiente:
LocalReport rdlc = new LocalReport();//importante
rdlc.ReportPath = @"..\..\Vistas\Report1.rdlc";//direccion absoluta del reporte, es muy importante a la hora de ponerlo en funcionamiento.
// si os da algun error puede ser por no encontrar la direccion exacta del reporte, creedme ya lo pase.
rdlc.ReportEmbeddedResource = "facturacion.Vistas.Report1.rdlc";
// las siguientes lineas son los datos que nesecito para mi reporte.
DataTable customer = CDetalleVenta.Mostrar((int)id_now);
rdlc.DataSources.Add(new ReportDataSource("DataSet1", customer));
DataTable venta2 = CVenta.MostrarID(id_now);
DataTable infomacion = CEmpresa.Mostrar();
DataTable cliente = CCliente.MostrarID(venta2.Rows[0]["idCliente"].ToString());
//los parametros dento de mi report.rdlc
ReportParameter nombre = new ReportParameter("nombre_cliente", cliente.Rows[0]["nombre"].ToString());
ReportParameter fecha = new ReportParameter("fecha", venta2.Rows[0]["fecVenta"].ToString());
rdlc.SetParameters(new ReportParameter[]{nombre,fecha});
// instancio un objeto dentro de la clase Impresor
Impresor imp = new Impresor();
imp.Imprime(rdlc);//llamo a la función e creedme imprime de fabula.

Espero que os ayude a unos cuantos con el mismo problema, ya que lo busque y leí bastante para poder hacerlo y entenderlo.
Con todo esto se soluciono y ahora el proceso es: presiono el botón pedido -> sale alerta de confirmación ->imprime.


text:
Q: How to use C# to connect to Exchange Server via RPC Over HTTPs We have application implemented in WinForm. Now Customer requests to add new feature - Mail Function. That one i have to connect to customer mail server (Exchange Server) to send marketing email. They are using RPC Over HTTPS with Outlook Client to connect to Exchange Server. They asked me to refer this link http://www.msexchange.org/tutorials/outlookrpchttp.html
That all I know. When they asked, I even don't know what is RPC Over HTTPS. But after I did searching on Internet I understand a bit now. I really need a code sample for this problem.
Please advise me.
Thank you all a lot.
Regards,

A: What are you using to send messages now?
If you are using the Outlook Object Model or Extended MAPI to send using an existing Outlook profile, there is nothing you need to do - that will all happen under the hood.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to recompile static gfortran and gcc libraries with fPIC I am compiling a shared library (for linux systems) from a Fortran source which I would like to distribute to researchers around the world.  I can successfully build with gfortran -shared -o mylib.so ....  Unfortunately, ldd mylib.so reveals dependencies on various gfortran and gcc libraries, and I find this totally unacceptable:
linux-vdso.so.1 =>  (0x00007fff995bd000)
libgfortran.so.3 => /usr/lib/x86_64-linux-gnu/libgfortran.so.3 (0x00007fa5227fa000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fa5224f1000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fa5222da000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fa521f10000)
libquadmath.so.0 => /usr/lib/x86_64-linux-gnu/libquadmath.so.0 (0x00007fa521cd1000)
/lib64/ld-linux-x86-64.so.2 (0x0000561be2268000)

I want my programs to execute out-of-the-box without requiring the user to know how to install gfortran on their machine and how to make sure they have the required libraries (e.g. libgfortran.so.3 and not libgfortran.so.4).
Therefore, I insist on statically linking all the gfotran libraries into my shared object.  Unfortunately gfortran -shared -static-libgfortran -static-libgcc fails with the error
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/5/libgfortran.a(error.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-linux-gnu/5/libgfortran.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status

Obviously, the .a files distributed with gfortran and gcc have not been compiled with position independent code. Question: I need step-by-step instructions on rebuilding the static versions of gfortran library files listed above with position independent code, so that I may successfully build my own shared library, with the gfortran libraries statically incorporated into them, achieving reduced dependences.


text:
Q: Rails 5 - Resque not processing enqueued job I'm trying to do enqueue a simple job using Resque 1.26.0 (and Redis-rb 3.3.1). The job doesn't seem to be processing the perform function because resque-web is processing each job and shows 0 failures. The jobs also are being processed instantly.
The jobs are enqueued from a controller action with
Resque.enqueue(TestJob, url)

The job itself looks like
class TestJob < ApplicationJob
  @queue = :tags_queue
  Logger.new("log/resque_worker_QUEUE.log").fatal("thing")

  def self.perform(url)
    Logger.new("log/resque_worker_QUEUE.log").fatal("other thing")
    logger.fatal("more errors please")

    myDivideByZeroVar= 1/0
    raise "error"
    Logger.new("log/resque_worker_QUEUE.log").fatal("other thing")
    logger.fatal("more errors please")
  end
end

A rake task is also set up:
require 'resque/tasks'
task "resque:setup" => :environment

The redis-server is running.
The worker is started with rake resque:work QUEUE=*. Using verbose logging doesn't show anything useful.
The log file only shows the first fatal error string "thing". None of the other errors are logged that are inside perform.
What am I doing wrong here?

A: Solved this. The job needed to be called using ActiveJob instead of using Resque.enqueue. TestJob.perform_later(url) worked just fine.


text:
Q: fatal error: method declaration not in @interface context What does this error mean ? Following is my code. But I don't see anything wrong
-(id) init
{
    if( (self=[super init] )) {
        CGSize winSize = [[CCDirector sharedDirector] winSize];
        CCSprite *player = [CCSprite spriteWithFile:@"Player.png"
                                               rect:CGRectMake(0, 0, 27, 40)];
        player.position = ccp(player.contentSize.width/2, winSize.height/2);
        [self addChild:player];
    }

    if( (self=[super initWithColor:ccc4(255,255,255,255)] ))
    {
    }
    return self;
}

A: You get this error if you write a property or method declaration outside of the  @interface … @end block, specifically if you place it either before @interface or after @end. Here's an example that would cause this error:
@interface MyClass : NSObject
{
    // instance vars here
}

// properties and method declarations here

@end

// ERROR: method declared outside @interface (after @end)
-(void) someMethodWithObject:(id)obj;


text:
Q: Open a form on the UI thread from a background thread I am trying to open a Form from a background thread (I think) because when I call formName.Show(); is freezes that form (Not the main form).
Goal:
When the user receives a new message, popup a newMessageFrm with the new message for reply.
Problem:
The new Form locks.
Here is the code I am using:
static void OnNewMessage(object sender, S22.Xmpp.Im.MessageEventArgs e)
        {
            if(CheckIfFormIsOpen(e.Jid.ToString(), e.Message.ToString()) == true){

            } else
            {
                newMessageFrm tempMsg = new newMessageFrm(e.Jid.ToString());

                tempMsg._msgText = e.Jid.ToString() + ": " + e.Message.ToString();
                tempMsg.frmId = e.Jid.ToString();
                tempMsg.Show(); //This locks up the application
            }

        }

I am using Visual Studio 2015, C#, and S22.Xmpp (As you can see from the code.)
When this event fires off the form does popup, but then locks.
Please let me know if you need any more information.

A: Unfortunately I don't know how to do this without any existing form. But I'm sure you have some kind of main form you can access. Or you can obtain a Form using
var invokingForm = Application.OpenForms[0];

So you can change the code of your method like this:
static void OnNewMessage(object sender, S22.Xmpp.Im.MessageEventArgs e)
{
    var invokingForm = Application.OpenForms[0]; // or whatever Form you can access
    if (invokingForm.InvokeRequired)
    {
        invokingForm.BeginInvoke(new EventHandler<S22.Xmpp.Im.MessageEventArgs>(OnNewMessage), sender, e);
        return; // important!!!
    }

    // the rest of your code goes here, now running
    // on the same ui thread as invokingForm
    if(CheckIfFormIsOpen(e.Jid.ToString(), e.Message.ToString()) == true)
    {
    }
    else
    {
        newMessageFrm tempMsg = new newMessageFrm(e.Jid.ToString());
        tempMsg._msgText = e.Jid.ToString() + ": " + e.Message.ToString();
        tempMsg.frmId = e.Jid.ToString();
        tempMsg.Show();
    }
}

Note that I assumend that S22.Xmpp.Im.MessageEventArgs is inherited from System.EventArgs.

A: In WinForms there is still a requirement that the UI objects need to be on a thread with a message pump.  This is usually the main application thread, also called the UI thread.
In Winforms checking to see if you are on the right thread to access a UI object is done with Control.InvokeRequired.  If this returns true, it means you are not on the proper thread, and need to use an Invoke operation.
Since you know you are one a different thread, you don't need to check, you can just Invoke.
public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
    }

    private void button1_Click(object sender, EventArgs e)
    {
        ThreadPool.QueueUserWorkItem(BadBackgroundLaunch);
        ThreadPool.QueueUserWorkItem(GoodBackgroundLaunch);
    }

    private void GoodBackgroundLaunch(object state)
    {
        this.Invoke((Action) (() =>
        {
            var form2 = new SecondForm();
            form2.Text = "Good One";
            form2.Show();
        }));
    }

    private void BadBackgroundLaunch(object state)
    {
        var form2 = new SecondForm();
        form2.Text = "Bad one";
        form2.Show();
    }
}


text:
Q: javascript code work in firefox and chrome but not in safari and IE explorer i have below javascript code that evaluate time span between two dates as below:
jQuery(document).ready(

function () {

    setInterval(function () {
        var date1 = new Date();
        var date2 = new Date("30/Feb/2017 07:07:07");

        var diff = Math.abs(date2.getTime() - date1.getTime());

        var days = Math.floor(diff / (1000 * 60 * 60 * 24));
        diff -= days * (1000 * 60 * 60 * 24);
        if (days < 10)
            days = "0" + days;
        var hours = Math.floor(diff / (1000 * 60 * 60));
        diff -= hours * (1000 * 60 * 60);
        if (hours < 10)
            hours = "0" + hours;
        var mins = Math.floor(diff / (1000 * 60));

        diff -= mins * (1000 * 60);
        if (mins < 10)
            mins = "0" + mins;
        var seconds = Math.floor(diff / (1000));
        if (seconds < 10)
            seconds = "0" + seconds;
        diff -= seconds * (1000);
        var time = days + " روز, " + hours + " ساعت, " + mins + " دقیقه, " + seconds + " ثانیه";
        document.getElementById("remaingTimeDays").textContent = days;
        document.getElementById("remaingTimeHours").textContent = hours;
        document.getElementById("remaingTimeMinutes").textContent = mins;
        document.getElementById("remaingTimeSeconds").textContent = seconds;
    }, 1000);
});

this code works fine in Firefox and Chrome but is not working in Safari, IE and Edge.
I almost read all questions about the topic but I did not find any appropriate solution.

A: the problem is that I write the due date in incorrect format.
the correct format is as below:
var date2 = new Date("02/30/2017 07:07:07");

02: is month
30: is day
2017: year and so on. thanks to all my friend to help correct this problem. thank you all guys very much


text:
Q: Using ActiveRecord callbacks Using Rails 6 and Ruby 2.7
I run calculations using callbacks, which works on create; however, this does not work on update. Unless marked complete, my calculation gets stuck in a loop. So, in order to edit/update I'm attempting to use the before_update to mark complete as false, and then run the same calculation as create and then marking it back to true. I can get it to break the loop and update the attributes, however, it does not run the calculations like it does upon create.
I've been trying so many variations to get this to work and feel absolutely lost. I've tried various callbacks and have gone through documentation and have been searching for an answer. If anyone can give me a clue, hint, or any insight, please. I am not receiving any errors of any kind.
For the .previous method, I am using the By_star gem and for the .second_to_last method, I am using the groupdate gem.
Thank you for your time.
  belongs_to :user
  belongs_to :store
  after_create :create_calculations
  before_update :before_update_calculations
  after_update :update_calculations

def create_calculations
    store = Store.find(self.store_id)
    sheet = Sheet.find(self.id)
    past_sheet = store.sheets.second_to_last

  unless store.sheets.last
     s = past_sheet.draw - sheet.returned
  else
   s = sheet.sold
  end

  unless past_sheet
   s = store.sheets.last.draw - sheet.returned
  else
   s = past_sheet.draw - sheet.returned
  end

   if sheet.complete != true && sheet.store.vending_box == true
     sheet.update(complete: true)
       sheet.update(sold: s)

     short = (sheet.sold * 0.75) - sheet.collected
     sheet.update(:shortage => short)

     pilferage = (sheet.shortage / 0.75)
     sheet.update(:pilferage => pilferage)
   elsif sheet.complete != true && sheet.store.vending_box == false
     sheet.update(complete: true)
     sheet.update(sold: s)

     short = (sheet.sold * 0.55) - sheet.collected
     sheet.update(:shortage => short)

     pilferage = (sheet.shortage / 0.55)
     sheet.update(:pilferage => pilferage)
   else

   end
 end

 def before_update_calculations
  unless Sheet.find(self.id).complete == true
   Sheet.find(self.id).update(complete: false)
  end
 end

def update_calculations
  store = Store.find(self.store_id)
  sheet = Sheet.find(self.id)
  past_sheet = store.sheets.find(self.id).previous

# will add back conditionals to deal with the .previous method, for when
# it's the first record and as no previous item, such as in the create.

   s = past_sheet.draw - sheet.returned

   if sheet.complete != true && sheet.store.vending_box == true
     sheet.update(complete: true)
     sheet.update(:sold => s)

     short = (sheet.sold * 0.75) - sheet.collected
     sheet.update(:shortage => short)

     pilferage = (sheet.shortage / 0.75)
     sheet.update(:pilferage => pilferage)

   elsif sheet.complete != true && sheet.store.vending_box == false
     sheet.update(complete: true)
     sheet.update(:sold => s)

     short = (sheet.sold * 0.55) - sheet.collected
     sheet.update(:shortage => short)

     pilferage = (sheet.shortage / 0.55)
     sheet.update(:pilferage => pilferage)
   else

   end
end

end```

A: You call update in your after_update which starts a new cycle of update callbacks.
I'd rather use methods which I call explicitly over callbacks but if you want to stick to callbacks, try assigning values in a before_update callback the data will be updated once.

A: A good way to avoid infinite update loops on callbacks, is to use a variable that is only used to that purpose. This variable should work as a flag. When up, run the callback. Otherwise, just skip it.
Thus, you could do, for your example, do the following:
attr_accessor :this_is_the_flag

after_update update_calculations, :if => "this_is_the_flag.nil?"

def update_calculations
    [...]
    self.this_is_the_flag = true # invalidate the callback
end

This is the general idea, you can adjust this to your need. Also, please, make sure the syntax is correct, because callback syntax tends to change regularly.


text:
Q: HTMLUNIT Add Row in HtmlTable based on table id Actually , to avoid the jquery stuff, im planning to add the row directly in the table list.
Can you please help me in getting the row added dynamically by setting the values as string in the  htmltable or some other way  (HTMLUNIT).
--------------

------------------------

package com.test;

import java.io.IOException;
import java.net.MalformedURLException;

import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.DomCharacterData;
import com.gargoylesoftware.htmlunit.html.DomNode;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlTable;
import com.gargoylesoftware.htmlunit.html.HtmlTableCell;
import com.gargoylesoftware.htmlunit.html.HtmlTableRow;

public class TestMain {

  public static void main(String args[])
        throws FailingHttpStatusCodeException, MalformedURLException, IOException {
    final String htmlContent = "<title>foo</title>

cell1

cell2

cell3

cell4

cell5

cell6

";
    WebClient webClient = new WebClient();
    final HtmlPage page = loadPage(htmlContent);
    final HtmlTable table = page.getHtmlElementById("list4");
    // want to add to the new row here
    for (final HtmlTableRow row : table.getRows()) {
      System.out.println("Found row");
      for (final HtmlTableCell cell : row.getCells()) {
        System.out.println("   Found cell: " + cell.asText());
      }
    }
  }
}

A: This code basically create a new row and cell. Then populates the cell with some text, then appends the elements to their parents.
HtmlTableRow newRow = page.createElement("tr");
HtmlTableCell newCell = page.createElement("td");
Text cellContent = page.createTextNode("Hello World");
newCell.appendChild(cellContent);
newRow.appendChild(newCell);
table.appendChild(newRow);
// you can also have `table.insertBefore(newRow, exisitingRow);`

A: I did, little modification. It worked for me.
    final HtmlTable table = page.getHtmlElementById("highlight");

    HtmlTableRow newRow = (HtmlTableRow) page.createElement("tr");
    HtmlTableCell newCell = (HtmlTableCell) page.createElement("td");
    DomText cellContent =  (DomText) page.createTextNode("Welcome Sireesh");

    newCell.appendChild((org.w3c.dom.Node) cellContent);
    newRow.appendChild(newCell);
    table.appendChild(newRow);


text:
Q: Ubuntu 14.04: Radeon driver: no more acceleration after HWS stack update to Wily after updating the Ubuntu HWS stack to Wily (kernel 4.2 and Xorg), system boots up fine, but screen is lagging; although DRI3 is now enabled, 2D acceleration seems to be gone.
FTR, I'm using Oibaf's PPA.
System is an older Pentium laptop (Packard Bell EasyNote) with a Radeon Xpress 200M chip. Video acceleration was just fine under the Vivid stack (kernel 3.19-64 + Xorg).
Have you experienced the same issue?
What would your suggestions be?
What Information am I lacking in the description of the problem, as to update this thread to find the cause?
Edit 1 (7/1/2016): Xorg.0.log added
Edit 2 (7/4/2016): added "vblank_mode=0" to /etc/drirc, Option "SwapbuffersWait" "false" on /etc/X11/Xorg.conf as well as Option "DRI" "3". While performance is overall worse than the Vivid Xorg stack, DRI3 is the insult added to injury.
[    39.964]
X.Org X Server 1.17.2
Release Date: 2015-06-16
[    39.964] X Protocol Version 11, Revision 0
[    39.964] Build Operating System: Linux 3.19.0-43-generic i686 Ubuntu
[    39.964] Current Operating System: Linux EasyNote 4.2.0-41-lowlatency #48~14.04.1-Ubuntu SMP PREEMPT Fri Jun 24 18:29:28 UTC 2016 i686
[    39.964] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-4.2.0-41-lowlatency root=UUID=1ab2e24a-a209-4061-8dae-a11a19a5059f ro quiet splash
[    39.964] Build Date: 15 January 2016  10:17:41PM
[    39.964] xorg-server 2:1.17.2-1ubuntu9.1~trusty1 (For technical support please see http://www.ubuntu.com/support)
[    39.964] Current version of pixman: 0.30.2
[    39.964]    Before reporting problems, check http://wiki.x.org
    to make sure that you have the latest version.
[    39.964] Markers: (--) probed, (**) from config file, (==) default setting,
    (++) from command line, (!!) notice, (II) informational,
    (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[    39.964] (==) Log file: "/var/log/Xorg.0.log", Time: Fri Jul  1 09:57:38 2016
[    39.964] (==) Using config file: "/etc/X11/xorg.conf"
[    39.964] (==) Using system config directory "/usr/share/X11/xorg.conf.d"
[    39.965] (==) ServerLayout "X.org Configured"
[    39.965] (**) |-->Screen "Screen0" (0)
[    39.965] (**) |   |-->Monitor "Monitor0"
[    39.965] (**) |   |-->Device "Card0"
[    39.965] (**) |-->Input Device "Mouse0"
[    39.965] (**) |-->Input Device "Keyboard0"
[    39.965] (**) Option "AIGLX" "on"
[    39.965] (==) Automatically adding devices
[    39.965] (==) Automatically enabling devices
[    39.965] (==) Automatically adding GPU devices
[    39.965] (WW) The directory "/usr/share/fonts/X11/cyrillic" does not exist.
[    39.965]    Entry deleted from font path.
[    39.965] (WW) The directory "/usr/share/fonts/X11/100dpi/" does not exist.
[    39.965]    Entry deleted from font path.
[    39.965] (WW) The directory "/usr/share/fonts/X11/75dpi/" does not exist.
[    39.966]    Entry deleted from font path.
[    39.966] (WW) The directory "/usr/share/fonts/X11/100dpi" does not exist.
[    39.966]    Entry deleted from font path.
[    39.966] (WW) The directory "/usr/share/fonts/X11/75dpi" does not exist.
[    39.966]    Entry deleted from font path.
[    39.966] (WW) The directory "/usr/share/fonts/X11/cyrillic" does not exist.
[    39.966]    Entry deleted from font path.
[    39.966] (WW) The directory "/usr/share/fonts/X11/100dpi/" does not exist.
[    39.966]    Entry deleted from font path.
[    39.966] (WW) The directory "/usr/share/fonts/X11/75dpi/" does not exist.
[    39.966]    Entry deleted from font path.
[    39.966] (WW) The directory "/usr/share/fonts/X11/100dpi" does not exist.
[    39.966]    Entry deleted from font path.
[    39.966] (WW) The directory "/usr/share/fonts/X11/75dpi" does not exist.
[    39.966]    Entry deleted from font path.
[    39.966] (**) FontPath set to:
    /usr/share/fonts/X11/misc,
    /usr/share/fonts/X11/Type1,
    built-ins,
    /usr/share/fonts/X11/misc,
    /usr/share/fonts/X11/Type1,
    built-ins
[    39.966] (**) ModulePath set to "/usr/lib/xorg/modules"
[    39.966] (**) Extension "Composite" is enabled
[    39.966] (**) Extension "RENDER" is enabled
[    39.966] (**) Extension "RANDR" is enabled
[    39.966] (**) Extension "DAMAGE" is enabled
[    39.966] (**) Extension "GLX" is enabled
[    39.966] (WW) Hotplugging is on, devices using drivers 'kbd', 'mouse' or 'vmmouse' will be disabled.
[    39.966] (WW) Disabling Mouse0
[    39.966] (WW) Disabling Keyboard0
[    39.966] (II) Loader magic: 0x80249660
[    39.966] (II) Module ABI versions:
[    39.966]    X.Org ANSI C Emulation: 0.4
[    39.966]    X.Org Video Driver: 19.0
[    39.966]    X.Org XInput driver : 21.0
[    39.966]    X.Org Server Extension : 9.0
[    39.966] (II) xfree86: Adding drm device (/dev/dri/card0)
[    39.968] (--) PCI:*(0:1:5:0) 1002:5a62:1631:c023 rev 0, Mem @ 0xb8000000/67108864, 0xfa8f0000/65536, I/O @ 0x00008800/256, BIOS @ 0x????????/131072
[    39.968] (II) "glx" will be loaded. This was enabled by default and also specified in the config file.
[    39.969] (II) LoadModule: "ddc"
[    39.969] (II) Module "ddc" already built-in
[    39.969] (II) LoadModule: "extmod"
[    39.969] (II) Module "extmod" already built-in
[    39.969] (II) LoadModule: "glx"
[    39.969] (II) Loading /usr/lib/xorg/modules/extensions/libglx.so
[    40.133] (II) Module glx: vendor="X.Org Foundation"
[    40.133]    compiled for 1.17.2, module version = 1.0.0
[    40.133]    ABI class: X.Org Server Extension, version 9.0
[    40.133] (**) AIGLX enabled
[    40.133] (II) LoadModule: "dri"
[    40.133] (II) Module "dri" already built-in
[    40.133] (II) LoadModule: "dri3"
[    40.133] (II) Module "dri3" already built-in
[    40.133] (II) LoadModule: "dbe"
[    40.133] (II) Module "dbe" already built-in
[    40.133] (II) LoadModule: "radeon"
[    40.133] (II) Loading /usr/lib/xorg/modules/drivers/radeon_drv.so
[    40.191] (II) Module radeon: vendor="X.Org Foundation"
[    40.191]    compiled for 1.17.2, module version = 7.5.99
[    40.191]    Module class: X.Org Video Driver
[    40.191]    ABI class: X.Org Video Driver, version 19.0
[    40.191] (II) RADEON: Driver for ATI Radeon chipsets:
    (extense chipset list),
    ATI Radeon XPRESS 200M 5975 (PCIE),
    ATI Radeon XPRESS 200 5A41 (PCIE),
    ATI Radeon XPRESS 200M 5A42 (PCIE),
    ATI Radeon XPRESS 200 5A61 (PCIE),
    ATI Radeon XPRESS 200M 5A62 (PCIE),

[    40.200] (++) using VT number 7

[    40.200] (II) [KMS] Kernel modesetting enabled.
[    40.200] (==) RADEON(0): Depth 24, (--) framebuffer bpp 32
[    40.200] (II) RADEON(0): Pixel depth = 24 bits stored in 4 bytes (32 bpp pixmaps)
[    40.200] (==) RADEON(0): Default visual is TrueColor
[    40.200] (**) RADEON(0): Option "Accel" "on"
[    40.200] (**) RADEON(0): Option "EnablePageFlip" "on"
[    40.200] (**) RADEON(0): Option "ColorTiling" "on"
[    40.200] (**) RADEON(0): Option "ColorTiling2D" "on"
[    40.200] (**) RADEON(0): Option "RenderAccel" "on"
[    40.200] (**) RADEON(0): Option "AccelMethod" "EXA"
[    40.200] (**) RADEON(0): Option "EXAVSync" "no"
[    40.200] (**) RADEON(0): Option "SwapbuffersWait" "on"
[    40.200] (**) RADEON(0): Option "DRI" "3"
[    40.200] (**) RADEON(0): Option "TearFree" "on"
[    40.200] (==) RADEON(0): RGB weight 888
[    40.200] (II) RADEON(0): Using 8 bits per RGB (8 bit DAC)
[    40.200] (--) RADEON(0): Chipset: "ATI Radeon XPRESS 200M 5A62 (PCIE)" (ChipID = 0x5a62)
[    40.200] (II) Loading sub module "dri2"
[    40.200] (II) LoadModule: "dri2"
[    40.201] (II) Module "dri2" already built-in
[    40.201] (II) Loading sub module "exa"
[    40.201] (II) LoadModule: "exa"
[    40.201] (II) Loading /usr/lib/xorg/modules/libexa.so
[    40.201] (II) Module exa: vendor="X.Org Foundation"
[    40.201]    compiled for 1.17.2, module version = 2.6.0
[    40.201]    ABI class: X.Org Video Driver, version 19.0
[    40.201] (II) RADEON(0): KMS Color Tiling: enabled
[    40.201] (II) RADEON(0): KMS Color Tiling 2D: disabled
[    40.201] (**) RADEON(0): TearFree enabled
[    40.201] (WW) RADEON(0): KMS Pageflipping: disabled because of ShadowPrimary/TearFree
[    40.201] (II) RADEON(0): SwapBuffers wait for vsync: enabled
[    40.212] (II) RADEON(0): Output VGA-0 using monitor section Monitor0
[    40.212] (II) RADEON(0): Output LVDS has no monitor section
[    40.224] (II) RADEON(0): EDID for output VGA-0
[    40.224] (II) RADEON(0): EDID for output LVDS
[    40.224] (II) RADEON(0): Manufacturer: LPL  Model: e300  Serial#: 0
[    40.224] (II) RADEON(0): Year: 2006  Week: 0
[    40.224] (II) RADEON(0): EDID Version: 1.3
[    40.224] (II) RADEON(0): Digital Display Input
[    40.224] (II) RADEON(0): Max Image Size [cm]: horiz.: 33  vert.: 21
[    40.224] (II) RADEON(0): Gamma: 2.20
[    40.224] (II) RADEON(0): No DPMS capabilities specified
[    40.224] (II) RADEON(0): Supported color encodings: RGB 4:4:4 YCrCb 4:4:4
[    40.224] (II) RADEON(0): First detailed timing is preferred mode
[    40.224] (II) RADEON(0): redX: 0.600 redY: 0.351   greenX: 0.324 greenY: 0.554
[    40.224] (II) RADEON(0): blueX: 0.153 blueY: 0.145   whiteX: 0.312 whiteY: 0.328
[    40.224] (II) RADEON(0): Manufacturer's mask: 0
[    40.224] (II) RADEON(0): Supported detailed timing:
[    40.224] (II) RADEON(0): clock: 71.0 MHz   Image Size:  331 x 207 mm
[    40.224] (II) RADEON(0): h_active: 1280  h_sync: 1328  h_sync_end 1360 h_blank_end 1440 h_border: 0
[    40.224] (II) RADEON(0): v_active: 800  v_sync: 803  v_sync_end 809 v_blanking: 823 v_border: 0
[    40.224] (II) RADEON(0):  LGPhilipsLCD
[    40.224] (II) RADEON(0):  LP154WX4-TLC3
[    40.224] (II) RADEON(0): EDID (in hex):
[    40.224] (II) RADEON(0):    00ffffffffffff00320c00e300000000
[    40.224] (II) RADEON(0):    00100103802115780ab3409959538d27
[    40.224] (II) RADEON(0):    25505400000001010101010101010101
[    40.224] (II) RADEON(0):    010101010101bc1b00a0502017303020
[    40.224] (II) RADEON(0):    36004bcf100000190000000000000000
[    40.224] (II) RADEON(0):    00000000000000000000000000fe004c
[    40.224] (II) RADEON(0):    475068696c6970734c43440a000000fe
[    40.224] (II) RADEON(0):    004c503135345758342d544c4333003c
[    40.224] (II) RADEON(0): Printing probed modes for output LVDS
[    40.224] (II) RADEON(0): Modeline "1280x800"x59.9   71.00  1280 1328 1360 1440  800 803 809 823 -hsync -vsync (49.3 kHz eP)
[    40.224] (II) RADEON(0): Modeline "1280x720"x59.9   74.50  1280 1344 1472 1664  720 723 728 748 -hsync +vsync (44.8 kHz)
[    40.224] (II) RADEON(0): Modeline "1152x768"x59.8   71.75  1152 1216 1328 1504  768 771 781 798 -hsync +vsync (47.7 kHz)
[    40.224] (II) RADEON(0): Modeline "1024x768"x59.9   63.50  1024 1072 1176 1328  768 771 775 798 -hsync +vsync (47.8 kHz)
[    40.224] (II) RADEON(0): Modeline "800x600"x59.9   38.25  800 832 912 1024  600 603 607 624 -hsync +vsync (37.4 kHz)
[    40.224] (II) RADEON(0): Modeline "848x480"x59.7   31.50  848 872 952 1056  480 483 493 500 -hsync +vsync (29.8 kHz)
[    40.224] (II) RADEON(0): Modeline "720x480"x59.7   26.75  720 744 808 896  480 483 493 500 -hsync +vsync (29.9 kHz)
[    40.224] (II) RADEON(0): Modeline "640x480"x59.4   23.75  640 664 720 800  480 483 487 500 -hsync +vsync (29.7 kHz)
[    40.224] (II) RADEON(0): Output VGA-0 disconnected
[    40.224] (II) RADEON(0): Output LVDS connected
[    40.224] (II) RADEON(0): Using exact sizes for initial modes
[    40.224] (II) RADEON(0): Output LVDS using initial mode 1280x800
[    40.224] (II) RADEON(0): Using default gamma of (1.0, 1.0, 1.0) unless otherwise stated.
[    40.224] (II) RADEON(0): mem size init: gart size :1fdff000 vram size: s:10000000 visible:f7f0000
[    40.224] (II) RADEON(0): EXA: Driver will allow EXA pixmaps in VRAM
[    40.224] (==) RADEON(0): DPI set to (96, 96)
[    40.224] (II) Loading sub module "fb"
[    40.224] (II) LoadModule: "fb"
[    40.224] (II) Loading /usr/lib/xorg/modules/libfb.so
[    40.225] (II) Module fb: vendor="X.Org Foundation"
[    40.225]    compiled for 1.17.2, module version = 1.0.0
[    40.225]    ABI class: X.Org ANSI C Emulation, version 0.4
[    40.225] (II) Loading sub module "ramdac"
[    40.225] (II) LoadModule: "ramdac"
[    40.225] (II) Module "ramdac" already built-in
[    40.225] (--) Depth 24 pixmap format is 32 bpp
[    40.225] (II) RADEON(0): [DRI2] Setup complete
[    40.225] (II) RADEON(0): [DRI2]   DRI driver: r300
[    40.225] (II) RADEON(0): [DRI2]   VDPAU driver: r300
[    40.225] (II) RADEON(0): Front buffer size: 4000K
[    40.225] (II) RADEON(0): VRAM usage limit set to 224870K
[    40.225] (II) RADEON(0): SYNC extension fences enabled
[    40.225] (II) RADEON(0): Present extension enabled
[    40.225] (**) RADEON(0): DRI3 enabled
[    40.225] (==) RADEON(0): Backing store enabled
[    40.225] (II) RADEON(0): Direct rendering enabled
[    40.225] (II) RADEON(0): Render acceleration enabled for R300/R400/R500 type cards.
[    40.225] (II) EXA(0): Driver allocated offscreen pixmaps
[    40.225] (II) EXA(0): Driver registered support for the following operations:
[    40.226] (II)         Solid
[    40.226] (II)         Copy
[    40.226] (II)         Composite (RENDER acceleration)
[    40.226] (II)         UploadToScreen
[    40.226] (II)         DownloadFromScreen
[    40.226] (II) RADEON(0): Acceleration enabled
[    40.226] (==) RADEON(0): DPMS enabled
[    40.226] (==) RADEON(0): Silken mouse enabled
[    40.226] (II) RADEON(0): Set up textured video
[    40.226] (II) RADEON(0): [XvMC] Associated with Radeon Textured Video.
[    40.226] (II) RADEON(0): [XvMC] Extension initialized.
[    40.226] (II) RADEON(0): RandR 1.2 enabled, ignore the following RandR disabled message.
[    40.226] (WW) RADEON(0): Option "TripleBuffer" is not used
[    40.226] (--) RandR disabled
[    40.403] (II) AIGLX: enabled GLX_MESA_copy_sub_buffer
[    40.403] (II) AIGLX: enabled GLX_ARB_create_context
[    40.404] (II) AIGLX: enabled GLX_ARB_create_context_profile
[    40.404] (II) AIGLX: enabled GLX_EXT_create_context_es2_profile
[    40.404] (II) AIGLX: enabled GLX_INTEL_swap_event
[    40.404] (II) AIGLX: enabled GLX_SGI_swap_control and GLX_MESA_swap_control
[    40.404] (II) AIGLX: enabled GLX_EXT_framebuffer_sRGB
[    40.404] (II) AIGLX: enabled GLX_ARB_fbconfig_float
[    40.404] (II) AIGLX: GLX_EXT_texture_from_pixmap backed by buffer objects
[    40.405] (II) AIGLX: Loaded and initialized r300
[    40.405] (II) GLX: Initialized DRI2 GL provider for screen 0
[    40.406] (II) RADEON(0): Setting screen physical size to 338 x 211
[    40.429] (II) XKB: reuse xkmfile /var/lib/xkb/server-B20D7FC79C7F597315E3E501AEF10E0D866E8E92.xkm
[    40.436] (II) config/udev: Adding input device Power Button (/dev/input/event3)
[    40.436] (**) Power Button: Applying InputClass "evdev keyboard catchall"
[    40.436] (II) LoadModule: "evdev"
[    40.436] (II) Loading /usr/lib/xorg/modules/input/evdev_drv.so
[    40.456] (II) Module evdev: vendor="X.Org Foundation"
[    40.456]    compiled for 1.17.2, module version = 2.9.2
[    40.456]    Module class: X.Org XInput Driver
[    40.456]    ABI class: X.Org XInput driver, version 21.0
[    40.456] (II) Using input driver 'evdev' for 'Power Button'
[    40.456] (**) Power Button: always reports core events
[    40.456] (**) evdev: Power Button: Device: "/dev/input/event3"
[    40.456] (--) evdev: Power Button: Vendor 0 Product 0x1
[    40.456] (--) evdev: Power Button: Found keys
[    40.456] (II) evdev: Power Button: Configuring as keyboard
[    40.456] (**) Option "config_info" "udev:/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/event3"
[    40.456] (II) XINPUT: Adding extended input device "Power Button" (type: KEYBOARD, id 6)
[    40.456] (**) Option "xkb_rules" "evdev"
[    40.456] (**) Option "xkb_model" "pc104"
[    40.456] (**) Option "xkb_layout" "us"
[    40.462] (II) XKB: reuse xkmfile /var/lib/xkb/server-D378AD8F86E560F712A83EE36E4E5E92C595B9BD.xkm
[    40.463] (II) config/udev: Adding input device Video Bus (/dev/input/event5)
[    40.463] (**) Video Bus: Applying InputClass "evdev keyboard catchall"
[    40.463] (II) Using input driver 'evdev' for 'Video Bus'
[    40.464] (**) Video Bus: always reports core events
[    40.464] (**) evdev: Video Bus: Device: "/dev/input/event5"
[    40.464] (--) evdev: Video Bus: Vendor 0 Product 0x6
[    40.464] (--) evdev: Video Bus: Found keys
[    40.464] (II) evdev: Video Bus: Configuring as keyboard
[    40.464] (**) Option "config_info" "udev:/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A03:00/device:00/LNXVIDEO:00/input/input9/event5"
[    40.464] (II) XINPUT: Adding extended input device "Video Bus" (type: KEYBOARD, id 7)
[    40.464] (**) Option "xkb_rules" "evdev"
[    40.464] (**) Option "xkb_model" "pc104"
[    40.464] (**) Option "xkb_layout" "us"
[    40.465] (II) config/udev: Adding input device Power Button (/dev/input/event1)
[    40.465] (**) Power Button: Applying InputClass "evdev keyboard catchall"
[    40.465] (II) Using input driver 'evdev' for 'Power Button'
[    40.465] (**) Power Button: always reports core events
[    40.465] (**) evdev: Power Button: Device: "/dev/input/event1"
[    40.465] (--) evdev: Power Button: Vendor 0 Product 0x1
[    40.465] (--) evdev: Power Button: Found keys
[    40.465] (II) evdev: Power Button: Configuring as keyboard
[    40.465] (**) Option "config_info" "udev:/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0C:00/input/input1/event1"
[    40.465] (II) XINPUT: Adding extended input device "Power Button" (type: KEYBOARD, id 8)
[    40.465] (**) Option "xkb_rules" "evdev"
[    40.465] (**) Option "xkb_model" "pc104"
[    40.465] (**) Option "xkb_layout" "us"
[    40.466] (II) config/udev: Adding input device Lid Switch (/dev/input/event0)
[    40.466] (II) No input driver specified, ignoring this device.
[    40.466] (II) This device may have been added with another device file.
[    40.466] (II) config/udev: Adding input device Sleep Button (/dev/input/event2)
[    40.466] (**) Sleep Button: Applying InputClass "evdev keyboard catchall"
[    40.466] (II) Using input driver 'evdev' for 'Sleep Button'
[    40.466] (**) Sleep Button: always reports core events
[    40.466] (**) evdev: Sleep Button: Device: "/dev/input/event2"
[    40.466] (--) evdev: Sleep Button: Vendor 0 Product 0x3
[    40.466] (--) evdev: Sleep Button: Found keys
[    40.466] (II) evdev: Sleep Button: Configuring as keyboard
[    40.466] (**) Option "config_info" "udev:/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0E:00/input/input2/event2"
[    40.466] (II) XINPUT: Adding extended input device "Sleep Button" (type: KEYBOARD, id 9)
[    40.466] (**) Option "xkb_rules" "evdev"
[    40.466] (**) Option "xkb_model" "pc104"
[    40.467] (**) Option "xkb_layout" "us"
[    40.468] (II) config/udev: Adding input device HDA ATI SB Mic (/dev/input/event8)
[    40.468] (II) No input driver specified, ignoring this device.
[    40.468] (II) This device may have been added with another device file.
[    40.468] (II) config/udev: Adding input device HDA ATI SB Headphone (/dev/input/event9)
[    40.468] (II) No input driver specified, ignoring this device.
[    40.468] (II) This device may have been added with another device file.
[    40.469] (II) config/udev: Adding input device Asus Laptop extra buttons (/dev/input/event7)
[    40.469] (**) Asus Laptop extra buttons: Applying InputClass "evdev keyboard catchall"
[    40.469] (II) Using input driver 'evdev' for 'Asus Laptop extra buttons'
[    40.469] (**) Asus Laptop extra buttons: always reports core events
[    40.469] (**) evdev: Asus Laptop extra buttons: Device: "/dev/input/event7"
[    40.469] (--) evdev: Asus Laptop extra buttons: Vendor 0 Product 0
[    40.469] (--) evdev: Asus Laptop extra buttons: Found keys
[    40.469] (II) evdev: Asus Laptop extra buttons: Configuring as keyboard
[    40.469] (**) Option "config_info" "udev:/sys/devices/platform/asus_laptop/input/input14/event7"
[    40.469] (II) XINPUT: Adding extended input device "Asus Laptop extra buttons" (type: KEYBOARD, id 10)
[    40.469] (**) Option "xkb_rules" "evdev"
[    40.469] (**) Option "xkb_model" "pc104"
[    40.469] (**) Option "xkb_layout" "us"
[    40.470] (II) config/udev: Adding input device AT Translated Set 2 keyboard (/dev/input/event4)
[    40.470] (**) AT Translated Set 2 keyboard: Applying InputClass "evdev keyboard catchall"
[    40.470] (II) Using input driver 'evdev' for 'AT Translated Set 2 keyboard'
[    40.470] (**) AT Translated Set 2 keyboard: always reports core events
[    40.470] (**) evdev: AT Translated Set 2 keyboard: Device: "/dev/input/event4"
[    40.470] (--) evdev: AT Translated Set 2 keyboard: Vendor 0x1 Product 0x1
[    40.470] (--) evdev: AT Translated Set 2 keyboard: Found keys
[    40.470] (II) evdev: AT Translated Set 2 keyboard: Configuring as keyboard
[    40.470] (**) Option "config_info" "udev:/sys/devices/platform/i8042/serio0/input/input4/event4"
[    40.470] (II) XINPUT: Adding extended input device "AT Translated Set 2 keyboard" (type: KEYBOARD, id 11)
[    40.470] (**) Option "xkb_rules" "evdev"
[    40.470] (**) Option "xkb_model" "pc104"
[    40.470] (**) Option "xkb_layout" "us"
[    40.471] (II) config/udev: Adding input device SynPS/2 Synaptics TouchPad (/dev/input/event6)
[    40.471] (**) SynPS/2 Synaptics TouchPad: Applying InputClass "evdev touchpad catchall"
[    40.471] (**) SynPS/2 Synaptics TouchPad: Applying InputClass "touchpad catchall"
[    40.471] (**) SynPS/2 Synaptics TouchPad: Applying InputClass "Default clickpad buttons"
[    40.471] (II) LoadModule: "synaptics"
[    40.471] (II) Loading /usr/lib/xorg/modules/input/synaptics_drv.so
[    40.472] (II) Module synaptics: vendor="X.Org Foundation"
[    40.472]    compiled for 1.17.2, module version = 1.8.2
[    40.472]    Module class: X.Org XInput Driver
[    40.472]    ABI class: X.Org XInput driver, version 21.0
[    40.472] (II) Using input driver 'synaptics' for 'SynPS/2 Synaptics TouchPad'
[    40.472] (**) SynPS/2 Synaptics TouchPad: always reports core events
[    40.472] (**) Option "Device" "/dev/input/event6"
[    40.505] (--) synaptics: SynPS/2 Synaptics TouchPad: x-axis range 1472 - 5472 (res 51)
[    40.505] (--) synaptics: SynPS/2 Synaptics TouchPad: y-axis range 1408 - 4448 (res 67)
[    40.505] (--) synaptics: SynPS/2 Synaptics TouchPad: pressure range 0 - 255
[    40.505] (--) synaptics: SynPS/2 Synaptics TouchPad: finger width range 0 - 15
[    40.505] (--) synaptics: SynPS/2 Synaptics TouchPad: buttons: left right double triple
[    40.505] (--) synaptics: SynPS/2 Synaptics TouchPad: Vendor 0x2 Product 0x7
[    40.505] (--) synaptics: SynPS/2 Synaptics TouchPad: touchpad found
[    40.505] (**) SynPS/2 Synaptics TouchPad: always reports core events
[    40.517] (**) Option "config_info" "udev:/sys/devices/platform/i8042/serio4/input/input13/event6"
[    40.517] (II) XINPUT: Adding extended input device "SynPS/2 Synaptics TouchPad" (type: TOUCHPAD, id 12)
[    40.517] (**) synaptics: SynPS/2 Synaptics TouchPad: (accel) MinSpeed is now constant deceleration 2.5
[    40.517] (**) synaptics: SynPS/2 Synaptics TouchPad: (accel) MaxSpeed is now 1.75
[    40.517] (**) synaptics: SynPS/2 Synaptics TouchPad: (accel) AccelFactor is now 0.040
[    40.517] (**) SynPS/2 Synaptics TouchPad: (accel) keeping acceleration scheme 1
[    40.517] (**) SynPS/2 Synaptics TouchPad: (accel) acceleration profile 1
[    40.517] (**) SynPS/2 Synaptics TouchPad: (accel) acceleration factor: 2.000
[    40.517] (**) SynPS/2 Synaptics TouchPad: (accel) acceleration threshold: 4
[    40.517] (--) synaptics: SynPS/2 Synaptics TouchPad: touchpad found
[    40.518] (II) config/udev: Adding input device SynPS/2 Synaptics TouchPad (/dev/input/mouse0)
[    40.518] (**) SynPS/2 Synaptics TouchPad: Ignoring device from InputClass "touchpad ignore duplicates"
[    41.888] (II) RADEON(0): EDID vendor "LPL", prod id 58112
[    41.888] (II) RADEON(0): Printing DDC gathered Modelines:
[    41.888] (II) RADEON(0): Modeline "1280x800"x0.0   71.00  1280 1328 1360 1440  800 803 809 823 -hsync -vsync (49.3 kHz eP)
[    50.973] (II) XKB: reuse xkmfile /var/lib/xkb/server-2DF772DDF0351DDF63D83CB25709C288F022DABB.xkm
[    53.009] (II) RADEON(0): EDID vendor "LPL", prod id 58112
[    53.010] (II) RADEON(0): Printing DDC gathered Modelines:
[    53.010] (II) RADEON(0): Modeline "1280x800"x0.0   71.00  1280 1328 1360 1440  800 803 809 823 -hsync -vsync (49.3 kHz eP)
[    53.798] (II) XKB: reuse xkmfile /var/lib/xkb/server-312B475CE76C42EBE698DD8B5781B64A177B6A82.xkm
[    53.842] (II) XKB: reuse xkmfile /var/lib/xkb/server-312B475CE76C42EBE698DD8B5781B64A177B6A82.xkm
[    54.039] (II) RADEON(0): EDID vendor "LPL", prod id 58112
[    54.039] (II) RADEON(0): Printing DDC gathered Modelines:
[    54.039] (II) RADEON(0): Modeline "1280x800"x0.0   71.00  1280 1328 1360 1440  800 803 809 823 -hsync -vsync (49.3 kHz eP)
[    54.280] (II) RADEON(0): EDID vendor "LPL", prod id 58112
[    54.280] (II) RADEON(0): Printing DDC gathered Modelines:
[    54.280] (II) RADEON(0): Modeline "1280x800"x0.0   71.00  1280 1328 1360 1440  800 803 809 823 -hsync -vsync (49.3 kHz eP)
[    54.428] (II) XKB: reuse xkmfile /var/lib/xkb/server-C2249D979A593B77A5463F9ADAD61294012EE6DD.xkm


text:
Q: Google Maps Geocoding :: geocode function stop after 11 requests In the code below table locs includes some names from different regions in Greece. For each region I call graphicMap function to find latitude and longitude through Geocoding Service and create a marker on map.
But from index 12 and after it show error.
See the results below:
Error : ΧΑΝΙΩΝ
OK : ΑΝΔΡΑΒΙΔΑΣ - ΚΥΛΛΗΝΗΣ
OK : ΒΕΡΟΙΑΣ
OK : ΑΒΔΗΡΩΝ
OK : ΑΧΑΡΝΩΝ
OK : ΑΣΤΥΠΑΛΑΙΑΣ
OK : ΡΕΘΥΜΝΗΣ
OK : ΓΑΛΑΤΣΙΟΥ
OK : ΔΕΛΦΩΝ
OK : ΒΕΛΒΕΝΤΟΥ
OK : ΖΑΓΟΡΑΣ - ΜΟΥΡΕΣΙΟΥ
OK : ΒΕΛΟΥ ΒΟΧΑΣ
If I remove for example the record ΑΧΑΡΝΩΝ, the value of ΧΑΝΙΩΝ works properly.
Has google set limits on search through Geocoding Service?
Is this because I haven't bought an API KEY?
Thanks in advance!
geocodeLatLong( JXMapContent , map , mapSet , graphic , graph , pins ){
    /**
    **** @procedure
    **** Split and create table with the regions
    **** Iterate table and find coordinates for each region
    **/
    var locs = JXMapContent.split( "," ) , u , length_table = locs.length;
    for( u = 0; u < length_table; u++ )
    {
        graph( locs[ u ] , map , graphic , pins );
    }

}

graphicMap( _location , map , graphic , pins ){
    var geocoderRequest = {
        address: _location
    };
    graphic.geocode( geocoderRequest, function(results, status) {
        if (status === google.maps.GeocoderStatus.OK){

            var marker = new google.maps.Marker({
                map:map,
                position : results[0].geometry.location,
                icon:"images/marker.png",
                animation:google.maps.Animation.DROP
            });

            pins.push( marker );
            marker.addListener('click', function() {
                for (var i = 0; i < pins.length; i++) {
                    pins[i].setAnimation(null);
                }
                if( this.getAnimation() !== null) {
                    this.setAnimation(null);
                } else {
                    this.setAnimation(google.maps.Animation.BOUNCE);
                }
            });
            console.log( "OK : " + _location );
        }else{
            console.log( "Error : " + _location );
        }
    });
}

A: While there will be for sure limits in the API calls you can make against the geocoding service of google maps, probably you could take a look at the error code you are getting back in order to understand what is going on. More details for what you understand is "google giving you an error" would be great.
From their documentation, you can find the error codes here https://developers.google.com/maps/documentation/javascript/geocoding?hl=es#GeocodingStatusCodes
If you would be going over quota you would see "OVER_QUERY_LIMIT" for example...
If an error just means that that city has no results maybe it's just giving you back a "ZERO_RESULTS" and you are not parsing properly the rest and your JS fails


text:
Q: flex row exceeding page width, text-overflow: ellipsis not working my apps flex capabilities have changed since adding some code.
In my MovieContainer ideally I want the flex-direction to be row (it's currently set to column) and only the width of the page and then to start again on the next column ideally 6 across.
But when set to row it goes outside the scope of my page.
Also since adding this new code the text-overflow on my MovieName is now exceeding its width and overflow is no longer hidden.
I feel like I've effected these styled components somehow although when I change the font-size it works fine.
Styled Components:
const MovieContainer = styled.div`
  display: flex;
  flex-direction: column;
  padding: 10px;
  width: 280px;
  box-shadow: 0 3px 10px 0 #aaa;
  cursor: pointer;
`;
const CoverImage = styled.img`
  height: 362px;
`;
const MovieName = styled.span`
  font-size: 18px;
  font-weight: 600;
  color: black;
  margin: 15px 0;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
`;
const InfoColumn = styled.div`
  display: flex;
  flex-direction: row;
  justify-content: space-between;
`;
const MovieInfo = styled.span`
  font-size: 12px;
  font-weight: 500;
  color: black;
  text-transform: capitalize;
`;

Rest of the code:
const MovieComponent = () => {
  const [filmWorld, setFilmWorld] = useState([]);
  const [cinemaWorld, setCinemaWorld] = useState([]);

  useEffect(() => {
    const theaters = ["cinema", "film"];
    theaters.forEach((theater) => {
      async function fetchCinema() {
        const data = await api.getFilm(theater);
        if (data.Provider === "Film World") {
          console.log("FILM WORLD: ", data.Provider);
          console.log(`Data ${theater}World: `, data);
          setFilmWorld(data);
        } else {
          console.log("CINEMAWORLD: ", data.Provider);
          console.log(`Data ${theater}World: `, data);
          setCinemaWorld(data);
        }
      }
      fetchCinema();
    });
  }, []);

  const movies = useMemo(() => {
    if (!filmWorld.Provider) return [];
    return filmWorld.Movies.map((movie, index) => ({
      ...movie,
      cinemaWorldPrice:
        cinemaWorld.Provider && cinemaWorld.Movies[index]?.Price,
    }));
  }, [filmWorld, cinemaWorld]);

Since making changes to the below code the styling seems to go out of wack. This is where the styled components are called:
return (
        <MovieContainer>
          {movies.map((movie, index) => (
            <div className="movies" key={index}>
              <MovieName>{movie.Title}</MovieName>
              <CoverImage src={movie.Poster} alt={movie.Title} />
              <InfoColumn>
                <MovieInfo>Filmworld Price: ${movie.Price}</MovieInfo>
                <MovieInfo>Cinemaworld Price: ${movie.cinemaWorldPrice}</MovieInfo>
              </InfoColumn>
            </div>
          ))}
        </MovieContainer>
      );
    };

    export default MovieComponent;

A: If I understood you correctly this is what you trying to achieve:
If that is the case all you have to do is add this line:
const MovieContainer = styled.div`
  .
  .
  .
  flex-direction: row;
  flex-wrap: wrap;
`;


text:
Q: beamer.cls and preview.sty don't work together I have the following file, in which I use the preview package and the beamer class
\documentclass[]{beamer}
\usepackage{preview}
\PreviewEnvironment{align*}
\PreviewEnvironment*{frame}
\begin{document}
\begin{frame}
  Some text and
  \begin{align*}
    x &= y\\
    \beta &= \gamma
  \end{align*}
  a displayed equation.
\end{frame}
\end{document}

If I ask for generation of previews inside XEmacs all is well,

but when it comes to generating the PDF...
$ pdflatex beamer+previev.tex
This is pdfTeX, Version 3.14159265-2.6-1.40.15 ...
LaTeX2e <2014/05/01> ...
Document Class: beamer 2013/12/02 3.33 ...
(./beamer+previev.aux) ...
(/usr/local/share/texmf/tex/latex/preview/preview.sty) ...
...
! Undefined control sequence.
\@EveryShipout@Output ...EveryShipout@Org@Shipout
                                                  \box \@cclv
l.16 \end{frame}

Overfull \vbox (200.87663pt too high) has occurred while \output is active
! Undefined control sequence.
\@EveryShipout@Output ...EveryShipout@Org@Shipout
                                                  \box \@cclv
l.17 \end{document}

Overfull \vbox (200.87663pt too high) has occurred while \output is active
! Undefined control sequence.
\@EveryShipout@Output ...EveryShipout@Org@Shipout
                                                  \box \@cclv
l.17 \end{document}

! Undefined control sequence.
\@EveryShipout@Output ...EveryShipout@Org@Shipout
                                                  \box \@cclv
l.17 \end{document}

Overfull \vbox (200.87663pt too high) has occurred while \output is active

LaTeX Font Warning: Size substitutions with differences
(Font)              up to 1.0pt have occurred.

 )
(see the transcript file for additional information)
...
$

By the way, if I remove the lines
\usepackage{preview}
\PreviewEnvironment{align*}
\PreviewEnvironment*{frame}

I can compile the PDF without any problem, but when I ask for the generation of the inline preview in the XEmacs buffer I get only the warning
 LaTeX found no preview images

in the minibuffer and no image is inserted.
Is there any incantation that I can use to reconcile beamer and preview ways of life?
As a matter of fact, I've just installed preview.sty and all the stuff auctex related this morning, the version is auctex-11.88, while beamer is a bit oldish, but
I experienced the same misbehaviour with 11.87 while two (or three?) years ago everything was fine, so this can be a regression I don't know on which side of the barricade...

A: While I was trying to answer a comment by giordano I thought that I had made similar remarks in a thread that I started in the AUCTeX mailing list almost exactly one years ago, so I searched that old thread to cite some parts of it and, surprise! I noticed that the thread was revived in November, 7 months later, by Nicolas Richard that advanced an hypotesis on the reason of the problem and later diagnosed the exact patch to pgf that caused the problem, finding also another patch that fixed it...
Loyal to SX mantra that links are not good answer, I'll report here the link content (the correct patch is due to Esseger)

As in the previous bug (315), this is due to the wrong patch of preview. The hack in pfgutil-latex.def, to make preview compatible with everyshi, is:

% Preview hack: preview.sty hacks into \shipout (which is ok), but
% does not honour everyshi.sty (which is not ok). This causes
% everyshi material to get lost.
\AtBeginDocument{
\@ifpackageloaded{preview}{%
% Ok, package loaded. Swap definitions of everyshi.sty's shipout
% and preview.sty's shipout:
\let\pgf@temp\pr@shipout% This is the original shipout
\let\pr@shipout\@EveryShipout@Shipout%
\let\@EveryShipout@Org@Shipout\pgf@temp%
}{}%
}

There are two problems with this patch:
     - it does not work if preview is loaded but not active (see bug 315)
     - it does not set \shipout correctly. Indeed, preview has to cancel the shipout of usual pages, so it sets \shipout to a fancy version of "do nothing". But everyshi sets again \shipout to something non-trivial, so usual pages are again output, giving rise to too many pages. So, the patch should again empty \shipout.
     Here is a correct patch:

\AtBeginDocument{
\@ifpackageloaded{preview}{%
% Ok, package loaded. Swap definitions of everyshi.sty's shipout
% and preview.sty's shipout:
\ifPreview
\let\shipout\@EveryShipout@Org@Shipout%This is the null version of \shipout, created by preview and saved by everyshi
\let\@EveryShipout@Org@Shipout\pr@shipout% This is the original shipout
\let\pr@shipout\@EveryShipout@Shipout%
\fi
}{}%
}

What else? I applied the patch to pgfutil-latex.def and, at least for my example, everything is OK...


text:
Q: Does the fact photons having gravity field contradict gravitomagnetism? as I read here two photons that aren't parallels can attract each other because  photons have energy. But the problem is that photon are going in the speed of light which means it would take infinity amount of time  to the photon get attract to each other, or in other worlds the gravitomagnetism would be equal to the gravity field and it would cancel out. The idea of gravitomagnetism is that there is a upside "force"  to gravity when mass or in our case energy moves because of relativity. So how come the two photon attract each other relative to observer that doesn't in the speed of light?

A: after a lot of thing I found two way to look at this one is that if they parallel their relative mass relative mass of each photon relative to each other is not zero their reltaive mass is cos sinos the angle between them multiply by hf/c^2


text:
Q: Links in  dropdown options Is it possible for each dropdown options to link somewhere when selected without the need for an external button?
<select>
  <option value="x">x</option>
  <option value="y">y</option>
</select>

A: You can use the onChange property.  Something like:
<select onChange="window.location.href=this.value">
    <option value="www.google.com">A</option>
    <option value="www.aol.com">B</option>
</select>

A: ... or if you want / need to keep your option 'value' as it was, just add a new attribute:
<select id="my_selection">
<option value="x" href="/link/to/somewhere">value 1</option>
<option value="y" href="/link/to/somewhere/else">value 2</option>
</select>

<script>
document.getElementById('my_selection').onchange = function() {
    window.location.href = this.children[this.selectedIndex].getAttribute('href');
}
</script>

A: Maybe this will help:
<select onchange="location = this.value;">
 <option value="home.html">Home</option>
 <option value="contact.html">Contact</option>
 <option value="about.html">About</option>
</select>

A: Add an onchange event handler and set the pages location to the value
<select id="foo">
    <option value="">Pick a site</option>
    <option value="http://www.google.com">x</option>
    <option value="http://www.yahoo.com">y</option>
</select>

<script>
    document.getElementById("foo").onchange = function() {
        if (this.selectedIndex!==0) {
            window.location.href = this.value;
        }
    };
</script>

A: This is an old question, I know but for 2019 peeps:
Like above if you just want to change the URL you can do this:
<select onChange="window.location.href=this.value">
    <option value="www.google.com">A</option>
    <option value="www.aol.com">B</option>
</select>

But if you want it to act like an a tag and so you can do "./page", "#bottom" or "?a=567" use window.location.replace()
<select onChange="window.location.redirect(this.value)">
    <option value="..">back</option>
    <option value="./list">list</option>
    <option value="#bottom">bottom</option>
</select>

A: Extending on @kevin's answer,
if someone has to perform some confirmation logic if URL is critical.
<select onChange=" this.options[this.selectedIndex].text == 'Delete' ? "Confirmation logic" : window.location.href=this.value;" >
    <option selected disabled>Action</option>
    <option value="/user/view">View</option>
    <option value="/user/edit">Edit</option>
    <option value="/user/delete">Delete</option>
</select>

A: You can use this code:
<select id="menu" name="links" size="1" onchange="window.location.href=this.value;">
    <option value="URL">Book</option>
    <option value="URL">Pen</option>
    <option value="URL">Read</option>
    <option value="URL">Apple</option>
</select>


text:
Q: Kafka consumer behavior for non existent offset I am a newbie to Kafka and there are certain things which are not clear to me.

*

*Kafka broker goes down will the producer go down.

*Kafka broker goes down will the consumer go down.

*If we start at an offset which doesn't exist would it be struck infinitely.

A: *

*The producer will not go down, it will select another (live) broker to produce to. If there are no other live brokers, you will get an error in the producer's response (anyway it will not crash).

*The consumer will not go down, the consumer(s) will rebalance the remaining (live) partitions. If you have replication for the partitions on this broker, their leader will change.

*It won't stuck. The behavior in that case depends on what you set in the auto.offset.reset of the consumer config (https://kafka.apache.org/documentation/#newconsumerconfigs).
If you set it to earliest, it will reset the offset to the earliest available one in the partitions.
If you set it to latest, it will reset the offset to the latest available one in the partition.
If you set it to none, it will throw an exception to the consumer.

As for 1 & 2 - if you wish that the producer/consumer will stop in that case, you can implement it with some coding.


text:
Q: Why does php redirect me instead of showing the alerts? I have a registration form, after successful register, i want the user to be redirected to home.php (it works)
But also i want to show errors/alerts, which are im redirected to register.php (white page and it shows them there)
include 'main.php';

$errors = []; // collect errors in here

//echo the errors
// Now we check if the data was submitted, isset() function will check if the data exists.
if (!isset($_POST['username'], $_POST['password'], $_POST['cpassword'], $_POST['email'])) {
 // Could not get the data that should have been sent.
 exit('
Please complete the registration form!
');
}
// Make sure the submitted registration values are not empty.
if (empty($_POST['username']) || empty($_POST['password']) || empty($_POST['email'])) {
 // One or more values are empty.
 exit('
Please complete the registration form!
');
}
// Check to see if the email is valid.
if (!filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
 exit('
Email is not valid!
');
}
// Username must contain only characters and numbers.
if (!preg_match('/^[a-zA-Z0-9]+$/', $_POST['username'])) {
 exit('
Username is not valid!
');
}
// Password must be between 5 and 20 characters long.
if (strlen($_POST['password']) > 20 || strlen($_POST['password']) < 6) {
 exit('
Password must be between 6 and 20 characters long!
');
}
// Check if both the password and confirm password fields match
if ($_POST['cpassword'] != $_POST['password']) {
 exit('
Passwords do not match!
');
}

// Check if the account with that username already exists

$stmt = $pdo->prepare('SELECT id, password FROM accounts WHERE username = ? OR email = ?');
$stmt->execute([ $_POST['username'], $_POST['email'] ]);
$account = $stmt->fetch(PDO::FETCH_ASSOC);
// Store the result so we can check if the account exists in the database.
if ($account) {
 // Username already exists
 echo '
Username and/or email exists!
';
} else {
 // Username doesn't exist, insert new account
 $stmt = $pdo->prepare('INSERT INTO accounts (username, password, email, activation_code) VALUES (?, ?, ?, ?)');
// We do not want to expose passwords in our database, so hash the password and use password_verify when a user logs in.
 $password = password_hash($_POST['password'], PASSWORD_DEFAULT);
 $uniqid = account_activation ? uniqid() : 'activated';
 $stmt->execute([ $_POST['username'], $password, $_POST['email'], $uniqid ]);

// Login in the user
 session_regenerate_id();
 $_SESSION['loggedin'] = TRUE;
 $_SESSION['name'] = $_POST['username'];
 $_SESSION['id'] = $pdo->lastInsertId();
 $_SESSION['role'] = 'the default role';
 if (account_activation) {
     // Account activation required, send the user the activation email with the "send_activation_email" function from the "main.php" file
     send_activation_email($_POST['email'], $uniqid);
     echo 'Please check your email to activate your account!';
 } else {
     // use content negotiation to determine response type
     if ($_SERVER['HTTP_ACCEPT'] === "application/json") {
         if (count($errors)) {
             header("Content-type: application/problem+json");
             http_response_code(400);
             exit(json_encode([
                 "message" => "Invalid form data or something",
                 "errors" => $errors
             ]));
         }
         header("Content-type: application/json");
         exit(json_encode(["location" => "home.php"]));
     }

 }}

foreach ($errors as $error) : ?>

<?= $error ?>

<?php endforeach;?>
?>

and this is my ajax call


text:
Q: How do I find the hook names for the WooCommerce stylesheets I want the WooCommerce Stylesheet to be loaded after my custom stylesheet, so that WooCommerce does not override any of my custom CSS entries.  To achieve this, I have entered the following into my functions.php file:
function theme_name_script_enqueue() {
    wp_enqueue_style('bootstrapstyle', get_template_directory_uri() . '/css/bootstrap/css/bootstrap.min.css', array(), '', 'all');
    wp_enqueue_style( 'wpb-fa', get_template_directory_uri() . '/fonts/css/font-awesome.min.css', array() );
    wp_enqueue_script('custom_js', get_template_directory_uri() . '/js/invictus-custom-java.js', array(), '1.0', true);
    wp_enqueue_style('custom_css', get_template_directory_uri() . '/css/invictus-custom-style.css', array(), '1.0', 'all');
}
add_action( 'wp_enqueue_scripts', 'theme_name_script_enqueue' 2);

//WooCommerce Stylesheet(s)
remove_action( 'A', 'B' );
add_action( 'C', 'D', 1 );

As you can see, I have placed a higher priority for theme_name_script_enqueue, so that it loads after the WooCommerce stylesheets.  Regarding the second section of code, I want to remove the WooCommerce Stylesheets and then re-add them  with a lower priority as to ensure they load 1st.  Is anyone able to help me in identifying where I can find WooCommerce's hook names etc, so that I can enter the correct details within A, B, C and D?

A: I believe this may be what you're looking for. Hope it helps!
https://docs.woocommerce.com/wc-apidocs/hook-docs.html

A: You do not need to do that. Just enqueue your styles and make sure that the styles in your stylesheet are at the same or greater level of specificality then the woocommerce style sheet.
General Rules:

*

*More specific selectors will override more general ones

*Use !important where rule one does not work.

Reference from w3org:
https://www.w3.org/TR/2011/REC-CSS2-20110607/cascade.html#cascade


text:
Q: When I click edit on a post, all the content disappear. Does anyone know how to fix this? I am working on a site: greatlakesecho.org
When I try to edit a post, the content just disappears from the visual editor.  I am running the latest version of Word Press but this happened on the previous version as well.  I am using the Project Largo theme with the site.
The site was recently migrated from to a new host and has gone an overhaul into a responsive design.  This first started happening when I changed the character encoding to remove odd symbols from the posts.  I was successful in that by changing it to utf16.  At this point only older posts that were created before the migration would disappear when I clicked edit.  I have since updated to the latest version of Word Press and it happens to every post.
I have tried removing all the plugins but no luck.
Tried different themes with no luck.
Tried repairing the database from cPanel.
Here is the debugging info:
WordPress database error: [Table 'greatlak_wp776.wp_itsec_lockouts' doesn't exist]
SELECT lockout_host FROM wp_itsec_lockouts WHERE lockout_active=1 AND lockout_expire_gmt > '2014-04-22 19:52:36' AND lockout_host='35.9.132.246';
WordPress database error: [Table 'greatlak_wp776.wp_itsec_lockouts' doesn't exist]
SELECT lockout_user FROM wp_itsec_lockouts WHERE lockout_active=1 AND lockout_expire_gmt > '2014-04-22 19:52:36' AND lockout_user=93;

A: Something went wrong with your migration. A plugin-- I think it is this one-- does not have the table(s) it needs to operate. I assume that some tables were not transfered. Disable that plugin, then reactivate it and this should clear up. I assume that the plugin will create its tables on re-activation.
If you can't get to the backend to disable it, just delete it or rename the directory, then reinstall it.

A: I had to remove the Navis Media Credit plugin manually.  I searched through the plugins folder using WinSCP and apparently when I was removing all the plugins using the WordPress admin panel, this one wasn't actually getting removed.  This plugin was conflicting with the theme I am using and learned this by deleting all the plugins and using one of the default WP themes.


text:
Q: React-table: how to use getCellProps, getHeaderProps etc.? The documentation of React Table is really sparse and I can't make sense of the examples.
For example here: https://react-table.tanstack.com/docs/examples/data-driven-classes-and-styles, we see this code:
{row.cells.map(cell => {
                return (
                  <td
                    // Return an array of prop objects and react-table will merge them appropriately
                    {...cell.getCellProps([
                      {
                        className: cell.column.className,
                        style: cell.column.style,
                      },
                      getColumnProps(cell.column),
                      getCellProps(cell),
                    ])}
                  >
                    {cell.render('Cell')}
                  </td>

It's not clear to me what's happening.
GetCellProps is called, and provided an array as argument. This array contains 1. an object with two properties, and 2. a call to getColumnProps (what does this do?), and then 3. another call to getCellProps but now with the cell as an argument.
The result of this call is then operated on with the spread-operator (...).
If anyone can help me understand all of this, much appreciated.

A: I will try to explain this to you -
cell.getCellProps -> is the method exposed on each cell by react-table, this is pretty useful in getting all props which the given cell will require based on the plugins used.
Few eg. of same are -
https://github.com/TanStack/react-table/blob/76a4a861ee56b782404ef91987c3b5691ecf2ebc/src/hooks/useTable.js#L415
https://github.com/TanStack/react-table/blob/76a4a861ee56b782404ef91987c3b5691ecf2ebc/src/plugin-hooks/useFlexLayout.js#L47
https://github.com/TanStack/react-table/blob/76a4a861ee56b782404ef91987c3b5691ecf2ebc/src/plugin-hooks/useAbsoluteLayout.js#L23
Now this method can expect an object or list of object to be provided as argument, which mainly acts as merge/override on prior values, loosely similar to object.assign with some exceptions based on key name, for more details on merge logic refer - https://github.com/TanStack/react-table/blob/76a4a861ee56b782404ef91987c3b5691ecf2ebc/src/publicUtils.js#L19
Below code is helpful in adding className in cell and merge/override styles with previously returned values.
{
    className: cell.column.className,
    style: cell.column.style,
}

Below two methods are props provided by  component
getColumnProps(cell.column),
getCellProps(cell)

getColumnProps={column => ({
  onClick: () => alert('Column!'),
})}
getCellProps={cellInfo => ({
  style: {
    backgroundColor: `hsl(${120 * ((120 - cellInfo.value) / 120) * -1 +
      120}, 100%, 67%)`,
  },
}

So whatever is returned by these props that will actually get merged in cell props, and will be applied to td.
P.S. - Refer https://github.com/tannerlinsley/react-table/blob/master/src/publicUtils.js#L48 for what all types of argumants can be expected in cell.getCellProps.


text:
Q: Cocoa blocks as strong pointers vs copy I did work several times with blocks as with pointers to which i had strong reference
I heard that you should use copy, but what is the implication in working with blocks as pointers and not with the raw object?
I never got a complain from the compiler, that i should not use
@property (nonatomic, strong) MyBlock block;

but should use
@property (nonatomic, copy) MyBlock block;

as far as i know, the block is just an object, so why to preferrer copy anyway?

A: Short Answer
The answer is it is historical, you are completely correct that in current ARC code there is no need to use copy and a strong property is fine. The same goes for instance, local and global variables.
Long Answer
Unlike other objects a block may be stored on the stack, this is an implementation optimisation and as such should, like other compiler optimisations, not have direct impact on the written code. This optimisation benefits a common case where a block is created, passed as a method/function argument, used by that function, and then discarded - the block can be quickly allocated on the stack and then disposed of without the heap (dynamic memory pool) being involved.
Compare this to local variables, which (a) created on the stack, (b) are automatically destroyed when the owning function/method returns and (c) can be passed-by-address to methods/functions called by the owning function. The address of a local variable cannot be stored and used after its owning function/method has return - the variable no longer exists.
However objects are expected to outlast their creating function/method (if required), so unlike local variables they are allocated on the heap and are not automatically destroyed based on their creating function/method returning but rather based on whether they are still needed - and "need" here is determined automatically by ARC these days.
Creating a block on the stack may optimise a common case but it also causes a problem - if the block needs to outlast its creator, as objects often do, then it must be moved to the heap before its creators stack is destroyed.
When the block implementation was first released the optimisation of storing blocks on the stack was made visible to programmers as the compiler at that time was unable to automatically handle moving the block to the heap when needed - programmers had to use a function block_copy() to do it themselves.
While this approach might not be out-of-place in the low-level C world (and blocks are C construct), having high-level Objective-C programmers manually manage a compiler optimisation is really not good. As Apple released newer versions of the compiler improvements where made. Early on it programmers were told they could replace block_copy(block) with [block copy], fitting in with normal Objective-C objects. Then the compiler started to automatically copy blocks off stack as needed, but this was not always officially documented.
There has been no need to manually copy blocks off the stack for a while, though Apple cannot shrug off its origins and refers to doing so as "best practice" - which is certainly debatable. In the latest version, Sept 2014, of Apple's Working with Blocks, they stated that block-valued properties should use copy, but then immediately come clean (emphasis added):

Note: You should specify copy as the property attribute, because a block needs to be copied to keep track of its captured state outside of the original scope. This isn't something you need to worry about when using Automatic Reference Counting, as it will happen automatically, but it's best practice for the property attribute to show the resultant behavior.

There is no need to "show the resultant behavior" - storing the block on the stack in the first place is an optimisation and should be transparent to the code - just like other compiler optimisations the code should gain the performance benefit without the programmer's involvement.
So as long as you use ARC and the current Clang compilers you can treat blocks like other objects, and as blocks are immutable that means you don't need to copy them. Trust Apple, even if they appear to be nostalgic for the "good old days when we did things by hand" and encourage you to leave historical reminders in your code, copy is not needed.
Your intuition was right.

A: You are asking about the ownership modifier for a property. This affects the synthesized (or auto-synthesized) getter and/or setter for the property if it is synthesized (or auto-synthesized).
The answer to this question will differ between MRC and ARC.

*

*In MRC, property ownership modifiers include assign, retain, and copy. strong was introduced with ARC, and when strong is used in MRC, it is synonymous with retain. So the question would be about the difference between retain and copy, and there is a lot of difference, because copy's setter saves a copy of the given value.
Blocks need to be copied to be used outside the scope where it was created (with a block literal). Since your property will be storing the value as an instance variable that persists across function calls, and it's possible that someone will assign an unoccupied block from the scope where it was created, the convention is that you must copy it. copy is the right ownership modifier.

*In ARC, strong makes the underlying instance variable __strong, and copy also makes it __strong and adds copying semantics to the setter. However, ARC also guarantees that whenever a value is saved into a __strong variable of block-pointer type, a copy is done. Your property has type MyBlock, which I assume is a typedef for a block pointer type. Therefore, a copy will still be done in the setter if the ownership qualifier were strong. So, in ARC, there is no difference between using strong and copy for this property.
If this declaration might be used in both MRC and ARC though (e.g. a header in a library), it would be a good idea to use copy so that it works correctly in both cases.

A: what is the implication in working with blocks as pointers and not with the raw object?

You are never using the raw value, you always have a pointer to a block: a block is an object.
Looking at your specific example, I am assuming you want to keep the block around, "so why to preferrer copy anyway"enter code here? Well, it's a matter of safety (this example is taken from Mike Ash blog). Since blocks are allocated on the stack (and not on the heap as the rest of the objects in objective-c), when you do something like this:
[dictionary setObject: ^{ printf("hey hey\n"); } forKey: key];

You are allocating the block on the stack frame of your current scope, so when the scope ends (for example your returning the dictionary), the stack frame is destroyed and the block goes with it. So you got yourself a dangling pointer. I would advise reading Mike's article fully. Anyway, you can go with a strong property if when you are assigning the block you copy it:
self.block = [^{} copy];

Edit: After looking at Mike's article date, I am assuming this was the behaviour Pre-ARC. On ARC it seems it's working as expected, and it won't crash.
Edit2: After experimenting with Non-ARC it doesn't crash as well. But this example shows different results depending on the use of ARC or not:
void (^block[10])();

int i = -1;
while(++i < 10)
    block[i] = ^{ printf("%d\n", i); };

for(i = 0; i < 10; i++)
    block[i]();

Quoting Mike Ashe on the different outcomes:

The reason it prints out ten 9s in the first case is quite simple: the
  block that's created within the loop has a lifetime that's tied to the
  loop's inner scope. The block is destroyed at the next iteration of
  the loop, and when leaving the loop. Of course, "destroy" just means
  that its slot on the stack is available to be overwritten. It just
  happens that the compiler reuses the same slot each time through the
  loop, so in the end, the array is filled with identical pointers, and
  thus you get identical behavior.

A: As far as I understand copy is required when the object is mutable. Use this if you need the value of the object as it is at this moment, and you don't want that value to reflect any changes made by other owners of the object. You will need to release the object when you are finished with it because you are retaining the copy.
On the other hand, strong means that you own the object until it is needed. It is a replacement for the retain attribute, as part of ARC.
Source: Objective-C declared @property attributes (nonatomic, copy, strong, weak)

A:
Note: You should specify copy as the property attribute, because a block needs to be copied to keep track of its captured state outside of the original scope. This isn't something you need to worry about when using Automatic Reference Counting, as it will happen automatically, but it's best practice for the property attribute to show the resultant behavior. For more information, see Blocks Programming Topics.