text:
Q: Python TKinter record GUI button press? I've been fiddling with this piece of code trying to figure out how to register button presses once you have placed them in a GUI and hit a wall.  I'm just trying to get it to output the corresponding number upon button press.
Here is what I have so far:
from tkinter import *

def click(self, key):
    self.entry.insert(END, key)

root = Tk()
labels = [['1','2','3'], ['4','5','6'], ['7','8','9'], ['*','0','#']]

for r in range(4):
    for c in range(3):

        def cmd(x = labels[r][c]):
            self.click(key)

        button = Button(root,
                        relief=RAISED,
                        padx=10,
                        text=labels[r][c],
                        command = cmd)
        button.grid(row=r+1, column=c)

Getting an error about no global "self" defined.  Possibly a simple error that has gone over my head, but I've tried about everything I can think of.

A: You are trying to run functions such as click that take self as a parameter. By using
self.click

you are referring to the object that should be created before calling these methods. You either need to remove the self or, in an ideal world, create the required classes and then use self.

redpajama_set_name: RedPajamaStackExchange


text:
Q: setting up testing environment with Vagrant Virtual Machine and Nginx I'm trying to set up a local web testing environment with Vagrant on a centos/6 virtual machine
In the vagrant configuration I set: config.vm.network    "forwarded_port", guest: 80, host: 8080
Inside of the vagrant box if I type: hostname -I it gives me a result of
10.0.2.15
In the vagrant box, nginx is already set and I do have a SSL certification and HTTPS connection set up:
server {
    listen       443;
    server_name 127.0.0.1:8000;
    ...(other configurations including ssl_certificate,
    ssl_certificate_key,protocols and cipher)
    ...(other values that I think its not relevant)
    location / {
            if ($http_host != 127.0.0.1:8000) {
                return 444;
            }
    proxy_pass http://127.0.0.1:8000;
}

And then I have:
server {
    listen 80 default;
    server_name ~^;
    return 302 https://127.0.0.1:8000$request_uri;
}

In my vagrant box, if I use curl to get the content at 127.0.0.1:8000: curl 127.0.0.1:8000, I'm able to successfully get the expected content
From my host operating system, when I'm using chrome to request access to 127.0.0.1, it simply says The connection was reset. and the error exception code is ERR_CONNECTION_RESET
My best guess is this has to deal with my SSL configuration?

A: Not sure if this will help, I run vagrant and use Virtualbox as my hypervisor. You will need to check what the vagrant box is doing for NAT. On mine, out of the box it is 192.169.33.10 and that will get to my dev box. Assumes port forwarding is set right and no firewall.
What does 192.168.33.10:8080 do?


text:
Q: Does the AndroidViewClient has the similar usage device.getHierarchyViewer().focusedWindowName? When we use MonkeyRunner to do the Android UI analysis, we can use the device.getHierarchyViewer().focusedWindowName to get the current screens' window name quickly.
Then we can use the window name to do some basic UI judgement or analysis.
And for AndroidViewClient ( git@github.com:dtmilano/AndroidViewClient.git ), does it have the similar usage?
Thanks.
device = MonkeyRunner.waitForConnection()
hViewer = device.getHierarchyViewer()
win_name = hViewer.getFocusedWindowName()

A: I think it's answered here.
However, I think, due to popular demand,  I will be adding a more straightforward method to AdbClient. Perhaps AdbClient.getFocusedWindowName() to be consistent. This Window has no relationship with the View hierarchy, that's why I think it doesn't fit as a exposed method  to ViewClient.
Comments are welcome.
EDIT
Good news, AndroidViewClient 8.27.1 now features AdbClient.getWindows(), AdbClient.getFocusedWindows() and AdbClient.getFocusedWindowName().
You can use it like here:
#! /usr/bin/env python
# -*- coding: utf-8 -*-
'''
Copyright (C) 2013-2014  Diego Torres Milano
Created on 2015-01-05 by Culebra v8.27.1
                      __    __    __    __
                     /  \  /  \  /  \  /  \
____________________/  __\/  __\/  __\/  __\_____________________________
___________________/  /__/  /__/  /__/  /________________________________
                   | / \   / \   / \   / \   \___
                   |/   \_/   \_/   \_/   \    o \
                                           \_____/--<
@author: Diego Torres Milano
@author: Jennifer E. Swofford (ascii art snake)
'''

import re
import sys
import os

try:
    sys.path.insert(0, os.path.join(os.environ['ANDROID_VIEW_CLIENT_HOME'], 'src'))
except:
    pass

from com.dtmilano.android.viewclient import ViewClient

kwargs1 = {'ignoreversioncheck': False, 'verbose': False, 'ignoresecuredevice': False}
device, serialno = ViewClient.connectToDeviceOrExit(**kwargs1)

print device.getWindows()
print device.getFocusedWindow()
print device.getFocusedWindowName()

BTW, I would be interested in knowing how you use these features. Is it to check preconditions?


text:
Q: error en datagridview al dar click tengo un datagridview en el cual muestro un listado de facturas, entonces cuando intento dar click a la primera factura me muestra este error,"
Esta operación no se puede realizar cuando se está cambiando de tamaño una columna de relleno automático." pero solo es con la primera linea del datagrid, ya quite en la propiedades el AutoSizeColumnsMode como None

aqui otra imagen de cuando la selecciono, en todos las demas filas funciona sin ningun problema, como decia solo es en esta.
por cierto esta dentro de un bloque try
  if (dgvFactura.Rows[e.RowIndex].Cells["Historico"].Selected)
                {
                    try
                    {
                        HistoricoPago hp = new HistoricoPago();
                        hp.idh = Convert.ToInt32(dgvFactura.CurrentRow.Cells["ID"].Value.ToString());
                        hp.paciente = dgvFactura.CurrentRow.Cells["NombreCliente"].Value.ToString();

                            hp.Show();
                    }
                    catch (Exception ex)
                    {

                        MessageBox.Show(ex.Message);
                    }

                }

A: Tienes que definir la columna del tipo DataGridViewButtonColumn
Crear una columna de botones con imagen usando la clase DataGridViewButtonColumn
Para definir el icono usas el evento CellPaint
private void dataGridView1_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
{
    if (e.ColumnIndex >= 0
        && this.dataGridView1.Columns[e.ColumnIndex].Name == "colBotones"
        && e.RowIndex >= 0)
    {
        e.Paint(e.CellBounds, DataGridViewPaintParts.All);

        DataGridViewButtonCell celBoton = this.dataGridView1.Rows[e.RowIndex].Cells["colBotones"] as DataGridViewButtonCell;
        Icon icoAtomico = new Icon(Environment.CurrentDirectory + @"Atomico.ico");
        e.Graphics.DrawIcon(icoAtomico, e.CellBounds.Left + 3, e.CellBounds.Top + 3);

        e.Handled = true;
    }
}

veras como se usa el e.Graphics.DrawIcon para asignar el icono
Ahora bien para detectar que boton se presiono se usa el CellClick nuevamente detectando que se presione sobre la columna del boton que interesa detectar
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{

    if (dataGridView1.Columns[e.ColumnIndex].Name == "colBotones")
    {
        var valCol = this.dataGridView1.Rows[e.RowIndex].Cells["NombreColumna"].Value;

        //resto codigo

    }

}

Si tienes mas de una columna de botones deberas definir varios if uno por cada columna


text:
Q: Not able to find mongoose models after creation I have created one express app and the database connection .

var app = express();
app.db = mongoose.connect("mongodb://localhost/forcast-db");

var accountSchema = new mongoose.Schema({
            accountId:{
                type:String,
                required:true
            }
        });
app.db.model('Account', accountSchema);
console.log(app.db.models);

But it is printing a empty object.
used library
"express": "^4.13.4",
"mongoose": "^4.4.7",
Any kind of help will be highly appreciated.

A: to get  all models created with your mongoose connection  use app.db.connection.models so your code should be like this:
    var app = express();
    app.db = mongoose.connect("mongodb://localhost/forcast-db");

    var accountSchema = new mongoose.Schema({
                accountId:{
                    type:String,
                    required:true
                }
            });
   var accountModel= app.db.model('Account', accountSchema);
    console.log(app.db.connection.models);
   //to create a document from this Account model and save it
    var newAccount= new accountModel({accountId:'1111'});
    newAccount.save();

A: For list of models use console.log(mongoose.models); instead of console.log(app.db.models);. console.log(app.db.models); will not give you list of model created.
Durga


text:
Q: How to re-use vba code (sub) into several other subs I've got 50 wb's Im currently updating using vba. But it's a drag writing (and updating) the same code 50 times, so I'm trying to come up with a method to re-use code. All wb's are equal in structure (sheetnames etc), and the basic "update-vba" should therefore be reusable in all "UpdateGroup-subs". My idea is to place definitions and basic "update-vba" in subs outside the "UpdateGroup-subs", and call upon them when running each "UpdateGroup-sub". But I'm getting a compile error (variable not defined). Is what I'm trying to do even possible? Anyone that can help me out on how to get this to work? I'm uploading 2 versions, one that is working (repeating all code in each "UpdateGroup-sub"), and one that's my attempt at simplify this...
WORKS:
Option Explicit
'************************************************************************

Sub UpdateAllGroups_1_WorksOK()

Dim StartTime As Double
Dim MinutesElapsed As String
StartTime = Timer

    Call UpdateGroup1
    Call UpdateGroup2

MinutesElapsed = Format((Timer - StartTime) / 86400, "hh:mm:ss")
MsgBox "All Updates is done in " & MinutesElapsed, vbInformation, "Message"

End Sub
'************************************************************************

Private Sub UpdateGroup1()

'DEFINITIONS
Dim fPath, ThisGroupWb, ReportR2ob, ReportR1vo, ReportR2vo As String
Dim WbReport, WbGroup As Workbook
Dim sh_Dash, sh_NewR2ob, sh_NewR1vo, sh_NewR2vo, sh_Time As Worksheet

    fPath = ThisWorkbook.Path
        If Right(fPath, 1) = "\" Then
        fPath = Left(fPath, Len(fPath) - 1)
        End If

Set WbGroup = Workbooks.Open(ThisWorkbook.Path & "\Group1_(M).xlsm")    'must be changed in each UpdateGroup-sub
    With WbGroup
        Set sh_Dash = .Worksheets("Dash")
        Set sh_NewR2ob = .Worksheets("NewR2ob")
        Set sh_NewR1vo = .Worksheets("NewR1vo")
        Set sh_NewR2vo = .Worksheets("NewR2vo")
        Set sh_Time = .Worksheets("Time")
    End With

ThisGroupWb = "Group1_(M).xlsm"     'must be changed in each UpdateGroup-sub
ReportR2ob = "R2ob - Group1.xls"    'must be changed in each UpdateGroup-sub
ReportR1vo = "R1vo - Group1.xls"    'must be changed in each UpdateGroup-sub
ReportR2vo = "R2vo - Group1.xls"    'must be changed in each UpdateGroup-sub

'NEW REPORTS
Application.ScreenUpdating = False
Application.DisplayAlerts = False

    Set WbReport = Workbooks.Open(fPath & "\R2ob\" & ReportR2ob)
    WbReport.Sheets(1).Cells.Copy sh_NewR2ob.Range("A1")
    WbReport.Close False

    Set WbReport = Workbooks.Open(fPath & "\R1vo\" & ReportR1vo)
    WbReport.Sheets(1).Cells.Copy sh_NewR2vo.Range("A1")
    WbReport.Close False

    Set WbReport = Workbooks.Open(fPath & "\R2vo\" & ReportR2vo)
    WbReport.Sheets(1).Cells.Copy sh_NewR1vo.Range("A1")
    WbReport.Close False

'STORE AND CLOSE GROUP-WB
Application.Goto sh_Dash.Range("A1"), True
WbGroup.Save
WbGroup.Close False

End Sub
'************************************************************************

Private Sub UpdateGroup2()

'DEFINITIONS
Dim fPath, ThisGroupWb, ReportR2ob, ReportR1vo, ReportR2vo As String
Dim WbReport, WbGroup As Workbook
Dim sh_Dash, sh_NewR2ob, sh_NewR1vo, sh_NewR2vo, sh_Time As Worksheet

    fPath = ThisWorkbook.Path
        If Right(fPath, 1) = "\" Then
        fPath = Left(fPath, Len(fPath) - 1)
        End If

Set WbGroup = Workbooks.Open(ThisWorkbook.Path & "\Group2_(M).xlsm")    'must be changed in each UpdateGroup-sub
    With WbGroup
        Set sh_Dash = .Worksheets("Dash")
        Set sh_NewR2ob = .Worksheets("NewR2ob")
        Set sh_NewR1vo = .Worksheets("NewR1vo")
        Set sh_NewR2vo = .Worksheets("NewR2vo")
        Set sh_Time = .Worksheets("Time")
    End With

ThisGroupWb = "Group2_(M).xlsm"     'must be changed in each UpdateGroup-sub
ReportR2ob = "R2ob - Group2.xls"    'must be changed in each UpdateGroup-sub
ReportR1vo = "R1vo - Group2.xls"    'must be changed in each UpdateGroup-sub
ReportR2vo = "R2vo - Group2.xls"    'must be changed in each UpdateGroup-sub

'NEW REPORTS
Application.ScreenUpdating = False
Application.DisplayAlerts = False

    Set WbReport = Workbooks.Open(fPath & "\R2ob\" & ReportR2ob)
    WbReport.Sheets(1).Cells.Copy sh_NewR2ob.Range("A1")
    WbReport.Close False

    Set WbReport = Workbooks.Open(fPath & "\R1vo\" & ReportR1vo)
    WbReport.Sheets(1).Cells.Copy sh_NewR2vo.Range("A1")
    WbReport.Close False

    Set WbReport = Workbooks.Open(fPath & "\R2vo\" & ReportR2vo)
    WbReport.Sheets(1).Cells.Copy sh_NewR1vo.Range("A1")
    WbReport.Close False

'STORE AND CLOSE GROUP-WB
Application.Goto sh_Dash.Range("A1"), True
WbGroup.Save
WbGroup.Close False

End Sub
'************************************************************************

NOT WORKING:
Option Explicit
'************************************************************************

Sub UpdateAllGroups_2_DoesntWork()

Dim StartTime As Double
Dim MinutesElapsed As String
StartTime = Timer

    Call UpdateGroup1
    Call UpdateGroup2

MinutesElapsed = Format((Timer - StartTime) / 86400, "hh:mm:ss")
MsgBox "All Updates is done in " & MinutesElapsed, vbInformation, "Message"

End Sub
'************************************************************************

Private Sub Definitions()

Dim fPath, ThisGroupWb, ReportR2ob, ReportR1vo, ReportR2vo As String
Dim WbReport, WbGroup As Workbook
Dim sh_Dash, sh_NewR2ob, sh_NewR1vo, sh_NewR2vo, sh_Time As Worksheet

    fPath = ThisWorkbook.Path
        If Right(fPath, 1) = "\" Then
        fPath = Left(fPath, Len(fPath) - 1)
        End If

    With WbGroup
        Set sh_Dash = .Worksheets("Dash")
        Set sh_NewR2ob = .Worksheets("NewR2ob")
        Set sh_NewR1vo = .Worksheets("NewR1vo")
        Set sh_NewR2vo = .Worksheets("NewR2vo")
        Set sh_Time = .Worksheets("Time")
    End With

End Sub
'************************************************************************

Private Sub UpdateGroups()

Set WbGroup = Workbooks.Open(ThisWorkbook.Path & "\ThisGroupWb")

'NEW REPORTS
Application.ScreenUpdating = False
Application.DisplayAlerts = False

    Set WbReport = Workbooks.Open(fPath & "\R2ob\" & ReportR2ob)
    WbReport.Sheets(1).Cells.Copy sh_NewR2ob.Range("A1")
    WbReport.Close False

    Set WbReport = Workbooks.Open(fPath & "\R1vo\" & ReportR1vo)
    WbReport.Sheets(1).Cells.Copy sh_NewR2vo.Range("A1")
    WbReport.Close False

    Set WbReport = Workbooks.Open(fPath & "\R2vo\" & ReportR2vo)
    WbReport.Sheets(1).Cells.Copy sh_NewR1vo.Range("A1")
    WbReport.Close False

'STORE AND CLOSE GROUP-WB
Application.Goto sh_Dash.Range("A1"), True
WbGroup.Save
WbGroup.Close False

End Sub
'************************************************************************

Private Sub UpdateGroup1()

Call Definitions
    ThisGroupWb = "Group1_(M).xlsm"
    ReportR2ob = "R2ob - Group1.xls"
    ReportR1vo = "R1vo - Group1.xls"
    ReportR2vo = "R2vo - Group1.xls"
Call UpdateGroups

End Sub
'************************************************************************

Private Sub UpdateGroup2()

Call Definitions
    ThisGroupWb = "Group2_(M).xlsm"
    ReportR2ob = "R2ob - Group2.xls"
    ReportR1vo = "R1vo - Group2.xls"
    ReportR2vo = "R2vo - Group2.xls"
Call UpdateGroups

End Sub

A: You should use arguments in your subroutine as follows:
'Version 1: using single argument GroupNumber

Option Explicit
'************************************************************************

Sub UpdateAllGroups()

Dim StartTime As Double
Dim MinutesElapsed As String
StartTime = Timer

    Call UpdateGroup(1)
    Call UpdateGroup(2)

MinutesElapsed = Format((Timer - StartTime) / 86400, "hh:mm:ss")
MsgBox "All Updates is done in " & MinutesElapsed, vbInformation, "Message"

End Sub
'************************************************************************

Private Sub UpdateGroup(ByVal GroupNumber As Long)

    'DEFINITIONS
    Dim fPath, ThisGroupWb, ReportR2ob, ReportR1vo, ReportR2vo As String
    Dim WbReport, WbGroup As Workbook
    Dim sh_Dash, sh_NewR2ob, sh_NewR1vo, sh_NewR2vo, sh_Time As Worksheet

        fPath = ThisWorkbook.Path
            If Right(fPath, 1) = "\" Then
            fPath = Left(fPath, Len(fPath) - 1)
            End If

    'Note that path is composed using supplied argument:
    Set WbGroup = Workbooks.Open(ThisWorkbook.Path & "\Group" & GroupNumber & "_(M).xlsm")
        With WbGroup
            Set sh_Dash = .Worksheets("Dash")
            Set sh_NewR2ob = .Worksheets("NewR2ob")
            Set sh_NewR1vo = .Worksheets("NewR1vo")
            Set sh_NewR2vo = .Worksheets("NewR2vo")
            Set sh_Time = .Worksheets("Time")
        End With

    'Same here:
    ThisGroupWb = "Group" & GroupNumber & "_(M).xlsm"     'must be changed in each UpdateGroup-sub
    ReportR2ob = "R2ob - Group" & GroupNumber & ".xls"    'must be changed in each UpdateGroup-sub
    ReportR1vo = "R1vo - Group" & GroupNumber & ".xls"    'must be changed in each UpdateGroup-sub
    ReportR2vo = "R2vo - Group" & GroupNumber & ".xls"    'must be changed in each UpdateGroup-sub

    'NEW REPORTS
    Application.ScreenUpdating = False
    Application.DisplayAlerts = False

        Set WbReport = Workbooks.Open(fPath & "\R2ob\" & ReportR2ob)
        WbReport.Sheets(1).Cells.Copy sh_NewR2ob.Range("A1")
        WbReport.Close False

        Set WbReport = Workbooks.Open(fPath & "\R1vo\" & ReportR1vo)
        WbReport.Sheets(1).Cells.Copy sh_NewR2vo.Range("A1")
        WbReport.Close False

        Set WbReport = Workbooks.Open(fPath & "\R2vo\" & ReportR2vo)
        WbReport.Sheets(1).Cells.Copy sh_NewR1vo.Range("A1")
        WbReport.Close False

    'STORE AND CLOSE GROUP-WB
    Application.Goto sh_Dash.Range("A1"), True
    WbGroup.Save
    WbGroup.Close False

End Sub

Or, closer to what you've done:
'Version 2: using ThisGroupWb, ReportR2ob, ReportR1vo and ReportR2vo

Option Explicit
'************************************************************************

Sub UpdateAllGroups()

Dim StartTime As Double
Dim MinutesElapsed As String
StartTime = Timer

    Call UpdateGroup("Group1_(M).xlsm", "R2ob - Group1.xls", "R1vo - Group1.xls", "R2vo - Group1.xls")
    Call UpdateGroup("Group2_(M).xlsm", "R2ob - Group2.xls", "R1vo - Group2.xls", "R2vo - Group2.xls")

MinutesElapsed = Format((Timer - StartTime) / 86400, "hh:mm:ss")
MsgBox "All Updates is done in " & MinutesElapsed, vbInformation, "Message"

End Sub
'************************************************************************

Private Sub UpdateGroup(ByVal ThisGroupWb As String, ByVal ReportR2ob As String, ByVal ReportR1vo As String, ByVal ReportR2vo As String)

    'DEFINITIONS
    Dim fPath As String
    Dim WbReport, WbGroup As Workbook
    Dim sh_Dash, sh_NewR2ob, sh_NewR1vo, sh_NewR2vo, sh_Time As Worksheet

        fPath = ThisWorkbook.Path
            If Right(fPath, 1) = "\" Then
            fPath = Left(fPath, Len(fPath) - 1)
            End If

    Set WbGroup = Workbooks.Open(ThisWorkbook.Path & "\" & ThisGroupWb)    'must be changed in each UpdateGroup-sub
        With WbGroup
            Set sh_Dash = .Worksheets("Dash")
            Set sh_NewR2ob = .Worksheets("NewR2ob")
            Set sh_NewR1vo = .Worksheets("NewR1vo")
            Set sh_NewR2vo = .Worksheets("NewR2vo")
            Set sh_Time = .Worksheets("Time")
        End With

    'Already assigned (call arguments)
    'ThisGroupWb = ...
    'ReportR2ob = ...
    'ReportR1vo = ...
    'ReportR2vo = ...

    'NEW REPORTS
    Application.ScreenUpdating = False
    Application.DisplayAlerts = False

        Set WbReport = Workbooks.Open(fPath & "\R2ob\" & ReportR2ob)
        WbReport.Sheets(1).Cells.Copy sh_NewR2ob.Range("A1")
        WbReport.Close False

        Set WbReport = Workbooks.Open(fPath & "\R1vo\" & ReportR1vo)
        WbReport.Sheets(1).Cells.Copy sh_NewR2vo.Range("A1")
        WbReport.Close False

        Set WbReport = Workbooks.Open(fPath & "\R2vo\" & ReportR2vo)
        WbReport.Sheets(1).Cells.Copy sh_NewR1vo.Range("A1")
        WbReport.Close False

    'STORE AND CLOSE GROUP-WB
    Application.Goto sh_Dash.Range("A1"), True
    WbGroup.Save
    WbGroup.Close False

End Sub


text:
Q: How to reduce PWA website space usage? PWA taking up huge space I recently deployed my website (https://www.travelengine.co/) and started using PWA to enhance the experience. The PWA works good and is able to cache offline articles as well. However, the issue I am facing is that the site usage has become huge. It happens on my chrome android as well as chrome desktop. Even after clearing cache, the usage spikes close to 800MB within just 2 refreshes.
Please help. How should I fix that? I am attaching the screenshots.
PWA Location: https://www.travelengine.co/service-worker.js


text:
Q: Can't add Google Plugin for Eclipse to Eclipse for Java EE developers (Helios edition)? I just installed Eclipse Helios (Java EE edition) and tried to install the Google App Engine plugin for Eclipse.
I get the following error:
Cannot complete the install because one or more required items could not be found.
  Software being installed: Google Plugin for Eclipse 3.5 1.3.3.v201006111302 (com.google.gdt.eclipse.suite.e35.feature.feature.group 1.3.3.v201006111302)
  Missing requirement: Google Plugin for Eclipse 3.5 1.3.3.v201006111302 (com.google.gdt.eclipse.suite.e35.feature.feature.group 1.3.3.v201006111302) requires 'org.eclipse.platform.feature.group [3.5.0,3.6.0)' but it could not be found

Is it only possible to add the plugin to Ganymede - not Helios?

A: There is a version of the GAE Plugin for Eclipse 3.6/Helios listed on the Download page - did you try this?


text:
Q: Localhost - Cookies are blocked or not supported by your browser I just set up this multisite wordpress on my localhost. It consists of a domain (local.mydomain.com) and 2 subdomains (local.site2.mydomain.com and local.site3.mydomain.com).
Everything works perfectly for the root domain, I can log in and go to the backend just fine, but when I try to log into any of the subdomains I get the "Cookies are blocked or not supported by your browser." error.

*

*Yes, my cookies are enabled.

*I tried the wp-config define hack

*Cleared cache

*Disabled plugins and themes

*Updated to 4.0

I realize this has been posted many times before, but I haven't seen a recent post for this nor I have seen the multisite in localhost version of that error.
Hopefully someone can help me out. Cheers!

A: You said "I tried the wp-config" define hack. I'm not sure what you mean by that but in my case it worked by setting the one below in the wp-config.php file:
define('COOKIE_DOMAIN', false);
One the other hand, if you are using Apache as a web server then check in your Apache configuration if you have enabled mod_security turned ON. This will prevent, among others, the cookie thing. So if it is enabled then just try to disable this module and check again. If it is the cause of the problem then check its configuration, particularly any settings related to cookies.
The settings for this Apache module may be stored within a file named modsecurity.conf. They may be found even in Apache's httpd.conf as well. You got the idea, anyway.

A: I tried just add define( 'COOKIE_DOMAIN', false ), but it didn't work for me.
this is what makes my multisite work locally:
define('ADMIN_COOKIE_PATH', '/');
define('COOKIE_DOMAIN', '');
define('COOKIEPATH', '');
define('SITECOOKIEPATH', '');
define( 'COOKIE_DOMAIN', false );


text:
Q: AdMob banner disappears after i reopen the app I have a view controller (iPad only) with a banner view implemented using storyboard (I followed the official tutorial).
The ads load fine, the only problem is when I close the app (multitasking): when I reopen it the ad view disappears and doesn't show any ads.
This is happening even with test ads.
My project uses Swift, Xcode 7.2 and AdMob SDK 7.2.0

A: I figured it out.
This happens only if your app support Split View.
The easy fix is to disable Split View by enabling "Requires full screen"


text:
Q: Tableau - Given longitude and latitude how can I count how many points fall under a certain zip code for New York? I'm trying to count how many subway stations each zip code in NYC has. I have the longitudes and latitudes of each station but am wondering how I can relate this to zip codes? Thank you for your help!
Subway Stations on default map

A: You'll need some spatial data source that contains the boundaries of each zip code, such as a ESRI shapefile, GeoJSON file, KML etc. Tableau's built-in geocoding can display zip code boundaries visually, but they are not accessible for computation (unless you find a way to hack the geocoding files that ship with Tableau)
It should not be hard to find a shapefile of zip code boundaries for NYC.
Once you have that use a spatial join with the INTERSECTS operator to combine the zip code boundary data with your subway station data. If your station data is not in a spatial format, you'll need to use the MAKEPOINT() function in Tableau to convert the latitude and longitude coordinates into a spatial geometry datatype that can be used to specify your join condition.
This sounds like more work that it really is. In the end, the INTERSECTS operator will do all the work to assign each station to the correct zip code.


text:
Q: After I upgraded to ubuntu 14.04.3, I couldn't boot to my windows systems I have 2 Sata 1TB drives. I setup originally with win7SP1 and Ubuntu 14.04 on the Toshiba Drive and WinXPSP3 on the WD drive.
Everything worked beautifully... Then I upgraded to Ubuntu 14.04.3, and now I can only boot into linux... As a matter of fact, Files doesn't even show the Toshiba Drive (which I used to see on the desktop above the trash icon) and it complains that its partition only has 364 MB - egad!
I did a boot-repair yesterday, got an 18 page text document.  Obviously, to me, everything seems to be present, yet grub or grub2 doesn't create the correct boot selection or coding.
Any suggestions would be appreciated...

A: Just Run this in terminal:
sudo update-grub

this command will scan for boot able operating systems and add them to the boot menu


text:
Q: How to use notificationBuilder.setSmallIcon(icon) in latest Android SDK update? I want to use setSmallIcon(Icon.createWithBitmap()) to create small icon for my notification but the constructor NotificationCompat.Builder(context) is deprecated now and the latest constructor NotificationCompat.Builder(context, channelId) doesn't contain this method which accepts icon as parameter. How can I use icon object in latest notification builder?
val channelId =
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
            { createNotificationChannel("111", "Speed Monitor Service") } else { "" }

        val remoteView = RemoteViews(packageName, R.layout.notification)
        val notification = NotificationCompat.Builder(this, channelId)
            .setSmallIcon(R.drawable.ic_launcher_background) //this method only accepts int not Icon
            .setCustomContentView(remoteView)
            .build()

        startForeground(1, notification)

A: Notification.Builder.setSmallIcon is what you need to use. If you need to utilize older API levels, you can use NotificationCompat.Builder.
This method has several overrides depending on the resource you would like to use, if you need to use a runtime image, and not a resource bundled in the application, you can leverage the Icon class and the method Notification.Builder.setSmallIcon(Icon icon).

A: Your question is a little vague let me clear it up for you. Notification.Builder(context) (which is deprecated) and Notification.Builder(context, channelId) are two constructors of the same class Notification.Builder. The class itself is not deprecated.

Notification.Builder(context, channelId) doesn't contain this method
  which accepts icon as parameter

The above statement is wrong (wrong as in technically wrong). Using either of the constructors doesn't imply you are using two different classes. There is only one class here Notification.Builderand it does contains the function setSmallIcon(Icon icon) as you can see here https://developer.android.com/reference/android/app/Notification.Builder.html#setSmallIcon(android.graphics.drawable.Icon)
In other words setSmallIcon(Icon icon) has to be there. The reason you are not seeing this function can be different. Show the code for further clearance.


text:
Q: What is the best way to save/load img/file(word,excel etc.) in php/asp.net application? I'm currently a student and I aspire to become a great web developer :)
I want to work on some 'practice' projects that is capable of storing/retrieving images or any  type of file(.doc,.xcl,.txt, etc.). Some are saying that it's better to store img/any file in a file system as opposed to saving it inside the database.
I would like to know the pros and cons of both side.
I would also like to know what's the best data type for storing imgs/files in MySQL
(I'm currently using longblob for PHP-MySQL)For saving imgs
I would also like to know what's the best data type for storing imgs/files in SQL Server
(I'm currently using Asp.net Varbinary(max) for SQL Server 2008)For saving imgs
Lastly,I'm just curious on how websites like facebook and other big web applications store imgs and files.
Sir/Ma'am, your answers would be of great help and be very much appreciated. Thank you++

A: Facebook uses haystack for images.
Here is a link from their site describing image storage and retrieval
http://www.facebook.com/note.php?note_id=76191543919
Based on prior experience, I would recommend not storing files directly into a SQL database.

A: Pros: Storing in database

*

*Files are saved "forever"

*Can restrict access to the real file more easily

*You can, technically, check for duplicate files.

*You are not keeping the files on drive, so it can be faster to access for the server

*Less files on your server is considered "better" and more organized

*"one file for everything"
Cons:

*

*If site is up but database is not, file will be invalid (through "direct" linking)

*Some databases that cannot be reconfigured only allow blobs to be of a certain size limit (a few mb), therefore making it so that really large images cannot be stored (but can be separated)

*More data becomes stored in memory when loading file to (to a variable); similar to the problem above, very large images can slow down your server.

*Some files may be of different character encoding, and thus storing and/or retrieving files may corrupt the original file. I am not sure if this is real problem, but I think it was.
I personally suggest you to  do not store files on my database anymore because of the cons.


text:
Q: Could not build Objective-C module / No such module My iOS app was working perfectly well just a few days ago, and then suddenly I became unable to build it due to seemingly endless problems with Cocoapods.
First I got this error:

Then I noticed that if I commented out that offending line, I would just get a problem with another pod module:

And another:

Only import UIKit and import Foundation don't give that problem.
After I noticed that, I went as far as to delete all the pods and comment out all the code that relied on pods in my project, and attempt to build the app from the bare .xcodeproj file. Then I got this error, as well as a few others:

I deleted and reinstalled all pods several times, cleaned my DerivedData folder, cleaned to build folder, and visited all pages related to those problems in StackOverflow and other sites. I'm still unable to build the project.
What is going on?

A: Based on line 2 in your error message, I assume you had Fabric installed at some point.
Looking at the install steps for it here: https://cocoapods.org/pods/Fabric
It mentions adding an entry in your build phases:

I would suggest you remove the associated script and try again. Odds are, this fails just before you run the cocoapods scripts.


text:
Q: Color key transparency does not work with SDL_image and PNG files I am trying to achieve transparency in SDL using color keying. While it does work with BMP files, it doesn't with PNG files.
Here is my code:
#include <SDL/SDL.h>
#include <SDL/SDL_image.h>

int main(int argc, char *argv[])
{
    SDL_Init(SDL_INIT_EVERYTHING);
    SDL_Surface *displaySurface = SDL_SetVideoMode(200, 100, 32, SDL_HWSURFACE | SDL_DOUBLEBUF);

    SDL_Surface *tmpSurface = NULL;
    SDL_Surface *backgroundSurface = NULL;
    SDL_Surface *bmpSurface = NULL;
    SDL_Surface *pngSurface = NULL;

    tmpSurface = IMG_Load("background.png");
    backgroundSurface = SDL_DisplayFormat(tmpSurface);
    SDL_FreeSurface(tmpSurface);

    tmpSurface = SDL_LoadBMP("bmpImage.bmp");
    bmpSurface = SDL_DisplayFormat(tmpSurface);
    SDL_FreeSurface(tmpSurface);
    SDL_SetColorKey(bmpSurface, SDL_SRCCOLORKEY | SDL_RLEACCEL, SDL_MapRGB(bmpSurface->format, 255, 0, 255));

    tmpSurface = IMG_Load("pngImage.png");
    pngSurface = SDL_DisplayFormat(tmpSurface);
    SDL_FreeSurface(tmpSurface);
    SDL_SetColorKey(pngSurface, SDL_SRCCOLORKEY | SDL_RLEACCEL, SDL_MapRGB(pngSurface->format, 255, 0, 255));

    SDL_Rect dest;

    dest.x = 0;
    dest.y = 0;

    SDL_BlitSurface(backgroundSurface, NULL, displaySurface, &dest);

    SDL_BlitSurface(bmpSurface, NULL, displaySurface, &dest);

    dest.x = 50;
    SDL_BlitSurface(pngSurface, NULL, displaySurface, &dest);

    SDL_Flip(displaySurface);

    SDL_Event event;

    while (1) {
        while (SDL_PollEvent(&event)) {
            ;
        }

        SDL_Delay(1);
    }

    return 0;
}

I have uploaded both the code and the images I am using here:
http://tobias.braun-abstatt.de/files/forums/transparency_test.zip

A: If you are using SDL_image version 1.2.10 or 1.2.11, make sure to update it to version 1.2.12.
#include <SDL/SDL_image.h>

#if (SDL_IMAGE_MAJOR_VERSION != 1) || (SDL_IMAGE_MINOR_VERSION != 2) || (SDL_IMAGE_PATCHLEVEL < 12)
#error "Invalid SDL_image version"
#endif


text:
Q: Unable to use a hook in a component I am trying to use a hook but I get the following error when using the useSnackbar hook from notistack.
Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app

My App.js
 <SnackbarProvider
      anchorOrigin={{
        vertical: 'top',
        horizontal: 'center',
      }}
    >
      <App />
 </SnackbarProvider>

My SnackBar.js
const SnackBar = (message, severity) => {
  const { enqueueSnackbar, closeSnackbar } = useSnackbar()
  const action = key => (
    <>
      <Button
        onClick={() => {
          closeSnackbar(key)
        }}
      >
        Dismiss
      </Button>
    </>
  )

  enqueueSnackbar(message, {
    variant: severity,
    autoHideDuration: severity === 'error' ? null : 5000,
    action,
    preventDuplicate: true,
    TransitionComponent: Fade,
  })
}

My demo.js contains this function
const Demo = props => {
    const showSnackBar = (message, severity) => {
      SnackBar(message, severity)
    }
}

If I were to call the hook in demo.js and pass it in as an argument like the following it works. What is the difference? Why can't I use the useSnackbar() hook in snackbar.js?
const Demo = props => {
    const showSnackBar = (message, severity) => {
      SnackBar(enqueueSnackbar, closeSnackbar, message, severity)
    }
}

A: The Easy way
Store the enqueueSnackbar & closeSnackbar in the some class variable at the time of startup of the application, And use anywhere in your application.
Follow the steps down below,
1.Store Both enqueueSnackbar & closeSnackbar to class variable inside the Routes.js file.
import React, { Component, useEffect, useState } from 'react';
import {Switch,Route, Redirect, useLocation} from 'react-router-dom';
import AppLayout from '../components/common/AppLayout';
import PrivateRoute from '../components/common/PrivateRoute';
import DashboardRoutes from './DashboardRoutes';
import AuthRoutes from './AuthRoutes';
import Auth from '../services/https/Auth';
import store from '../store';
import { setCurrentUser } from '../store/user/action';
import MySpinner from '../components/common/MySpinner';
import { SnackbarProvider, useSnackbar } from "notistack";
import SnackbarUtils from '../utils/SnackbarUtils';

const Routes = () => {
    const location = useLocation()
    const [authLoading,setAuthLoading] = useState(true)

    //1. UseHooks to get enqueueSnackbar, closeSnackbar
    const { enqueueSnackbar, closeSnackbar } = useSnackbar();

    useEffect(()=>{

    //2. Store both  enqueueSnackbar & closeSnackbar to class variables
        SnackbarUtils.setSnackBar(enqueueSnackbar,closeSnackbar)
        const currentUser = Auth.getCurrentUser()
        store.dispatch(setCurrentUser(currentUser))
        setAuthLoading(false)
    },[])
    if(authLoading){
        return(
            <MySpinner title="Authenticating..."/>
        )
    }
    return (
        <AppLayout
        noLayout={location.pathname=="/auth/login"||location.pathname=="/auth/register"}
        >

                <Switch>
                    <Redirect from="/" to="/auth" exact/>
                    <PrivateRoute redirectWithAuthCheck={true}  path = "/auth" component={AuthRoutes}/>
                    <PrivateRoute path = "/dashboard" component={DashboardRoutes}/>
                    <Redirect  to="/auth"/>
                </Switch>

        </AppLayout>
     );
}

export default Routes;

2. This is how SnackbarUtils.js file looks like
class SnackbarUtils {
  #snackBar = {
    enqueueSnackbar: ()=>{},
    closeSnackbar: () => {},
  };

  setSnackBar(enqueueSnackbar, closeSnackbar) {
    this.#snackBar.enqueueSnackbar = enqueueSnackbar;
    this.#snackBar.closeSnackbar = closeSnackbar;
  }

  success(msg, options = {}) {
    return this.toast(msg, { ...options, variant: "success" });
  }
  warning(msg, options = {}) {
    return this.toast(msg, { ...options, variant: "warning" });
  }
  info(msg, options = {}) {
    return this.toast(msg, { ...options, variant: "info" });
  }

  error(msg, options = {}) {
    return this.toast(msg, { ...options, variant: "error" });
  }
  toast(msg, options = {}) {
    const finalOptions = {
      variant: "default",
      ...options,
    };
    return this.#snackBar.enqueueSnackbar(msg, { ...finalOptions });
  }
  closeSnackbar(key) {
    this.#snackBar.closeSnackbar(key);
  }
}

export default new SnackbarUtils();

3.Now just import the SnackbarUtils and use snackbar anywhere in your application as follows.
<button onClick={()=>{
           SnackbarUtils.success("Hello")
        }}>Show</button>

You can use snackbar in non react component file also

A: Hooks are for React components which are JSX elements coated in a syntactic sugar.
Currently, you are using useSnackbar() hook inside SnackBar.js
In order to work, SnackBar.js must be a React component.
Things to check.

*

*If you have imported React from "react" inside the scope of your component.

*If you have return a JSX tag for the component to render.

For your case,

*

*Your SnackBar.js is not a component since it doesn't return anything.

*Your demo.js works because it is a component and it already called the hook and then pass the result down to child function.

A: Change
const SnackBar = (message, severity) => { }
to
const SnackBar = ({ message, severity }) => { }
and you have to return some mark-up as well,
return
Some stuff

A: UPDATE: The reason you can't call the useSnackbar() in snackbar.js is because snackbar.js is not a functional component. The mighty rules of hooks (https://reactjs.org/docs/hooks-rules.html) state that you can only call hooks from: 1) the body of functional components 2) other custom hooks. I recommend refactoring as you have done to call the hook first in demo.js and passing the response object (along with say the enqueueSnackbar function) to any other function afterwards.
PREVIOUS RESPONSE:
Prabin's solution feels a bit hacky but I can't think of a better one to allow for super easy to use global snackbars.
For anyone getting
"TypeError: Cannot destructure property 'enqueueSnackbar' of 'Object(...)(...)' as it is undefined"
This was happening to me because I was using useSnackbar() inside my main app.js (or router) component, which, incidentally, is the same one where the  component is initialized. You cannot consume a context provider in the same component that declares it, it has to be a child element. So, I created an empty component called Snackbar which handles saving the enqueueSnackbar and closeSnackbar to the global class (SnackbarUtils.js in the example answer).


text:
Q: OpenCV: assertation failed ((img.depth() == CV_8U || img.depth() == CV_32F) && img.type() == templ.type()) I get this error from above and don't know how to avoid it.
My aim is to get a screenshot and then perform a template matching on it to see if an icon is shown on the screen at this moment. Till now it's just the position of the icon.
My code:
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/core/core.hpp"
#include <Windows.h>
#include <iostream>
#include <stdio.h>
#include <string>

using namespace std;
using namespace cv;

Mat hwnd2mat();

/// Global Variables
Mat img; Mat templ; Mat result;

int main()
{
  /// Load image and template
  templ = imread( "Template.bmp",1);
  templ.convertTo(templ, CV_8U);

  //img = imread( "Image.jpg", 1 );
  img = hwnd2mat();

  /// Create the result matrix
  int result_cols =  img.cols - templ.cols + 1;
  int result_rows = img.rows - templ.rows + 1;

  result.create( result_cols, result_rows, CV_8U);

  /// Do the Matching and Normalize
  matchTemplate( img, templ, result, CV_TM_SQDIFF );
  normalize( result, result, 0, 1, NORM_MINMAX, -1, Mat() );

  /// Localizing the best match with minMaxLoc
  double minVal; double maxVal; Point minLoc; Point maxLoc;
  Point matchLoc;

  minMaxLoc( result, &minVal, &maxVal, &minLoc, &maxLoc, Mat() );

  /// show best position
  matchLoc = minLoc;
  cout<<matchLoc<<" is best position"<<endl;

  waitKey(0);
  return 0;
}

Mat hwnd2mat(){

    HWND hwnd = GetDesktopWindow();
    HDC hwindowDC,hwindowCompatibleDC;

    int height,width,srcheight,srcwidth;
    HBITMAP hbwindow;
    Mat src;
    BITMAPINFOHEADER  bi;

    hwindowDC=GetDC(hwnd);
    hwindowCompatibleDC=CreateCompatibleDC(hwindowDC);
    SetStretchBltMode(hwindowCompatibleDC,COLORONCOLOR);

    RECT windowsize;    // get the height and width of the screen
    GetClientRect(hwnd, &windowsize);

    srcheight = windowsize.bottom;
    srcwidth = windowsize.right;
    height = windowsize.bottom/1;  //change this to whatever size you want to resize to
    width = windowsize.right/1;

    src.create(height,width,CV_8U);

    // create a bitmap
    hbwindow = CreateCompatibleBitmap( hwindowDC, width, height);
    bi.biSize = sizeof(BITMAPINFOHEADER);
    bi.biWidth = width;
    bi.biHeight = -height;  //this is the line that makes it draw upside down or not
    bi.biPlanes = 1;
    bi.biBitCount = 32;
    bi.biCompression = BI_RGB;
    bi.biSizeImage = 0;
    bi.biXPelsPerMeter = 0;
    bi.biYPelsPerMeter = 0;
    bi.biClrUsed = 0;
    bi.biClrImportant = 0;

    // use the previously created device context with the bitmap
    SelectObject(hwindowCompatibleDC, hbwindow);
    // copy from the window device context to the bitmap device context
    StretchBlt( hwindowCompatibleDC, 0,0, width, height, hwindowDC, 0, 0,srcwidth,srcheight, SRCCOPY); //change SRCCOPY to NOTSRCCOPY for wacky colors !
    GetDIBits(hwindowCompatibleDC,hbwindow,0,height,src.data,(BITMAPINFO *)&bi,DIB_RGB_COLORS);  //copy from hwindowCompatibleDC to hbwindow

    DeleteObject(hbwindow);
    DeleteDC(hwindowCompatibleDC);
    ReleaseDC(hwnd, hwindowDC);

    return src;
}

The function with the screenshot is not my own work, i got it from here
Any Ideas what to do?
Thanks for help, best regards!

A: The problem is that the function hwnd2mat is returning a grayscale image of type CV_8UC1 while templ is a color image of type CV_8UC3. So the assertion is failing on the function matchTemplate due to the failing condition img.type() == templ.type(). You may load the image as grayscale to avoid the error.
templ = imread( "Template.bmp",CV_LOAD_IMAGE_GRAYSCALE);

UPDATE:
It is worth noting that the function hwnd2mat is not working in its current form and it returns an invalid image. The original code creates the output image of type CV_8UC4 which is the correct approach.
src.create(height,width,CV_8UC4);

Either you may convert src to grayscale before returning from hwnd2mat, or you may convert templ to 4 channel image. Anyway, the point is that both image must have same type for matchTemplate to work.


text:
Q: to see which case I'm in in vim? I always mis-press the caps lock key when I typing. So there are lots of time that I don't know which case I actually in. I always have go into insert mode to test, which is painful. So are there any method to tell vim to show the case I'm in all the time?
thanks.
By the way, I using powerlines plugin, which may disable some feature of the original vim. If it does, let me know please.

A: If you press Caps Lock inadvertently, you should disable it or remap it.
According to this vim thread, there is not a platform-independent way to accomplish what you are asking for in vim.


text:
Q: Failed to run @QuarkusTest. Unsupported api 524288. After update quarkus plugin version when i run my test on intellij, it was returning
[error]: Build step io.quarkus.jsonb.deployment.JsonbProcessor#generateCustomizer threw an exception:
    java.lang.IllegalArgumentException: Unsupported api 524288
    at org.objectweb.asm.ClassVisitor.
[error]: Build step io.quarkus.vertx.http.deployment.HttpSecurityProcessor#setupAuthenticationMechanisms threw an exception:
    java.lang.IllegalArgumentException: Unsupported api 524288
[error]: Build step io.quarkus.smallrye.openapi.deployment.SmallRyeOpenApiProcessor#handler threw an exception:
    java.lang.IllegalArgumentException: Unsupported api 524288
    at org.objectweb.asm.ClassVisitor.<init>(ClassVisitor.java:70)
    at org.objectweb.asm.ClassVisitor.<init>(ClassVisitor.java:70)
[error]: Build step io.quarkus.deployment.steps.BootstrapConfigSetupBuildStep#setupBootstrapConfig threw an exception: java.lang.IllegalArgumentException: Unsupported api 524288
    at org.objectweb.asm.ClassVisitor.<init>(ClassVisitor.java:70)

My problem came after updating quarkus plugin version from 1.4.2.Final to 1.6.0.Final. And i dont know how to fix this. When come back to 1.4.2 everything is ok. In my case, update was needed to implement quarkus-smallrye-graphql. When i add that graphql dependency to my pom with 1.4.2 version, it says quarkus-smallrye-graphql dependency is missing. I had execute mvn clean install -U to update. but still saying missing.
But then i found that quarkus-graphql depency is successfully loaded when i update quarkus-plugin-version to 1.6.0.Final, but that is break all my testcase.
this is my test
package org.me.service;

import io.quarkus.hibernate.orm.panache.PanacheQuery;
import io.quarkus.test.junit.QuarkusTest;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.me.model.Nutrition;

import javax.inject.Inject;
import javax.transaction.Transactional;
import javax.ws.rs.core.Response;

import static org.junit.jupiter.api.Assertions.assertEquals;

@QuarkusTest
class NutritionServiceTest {

    @Inject
    NutritionService nutritionService;

    @AfterEach
    @Transactional
    public void tearDown() {
        Nutrition.deleteAll();
    }

    @Test
    void addNutritionCatalog_shouldSave_whenSuccessSendToDatabase() {
        Nutrition nutrition = Nutrition.builder()
                .name("nameee")
                .description("descriptionn")
                .build();

        final Response response = nutritionService.addNutritionCatalog(nutrition);
        final PanacheQuery<Nutrition> all = Nutrition.findAll();

        assertEquals(1, all.count());
        assertEquals(nutrition, response.getEntity());
    }
}

i think thats because of my dependecy. so, this is my pom file
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.me</groupId>
  <artifactId>catalog</artifactId>
  <version>1.0.0-SNAPSHOT</version>
  <properties>
    <compiler-plugin.version>3.8.1</compiler-plugin.version>
    <maven.compiler.parameters>true</maven.compiler.parameters>
    <maven.compiler.source>11</maven.compiler.source>
    <maven.compiler.target>11</maven.compiler.target>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <quarkus-plugin.version>1.6.0.Final</quarkus-plugin.version>
    <quarkus.platform.artifact-id>quarkus-universe-bom</quarkus.platform.artifact-id>
    <quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id>
    <quarkus.platform.version>1.6.0.Final</quarkus.platform.version>
    <surefire-plugin.version>2.22.1</surefire-plugin.version>
  </properties>
  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>${quarkus.platform.group-id}</groupId>
        <artifactId>${quarkus.platform.artifact-id}</artifactId>
        <version>${quarkus.platform.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-resteasy-jsonb</artifactId>
    </dependency>
    <dependency>
      <groupId>org.projectlombok</groupId>
      <artifactId>lombok</artifactId>
      <version>1.18.12</version>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-smallrye-openapi</artifactId>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.module</groupId>
      <artifactId>jackson-module-jaxb-annotations</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-smallrye-graphql</artifactId>
    </dependency>

    <!--    TEST    -->
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-junit5</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.rest-assured</groupId>
      <artifactId>rest-assured</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-junit5-mockito</artifactId>
      <version>1.4.1.Final</version>
      <scope>test</scope>
    </dependency>

<!--    DATABASE    -->
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-hibernate-orm-panache</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-jdbc-h2</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-liquibase</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-jdbc-postgresql</artifactId>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>io.quarkus</groupId>
        <artifactId>quarkus-maven-plugin</artifactId>
        <version>${quarkus-plugin.version}</version>
        <executions>
          <execution>
            <goals>
              <goal>build</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>${compiler-plugin.version}</version>
      </plugin>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${surefire-plugin.version}</version>
        <configuration>
          <systemProperties>
            <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
          </systemProperties>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <id>native</id>
      <activation>
        <property>
          <name>native</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-failsafe-plugin</artifactId>
            <version>${surefire-plugin.version}</version>
            <executions>
              <execution>
                <goals>
                  <goal>integration-test</goal>
                  <goal>verify</goal>
                </goals>
                <configuration>
                  <systemProperties>
                    <native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
                  </systemProperties>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
      <properties>
        <quarkus.package.type>native</quarkus.package.type>
      </properties>
    </profile>
  </profiles>
</project>

A: First, I would remove the version from the quarkus-junit5-mockito artifact.
Then you should check you don't have an old ASM version around in your dependency tree.

A: We hat the same issue using Quarkus version 1.6.1-Final.
There were no additional version attributes specified in the pom file for the Quarkus dependencies.
Removing the .idea directory and reimporting the whole project into IntelliJ IDEA resolved the issue for us.


text:
Q: Ensure less clears screen Is there a way to ensure less clears screen on exit?  The opposite of less -X.
The screen is not being cleared when I exit a man page in iTerm2, however the screen is cleared when using the default mac terminal.  Does anyone have suggestions?
$LESS is set to less -R

A: Normally less "clears the screen" (which probably refers to switching back to the normal screen from the alternate screen) when the terminal description has the appropriate escape sequence in the rmcup capability.
You would see a difference if you are using different values of TERM in the two programs.  The infocmp program can show differences for the corresponding terminal descriptions.
less also attempts to clear the remainder of the screen, but that depends upon whether anything was displayed, and if the output was a terminal (in contrast to a pipe).
Aside from the terminal description, some terminal emulators make it optional whether to allow the alternate screen. You may have selected that option at some point. (I'm testing with default configuration, which works as intended).

A: I would suggest if 'less' fails to clear the screen that you put:
function less(){
    less $@
    clear
}

in your ~/.profile or /.bashrc. Not sure if this will behave like you want in pipes, but for other purposes it should be okay.
One could add printf '\033[2J\033[H' to this, which should work on most terminals without relying on terminfo or other external references. It may not work everywhere, though. (Reference: https://tldp.org/HOWTO/Bash-Prompt-HOWTO/x361.html )
(Original answer was utterly wrong, my mistake. This one should actually work, but I can't change the existing downvotes :\)

A: Why not just clear the screen on exit?
man man; clear


text:
Q: How to deal with a response variable calculated from added percentages I am analyzing a data set where the response variable is the total non-native plant cover within a plot. There are non-native grasses and non-native herbaceous plants with overlapping canopies, so the response variable comes from adding together two percentages (percent cover in each layer within the plot).  Therefore, the variable is bounded between 0 and 200. I also have both random and fixed effects.
Can I run a linear mixed model with this response variable, or would that be invalid? Would a GLMM make more sense, and if so what type of distribution would fit?

A: With such a wide variation in the sum of proportions, You definitely need to worry about the variance changing.
If you had single proportions rather than a sum, and no zeros you could use a beta model.
A beta won't work with the zeros, unless you do a zero-inflated model. The big problem with the binomial approach on continuous proportions is the $n$, but if you put in some fixed number, the overdispersion parameter should take care of that.
The big problem with the sum is that you don't know if "99%" is "50%+49% or "99% + 0%" - and the implied variance of the two is vastly different.
If you have the individual proportions, then you can do it easily enough, as long as you can assume independence (the fact that they can sum to 200% suggests that might be possible)
It's hard to say much more without more details about your data.


text:
Q: Make each specific cell clickable in a HTML table in php I have a HTML table looking like the following:

                <svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-calendar" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5zM1 4v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4H1z"/></svg>
                <?php echo "" . date("l") . "
" . date("d.m.Y"); ?>
                <?php echo "" . date("l", strtotime("+1 day")). "
" . date("d.m.Y", strtotime("+1 day")); ?>
                <?php echo "" . date("l", strtotime("+2 day")). "
" . date("d.m.Y", strtotime("+2 day")); ?>
                <?php echo "" . date("l", strtotime("+3 day")). "
" . date("d.m.Y", strtotime("+3 day")); ?>

                Zeit
                Platz 1
                Platz 2
                Platz 3
                Platz 1
                Platz 2
                Platz 3
                Platz 1
                Platz 2
                Platz 3
                Platz 1
                Platz 2
                Platz 3

                08:00

                09:00

What I want to do is open a bootstrap modal when a cell is clicked, which can then be used to populate the cell. But for that I need to get the specific cell which is clicked somehow. I haven't found anything specific online, hopefully you can help me.
Cheers,
Zangerle

A: The javascript below will trigger some basic actions when a table cell is clicked - how that click event is handled is up to you but you would use the callback to run whatever routines you wish

const clickcallback=function(e){
    e.target.style.background='red';
    // alternatively you can use `this` to access the element in this instance
    alert(this)
}

document.querySelectorAll('table#reservationtable td').forEach( td=>{
    td.addEventListener('click',clickcallback)
})

            <svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-calendar" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5zM1 4v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4H1z"/></svg>
            <?php echo "" . date("l") . "
" . date("d.m.Y"); ?>
            <?php echo "" . date("l", strtotime("+1 day")). "
" . date("d.m.Y", strtotime("+1 day")); ?>
            <?php echo "" . date("l", strtotime("+2 day")). "
" . date("d.m.Y", strtotime("+2 day")); ?>
            <?php echo "" . date("l", strtotime("+3 day")). "
" . date("d.m.Y", strtotime("+3 day")); ?>

            Zeit
            Platz 1
            Platz 2
            Platz 3
            Platz 1
            Platz 2
            Platz 3
            Platz 1
            Platz 2
            Platz 3
            Platz 1
            Platz 2
            Platz 3

            08:00

            09:00


text:
Q: How to read Maven repository credentials only when needed? I have a Gradle Kotlin DSL script that publishes some artifacts to a local Maven repository:
    publishing {
        publications {
            create<MavenPublication>("maven") {
                groupId = "my.company"
                artifactId = project.name
                version = "0.0.1"
                from(components["java"])
            }
        }
        repositories {
            maven {
                url = uri("https://maven.mycompany.com/content/repositories/whatever")
                credentials {
                    username = (read from some file)
                    password = (read from some file)
                }
            }
        }
    }

As you can see, Gradle will always try to read the username and password from file. Even if the publish task isn't going to be executed.
I tried to fix it by moving the credentials to a doFirst block in the publish task, but the code is simply never executed:
publishing {
  doFirst { // this doesn't compile, doFirst doesn't exist here
  }
}
tasks.getByName("publish").doFirst {
  // this compiles just fine, but it's never executed
}
tasks.named("publish") {
  doFirst {
    // this compiles just fine, but it's never executed
  }
}

How do I set credentials so that it only happens when executing the publish task?

A: You are always configuring the credentials regardless if they are needed or not. You need to conditionally configure the credentials. This can be accomplished in many ways.
For example, let's say you never want to publish snapshot versions. Your build could look something like:
version = "0.0.1-SNAPSHOT"

publishing {
    publications {
        create<MavenPublication>("maven") {
            from(components["java"])
        }
        repositories {
            maven {
                url = uri("https://maven.mycompany.com/content/repositories/whatever")
                if (!version.toString().contains("SNAPSHOT")) {
                    credentials {
                        username = property("username") as String
                        password = property("password") as String
                    }
                }
            }
        }
    }
}

Notice the conditional. During the configuration phase, Gradle will evaluate that condition and skip credentials { } because the version contains SNAPSHOT.
As I said, there are a variety of ways you can do the above. However, the best way is to use environment variables:
publishing {
    publications {
        create<MavenPublication>("maven") {
            from(components["java"])
        }
        repositories {
            maven {
                url = uri("https://maven.mycompany.com/content/repositories/whatever")
                credentials {
                    username = System.getenv()["username"]
                    password = System.getenv()["password"]
                }
            }
        }
    }
}

No conditions whatsoever. null is an acceptable value for the credentials and doesn't matter during the configuration phase. It only matters when you publish is when you will get a NullPointerException


text:
Q: IDEA(Ultimate v.14.0) with scala plugin(v.1.1.1) do not compile test classes Today I have updated the scala-plugin to v.1.1.1 in IDEA Ultimate v.14.0 and now I can't execute tests via IDEA.
I get an exception: java.lang.ClassNotFoundException: models.HelloWorldSpec
I noticed that test classes do not appears in 'target/scala-2.10/test-classes' after compilation via IDEA. But all good when I execute 'sbt clean compile test' in the console.

A: This is resolved in release 1.1.2 of the IntelliJ Scala plugin, as of 21st November:
https://plugins.jetbrains.com/update/index?pr=&updateId=17896


text:
Q: Cannot successfully start WAR file on server I've got a successfully compiled project which I want to run on a server.
Its a grails project and I tried to run it on a server
Here is the error from tomcat:
http://i.imgur.com/BLRjxZR.png
http://i.imgur.com/lKFSOxD.png
Catalinga.log:
2-apr-2014 14:43:45 org.apache.catalina.core.AprLifecycleListener init
INFO: Loaded APR based Apache Tomcat Native library 1.1.27 using APR version 1.4.6.
2-apr-2014 14:43:45 org.apache.catalina.core.AprLifecycleListener init
INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
2-apr-2014 14:43:46 org.apache.catalina.core.AprLifecycleListener initializeSSL
INFO: OpenSSL successfully initialized with version OpenSSL 1.0.1d 5 Feb 2013
2-apr-2014 14:43:46 org.apache.coyote.http11.Http11AprProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
2-apr-2014 14:43:46 org.apache.coyote.ajp.AjpAprProtocol init
INFO: Initializing Coyote AJP/1.3 on ajp-8009
2-apr-2014 14:43:46 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1158 ms
2-apr-2014 14:43:46 org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
2-apr-2014 14:43:46 org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.39
2-apr-2014 14:43:46 org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor host-manager.xml
2-apr-2014 14:43:46 org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor manager.xml
2-apr-2014 14:43:46 org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive bba.war
2-apr-2014 14:44:15 org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
2-apr-2014 14:44:15 org.apache.catalina.core.StandardContext start
SEVERE: Context [/bba] startup failed due to previous errors
2-apr-2014 14:44:18 org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory docs
2-apr-2014 14:44:18 org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory examples
2-apr-2014 14:44:18 org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory ROOT
2-apr-2014 14:44:19 org.apache.coyote.http11.Http11AprProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
2-apr-2014 14:44:19 org.apache.coyote.ajp.AjpAprProtocol start
INFO: Starting Coyote AJP/1.3 on ajp-8009
2-apr-2014 14:44:19 org.apache.catalina.startup.Catalina start
INFO: Server startup in 32751 ms
2-apr-2014 14:44:49 org.apache.coyote.http11.Http11AprProtocol pause
INFO: Pausing Coyote HTTP/1.1 on http-8080
2-apr-2014 14:44:49 org.apache.coyote.ajp.AjpAprProtocol pause
INFO: Pausing Coyote AJP/1.3 on ajp-8009
2-apr-2014 14:44:50 org.apache.catalina.core.StandardService stop
INFO: Stopping service Catalina
2-apr-2014 14:44:51 org.apache.coyote.http11.Http11AprProtocol destroy
INFO: Stopping Coyote HTTP/1.1 on http-8080
2-apr-2014 14:44:51 org.apache.coyote.ajp.AjpAprProtocol destroy
INFO: Stopping Coyote AJP/1.3 on ajp-8009

Localhost log:
2-apr-2014 14:43:48 org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
2-apr-2014 14:44:18 org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
2-apr-2014 14:44:18 org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
2-apr-2014 14:44:51 org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextDestroyed()
2-apr-2014 14:44:51 org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextDestroyed()

And the stacktrace.log is empty.
How to fix it?


text:
Q: scala : case class and how to organize I want to store information of an open project in a web based project that denotes CSV-like data.
I have
 case class Project(user:String, sessionId : String, fileOpen : String, commands:ArrayBuffer[Command])

Question : will commands that have different elements change affect the meaning of equals?
If I do not want commands to take part in equals and hash code and don't want to over ride those methods too, can I declare commands after the class declaration  :
case class Project(user:String, sessionId : String, fileOpen : String) ...{
     val commands:ArrayBuffer[Command]

Any other way to tell the compiler not to use it in the equals and hascode?

A: override equals to only compare the required fields for equality check and ignore commands.
Do not use ArrayBuffer instead use immutable solution.
If you want add commands to a exisiting Project instance use copy to do that
val newProject = project.copy(commands = Command("ls") :: project.commands)

assuming command is declared like this case class Command(name: String)
Overriding equals and hashCode
case class Project(user:String, sessionId : String, fileOpen : String, commands: List[Command]) {
  override def equals(obj: scala.Any): Boolean = obj match {
    case obj: Project => this.user == obj.user && this.sessionId == obj.sessionId && this.fileOpen == obj.fileOpen
    case _ => false
  }
  override def hashCode(): Int = 1013 * user.hashCode + 1009 * sessionId.hashCode + 1003 * fileOpen.hashCode
}


text:
Q: How to transfer table column into array? I want to separate table column into array format like this:
{[A,B,C],[A,B,C],[A,B,C],[A,B,C]}
Now I only know how to transfer table row into string:
A,A,A,A,B,B,B,B,C,C,C,C
How to set table column into array?
My code below here:

$(function(){

    var letters = $("#selectable td").map(function() {
       return $(this).text();
  }).get();
    console.log(letters);
});
#selectable tr .ui-selected{
  background: #F39814;
  color: white;
}
#selectable{
  list-style-type: none;
  margin: 0;
  padding: 0;
  width: 450px;
}
#selectable td{
  margin: 3px;
  padding: 1px;
  float: left;
  width: 100px;
  height: 80px;
  font-size: 4em;
  text-align: center;
}
#selectable th{
  margin: 3px;
  padding: 1px;
  float: left;
  width: 100px;
  height: 20px;
  font-size: 1em;
  text-align: center;
}

<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">

1
2
3
4

  A
  A
  A
  A

  B
  B
  B
  B

  C
  C
  C
  C

A: Try this:

$(function(){

    var letters = [];
    $("#selectable tr.content").each(function() {
  letters.push($(this).find('td').map(function() {
       return $(this).text();}).get());
 });
    console.log(JSON.stringify(letters));
});
#selectable tr .ui-selected{
  background: #F39814;
  color: white;
}
#selectable{
  list-style-type: none;
  margin: 0;
  padding: 0;
  width: 450px;
}
#selectable td{
  margin: 3px;
  padding: 1px;
  float: left;
  width: 100px;
  height: 80px;
  font-size: 4em;
  text-align: center;
}
#selectable th{
  margin: 3px;
  padding: 1px;
  float: left;
  width: 100px;
  height: 20px;
  font-size: 1em;
  text-align: center;
}

<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">

  1
  2
  3
  4

  A
  A
  A
  A

  B
  B
  B
  B

  C
  C
  C
  C

A:

$(function(){
    var letters = []
    $('#selectable tr').map(function(index_tr, item_tr){
        $(item_tr).find('td').map(function(index_td, item_td){
            letters[index_td] = letters[index_td] || []
            letters[index_td].push($(item_td).text())
     })
    })
    alert(JSON.stringify(letters))
});
#selectable tr .ui-selected{
  background: #F39814;
  color: white;
}
#selectable{
  list-style-type: none;
  margin: 0;
  padding: 0;
  width: 450px;
}
#selectable td{
  margin: 3px;
  padding: 1px;
  float: left;
  width: 100px;
  height: 80px;
  font-size: 4em;
  text-align: center;
}
#selectable th{
  margin: 3px;
  padding: 1px;
  float: left;
  width: 100px;
  height: 20px;
  font-size: 1em;
  text-align: center;
}

1
2
3
4

  A
  A
  A
  A

  B
  B
  B
  B

  C
  C
  C
  C


text:
Q: Stuck with excel function with SUMIF and concatenate I found a nice tutorial on making burndown and burnup charts. I just cant get the same functions to work no matter what I try. Seems like there is a difference between excel 2007 and 2010 on how the function must be written??
The tutorial: http://rapidapplicationdevelopment.blogspot.com/2010/02/video-how-to-create-burndown-charts-for.html
Basically im just trying to add numbers. Each row have column with a random number and a column that shows the total of the numbers until that row. So the last row will show the total of all the numbers. Row number 5 will only show the total of the numbers from row 1, 2, 3, 4 and 5. I hope it makes sense :)
The function according to the tutorial:
=SUMIF([Created Date],CONCATENATE("<=",Table_owssvr_1[[#This Row],[Released]]),[Points])

But when I paste it into my own excel workbook it gives an error. From what I can see, I have to change the "," with ";". The "#This Row" is not regonized but my best guess is that it has to be replaced with "@".
This is as close as I can get:
=SUMIF([Oprettet dato]; CONCATENATE("<=";Table2[@];[Sprint start]);[Estimat])

Is it because of the difference between 2007 and 2010 or am I just too much of a noob?? :)

A: In Office 2010 the [#This Row] notation has been condensed to improve the user experience.  The [#This Row] notation has been replaced with an @ notation in formulas and, where possible, the requirement for explicit table name references in the formula have been removed.
=SUMIF([Oprettet Date]; CONCATENATE("<=";[@Sprint start]);[@Estimat])

Note, using ; enstead of , is regional settings specific

In responce to comment: sorry, an extra row ref slipped in, try this
=SUMIF([Oprettet Date]; CONCATENATE("<=";[@Sprint start]);[Estimat])


text:
Q: Dynamic Forms that add more content on selection I'm not sure exactly what it is called, but I would really like to have a form where there are two radio buttons at the bottom, saying do you have a client yes/no, and if they click on yes, another bit of the form appears. here is the code from the file, it is PHP.

<?php
if (isset($_REQUEST['email']))
//if "email" is filled out, send email
{
//send email
$to = "email" ;
$subject = "New Enquiry" ;
$name = $_REQUEST['name'] ;
$email = $_REQUEST['email'] ;
$address = $_REQUEST['address'] ;
$address2 = $_REQUEST['address2'] ;
$postcode = $_REQUEST['postcode'] ;
$city = $_REQUEST['city'] ;
$tel = $_REQUEST['tel'] ;
$tel2 = $_REQUEST['tel2'] ;
$club = $_REQUEST['club'] ;
$which = ", " . $_REQUEST['which'] ;
$passdetails = $_REQUEST['updates'] ;
$cname = $_REQUEST['cname'] ;
$ctel = $_REQUEST['ctel'] ;
$cloan = $_REQUEST['cloan'] ;
$creasons = $_REQUEST['creasons'] ;
$message = "Name: " . $name . "\n Email: " . $email . "\n Address: " . $address . ", " .     $address2 . "\n Postcode: " . $postcode . "\n City: " . $city . "\n Telephone Number: " . $tel . "\n Alternative Number: " . $tel2 . "\n Member of a club?: " . $club . $which . "\n Can use details: " . $passdetails . "\n" . "\n Client Details (Optional): " . "\n" . "\n Client Name: " . $cname . "\n Client Telephone Number: " . $ctel . "\n Loan Amount: " . $cloan . "\n Reasons for loan: " . $creasons ;
$from = "Introducer Registration" ;

mail($to,$subject,$message,"From: " . $from) ;

echo "
Thank you for using our enquiry form, a member of the team will contact you as soon as they can.
";
}
else
//if "email" is not filled out, display the form
{
echo "<form action='register.php' method='post' style='width:21cm;font-family:helvetica;font-size:12px;'>

* = required

Name*Email*

<input type='text' style='width:10cm;padding-top:4px;' name='name' />
<input type='text' style='width:10cm;padding-top:4px;margin-left:10px;' name='email' />

Address Line One*Address Line Two

<input type='text' style='width:10cm;padding-top:4px;' name='address' />
<input type='text' style='width:10cm;padding-top:4px;margin-left:10px;' name='address2' />

Town/CityPostcode*

<input type='text' style='width:10cm;padding-top:4px;margin-bottom:0px;' name='city' />
<input type='text' style='width:10cm;padding-top:4px;margin-left:10px;' name='postcode' />

Phone Number*Alternative Number

<input type='text' style='width:10cm;padding-top:4px;margin-bottom:0px;' name='tel' />
<input type='text' style='width:10cm;padding-top:4px;margin-left:10px;margin-bottom:0px;' name='tel2' />

Are you a member of a club?*If yes, which club?

<input type='radio' name='club' value='Yes' style='margin-top:-10px;' />Yes
<input type='radio' name='club' value='No' />No
<input type='text' name='which' style='font-family:source sans pro;color:#000000;;width:10cm;margin-left:320px;margin-top:0px;' />

<input type='hidden' name='updates' value='Yes' />
<input type='checkbox' name='updates' value='No'/>*If you DO NOT wish to be contacted by affiliated companies with potentially helpful products and services, please tick this box.

<h9 style='font-size:14px;'>Enter Client Details for assessment (optional)</h9>

NamePhone Number

<input type='text' style='font-family:source sans pro;color:#000000;width:10cm;padding-top:4px;' name='cname' />
<input type='text' style='font-family:source sans pro;color:#000000;width:10cm;padding-top:4px;margin-left:10px;' name='ctel' />

Loan AmountReasons for loan

<input type='text' style='font-family:source sans pro;color:#000000;width:10cm;padding-top:4px;' name='cloan' />
<input type='text' style='font-family:source sans pro;color:#000000;width:10cm;padding-top:4px;margin-left:10px;' name='creasons' />

<input style='margin-left:713px;padding:0;' type='submit' value='Submit' />

</form>";
}
?>

Before the "enter client details for assessment, i really want to have it so they can choose whether or not they have them, and then a form drops down if they do, but it all gets sent via email, and i would like it so they are ll on the same email.
Thanks for your help!

A: Put the "enter client details for assessment" section in a DIV and set the CSS for this DIV to be:
display:none

This will hide it from view.
Put an onclick in the 'Yes' radio element so that when it is selected, a JavaScript function is run that would change the style of the div to:
display:inline

You would then want to add another onclick to the 'No' radio element, so that if that one is selected, it turns the display back to hidden.


text:
Q: How can i catch mouse wheel direction using famo.us scrollSync? I want to know wheel direction using "famo.us" scrollSync.
but i can't search exact solution.
my code is below. please give me a solution.

var Engine     = require("famous/core/Engine");
var Surface    = require("famous/core/Surface");
var ScrollSync = require("famous/inputs/ScrollSync");
var mainContext = Engine.createContext();
var start = 0;
var update = 0;
var end = 0;
var scrollSync = new ScrollSync(function() {
    return [0,0];
});
Engine.pipe(scrollSync);
var contentTemplate = function() {
    return "
Start Count: " + start + "
" +
    "
End Count: " + end + "
" +
    "
Update Count: " + update + "
";
};
var surface = new Surface({
    size: [undefined, undefined],
    classes: ['grey-bg'],
    content: contentTemplate()
});
scrollSync.on("start", function() {
    surface.setContent(contentTemplate());
});
scrollSync.on("update", function(data) {
    surface.setContent(contentTemplate());
});
scrollSync.on("end", function() {
    surface.setContent(contentTemplate());
});
mainContext.add(surface);

A: There are a couple things I did to get your code to work. First just use surface.pipe(scrollSync) to get events scroll sync, and next, actually update the variables for start, update, and end. I also added a direction variable where I inspect the delta property of the event to determine the direction you are moving your mousewheel.
Here is the example.. Hope it helps!
var Engine     = require("famous/core/Engine");
var Surface    = require("famous/core/Surface");
var ScrollSync = require("famous/inputs/ScrollSync");
var mainContext = Engine.createContext();

var start = 0;
var update = 0;
var end = 0;
var direction = undefined;

var scrollSync = new ScrollSync();

var contentTemplate = function() {
    return "
Start Count: " + start + "
" +
    "
End Count: " + end + "
" +
    "
Update Count: " + update + "
" +
    "
Direction: " + direction + "
";
};
var surface = new Surface({
    size: [undefined, undefined],
    classes: ['grey-bg'],
    content: contentTemplate()
});

surface.pipe(scrollSync);

scrollSync.on("start", function() {
    start += 1;
    surface.setContent(contentTemplate());
});
scrollSync.on("update", function(data) {
    update += 1;
    delta = data['delta'];
    direction = delta[0] == 0 ? (delta[1] > 0 ? "down" : "up") : (delta[0] > 0 ? "right" : "left") ;
    surface.setContent(contentTemplate());
});
scrollSync.on("end", function() {
    end += 1;
    surface.setContent(contentTemplate());
});
mainContext.add(surface);


text:
Q: How to Navigate through the table inside a fieldset There will be a Table inside a Fieldset, I am using below code to access that table. But it is not working.
 $('Fieldset_A TABLE TBODY TR').each(function()
  {
     .......
  }

My HTML Code is like this

<fieldset id="Fieldset_A">

.............

Please someone help me.

A: assuming fieldset_A is an id you need to identify it as such like so
 $('#Fieldset_A TABLE TBODY TR').each(function()....

if it is a class then
$('.Fieldset_A TABLE TBODY TR').each(function()

Working Demo


text:
Q: How to make google transliteration happens on keyup event instead of space bar click After page loads for the first time, if I select any other language in dropdown, it is giving malayalam language instead of elected language, but after selecting the same or another language for the second time, it is translating correctly. Can anyone please help me to solve this.
My code:

        <form>

            <input type="textbox name="ta"  rows="6"  id="language" cols="6" style="width:600px;height:218px" ></input>
        </form>


text:
Q: Clearing input-map of a JSplitPane I chased down some keyboard problems to JSplitPane eating my cursor keys for WHEN_ANCESTOR_OF_FOCUSED_COMPONENT. I saw those entries in the step debugger. But when is the input map actually populated? Because if I try to clear it, there is nothing there...
val sp = new javax.swing.JSplitPane(orient, left, right)
val map = sp.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
map.clear()

Then that map is already empty. So it must be filled at a later point?

A: While it doesn't directly answer my question, it solves my problem:
UIManager.getDefaults.remove("SplitPane.ancestorInputMap")


text:
Q: Output Net::HTTP request to human readable form I am trying to debug a request that I am making to a server, but I can't figure out what is wrong with it, as it seems to be just like the request that I am putting through on RESTClient.
I am initializing it like so:
request = Net::HTTP::Post.new(url.to_s)
request.add_field "HeaderKey", "HeaderValue"
request.body = requestBody

and then I am executing it like so:
Net::HTTP.start(url.host, url.port) do |http|
  response = http.request(request)
end

The requestBody is a string that is encoded with Base64.encode64.
Is there a way to output the request to see exactly where it's going and with what contents? I've used Paros for checking my iOS connections and I can also output a description of requests from most platforms I've worked with, but I can't figure it out for Ruby.

A: I've found that HTTP Scoop works pretty well for grabbing network traffic (disclaimer - it's not free!)


text:
Q: Como chamar uma classe dentro de uma função Eu tenho a seguinte estrutura de pastas
/THEME
      /vendor
        autoload.php
        /composer
          files of composer
        /jflight
           /gacookie
              /src
              /tests
              other files
  composer.json
  composer.lock
  function.php

dentro de src, tem a classe:
Utmz.php
    <?php namespace Jflight\GACookie;

use Jflight\GACookie\ParseInterface;

class Utmz extends Cookie
{
    /**
     * Timestamp
     * @var string
     */
    public $timestamp;

    /**
     * Session count
     * @var string
     */
    public $session_count;

    /**
     * Campaign number
     * @var string
     */
    public $campaign_number;

    /**
     * Source
     * @var string
     */
    public $source;

    /**
     * Medium
     * @var string
     */
    public $medium;

    /**
     * Campaign
     * @var string
     */
    public $campaign;

    /**
     * Term
     * @var string
     */
    public $term;

    /**
     * Content
     * @var string
     */
    public $content;

    /**
     * Maps the string values in the cookie to the properties of the Utmz object
     * @var array
     */
    protected $keyMappings = array(
                        'utmcsr' => 'source',
                        'utmcmd' => 'medium',
                        'utmccn' => 'campaign',
                        'utmctr' => 'term',
                        'utmcct' => 'content'
                        );

    /**
     * Constructor
     * @param DateTimeImmutable $date
     */
    public function __construct(\DateTime $date)
    {
        $this->date = $date;
    }

    /**
     * Parse cookie string and assign properties to this
     * @param  string $cookie The string from inside the cookie
     * @return static
     */
    public function parse($cookie)
    {
        $cookieBits = explode('.', $cookie, 5);
        $this->timestamp = $this->date->createFromFormat('U', $cookieBits[1]);
        $this->session_count = (integer) $cookieBits[2];
        $this->campaign_number = (integer) $cookieBits[3];
        $array = $this->paramsToArray($cookieBits);
        $this->setExtras($array);
        return $this;
    }

    /**
     * Logic for setting the extras values from the cookie as object properties
     * @param array $array
     */
    protected function setExtras($array)
    {
        if (is_array($array))
        {
            foreach ($array as $key => $item)
            {
                if (array_key_exists($key, $this->keyMappings))
                {
                    $property = $this->keyMappings[$key];
                    $this->$property = $item;
                }
            }
        }
    }

    /**
     * Logic for splitting the extra properties from string to array
     * @param  string $cookie
     * @return array
     */
    protected function paramsToArray($cookie)
    {
        if (isset($cookie[4]))
        {

            $pairs = explode('|', $cookie[4]);

            foreach ($pairs as $pair)
            {
                $item = explode('=', $pair);

                $return[$item[0]] = $item[1];
            }

            return $return;
        }
    }
}

no arquivo function.php que esta na raiz adicionei:
require_once dirname(__FILE__).'/vendor/autoload.php';

function get_data_cookies(){

            // COMO EU CHAMO A CLASSE AQUI, QUE ESTA NO DIRETÓRIO /src/Utmz.php???

            // utmz

            $utmz->timestamp; // DateTime
            $utmz->session_count; // Integer
            $utmz->campaign_number; // Integer
            $utmz->source; // string
            $utmz->medium; // string
            $utmz->campaign; // string
            $utmz->term; // string
            $utmz->content; // string

}

Como eu chamo a classe dentro da função get_data_cookies?
----------------- ATUALIZAÇÃO ----------
require get_template_directory().'/vendor/autoload.php';

use Jflight\GACookie\GACookie;

function get_cookies(){

    $utma = GACookie::parse('utma');
    $utmz = GACookie::parse('utmz');
    var_dump( $utma );
    var_dump( $utmz );

                    //utma

             $args = $utma->time_of_first_visit; // DateTime
             $args = $utma->time_of_last_visit; // DateTime
             $args = $utma->time_of_current_visit; // DateTime
             $args = $utma->session_count; // Integer

            // utmz

             $args = $utmz->timestamp; // DateTime
             $args = $utmz->session_count; // Integer
             $args = $utmz->campaign_number; // Integer
             $args = $utmz->source; // string
             $args = $utmz->medium; // string
             $args = $utmz->campaign; // string
             $args = $utmz->term; // string
             $args = $utmz->content;  // string

}

no corpo da mensagem do formulario de contatos onde estou tentando usar esses dados inseri:
<?php get_cookies() ?>

mas isso retorna
bool(false)bool(false)

A: A classe Utmz da biblioteca Jflight/GACookie precisa ser instanciada e precisa de uma string que representa o cookie do Google Analytics para inicializar. Não sei o contexto que está utilizando essa biblioteca, mas tente isso:
require_once dirname(__FILE__).'/vendor/autoload.php';

use \Jflight\GACookie\Utmz;

function get_data_cookies(){
  $utmz = new Utmz(new Datetime());
  $utmz->parse("GA1.2.1640324400.1505291004.utmcct=testando|utmcsr=teste");

  $utmz->timestamp; // DateTime
  $utmz->session_count; // Integer
  $utmz->campaign_number; // Integer
  $utmz->source; // string
  $utmz->medium; // string
  $utmz->campaign; // string
  $utmz->term; // string
  $utmz->content; // string
}

Contudo, leia o arquivo README.md da biblioteca que tem exemplos de uso bem claros: https://github.com/jamesflight/Google-Analytics-Cookie-Parser-PHP


text:
Q: how to exit a program when a given openmp thread finishes I have some logging software that I've written to capture Images from multiple Point Grey cameras, a GPS and a Phidget sensor.
I've used OpenMP to offload different tasks to different threads. They are the following...

*

*Thread 3 - Update GPS values (stored in a struct)

*Thread 2 - Update Phidget values (stored in a struct)

*Thread 1 - Grab Images and the latest values from the GPS and Phidget structs

When the program is running it displays the images, gps and accelerometer data fine. I hit the 'L' key and the logging of the data works correctly.
The Problem
I press the 'x' key to set the grabimgs to false to exit the while loop in thread 1. This stops the images being updated. I was hoping this would also update the variable in the other threads and they would also stop... but they don't.
This is the bit I don't understand, I can share data obtained in the other threads (Phidget and GPS data) with thread 1. As soon as new images are obtained from the camera the latest values of the accelerometer and GPS are dumped to a file.
int main() {
    //connection flags
    bool cameras_connected  = false;
    bool phidget_connected  = false;
    bool GPS_connected      = false;
    if (cap.ConnectCameras()) {
        cout << "Connected to FireFly cameras" << endl;
        cameras_connected = true;
    }
    if (GPS.isReady()) {
        cout << "Connected to GPS" << endl;
        GPS_connected = true;
    }
    if (Phid.connectPhidget()) {
        cout << "Connected to Phidget" << endl;
        phidget_connected = true;
    }

bool grabimgs = true;
#pragma omp parallel sections shared(GPSData,PhidgetData,grabimgs,cameras_connected,phidget_connected,GPS_connected)
{
    //---- THREAD 1 ----
    // Camera Capture Thread
    #pragma omp section
    {
        while(grabimgs) {
            vector<cv::Mat> Images;
            if(cap.GrabMats(Images)) {
                //do imshow and logging bits
                //GPS and Phidget data is written and displayed from here
                char key = cv::waitKey(1000/30);
                if (key=='x'){
                    grabimgs = false;
                    doLogging = false;
                }
            }
        }
    }   //END OF THREAD 1

    //---- THREAD 2 ----
    //Phidget Capture Thread
    #pragma omp section
    {
        if (phidget_connected) {
            while(grabimgs) {
                cout << "grabimgs in thread 2 = " << grabimgs << endl;
                //get Phidget data
                Phid.updateReadings(PhidgetData);
            }
        }
    }   //END OF THREAD 2

    //---- THREAD 3 ----
    //GPS Capture Thread
    #pragma omp section
    {
        if(GPS_connected) {
            while(grabimgs) {
                cout << "grabimgs in thread 3 = " << grabimgs << endl;
                //get GPS Data
                GPS.update(GPSData,FORCE_UPDATE);
            }
        }
    }   //END OF THREAD 3
}// end of OMP
return 1;

}
So why can't I use the grabimgs to instruct the other threads to stop?
I'm using C++ on Win7 x64, Visual Studio 2010.

A: You should flush the variable to synchronize it with the other threads: flush(grabimgs).
See also https://computing.llnl.gov/tutorials/openMP/#FLUSH


text:
Q: VLOOKUP to check if a value exists in a cell I have data like this in a column:
John L. Doe
Jane N. Doe
Michael A. Doe

I'm trying to match the entries against another column with this format.
doe, jane
doe, john
doe, michael

I've tried VLOOKUP's for the lastname and using wildcards:
VLOOKUP("*" & A1 & "*",B:B,2, FALSE)
but I'm getting #N/A as a result.

A: If your columns are labelled, then in C2 and copied down to suit:
=MATCH(TEXT(MID(B2,FIND(" ",B2)+1,LEN(B2))&"*"&LEFT(B2,FIND(",",B2)-1),"@"),A:A,0)

should return the row number of a match in ColumnA for the value in ColumnB that is in the same row as the formula result.
To match "the other way around" is very similar, and as it happens for the example the results the same:
  =MATCH(TEXT(MID(A2,FIND(" ",A2,FIND(" ",A2)+1)+1,LEN(A2))&"*"&LEFT(A2,FIND(" ",A2)-1),"@"),B:B,0)


text:
Q: How to make Adobe PDFMaker (Acrobat Pro XI) working with Microsoft Office 2007 using winetricks? I have installed Microsoft Office 2007 with help of this answer using WineTricks.
I need to integrate Adobe Acrobat Pro XI into Word to produce high quality PDFs.
So I have a question - how to make Acrobat PDFMaker working on Ubuntu using Wine?
And please do not suggest me to use LibreOffice for this purpose. There are some use-cases where Acrobat Pro is needed.

A: One can install Adobe Acrobat Pro XI by the method similar to the MathType installation (to the same WINEPREFIX) and following this answer about Acrobat Pro by steps below:
wget https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks
export WINEPREFIX=~/.local/share/wineprefixes/office2007pro
sh ./winetricks msxml3 msxml6 wininet ie8 vcrun6 atmlib
wine SETUP.EXE

Then it will add Acrobat panel to the Word 2007 ribbon:

and clicking Create PDF will start PDF creation process with progress bar window

and will finish by showing PDF document.
Note: method is fully-functional, but embedded Mathtype equations look weird in resulting PDF document.