text:
Q: What can cause IllegalMonitorStateException in the given sample code I am trying to learn java concurrency programming. Kindly check my sample code and help me understanding why I'm getting "java.lang.IllegalMonitorStateException" even though I have called wait() and notify in a synchronized context.
public class Test {

    public static void main(String[] args) throws Exception {
        Test t1 = new Test();
        t1.m1();
    }

    private void m1() {
        Example ex = new Example();
        Thread t1 = new Thread(ex);
        t1.start();
        synchronized (ex) {
            System.out.println("waiting");
            try {
                wait();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }

    public class Example implements Runnable {
        @Override
        public void run() {
            System.out.println("Running");
            notifyMethod();
        }

        private void notifyMethod() {
            System.out.println("Notifying");
            synchronized (this) {
                try {
                    Thread.sleep(1000);
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
                notify();
            }
        }
    }
}

I expect out of "waiting,running,notifying" but the actual output is:
waiting
Running
java.lang.IllegalMonitorStateException
Notifying
    at java.lang.Object.wait(Native Method)
    at java.lang.Object.wait(Object.java:502)
    at examples.Test.m1(Test.java:18)
    at examples.Test.main(Test.java:8)

A: First of, I think synchonizing on a Runnable isn't a good idea (Example in your case). You either synchonize on this or, even better, on a dedicated Object, that is lock in my example. Edit: Synchronizing on a Runnable is the same as using this but for me it looks better. Guts tell me there might be something more to that, but I'm not an expert in this field. Dedicated lock Object is always better, read this article if you want to find out more on the topic.
Then, while synchonizing on a lock, you have to call wait() on that same object: lock.wait(). If you synchronize on this, then you call this.wait() or just wait().
When you want to notify the waiting thread, you again have to synchronize on the lock and call notify() on that object: lock.notify(). Both the monitor in the synchronize and the object on which you call notify() have to be the exact same object you have called wait() on.
Here is a code that works:
public class Test {
  public static final Object lock = new Object();

    public static void main(String[] args) throws Exception {
        Test t1 = new Test();
        t1.m1();
    }

    private void m1() {
        Example ex = new Example();
        Thread t1 = new Thread(ex);
        t1.start();
        synchronized (lock) {
            System.out.println("waiting");
            try {
                lock.wait();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }

    public static class Example implements Runnable {
        @Override
        public void run() {
            System.out.println("Running");
            notifyMethod();
        }

        private void notifyMethod() {
            System.out.println("Notifying");
            synchronized (lock) {
                try {
                    Thread.sleep(1000);
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
                lock.notify();
            }
        }
    }
}


text:
Q: Select all columns except primary key in MySQL How can I select all columns except the primary key from a table? It should be noted that I don't know field names in this table, the operation should be able to run automatically.
Thank you for the help.

A: Use:
To get All columns Without primary use
 SELECT `COLUMN_NAME` FROM `information_schema`.`COLUMNS` WHERE (`TABLE_SCHEMA` = 'wpresstest') AND (`TABLE_NAME` = 'wp_countries') AND (`COLUMN_KEY` <> 'PRI')

See you cant do all using simple SQL.So
Either use mysql Prepare Execute statement Or use PHP way like:
1)This would be your 1st Query as above.You will get All column names Excluding primary.OK?
2)Now fetch the resulted array in PHP.and build dynamic query for Comma separated Column names you just got.
3)Now fire 2nd query to fetch ROWS .Here you will include SELECT (Column1,Column2) from TBL.
And after getting column names , you can fire query to return Result based on Returned columns

redpajama_set_name: RedPajamaStackExchange


text:
Q: Move list items with current state Is it possible for an item to be moved to another list with its current state?
For example, I have an item with a running Workflow. When I move it, will it still have the same state?
Thanks!

A: You may apply a workaround for the above requirement. Create a column in the source list named 'Is Moved' and type 'Yes/No' and set the default value as 'No'. Run a workflow to copy the list item from Source list to destination list. Once the item is copied, update the field 'Is Moved' to 'Yes' for that item using the same workflow. You may modify the view of the list to display the list items for which 'Is Moved' field value is not equals to 'Yes'.


text:
Q: Combobox value hiding when add New record in datagridview vb.net
Hiding previous row value
Previous combobox data is hiding in datagridview when enter new row in datagridview using vb.net, and I want to know how to do cascading combox in datagridview combobox
Private Sub dgsalorder_CellValueChanged(sender As Object, e As DataGridViewCellEventArgs)Handles dgsalorder.CellEnter

If e.RowIndex >= 0 Then

        Dim i As Integer = dgsalorder.CurrentRow.Index

        Dim styleval = dgsalorder.Rows(i).Cells(1).Value
      If Convert.ToBoolean(dgsalorder.Rows(i).Cells(0).Value) = True Then
                If styleval > 0 Then
                    Dim mysqlda As New SqlDataAdapter
                    Dim mysqldt As New DataTable

                    mysqlda = New SqlDataAdapter("select id,BrandID,ColorID,PackID,SizeMasterID,Pairpercarton,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14,s15,s16,s17,s18,s19,s20,s21,s22,s23,s24,s25,s26,s27,s28,s29,s30 from StyleMaster where Id='" & styleval.ToString & "'", con)
                    mysqlda.Fill(mysqldt)
                    If mysqldt.Rows.Count > 0 Then
                        brand = mysqldt.Rows(0)(1).ToString()
                        color = mysqldt.Rows(0)(2).ToString()
                        Pack = mysqldt.Rows(0)(3).ToString()
                        Size = mysqldt.Rows(0)(4).ToString()
                        totalqty = mysqldt.Rows(0)(5).ToString()
                     Dim strQuery As String = "select id,BrandName from BrandMaster where id='" + brand.ToString + "'"
                        lblbrands.DisplayMember = "_Value"
                        lblbrands.ValueMember = "_Key"
                        lblbrands.DataSource = getcombobox(strQuery)

                        Colorcolumn = DirectCast(dgsalorder.Columns("lblcolors"), System.Windows.Forms.DataGridViewComboBoxColumn)
                        Dim strQuery1 As String = "select id,ColorCode from ColorMaster where id='" + color.ToString + "'"
                        Colorcolumn.DisplayMember = "_Value"
                        Colorcolumn.ValueMember = "_Key"
                        Colorcolumn.DataSource = getcombobox(strQuery1)

 end sub

A: Here is an example of filtering a second combo box column based on the selection in the first combo box column in the same row. The column is bound to the full list of possible values, so any value in every cell is valid. When editing a cell, the editing control is bound to a partial list that is filtered appropriately.
Public Class Form1

    Private ReadOnly data As New DataSet
    Private ReadOnly categoryTable As DataTable = data.Tables.Add("Category")
    Private ReadOnly subcategoryTable As DataTable = data.Tables.Add("Subcategory")
    Private ReadOnly mainTable As DataTable = data.Tables.Add("Main")

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        With categoryTable.Columns
            .Add("CategoryId", GetType(Integer))
            .Add("Name", GetType(String))
        End With

        With categoryTable.Rows
            .Add(1, "Category 1")
            .Add(2, "Category 2")
            .Add(3, "Category 3")
        End With

        With subcategoryTable.Columns
            .Add("SubcategoryId", GetType(Integer))
            .Add("CategoryId", GetType(Integer))
            .Add("Name", GetType(String))
        End With

        With subcategoryTable.Rows
            .Add(1, 1, "Subcategory 1A")
            .Add(2, 1, "Subcategory 1B")
            .Add(3, 1, "Subcategory 1C")
            .Add(4, 2, "Subcategory 2A")
            .Add(5, 2, "Subcategory 2B")
            .Add(6, 2, "Subcategory 2C")
            .Add(7, 3, "Subcategory 3A")
            .Add(8, 3, "Subcategory 3B")
            .Add(9, 3, "Subcategory 3C")
        End With

        With mainTable.Columns
            .Add("MainId", GetType(Integer)).AutoIncrement = True
            .Add("CategoryId", GetType(Integer))
            .Add("SubcategoryId", GetType(Integer))
        End With

        With mainTable.Rows
            .Add(Nothing, 1, 1)
            .Add(Nothing, 2, 5)
            .Add(Nothing, 3, 9)
        End With

        categoryBindingSource.DataSource = categoryTable
        subcategoryBindingSource.DataSource = subcategoryTable
        filteredSubcategoryBindingSource.DataSource = New DataView(subcategoryTable)
        mainBindingSource.DataSource = mainTable

        With categoryColumn
            .ValueMember = "CategoryId"
            .DisplayMember = "Name"
            .DataSource = categoryBindingSource
        End With

        'The subcategory column is bound to the full list of subcategories, so any value in any cell will be valid.
        With subcategoryColumn
            .ValueMember = "SubcategoryId"
            .DisplayMember = "Name"
            .DataSource = subcategoryBindingSource
        End With

        DataGridView1.DataSource = mainBindingSource
    End Sub

    Private Sub DataGridView1_CellValueChanged(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView1.CellValueChanged
        If e.ColumnIndex = 1 AndAlso e.RowIndex >= 0 Then
            'When a category changes, clear the subcategory in the same row as the current value cannot be valid.
            DataGridView1.Rows(e.RowIndex).Cells(2).Value = DBNull.Value
        End If
    End Sub

    Private Sub DataGridView1_EditingControlShowing(sender As Object, e As DataGridViewEditingControlShowingEventArgs) Handles DataGridView1.EditingControlShowing
        Dim currentCellAddress = DataGridView1.CurrentCellAddress

        If currentCellAddress.X = 2 Then
            'When selecting a subcategory, bind the editing control to a partial list filtered by the category selected in the same row.
            Dim currentRow = DirectCast(mainBindingSource.Current, DataRowView).Row
            Dim categoryId = currentRow.Field(Of Integer)("CategoryId")
            Dim subcategoryId = If(currentRow.Field(Of Integer?)("SubcategoryId"), DBNull.Value)

            filteredSubcategoryBindingSource.Filter = $"CategoryId = {categoryId}"

            With DirectCast(e.Control, ComboBox)
                .ValueMember = "SubcategoryId"
                .DisplayMember = "Name"
                .DataSource = filteredSubcategoryBindingSource
                .SelectedValue = subcategoryId
            End With
        End If
    End Sub

End Class

This relies on an appropriately configured DataGridView and BindingSources. Here is the designer code I used:
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container()
        Me.mainBindingSource = New System.Windows.Forms.BindingSource(Me.components)
        Me.categoryBindingSource = New System.Windows.Forms.BindingSource(Me.components)
        Me.DataGridView1 = New System.Windows.Forms.DataGridView()
        Me.subcategoryBindingSource = New System.Windows.Forms.BindingSource(Me.components)
        Me.filteredSubcategoryBindingSource = New System.Windows.Forms.BindingSource(Me.components)
        Me.idColumn = New System.Windows.Forms.DataGridViewTextBoxColumn()
        Me.categoryColumn = New System.Windows.Forms.DataGridViewComboBoxColumn()
        Me.subcategoryColumn = New System.Windows.Forms.DataGridViewComboBoxColumn()
        CType(Me.mainBindingSource, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.categoryBindingSource, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.DataGridView1, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.subcategoryBindingSource, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.filteredSubcategoryBindingSource, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        '
        'DataGridView1
        '
        Me.DataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize
        Me.DataGridView1.Columns.AddRange(New System.Windows.Forms.DataGridViewColumn() {Me.idColumn, Me.categoryColumn, Me.subcategoryColumn})
        Me.DataGridView1.Location = New System.Drawing.Point(12, 12)
        Me.DataGridView1.Name = "DataGridView1"
        Me.DataGridView1.Size = New System.Drawing.Size(506, 426)
        Me.DataGridView1.TabIndex = 0
        '
        'idColumn
        '
        Me.idColumn.DataPropertyName = "MainId"
        Me.idColumn.HeaderText = "ID"
        Me.idColumn.Name = "idColumn"
        Me.idColumn.ReadOnly = True
        '
        'categoryColumn
        '
        Me.categoryColumn.DataPropertyName = "CategoryId"
        Me.categoryColumn.HeaderText = "Category"
        Me.categoryColumn.Name = "categoryColumn"
        '
        'subcategoryColumn
        '
        Me.subcategoryColumn.DataPropertyName = "SubcategoryId"
        Me.subcategoryColumn.HeaderText = "Subcategory"
        Me.subcategoryColumn.Name = "subcategoryColumn"
        Me.subcategoryColumn.Width = 120
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(800, 450)
        Me.Controls.Add(Me.DataGridView1)
        Me.Name = "Form1"
        Me.Text = "Form1"
        CType(Me.mainBindingSource, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.categoryBindingSource, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.DataGridView1, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.subcategoryBindingSource, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.filteredSubcategoryBindingSource, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)

    End Sub

    Friend WithEvents mainBindingSource As BindingSource
    Friend WithEvents categoryBindingSource As BindingSource
    Friend WithEvents DataGridView1 As DataGridView
    Friend WithEvents subcategoryBindingSource As BindingSource
    Friend WithEvents filteredSubcategoryBindingSource As BindingSource
    Friend WithEvents idColumn As DataGridViewTextBoxColumn
    Friend WithEvents categoryColumn As DataGridViewComboBoxColumn
    Friend WithEvents subcategoryColumn As DataGridViewComboBoxColumn
End Class


text:
Q: When using semicolon for two ind.clauses, does parenthetical citation apply to the full sentence? I have a technical question.
In the following sentence, the in-text citation in parenthetical needs to be applied to the whole sentence. I am not sure if a semicolon separating the two clauses makes the citation apply itself to only the second clause.

But the regional unemployment rate is not an appropriate indicator of an individual's employment prospects; and differentiating access, benefit duration, and benefit amount on the basis of the regional unemployment rate is, in fact, quite problematic (XX 2009; YY 2011).

I am following Chicago Manual of Style, but can't find any reference there to such a query.


text:
Q: Enabling basic auth in apache user directory from Directory context instead of .htaccess file I've enabled Apache user directories on my Ubuntu server. User can now load their /home/username/public_html directory from the browser by visiting http://example.com/~username.
I'm trying to password protect these directories. I was able to get it to work fine using an .htaccess file, but I would prefer to enabled authentication from the Directory context.  This is my configuration file for the user directory module, located at /etc/apache2/mods-enabled/userdir.conf:
<IfModule mod_userdir.c>
        UserDir public_html
        UserDir disabled root

        <Directory /home/*/public_html>
                AuthType Basic
                AuthName Private
                Authuserfile /etc/apache2/.htpasswd
                Require valid-user

                Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
                <Limit GET POST OPTIONS>
                        Require all granted
                </Limit>
                <LimitExcept GET POST OPTIONS>
                        Require all denied
                </LimitExcept>
        </Directory>
</IfModule>

When I navigate my browser to one of the user directories, it does not even prompt me for a credentials. When I switch back to the .htaccess method, it works correctly.
I have reloaded apache after every change I make to the user directory configuration file. Why isn't authentication working from the Directory context?

A: Put the authentication directives to a separate Location directive, like this:
<IfModule mod_userdir.c>
    <Location ~ "/~.*">
        AuthType Basic
        AuthName Private
        Authuserfile /etc/apache2/.htpasswd
        Require valid-user
    </Location>
</IfModule>

This will enable password authentication for every path starting with "/~".


text:
Q: The select command property has not been initialized before calling 'Fill' I am working on a Windows forms project that connects to a Microsoft Access database, reads the the file, does some math and then provides some basic statistics back.  Right now I am teaching myself VB and I know the code below could be more efficient.  However, right now I am just trying to make it functional.
The program filters the data it needs via sql, and there are several sql statements.  I separated the code for each of the sql statements and into a subroutine so that I could call each one when the form loads and also when the user clicks a button to update.  The program works fine on the form load, however, when you click the update button you get the following error on the 'odaCalls.Fill' in subroutine Count(): "The select command property has not been initialized before calling 'Fill'.
Any help is greatly appreciated.  I have searched on google and tried the suggestions found there but have not found a fix.
Option Explicit On

Public Class Form1

  'Count() Variables
  Dim strSQL = "SELECT * FROM tblcallLog"

  Dim strPath As String = "Provider=Microsoft.ACE.OLEDB.12.0 ;" _
        & "Data Source=C:\callLogRev2_be.accdb"
  Dim odaCalls As New OleDb.OleDbDataAdapter(strSQL, strPath)
  Dim datCallCount As New DataTable
  Dim intCount As Integer = 0

  'LiveCalls() variables
  Dim strSQLLive As String = "SELECT * FROM tblcallLog WHERE callLive=True"
  Dim odaCallsLive As New OleDb.OleDbDataAdapter(strSQLLive, strPath)
  Dim datCallLive As New DataTable
  Dim intCallLiveCount As Integer = 0
  Dim decCallLivePct As Decimal

  'TransferCalls() variables
  Dim strSQLTransfered As String = _
      "SELECT * FROM tblcallLog WHERE callName LIKE '% transfer %' OR callName LIKE 'transfer%'"
  Dim odaCallsTransfered As New OleDb.OleDbDataAdapter(strSQLTransfered, strPath)
  Dim datCallTransfered As New DataTable
  Dim intCallTransfered As Integer = 0
  Dim decCallTranfered As Decimal

  'SingleStaffCall() Variables
  Dim strSQLSingleStaff As String = _
      "SELECT * FROM tblcallLog WHERE callName LIKE '% single %' OR callName LIKE 'single%'"
  Dim odaCallSingleStaff As New OleDb.OleDbDataAdapter(strSQLSingleStaff, strPath)
  Dim datCallSingleStaff As New DataTable
  Dim intCallSingleStaff As Integer = 0
  Dim decCallSingleStaff As Decimal

  'SingleStaffCallsLive() Variables
  Dim strSQLSingleStaffLive As String = _
      "SELECT * FROM tblcallLog WHERE callName LIKE '% single %' OR callName LIKE 'single%' AND callLive=True"
  Dim odaCallSingleStaffLive As New OleDb.OleDbDataAdapter(strSQLSingleStaffLive, strPath)
  Dim datCallSingleStaffLive As New DataTable
  Dim intCallSingleStaffLive As Integer = 0
  Dim decCallSingleStaffLive As Decimal

  'CallToday() Variables
  Dim strSQLToday As String = _
      "SELECT * FROM tblcallLog WHERE startDate = date()"
  Dim odaCallToday As New OleDb.OleDbDataAdapter(strSQLToday, strPath)
  Dim datCallToday As New DataTable
  Dim intCallToday As New Integer

  'CallTodayLive() Variables
  Dim strSQLTodayLiveCalls As String = _
      "SELECT * FROM tblcallLog WHERE callLive=TRUE AND startDate = date()"
  Dim odaCallTodayLive As New OleDb.OleDbDataAdapter(strSQLTodayLiveCalls, strPath)
  Dim datCallTodayLive As New DataTable
  Dim intCallTodayLive As New Integer
  Dim decCallTodayLive As New Decimal

  Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Count()
    LiveCalls()
    TransferCalls()
    SingleStaffCalls()
    SingleStaffCallsLive()
    CallToday()
    CallTodayLive()
  End Sub

  Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdate.Click

    'Checks the database for updates when user pushes the update button on the static data tab.
    Count()
    LiveCalls()
    TransferCalls()
    SingleStaffCalls()
    SingleStaffCallsLive()
    CallToday()
    CallTodayLive()
  End Sub

  Private Sub Count()
    'database connect and call count
    odaCalls.Fill(datCallCount)
    odaCalls.Dispose()

    intCount = datCallCount.Rows.Count

    lblTotalCallsData.Text = intCount.ToString
    lblTotalCallsData.Visible = True
  End Sub

  Private Sub LiveCalls()
    'determine number of live calls
    odaCallsLive.Fill(datCallLive)
    odaCallsLive.Dispose()

    intCallLiveCount = datCallLive.Rows.Count
    lblcallsLiveData.Text = intCallLiveCount.ToString
    lblcallsLiveData.Visible = True

    decCallLivePct = intCallLiveCount / intCount
    lblPctCallsLiveData.Text = decCallLivePct.ToString("P")
    lblPctCallsLiveData.Visible = True
  End Sub

  Private Sub TransferCalls()
    'determine the number of transfer calls

    odaCallsTransfered.Fill(datCallTransfered)
    odaCallsTransfered.Dispose()

    intCallTransfered = datCallTransfered.Rows.Count
    lblTotalTransferCallsData.Text = intCallTransfered.ToString
    lblTotalTransferCallsData.Visible = True

    decCallTranfered = intCallTransfered / intCount
    lblPctTransferCallsData.Text = decCallTranfered.ToString("P")
    lblPctTransferCallsData.Visible = True
  End Sub

  Private Sub SingleStaffCalls()
    'determine the number of single staff calls and percentage of total

    odaCallSingleStaff.Fill(datCallSingleStaff)
    odaCallSingleStaff.Dispose()

    intCallSingleStaff = datCallSingleStaff.Rows.Count
    lblTotalSingleStaffCallData.Text = intCallSingleStaff.ToString
    lblTotalSingleStaffCallData.Visible = True
    decCallSingleStaff = intCallSingleStaff / intCount
    lblPctSingleStaffCallsData.Text = decCallSingleStaff.ToString("P")
  End Sub

  Private Sub SingleStaffCallsLive()
    'determine the percentage of single staff calls taken live

    odaCallSingleStaffLive.Fill(datCallSingleStaffLive)
    odaCallSingleStaffLive.Dispose()

    intCallSingleStaffLive = datCallSingleStaffLive.Rows.Count
    decCallSingleStaffLive = intCallSingleStaffLive / intCount

    lblPctSingleStaffCallsLiveData.Visible = True
    lblPctSingleStaffCallsLiveData.Text = decCallSingleStaffLive.ToString("P")
  End Sub

  Private Sub CallToday()
    'determine values for todays date
    odaCallToday.Fill(datCallToday)
    odaCallToday.Dispose()

    intCallToday = datCallToday.Rows.Count
    lblTotalCallsTodayData.Text = intCallToday
    lblTotalCallsTodayData.Visible = True
  End Sub

  Private Sub CallTodayLive()
    'determine the number of live calls today
    odaCallTodayLive.Fill(datCallTodayLive)
    odaCallTodayLive.Dispose()

    intCallTodayLive = datCallTodayLive.Rows.Count
    lblCallsTodayLiveData.Text = intCallTodayLive.ToString
    lblCallsTodayLiveData.Visible = True

    'Statement to error correct so the database doesn't force the program to divide by zero
    Try
      decCallTodayLive = intCallTodayLive / intCallToday
    Catch Exception As DivideByZeroException
      lblPctCallsTodayLiveData.Text = "0.00%"
      lblPctCallsTodayLiveData.Visible = True
    Catch Exception As OverflowException
      decCallTodayLive = 0
    End Try

    lblPctCallsTodayLiveData.Text = decCallTodayLive.ToString("P")
    lblPctCallsTodayLiveData.Visible = True
  End Sub
End Class

A: The problem is that you are disposing the dataadapters immediately after filling them.
This is why it works on form load, but not after. It would be better practice to create the and destroy the dataadapters in the methods where they are used instead of creating them on spec at the form level.


text:
Q: Where is IBM ClearCase client (not ClearCase Remote Client) evaluation software installation for Windows? Where would you find an IBM ClearCase client (not CCRC ClearCase Remote client) evaluation software installation for Windows?

A: To my knowledge, there isn't an "evaluation version" of ClearCase.
If you are registered as an IBM client, you can download the full product and then ask for an evaluation key.
There was also a remote session for you to evaluate ClearCase or ClearCase with Eclipse (you connect to a remote IBM server where the product is already installed and where you have 3 hours to explore).
But I don't know if this program is still active.

A: You need to have a valid Passport Advantage account to download most IBM products.
http://www-01.ibm.com/software/lotus/passportadvantage/pacustomers.html


text:
Q: Нумерованый список и под список Есть нумерованный список который начинается с "1". Нужно сделать так чтобы под список начинался с цифры- с которой начинается родительский элемент.

Возможно ли сделать такое средствами css без js?

.list {
    color: $color-primary;
    font-weight: 600;

    & > li {
        &:before {
            margin-right: 1.2rem;
        }

        ul {
            color: $color-minor-dark;

            li {
                &:before {
                    margin-right: 1.2rem;
                }
            }
        }
    }

    &.numeration {
        counter-reset: list decimal;

        & > li {
            list-style-type: none;

            &:before {
                counter-increment: list;
                content: counter(list) ".";
                color: $color-active;
            }

            ul {
                counter-reset: list decimal;

                & > li {
                    &:before {
                        counter-increment: lists;
                        content: counter(lists) "." counter(decimal);
                    }
                }
            }
        }
    }

    &.sm {
        font-size: 1.4rem;

        & > li {
            & + li {
                margin-top: 1.2rem;
            }

            ul {
                margin-top: 1.2rem;
                margin-left: 1.6rem;

                & > li {
                    margin-top: 1.2rem;
                    padding-left: 1.2rem;
                }
            }
        }
    }

    &.md {
        font-size: 1.6rem;

        & > li {
            & + li {
                margin-top: 1.4rem;
            }

            ul {
                margin-top: 1.4rem;
                margin-left: 1.6rem;

                & > li {
                    margin-top: 1.4rem;
                    padding-left: 1.2rem;
                }
            }
        }
    }
}

work status

annual income

net worth

forex market

position 5

A:

ol {
  /* убираем стандартную нумерацию */
  list-style: none;
  /* Идентифицируем счетчик и даем ему имя li. Значение счетчика не указано – по умолчанию оно равно 0 */
  counter-reset: li;
}

li:before {
  /* Определяем элемент, который будет нумероваться — li. Псевдоэлемент before указывает, что содержимое, вставляемое при помощи свойства content, будет располагаться перед пунктами списка. Здесь же устанавливается значение приращения счетчика (по умолчанию равно 1). */
  counter-increment: li;
  /* С помощью свойства content выводится номер пункта списка. counters() означает, что генерируемый текст представляет собой значения всех счетчиков с таким именем. Точка в кавычках добавляет разделяющую точку между цифрами, а точка с пробелом добавляется перед содержимым каждого пункта списка */
  content: counters(li,".") ". ";
}

пункт
 <!-1.->

пункт

пункт
 <!-2.1.->

пункт
 <!-2.2.->

пункт

пункт
 <!-2.3.1.->

пункт
 <!-2.3.2.->

пункт
 <!-2.3.3.->

 <!-2.3.->

пункт
 <!-2.4.->

 <!-2.->

пункт
 <!-3.->

пункт
 <!-4.->


text:
Q: How many entries are there in an inverted page table? Consider a computer system with 48-bit logical address space and 2Kbytes page size. The system has  1 Gbytes of physical memory. How many entries are there in an inverted page table?

A: Number of entries in inverted page table = physical address space  / page size
Physical address space= 1GB =2^30
Page size = 2KB= 2^11
Number of entries =2 ^ (30-11) =2^19 =512K entries.

A: As it can be inferred from its name, if size of physical memory is 2^m frame then size of inverted page table must be 2^m. In your specific case, size (number of entries) of inverted page table is = 2^30.
The inverted page table is used by all processes,which is consist of(process-id , page number, control bits )
Benefits:
1)Reduce overhead of creating page table for each process
2)nverted Page tables are sorted in order of frame number but the memory look-up takes place with respect to the virtual address, so, it usually takes a longer time to find the appropriate entry but often these page tables are implemented using hash data structures for a faster lookup.
for more >>> https://www.geeksforgeeks.org/inverted-page-table-in-operating-system/


text:
Q: How to set MQRHF2 header via JMS API I using JMS for communicate with message queue. The message queue server is IBM Websphere MQ 7.5.0.5.
And now I need to set MQRHF2 headers to my messages. How to do this via JMS?


text:
Q: jQuery many functions for many rows, how to manage? I have this code: Example of my code working
Or maybe this with ID: Example 2 of my code
Another try: http://jsbin.com/wazeba/edit?js,console,output
And another one (with code from here: https://stackoverflow.com/a/4785886/4412054 ): http://jsbin.com/fuvoma/edit?js,console,output
IN EVERY CASE THE ID IS THE SAME.
My html:
<!DOCTYPE html>

  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>

<button id="btnTest">Test many!</button>

<form id="formTest">

      Code
    Name

        <input type="text" name="anumber" id="anumber">

        <input type="text" name="name" id="name">

</form>

<button type="button" id="btnAdd">Add</button>

and my Javascript:
jQuery(document).ready(function() {

    jQuery("#btnTest").click(function() {
        for (var i = 0; i < 10; i++) {
            console.log("Test: " + i);
            jQuery("#formTest tbody tr").last().find("input[name*='anumber']").val('243');
            jQuery('#btnAdd').click();
        }
    });

    jQuery("#btnAdd").click(function(e) {
        lastR = $("#formTest tbody tr").last();
        jQuery(lastR).clone().appendTo('#formTest tbody');
      readFnc(lastR);
    });

    function readFnc(lastR) {
      rowCode = $(lastR).find("input[name='anumber']");
      rowName = $(lastR).find("input[name='name']");
      var jqxhr = $.getJSON('http://beta.json-generator.com/api/json/get/41Lpsgmsx', function(data) {
       })
      .fail( function() {
        console.log("Error");
      })
      .done( function(data) {
        console.log("Goo!");
        rowCode.val(data.code);
        rowName.val(data.name);
        $(lastR).css({"background-color": "#99ff99"});
      });
    }

});

Now I need to update every row with a different value from each getJSON. How to manage many ajax calls or, more abstract, many functions?
I need to update form when the server resonds. And just then.
If I assign an ID to every tr then on each "Add" click the function variables are override. How to do?

A: getJSON is async so the script create 10 rows and just THEN it resolve the getJSOn promise, using the last() selector it assign the value only to the last row created. To avoid this issue you can pass the cloned object to the function.
Just for explanation you can see that callOrder and resolveOrder are in a different order.
  var callORder = 0;

  jQuery("#btnAdd").click(function(e) {
    lastR = $("#formTest tbody tr").last();
    var newRow = jQuery(lastR).clone();
    newRow.appendTo('#formTest tbody');
    readFnc(newRow,++callORder);
  });

  var resolveOrder = 0;

  function readFnc(newR,callORder) {

    var jqxhr = $.getJSON('http://beta.json-generator.com/api/json/get/41Lpsgmsx', function(data) {})
      .fail(function() {
        console.log("Error");
      })
      .done(function(data) {
        console.log("Goo!");
        rowCode = newR.find("input[name='anumber']");
        rowName = newR.find("input[name='name']");
        rowCode.val(data.code + " " + (++resolveOrder)+ " " + (callORder));
        rowName.val(data.name);
        newR.css({
          "background-color": "#99ff99"
        });
      });
  }

jQuery(document).ready(function() {

  jQuery("#btnTest").click(function() {
    for (var i = 0; i < 10; i++) {
      console.log("Test: " + i);
      jQuery("#formTest tbody tr").last().find("input[name*='anumber']").val('243');
      jQuery('#btnAdd').click();
    }
  });

  var callORder = 0;

  jQuery("#btnAdd").click(function(e) {
    lastR = $("#formTest tbody tr").last();
    var newRow = jQuery(lastR).clone();
    newRow.appendTo('#formTest tbody');
    readFnc(newRow,++callORder);
  });

  var resolveOrder = 0;

  function readFnc(newR,callORder) {

    var jqxhr = $.getJSON('http://beta.json-generator.com/api/json/get/41Lpsgmsx', function(data) {})
      .fail(function() {
        console.log("Error");
      })
      .done(function(data) {
        console.log("Goo!");
        rowCode = newR.find("input[name='anumber']");
        rowName = newR.find("input[name='name']");
        rowCode.val(data.code + " " + (++resolveOrder)+ " " + (callORder));
        rowName.val(data.name);
        newR.css({
          "background-color": "#99ff99"
        });
      });
  }

});
<!DOCTYPE html>

  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>

  <button id="btnTest">Test many!</button>

  <form id="formTest">

          Code
            Name

            <input type="text" name="anumber" id="anumber">

            <input type="text" name="name" id="name">

  </form>

  <button type="button" id="btnAdd">Add</button>


text:
Q: How to read the function pointer? How to interpret the following c++ declaration?
int (*(*x[2])())[3];

This is from the example present at Type-cppreference.

A: The interpretation of the sample declaration in the question is present in the Type-cppreference page linked.
int (*(*x[2])())[3];      // declaration of an array of 2 pointers to functions
                          // returning pointer to array of 3 int

So the actual question is not about that case in particular; but about how any C++ declaration shall be read.
You can infer all those details starting at the declared name x and moving clockwise respecting parenthesis. You will get to the description above:

x is a an array of dimension 2 of pointers to functions that return a pointer to an array of dimension 3 of ints.

Better explained here as the Clockwise/Spiral Rule: http://c-faq.com/decl/spiral.anderson.html

A: It is an array of two pointers to functions that return pointer to array of type int[3] and do not have parameters.
Here is a demonstrative program
int ( *f() )[3] { return new int[2][3]; }
int ( *g() )[3] { return new int[4][3]; }

int main()
{
    int (*(*x[2])())[3] = { f, g };

    for ( auto func : x ) delete []func();

    return 0;
}


text:
Q: How to disable JIT compilation with HHVM? I'm working with hhvm 3.6.1--please exuse my limited understanding of the internals of HHVM and how it performs JIT.
I'm trying to suppress JIT compilation in HHVM and run the php in interpreted mode.   Right now I'm guessing you could set the warm  up request in your php.ini to some arbitrarily high number like:
 hhvm.eval.jit_warmup_requests = 1000

However, I'm looking to see if any one knows a setting like jit_enabled=false
The reason I'm doing this is I'm seeing wonky behavior running with xdebug enabled with remote debuging (seemingly random seg faults,  mismatched file to breakpoints) and want to factor the JIT out--if that makes any sense at all with how HHVM functions.

A: https://github.com/facebook/hhvm/wiki/INI-Settings claims that the INI form is indeed hhvm.jit -- not sure if that's accurate, but the command-line option is definitely -v Eval.Jit=false. (I'm curious how you are determining that the JIT is still enabled and the option didn't work?)
That said, xdebug is believed to work, and furthermore the team at FB (and nearly every usage, inside FB and out) all run with the JIT enabled. Believe it or not, that's actually likely to be much better supported than the interpreter at this point.
If you're running into problems with xdebug, you should file an issue: https://github.com/facebook/hhvm/issues

A: Struggled with this for hours too.
To disable JIT, you should lookup "hhvm.jit = 1" in server.ini, not php.ini.


text:
Q: FriendlyUrl's - breaks Page.IsPostback after Server.Transfer Usually you can execute a
Server.Transfer("mypage.aspx")

Once at mypage.aspx if you execute this on Page_Load
if (!Page.IsPostBack)
{
}

It will only execute the first time. However, if you install the FriendlyUrl's package, (!Page.IsPostBack) will be executed on the first page load, and on the next subsequent load.
After that it doesn't execute.
This is breaking pages totally. it only happens after a Server.Transfer.
I am using asp.net 4.5.1 + web forms.
Why is this and how can I fix it?!
thx.


text:
Q: How do I get GIT to stop track a folder that I recently added to gitignore? I have a folder with a bunch of files that I do not want to track. I don't want to remove them, I just want to keep them out of version control. This folder was recently added to gitignore, but when any of the files change they still show up as changed in GIT. I just want GIT to completly ignore this folder.
How do I do this? I searched around and found several similar questions but non that gave the answer to this specific question.

A: $ git rm -rf --cached <folder>

rm -- remove files from version control
-r -- do it recursive
-f -- force non-empty directory removing
--cached -- actually do not remove files, just remove it from version control
man git rm
If you also want to remove files from all revisions they was encoutered, you might use more powerful tool: git filter-branch.

A: I think you should do
git rm --cached

A: I think I managed to do what I wanted now. I did:
git update-index --assume-unchanged files/

And got this respons:
    Ignoring path files/
When I do a git status now I don't get the list of removed/changed files that I did before. Seems like this is it for me.


text:
Q: Visual Studio 2015 hangs when typing code in a large C# file I've already seen this question: Visual studio is waiting for internal operation to complete so please don't mark this as a duplicate.
I have a large C# code file that seeds a database with about 2000 location entities and 1000 category entities. This file necessarily has several thousand variables declared. Whenever I try to type any more code into this file, Visual Studio hangs with the message: Visual studio is busy: Microsoft Visual studio is waiting for internal operation to complete.
This only happens when typing in code in this particular large file, e.g. if I type string, and then hit space, Visual Studio freezes. Because string and a space will be immediately be underlined with a red squiggly line and an error until you finish the code statement, is it possible that this might have something to do with the static type checker not being able to handle large files, or some other natural limit or bug?
Things I've tried so far:

*

*Deleting the ".vs" folder on the project root

*Delete the .suo file in the project root

*Repairing Visual Studio

*Reinstalling Visual Studio

I'm using Visual Studio 2015 Community Update 3.

A: Visual Studio was choking on the size of the Seed method. I've split the contents of this method into several methods in separate files. I've also reduced the number of string variables in each method. I actually didn't need to declare lots of string variables, since each one was used only once in a row in an AddOrUpdate, but for various reasons I felt they enhanced accuracy and readability.
Just another reminder that our hardware and software still have serious limits. Here's to the future.


text:
Q: Should I need delete or after close? I have a form (inherited from QMainWindow) with "Settings" button that need to show settings form (inherited from QWidget).
Button click() connected with some settingsButtonClick() slot
And in settingsButtonClick:
void MainQT::settingsButtonClick()
{
    SettingsForm *settingsForm = new settingsForm();
    settingsForm->show();
}

It works properly, but question is should I need delete this form somewhere or it would be deleted when I close settings form?
What i correct way to manage memory in this case? Should I instantiate settings form in MainForm's ctor hidden and only show on request?

A: I would do it in the following way:
void MainQT::settingsButtonClick()
{
    SettingsForm *settingsForm = new settingsForm();
    settingsForm->setAttribute( Qt::WA_DeleteOnClose );
    settingsForm->show();
}

Using Qt::WA_DeleteOnClose will make sure that the settingsForm will be deleted after you closing it.
For more details take a look into Qt documentation.

A:
should I delete this form somewhere or it would be deleted when I close settings form? What is the correct way to manage memory in this case? Should I instantiate settings form in MainForm's ctor hidden and only show on request?

There are no strict rules for this, you may:

*

*create Settings dialog each time you need to display it and then destroy the object;

*create Settings dialog in MainForm constructor and then just display it upon user action;

*you may even use Settings dialog as a contrainer to store settings values

Please just note that your code creates new object and never destroys it, which would result in memory leak; consider saving pointer as member variable and re-use it if user opens Settings dialog another time:
void MainQT::settingsButtonClick()
{
    if(!mSettingsForm) mSettingsForm = new settingsForm();
    settingsForm->show();
}


text:
Q: Linux `system()` doesn't find program even though it is in the same folder I have a program which calls another program by executing system(..). This other program is located in the same folder as the main program but for whatever reason, system(..) returns with sh: 1: program_name: not found. Why is that?

A: It's because the current workin directory is not in PATH.  Use ./program_name instead.


text:
Q: How to refresh data of one component from another component in react js I'm new to react js and creating one sample application with  and some basic CRUD operation.
I'm able to display a list, but I don't have any idea if I delete any record then how to refresh data grid.
Here is my code:
var DeleteRow = React.createClass({
    rowDelete: function (e) {
        console.log(this.props);
        var isConfirm = confirm("Are you sure want to delete this record?")
        if (isConfirm) {
            $.ajax({
                type: 'POST',
                url: 'Students/DeleteStudent',
                data: { id: this.props.data },
                success: function (data) {
                    // refresh the list data
                },
                error: function (error) {

                }
            });
        }
    },
    render: function () {
        return(
              <button data={this.props.id} onClick={this.rowDelete} className="btn btn-danger">Delete</button>
         );
    },
});

var SudentList = React.createClass({
    render: function () {
        var RowData = this.props.data.map(function(item){
            return (

                 {item.id}
                 {item.firstMidName}
                 {item.lastName}
                 {item.enrollmentDate}
                 Edit
                 <DeleteRow data={item.id}/>

            );
          });

        return (

                 Id
                 Fist Name
                 Last Name
                 Enrollment Date
                 Edit
                 Delete

                 {RowData}

      );
    }
});

var Gird = React.createClass({
    loadStudentsFromServer: function () {
        $.get(this.props.dataUrl, function (data) {
            if (this.isMounted()) {
                this.setState({
                    items: data
                });
            }
        }.bind(this));
    },
    getInitialState: function () {
        return { items: [] };
    },
    componentDidMount: function () {
        this.loadStudentsFromServer();
    },
    render: function () {

        var addBtnStyle = {
            margin:'10px',
        }

        return (

           <button className="btn btn-primary pull-right" style={addBtnStyle}>Add New</button>
           <SudentList data={this.state.items} />

    );
    }
});

ReactDOM.render(
  <Gird dataUrl='/Students/GetAllStudent' />,
  document.getElementById('content')
);

I want to refresh the data of Gird component from DeleteRow component on ajax success, how can I do that?.
I've gone through few questions on this site, but not luck so far.

A: What you need to do is pass a function to the DeleteRow component from the Grid component, so that when the delete is successful, you will update the list of items in Grid. Try something like this
var DeleteRow = React.createClass({
    rowDelete: function (e) {
        console.log(this.props);
        var self = this;
        var isConfirm = confirm("Are you sure want to delete this record?")
        if (isConfirm) {
            $.ajax({
                type: 'POST',
                url: 'Students/DeleteStudent',
                data: { id: this.props.data },
                success: function (data) {
                    // refresh the list data
                    self.props.onRowDelete(self.props.data)
                },
                error: function (error) {

                }
            });
        }
    },
    render: function () {
        return(
              <button data={this.props.id} onClick={this.rowDelete} className="btn btn-danger">Delete</button>
         );
    },
});

var SudentList = React.createClass({
    render: function () {
        var self = this;
        var RowData = this.props.data.map(function(item){
            return (

                 {item.id}
                 {item.firstMidName}
                 {item.lastName}
                 {item.enrollmentDate}
                 Edit
                 <DeleteRow data={item.id} onRowDelete={self.props.onRowDelete}/>

            );
          });

        return (

                 Id
                 Fist Name
                 Last Name
                 Enrollment Date
                 Edit
                 Delete

                 {RowData}

      );
    }
});

var Gird = React.createClass({
    loadStudentsFromServer: function () {
        $.get(this.props.dataUrl, function (data) {
            if (this.isMounted()) {
                this.setState({
                    items: data
                });
            }
        }.bind(this));
    },
    getInitialState: function () {
        return { items: [] };
    },
    componentDidMount: function () {
        this.loadStudentsFromServer();
    },
    onRowDelete: function(id) {
      var items = this.state.items.filter(function(item, i) {
        return item.id !== id;
      })
      this.setState({items: items})
    },
    render: function () {

        var addBtnStyle = {
            margin:'10px',
        }

        return (

           <button className="btn btn-primary pull-right" style={addBtnStyle}>Add New</button>
           <SudentList data={this.state.items} onRowDelete={this.onRowDelete}/>

    );
    }
});

This might be helpful as well

A: i have one solution of your code, you can passing function loadStudentsFromServer() to component DeleteRow same like you passing this.state.items to component SudentList
you can change your code, the first one is here :
<SudentList data={this.state.items} loadStudentsFromServer={this.loadStudentsFromServer}/>

and then in your SudentList component you can add this function :
loadStudentsFromServer: function(){
        this.props.loadStudentsFromServer()
    }.bind(this),

and also change this one to passing your function to DeleteRow component :
<DeleteRow data={item.id} loadStudentsFromServer={this.props.loadStudentsFromServer} />

and just call the function if you success delete the data :
success: function (data) {
  // refresh the list data
  this.props.loadStudentsFromServer()
},

and this is the full code :
var DeleteRow = React.createClass({
    rowDelete: function (e) {
        console.log(this.props);
        var isConfirm = confirm("Are you sure want to delete this record?")
        if (isConfirm) {
            $.ajax({
                type: 'POST',
                url: 'Students/DeleteStudent',
                data: { id: this.props.data },
                success: function (data) {
                    // refresh the list data
                    this.props.loadStudentsFromServer()
                },
                error: function (error) {

                }
            });
        }
    },
    render: function () {
        return(
              <button data={this.props.id} onClick={this.rowDelete} className="btn btn-danger">Delete</button>
         );
    },
});

var SudentList = React.createClass({
    loadStudentsFromServer: function(){
        this.props.loadStudentsFromServer()
    }.bind(this),
    render: function () {
        var RowData = this.props.data.map(function(item){
            return (

                 {item.id}
                 {item.firstMidName}
                 {item.lastName}
                 {item.enrollmentDate}
                 Edit
                 <DeleteRow data={item.id} loadStudentsFromServer={this.props.loadStudentsFromServer} />

            );
          });

        return (

                 Id
                 Fist Name
                 Last Name
                 Enrollment Date
                 Edit
                 Delete

                 {RowData}

      );
    }
});

var Gird = React.createClass({
    loadStudentsFromServer: function () {
        $.get(this.props.dataUrl, function (data) {
            if (this.isMounted()) {
                this.setState({
                    items: data
                });
            }
        }.bind(this));
    },
    getInitialState: function () {
        return { items: [] };
    },
    componentDidMount: function () {
        this.loadStudentsFromServer();
    },
    render: function () {

        var addBtnStyle = {
            margin:'10px',
        }

        return (

           <button className="btn btn-primary pull-right" style={addBtnStyle}>Add New</button>
           <SudentList data={this.state.items} loadStudentsFromServer={this.loadStudentsFromServer}/>

    );
    }
});

ReactDOM.render(
  <Gird dataUrl='/Students/GetAllStudent' />,
  document.getElementById('content')
);

Hope it can help you, you can comment if have another error, thanks :)
Note : this code is re fetching your data from server after delete some data


text:
Q: iOS File input for videos, video compressing terminates when screen not active anymore I have a web app with a file upload input for large videos (30+ minutes).
In iOS, when user selects a video, the OS will first compress it, an action that happens before the onClick of the file input is being called.
As this process can take a while for large videos, users tend to switch to other apps meanwhile, but it seems that when a user is leaving the compression screen, the action is being canceled, without even notifying the user.
This is the file input snippet (I'm using react).
<input
    required={true}
    id="inputFile"
    type="file"
    accept="video/*"
    ref={fileInput}
    className={style['input']}
    onChange={(e) => {
        const file = e.target.files[0];
        if(file) {
        setValue(fieldName, file)
    }}
/>

The behaviour is the same on both iOS chrome and safari.
Is there a way to make the action proceed when the browser is not active anymore?

A: It is not possible to continue an action in the background when the browser is not active. The only way to do this would be to use a native app instead of a web app. The documentation for the File API on mobile devices states https://developer.mozilla.org/en-US/docs/Web/API/File/Using_files_from_web_applications is going to be "further limited" on mobile devices.
The only way to continue an action in the background when the browser is not active would be to use a native app instead of a web app.


text:
Q: Can I use multiple NavHostFragments in Navigation Component? Please look at the flowchart I made if you have difficulty in understanding the following paragraph.
I'm currently making a notes app with 3 top level destinations. One of the top-level destinations(NotesList) displays a list of notes created by the user. NotesList has a filter button which brings up a bottom modal sheet with FilterMenu destination. FilterMenu has a search button, which on clicking, replaces the contents of the sheet with a Search destination and a button named tags which on clicking, replaces the contents of the sheet with a fragment containing list of the tags associated with all the notes(TagList destination).

Everything in blue is a top level destination. Everything in purple is present in the modal sheet.
The FilterMenu, Search and the TagList are displayed in a modal sheet. Which means that the NotesList contains these fragments and is not replaced by them. They exist in a region of screen smaller than the NotesList. If I use navigation, the fragments will replace each other.
Can I use two NavHosts? One for the top-level destinations and one for the stuff in the modal sheet? If so, how would I implement it? If not, what's the recommended thing to do in this case?

A: You can create two navigation graphs to achieve the behavior you want. One for the top level destinations and a second one for the modal sheet. They need to be independent and do not have any links between each other. You can't use only one nav graph as the "navigation surface" is a different one. For the main navigation it's the activity and for the modal bottom sheet it's the bottom sheets window (which is in case of a BottomSheetDialogFragment actually a different window).
In theory this can be achieved very easily:

*

*main_nav.xml holds Settings, NoteList and Trash

*filter_nav.xml holds the FilterMenu, Search, and TagList
If you don't want back navigation on the top level you can even do the top level without a navigation controller using fragment transactions.
So basically you need a (BottomSheet)DialogFragment which needs an seperate NavHost independent from the main/other NavHost. You can achieve this with following class:
dialog_fragment_modal_bottom_sheet.xml
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/filterNavHost"/>

ModalBottomSheetDialogFragment .kt
class ModalBottomSheetDialogFragment : BottomSheetDialogFragment() {

    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View =
        inflater.inflate(R.layout.dialog_fragment_modal_bottom_sheet, container, false)

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)

        // We can't inflate the NavHostFragment from XML because it will crash the 2nd time the dialog is opened
        val navHost = NavHostFragment()
        childFragmentManager.beginTransaction().replace(R.id.filterNavHost, navHost).commitNow()
        navHost.navController.setGraph(R.navigation.filter_nav)
    }

    override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
        return super.onCreateDialog(savedInstanceState).apply {
            // Normally the dialog would close on back press. We override this behaviour and check if we can navigate back
            // If we can't navigate back we return false triggering the default implementation closing the dialog
            setOnKeyListener { _, keyCode, event ->
                if (keyCode == KeyEvent.KEYCODE_BACK && event.action == KeyEvent.ACTION_UP) {
                    view?.findNavController()?.popBackStack() == true
                } else {
                    false
                }
            }
        }
    }
}

We do two tricks here:

*

*We need to manually create the NavHost fragment. If we directly put it into XML, it will crash the second time the dialog is opened as the ID is already used

*We need to overwrite the dialog's back navigation. A dialog is a separate window on top of your activity, so the Activity's onBackPressed() gets not called. Instead, we add a OnKeyListener and when the back button is released (ACTION_UP) we check with the NavController whether it can pop the back stack (go back) or not. If it can pop the back stack we return true and thus consume the back event. The dialog stays open and the NavController goes one step back. If it is already at the starting point, the dialog will close as we return false.
You can now create a nested graph inside the dialog and not care about the outer graph. To show the dialog with the nested graph use:
val dialog = ModalBottomSheetDialogFragment()
dialog.show(childFragmentManager, "filter-menu")

You could also add the ModalBottomSheetDialogFragment as <dialog> destination in main_nav, I did not test this though. This feature is currently still in alpha and was introduced in navigation 2.1.0-alpha03. Because this is still in alpha, the API might change and I'd personally use the code above to show the dialog. As soon as this is out of alpha/beta, using a  destination in main_nav.xml should be the preferred way. The different way to show the dialog makes no difference from a user's perspective.
I create a sample application with your navigation structure here on GitHub. It has working back navigation on both levels with the two independent graphs. You can see it working here on Youtube. I used a bottom bar for the main navigation, but you can replace it with a drawer instead.

A: An easy way to create two navHostFragments is to create another navigation.xml file.
In my app for example I have two navHostsFragments.
I defined the first one for navigation flow so when the user enters the app he goes to the login fragment which is the navHostFragment.
After user logs in he is transferred to the mainActivity which contains my new navHostFragment.
That way whenever I start a new activity that contains my new navHostFragment.
Hope this helps


text:
Q: Render JUnit-style XML test output to HTML I'm doing some Unit/Integration testing in a Non-Java language (Python), using a test-framework (py.test) which is able to produce JUnit-style XML output, for example like this:
<?xml version="1.0" encoding="utf-8"?>
<testsuite name="" errors="0" failures="0" skips="4" tests="4" time="75.956">
    <testcase classname="daemon_ping_test.SimpleDaemonTestCase" name="test_daemon_runs_plugin" time="0.000185012817383">
        <skipped type="pytest.skip" message="skipped temporarily">/usr/local/lib/python2.7/dist-packages/pytest-2.1.3-py2.7.egg/_pytest/unittest.py:88: Skipped: skipped temporarily</skipped>
    </testcase>
    <testcase classname="libvirt_handler_test.LibvirtHandlerTestcase" name="test_domain_with_iscsi" time="0.00244903564453">
    </testcase>
    <testcase classname="libvirt_handler_test.LibvirtHandlerTestcase" name="test_libvirt_controller" time="0.00547981262207">
    </testcase>
        <testcase classname="libvirt_handler_test.LibvirtHandlerTestcase" name="test_libvirt_get_vmid_by_storage" time="0.000415086746216">
        <skipped type="pytest.skip" message="temporarily disabled">/usr/local/lib/python2.7/dist-packages/pytest-2.1.3-py2.7.egg/_pytest/unittest.py:88: Skipped: temporarily disabled</skipped>
    </testcase>
    <testcase classname="test_integration.StorageTests" name="test_1_CreateTemplate" time="73.7471599579"></testcase>
    <testcase classname="test_integration.StorageTests" name="test_2_CreateStorageVol" time="0.000442981719971">
        <skipped type="pytest.skip" message="temporarily skipped">/usr/local/lib/python2.7/dist-packages/pytest-2.1.3-py2.7.egg/_pytest/unittest.py:88: Skipped: temporarily skipped</skipped>
    </testcase>
    <testcase classname="test_integration.StorageTests" name="test_3_StorageVolMap" time="0.000404119491577">
        <skipped type="pytest.skip" message="temporarily skipped">/usr/local/lib/python2.7/dist-packages/pytest-2.1.3-py2.7.egg/_pytest/unittest.py:88: Skipped: temporarily skipped</skipped>
    </testcase>
    <testcase classname="test_integration.StorageTests" name="test_4_RemoveTemplate" time="1.97415280342">
    </testcase>
</testsuite>

Now I would like to render these results to a human-readable HTML file. Is there any tool out there to do that?

A: Ant is probably the easiest way to do that.  You can use the junit-report task, like so..
<junitreport todir="./reports">
   <fileset dir=".">
    <include name="**/*.xml" />
   </fileset>
   <report format="frames" todir="./reports/html" />
</junitreport>

A: The other way is to use XSLT processor to write it. Define an xsl stylesheet, and then run it with:
xsltproc --output tests.html your.xsl path/to/tests.xml


text:
Q: How to derive "loading" from useSWR between fetches without revalidation? I was asked a question regarding SWRs "loading" state:

How do you create a loading state from SWR between different URL fetches?

Their docs make it appear straight forward:
  const { data, error } = useSWR(`/api/user/${id}`, fetcher)
  const isLoading = !error && !data;

However, this logic seems to fail after the first render of the hook/component.  On the first render data is undefined.  Then loads and data becomes a value to consume in the UI.
Let's say I change the id via the UI and want to show loading indicator.  Because data is no longer undefined, the same logic fails.
There is an additional item returned isValidating.  So I updated my logic:
const isLoading = (!data && !error) || isValidating

However, this could be true when:

there's a request or revalidation loading.

So in theory something else causes my component to rerender. This could inadvertently cause a "revalidation" and trigger loading state gets shown.  This could break the UI temporarily, by accident.
So how do you derive "loading" between URL changes without revalidation?  I am trying to replicate how graphQL Apollo Client returns const { loading, error, data } = useQuery(GET_DOGS);

A: Alternatively, you can derive loading through the use of middleware. Here's what I use...
loadingMiddleware.ts
import { useState } from 'react'
import { Middleware } from 'swr'

const loadingMiddleware: Middleware = (useSWRNext) => (key, fetcher, config) => {
  const [loading, setLoading] = useState(false)

  const extendedFetcher = (...args) => {
    setLoading(true)
    try {
      return fetcher(...args)
    } finally {
      setLoading(false)
    }
  }

  const swr = useSWRNext(key, extendedFetcher, config)

  return { ...swr, loading }
}

export default loadingMiddleware

App.tsx
import { SWRConfig } from 'swr'
import loadingMiddleware from './loadingMiddleware'

const App: FC = () => {
  ...

  return (
    <SWRConfig value={{ use: [loadingMiddleware] }}>
      ...
    </SWRConfig>
  )
}

export default App

Update (12/13/22)
swr@v2 is out and provides isLoading and isValidating properties in the return value of useSWR.
Here's the difference between the two according to the swr docs.

*

*isValidating becomes true whenever there is an ongoing request whether the data is loaded or not.

*isLoading becomes true when there is an ongoing request and data is not loaded yet.

A:
Let's say I change the id via the UI and want to show loading indicator. Because data is no longer undefined, the same logic fails.

data will be undefined again when you change the key (id), if it doesn't have a cache value.
Remember that in SWR { data } = useSWR(key) is mentally equivalent to v = getCache(k), where fetcher (validation) just write to the cache and trigger a re-render.
data is default to undefined, and isValidating means if there's an ongoing request.


text:
Q: How does pandas.DataFrame.replace works? I need to remove '$' symbol in 'price' column. I used pd.DataFrame.replace to do that.
replace result.
Why did nothing happen?
If I use str.replace it works: str.replace

A: Try this :
listings['price'].str.replace({'$':''},regex=True,inplace=True)


text:
Q: Count the permutations which are products of exactly two disjoint cycles.
Let $a_n$ be the number of those permutation $\sigma $ on $\{1,2,...,n\}$  such that $\sigma $ is a product of exactly two disjoint cycles. Then find $a_4$ and $a_5$.

Calculating $a_4$: Possible cases which can happen are $(12)(34),(13)(24),(14)(23)$, any cycle of the form $(123)$ or $(12)$ i.e. two-cycles and three cycles thus we have in total $3+\frac{1}{3}4P_3+\frac{1}{2}4P_2=3+8+6=17$ but the correct answer is given to be either $11$ or $14$.
Where am I wrong? Please help.

A: Let $r\in[1\>..\>n-1]$ be the length of the cycle containing  the number $n$. Begin the listing of this cycle with $n$. There are $(n-1)(n-2)\cdots(n-r+1)$ ways to choose the remaining entries of this cycle. Now there will be $n-r\geq1$ numbers left over, one of them the largest. Begin the listing of the second cycle with this largest left-over number, and you will then have $(n-r-1)!$ ways to choose the remaining entries of the second cycle. In all we have ${(n-1)!\over n-r}$ permutations of this kind. It follows that there are
$$a_n=(n-1)!\sum_{k=1}^{n-1}{1\over k}\tag{1}$$
elements of $S_n$ having exactly two cycles. In particular this gives $a_4=11$. – Maybe the formula $(1)$ can be brought into a closed form, using some combinatorial identity.
Computing the $a_n$ we obtain the sequence $(1, 3, 11, 50, 274, 1764, 13068, 109584, 1026576,\ldots)$ which OEIS identifies as A000254.

A: From the possible answers, it appears that the question intended to ask how many permutations have exactly two cycles in their cycle decomposition, including the $1$-cycles.
If the smaller cycle has $k$ elements, the greater has $n-k$, and $j$ particular elements can form $(j-1)!$ different $j$-cycles. Thus the desired count is
$$
\frac12\sum_{k=1}^{n-1}\binom nk(k-1)!(n-k-1)!=\frac{n!}2\sum_{k=1}^{n-1}\frac1{k(n-k)}\;,
$$
where the factor $\frac12$ compensates for the double-counting of all products, including in the case of even $n$ the products of two cycles of length $\frac n2$. So we have
$$
a_4=4!\left(\frac1{1(4-1)}+\frac12\frac1{2(4-2)}\right)=24\left(\frac13+\frac18\right)=11
$$
and
$$
a_5=5!\left(\frac1{1(5-1)}+\frac1{2(5-2)}\right)=120\left(\frac14+\frac16\right)=50\;.
$$


text:
Q: How to change the display of an empty string in mysql command line tool? I'm maintaining a database with InnoDB tables.
These tables have some columns of type (from show create table):
`val0` varchar(30) default NULL,
`val1` varchar(30) default NULL,
etc...

From the mysql command line I am searching for NULL entries in these tables.
Now I SELECTed some rows where val0 IS NULL AND val1 = '' (empty string), but the mysql command line shows both values as
+------+------+
| val0 | val1 |
+------+------+
| NULL | NULL |
+------+------+

Apparently this is confusing me. Is this behavior intentional? Is there a method to define how empty strings are displayed?

EDIT :
I should mention that STRICT MODE (see the docs) seems to be enabled.
The query
SELECT * FROM table WHERE val0 IS NULL AND val1 = '';

finds the row above. The query
SELECT * FROM table WHERE val0 IS NULL AND val1 IS NULL;

doesn't find that row. Still the '' is displayed as 'NULL'. How do I change that?
Server version is "5.0.22-log".

EDIT 2 :
Here is the full (anonymized) SHOW CREATE TABLE mytable:
CREATE TABLE `mytable` (
  `id` int(11) NOT NULL,
  `time` int(20) NOT NULL,
  `val0` varchar(30) default NULL,
  `val1` varchar(30) default NULL,
  `val2` varchar(30) default NULL,
  `val3` varchar(30) default NULL,
  `val4` varchar(30) default NULL,
  `val5` varchar(30) default NULL,
  `val6` varchar(30) default NULL,
  `val7` varchar(30) default NULL,
  `val8` varchar(30) default NULL,
  `val9` varchar(30) default NULL,
  `status` tinyint(4) default '0',
  UNIQUE KEY `idtime` (`id`,`time`),
  KEY `status` (`status`),
  KEY `id` (`id`),
  KEY `time` (`time`),
  CONSTRAINT `mytable_ibfk_1` FOREIGN KEY (`id`) REFERENCES `idtable` (`id`)
    ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8

Here are my queries:
select * from mytable where val1 is null limit 1;

-> no result
select * from mytable where val1 = '' limit 1;

result:
+-----+------------+------+------+------+------+------+------+------+------+------+------+--------+
| id  | time       | val0 | val1 | val2 | val3 | val4 | val5 | val6 | val7 | val8 | val9 | status |
+-----+------------+------+------+------+------+------+------+------+------+------+------+--------+
| 300 | 1346855716 | 0    | NULL | 42   | 4711 | blib | blub | NULL | NULL | NULL | NULL |      5 |
+-----+------------+------+------+------+------+------+------+------+------+------+------+--------+

fun fact: These last four NULLs are actually the string "NULL". (I'm only maintaining this system, I didn't build it...)

A: Bug #20067 empty string returns NULL as dispalyed value
This bug is possibly fixed 5.0.23. Look at the document referenced by the above page.


text:
Q: How to customize Entity Framework classes? Is there a way to take over the Entity Framework class builder? I want to be able to have my own class builder so i can make some properties to call other methods upon materialization or make the entity classes partial.

A: Actually they are already in partial classes. See MSDN

A: System.Data.Entity.Design.EntityClassGenerator, is the type used in VS to generate the object layer from your .edmx file, and it is the type used by EdmGen.exe to generate the object layer from a .csdl file. Below I listed the 3 ways that you can affect the generated code.  The 3rd option requires that you call EntityClassGenerator yourself.  You can get your code to run automatically in VS sort of like an SingleFileGenerator by using this technique presented by Sanjay.

*

*Add code to the types through partial classes

*Add code to the partial methods that are called by the generated classes

*Hook the code generation events to inject code directly into the properties and types as they are generated.  See Danny's blog post for an example

A: I'll add that not only can you can tack on your own class partial classes to those emitted by the Entity Framework, but you can also write out all the partial methods created by the generated code.
IE. There'll be a lot of partial method code which get called but the method itself in the generated code isn't really implemented. For that you can write a partial method to catch events when properties change and such. It's not a terrible way to handle some business rules.


text:
Q: Can't catch Win32Exception So I'm receiving a Win32Exception during an Entity Framework "Any" transaction. The db machine is offline so it's to be expected. It's a monitoring app so I want to log that the machine isn't available however it's not catching the error.
The error is: (reported by Elmah)

System.ComponentModel.Win32Exception
  The network path was not found
System.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) ---> System.ComponentModel.Win32Exception (0x80004005): The network path was not found
     at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)

Ok, so here's my (pseudo) code:
if(Monitor.TryEnter(Variables))
try
{
    foreach(var thing in things)
    {
        try
        {
            using(var ctx = new context())
            {
                Do Stuff...
                if(thing.Any()) <-- Error
                Do more stuff... like look for problems.
            }
        }
        catch(Win32Exception)
        {
            Add exception to list of problems.;
        }
        catch(exception)
        {
            throw; //I was just seeing if this would help, it didn't
        }
     }
     Return list of problems
}
catch(Exception ex)
{
    Elmah.ErrorLog.GetDefault(null).Log(new Elmah.Error(ex));
}
finally
{
    Monitor.Exit(variables)
}

So I hope you can see that the Win32Exception should be caught, but it isn't - Elmah is reporting it. The errors that are being found in the database are being located and reported upon properly. It all works until this Win32Exception happens then it just seems to ignore my catch.


text:
Q: Android - getting hash key for Facebook Integration I am trying to implement Facebook into my app to allow things like sending stuff to the user's wall, updating status', etc.
So after downloading the stuff I was told to get a key using the keystore file. I decided to be brave and create my own keystore file (for publishing stuff later) and did so successfully.
After creating the file though I am having all sorts of problems trying to retreieve a key from it, i entered the command via keytool/command prompt and it asked me for my keystore password...
After entering the password i set in the first place, I am getting nothing but wierd ascii symbols and letters and my keystore details also in the middle of it. What is going wrong??
UPDATE:
Ok, I am aware you may need to use OpenSSL to display the text correctly. I have installed OpenSSL but how do I use it to get the Hash code?

A: *

*Download Openssl from: http://code.google.com/p/openssl-for-windows/downloads/list

*Make a openssl folder in C drive

*Extract Zip files into openssl folder

*check that the directory the keytool executable is in is on your path. (For example, on my Windows 7 machine, it's in C:\Program Files (x86)\Java\jre6\bin.)

*open cmd and paste:
keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | C:\openssl\bin\openssl sha1 -binary | C:\openssl\bin\openssl base64
type password android if need
you receive your hash code

A: I always use this method under Linux, because it fails in the original way:
keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore > key.out
cat key.out | openssl sha1 -binary > key.bin
cat key.bin | openssl base64

You will get the key you need to enter on page mobile, android section of your Facebook apllication. Every time you use different keytore to sign your app, you need to change the key on the facebook page also.

A: The best method.
*try {
        PackageInfo info = getPackageManager().getPackageInfo(
                "Your package name",
                PackageManager.GET_SIGNATURES);
        for (Signature signature : info.signatures) {
            MessageDigest md = MessageDigest.getInstance("SHA");
            md.update(signature.toByteArray());
            Log.d("Your Tag", Base64.encodeToString(md.digest(), Base64.DEFAULT));
            }
    } catch (NameNotFoundException e) {} catch (NoSuchAlgorithmException e) {
}*
Some times the openssl provide the wrong keyhash.

A: you can use code below to get the Hash key :
try {

   PackageInfo info = getPackageManager().getPackageInfo(getPackageName(), PackageManager.GET_SIGNATURES);

   for (Signature signature : info.signatures)
   {
    MessageDigest md = MessageDigest.getInstance("SHA");
    md.update(signature.toByteArray());
    Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
   }

  } catch (NameNotFoundException e) {
   Log.e("name not found", e.toString());
  } catch (NoSuchAlgorithmException e) {
   Log.e("no such an algorithm", e.toString());
  }

Reference :
http://limbaniandroid.blogspot.com/2013/04/how-to-get-hash-key-for-integarte.html


text:
Q: how can i make user assign look stacked?
I want each user to be stacked, neat as in the picture how can i make user assign look stacked? i want like this :
enter image description here

my result now :
enter image description here
my code :

          Row(
            children: List.generate(3, (index) {
              return Column(
                children: [
                  ClipRRect(
                    borderRadius:BorderRadius.circular(8),
                    child: Image.asset(
                      'asset/img/profile_photo.png',
                      width: 40,
                      height: 40,
                    ),
                  ),
                ],
              );
            }),
          ),

A: This is how i usually do stacked widgets like that. try it out

Stack(
           clipBehavior: Clip.none,
              children: [
                for (var i = 0; i < yourList.length; i++)
                  Container(

                //* you can adjust the margin here base on your desired output
                    margin: EdgeInsets.only(left: 12 * i.toDouble()),
                    child: ClipRRect(
                      borderRadius: BorderRadius.circular(8),
                      child: Image.asset(
                        'asset/img/profile_photo.png',
                        width: 40,
                        height: 40,
                      ),
                    ),
                  ),
              ]),

A: To make widgets stack on top of another, you need to use the Stack widget.
Stack(
  children: List.generate(3, (index) {
    return Padding(
      padding: EdgeInsets.only(left: (index * 0.5) * 40), // distance from the left
      child: ClipRRect(
        borderRadius: BorderRadius.circular(8),
        child: Image.asset(
          'asset/img/profile_photo.png',
          width: 40,
          height: 40,
        ),
      ),
    );
  }),
),

A: Of course you need to use Stack to make everything looks stacked, not Row. You can use something like this:
  @override
  Widget build(BuildContext context) {
    const WIDTH = 80.0;

    return Scaffold(
      body: Center(
        child: Stack(
            children: List.generate(7, (index) {
          return Positioned(
            left: (WIDTH - 30) * index,
            child: Container(
              decoration: BoxDecoration(
                borderRadius: BorderRadius.all(Radius.circular(5)),
                border: Border.all(color: Colors.black, width: 1.0*index),
              ),
              width: WIDTH,
              height: 40.0,
              child: Text(index.toString()),
            ),
          );
        })),
      ),
    );
  }

Result:
Remember to calculate distance carefully. I use Positioned and calculate left distance = (WIDTH - 30) * index. It is kinda same as your images, just adjust few things, then OK. Good luck!


text:
Q: WordPress: 3-way-development with Git without 3rd Party Software Maybe this question is too broad (I hope not) but I'm currently don't know, how to solve my WordPress Git Branching Model problem.
My plan was to create a branching model like this without using a BitBucket Server or Jenkins:

So I've started making a git init in the wp-content folder of my PROD (at this time only installation of WP) system.
After I was done with this, I've cloned the whole PROD page and created a staging subdomain. After cloning was completed, I've deleted the wp-content folder at the staging system and typed in a git clone <prod-path>/.git.
This worked great and after doing some changes (for testing purposes) at the staging version, I was able to push them back to the PROD. Until now, everything is logic and normal and worked very well.
After thinking some time, I've got the great (maybe stupid) idea, to do the same with a local DEV clone on my PC. So I've did the same like at the staging version before, but this time, I've cloned the staging wp-content clone (PROD clone) to my local DEV version.
For the first view, everything looked fine but after trying to push something to the Staging system, I've got rejected from the target staging Git:
remote: error: refusing to update checked out branch: refs/heads/development
remote: error: By default, updating the current branch in a non-bare repository

So I first thought, that it's very stupid what I did, because the staging is also a clone without a HEAD like on the PROD (I think).
So my question to you:
Do you have an idea, how I can keep this kind of Workflow without any 3rd party software, but with 2 clones that I can work on DEV, test on Staging and going live on PROD?
To say it with commands:
1. git push <to the staging>
2. git push <to the prod>
3. git merge <dev to master>

Update
This is the content of my bare hooks folder (there is no post-received, what should I do?):
/wp-content/.bare/hooks$ ls -la
total 56
drwxr-xr-x 2 wp_ftp psacln 4096 Apr 11 13:09 .
drwxr-xr-x 7 wp_ftp psacln 4096 Apr 11 13:20 ..
-rwxr-xr-x 1 wp_ftp psacln  478 Apr 11 13:09 applypatch-msg.sample
-rwxr-xr-x 1 wp_ftp psacln  896 Apr 11 13:09 commit-msg.sample
-rwxr-xr-x 1 wp_ftp psacln 3327 Apr 11 13:09 fsmonitor-watchman.sample
-rwxr-xr-x 1 wp_ftp psacln  189 Apr 11 13:09 post-update.sample
-rwxr-xr-x 1 wp_ftp psacln  424 Apr 11 13:09 pre-applypatch.sample
-rwxr-xr-x 1 wp_ftp psacln 1642 Apr 11 13:09 pre-commit.sample
-rwxr-xr-x 1 wp_ftp psacln 1492 Apr 11 13:09 prepare-commit-msg.sample
-rwxr-xr-x 1 wp_ftp psacln 1348 Apr 11 13:09 pre-push.sample
-rwxr-xr-x 1 wp_ftp psacln 4898 Apr 11 13:09 pre-rebase.sample
-rwxr-xr-x 1 wp_ftp psacln  544 Apr 11 13:09 pre-receive.sample
-rwxr-xr-x 1 wp_ftp psacln 3610 Apr 11 13:09 update.sample

A:
but after trying to push something to the Staging system, I've got rejected from the target staging Git

It depends what is the "rejected" message.
If it is
remote: error: refusing to update checked out branch: refs/heads/development
remote: error: By default, updating the current branch in a non-bare repository

That means you need to have a subfolder "bare" within your staging repo:
cd staging
git init --bare . bare
echo /bare/>>.gitignore
git add .gitignore
git commit -m "Ignore nested bare repo /bare/"
git remote add bare bare
git config remote.bare.fetch '+refs/heads/*:refs/remotes/bare/*'

cd bare
git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'

Then modify the bare/hooks/post-receive file in order for it to:

*

*be executable

*include the following content

post-receive hook in bare nested bare repository:
#!/bin/bash
unset GIT_DIR
cd ..
git --work-tree=. --git-dir=.git fetch bare
git --work-tree=. --git-dir=.git fetch --tags bare

if ! git --work-tree=. --git-dir=.git merge-base --is-ancestor master origin/master; then
  echo "Reset non-bare master to bare master (forced update)"
  git  --work-tree=. --git-dir=.git reset --hard origin/master
else
  echo "Update non-bare master with merge from origin/master"
  git --work-tree=. --git-dir=.git pull --no-rebase origin master
fi

Finally, on your dev cloned repo:
cd dev
git config --unset-all remote.origin.pushurl
git config --add remote.origin.pushurl "/path/to/staging/bare"

That way, you are fetching from the Staging repo as usual, but are pushing to the bare nested Staging repo, and the hook will update said Staging content.


text:
Q: Does HERE isoline API account for time waiting at intersections? I am testing out HERE's calculate isoline API and want to know a little more about how the time taken along routes is calculated.
In particular, does the API account for time taken waiting at intersections, or does it just apply some historical average speed to each link along the route?

A: For the estimation of traffic times, there is no difference between enabled and disabled traffic modes. Historical, real time and predictive traffic are taken into account based on the specified arrival/departure times.
See documentation on traffic mode type:
https://developer.here.com/documentation/routing/dev_guide/topics/resource-param-type-routing-mode.html#type-traffic-mode


text:
Q: Using %v in Apache LogFormat definition matches ServerName instead of specific vhost requested We have an application which uses a DNS wildcard, i.e. *.app.example.com. We're using Apache 2.2 on Ubuntu Hardy. The relevant parts of the Apache config are as follows.
In /etc/apache2/httpd.conf:
LogFormat "%v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" vlog

In /etc/apache2/sites-enabled/app.example.com:
ServerName app.example.com
ServerAlias *.app.example.com
...
CustomLog "|/usr/sbin/vlogger -s access.log /var/log/apache2/vlogger" vlog

Clients access this application using their own URL, e.g. company1.app.example.com, company2.app.example.com, etc.
Previously, the %v in the LogFormat directive would match the hostname of the client request, and we'd get several subdirectories under /var/log/apache2/vlogger corresponding to the various client URLs in use.
Now, %v appears to be matching the ServerName value, so we only get one log under /var/log/apache2/vlogger/app.example.com. This breaks our logfile analysis because the log file has no indication of which client the log relates to.
I can fix this easily by changing the LogFormat to this:
LogFormat "%{Host}i %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" vlog

This will use the HTTP Host: header to tell vlogger which subdirectory to create the logs in and everything will be fine.
The only concern I have is that this has worked in the past and I can't find any indication that this has changed recently.
Is anyone else using a similar config, i.e. wildcard + vlogger and using %v? Is it working fine?

A: There is also %V (note the cap) and the useCanonicalName option

A: %v is and always has been the canonical name of the vserver, ive just checked the manuals for both 1.3, 2.0 and 2.2 and they all say
%...v:          The canonical ServerName of the server serving the request.

https://httpd.apache.org/docs/1.3/mod/mod_log_config.html
https://httpd.apache.org/docs/2.0/mod/mod_log_config.html
https://httpd.apache.org/docs/2.2/mod/mod_log_config.html


text:
Q: Holomorphic extension of a function to $\mathbb{C}^n$ I am stuck at the following question :
Let $f$ be a holomorphic function on $\mathbb{C}^n \setminus \{(z_1, z_2, \ldots, z_n) | z_1=z_2=0\}$. Show that $f$ can be extended to a holomorphic function on $\mathbb{C}^n$.
I think that I have to somehow use the Riemann extension theorem here. But I am not being able to carry out the details.
Can anybody please help ?? Any suggestion or comment is very much appreciated.

A: Riemann's second extension theorem says that if $M$ is a holomorphic manifold and  $S\subset M$ is an analytic subset of codimension at least two, the restriction map $\mathcal O(M) \to \mathcal O(M\setminus S) $ is bijective.
Your question is solved by applying this result to $M=\mathbb C^n$ and $S=\{(z_1, z_2, \ldots, z_n) \in \mathbb C^n| z_1=z_2=0\}$
The theorem is not very difficult but for some reason it is underappreciated and rather difficult to find in the literature.
I located a slightly weaker but very elementary version  in Gunning's  Introduction to Holomorphic Functions of Several Variables, volume I, Theorem 2, page 30.
(The weaker version is local and supposes $S$ smooth, but this suffices for your question).
The general version can be found in Grauert-Remmert's masterful Coherent analytic Sheaves, page 132.


text:
Q: How can I draw and fill up a table with while cycle? I tried this way, but it isn't work.
$row2 = 0;
while ($row = mysql_fetch_assoc($query))
{
echo "
";
    if($row2 == 0){
        echo "
";
    }
    elseif($row2 < 5){
        echo "";
        echo "";
        echo "";
        echo "";
        echo $row['title'];
        echo "	";
        $sor++;
    }
    elseif($row2 == 5){
        echo "
";
    }
echo"
";
}

The while cycle is working, because if I print out just images, everything ok. The problem is only with the table.
I would like to draw a 5x2 table and fill it with movie posters and titles.

A: You are not increasing $row2 (it looks like you are increasing $sor).
Also, place your

 /

 outside your loop.
You can also use modulus % so that if you increase the db rows it will increase your rows.
Try something like this (untested)
$row2 = 0;
echo "
";
echo "
";
while ($row = mysql_fetch_assoc($query))
{
    if($row2%5== 0){
          echo "

";
    }
    echo "";
    echo "";
    echo "";
    echo "";
    echo $row['title'];
    echo "	";
    $row2++;
}
echo "
";
echo"
";


text:
Q: How do I define two bindable properties which update each other in Xamarin.Forms? I want to declare a BindableProperty which acts as a convenience property to another BindableProperty in Xamarin.Forms. Setting one will update the other. I won't give the full context and the actual types, but a very simple and understandable scenario would be as follows:
I have a view which defines a Number and a Numberp1 property. Number is bindable, while the Numberp1 property acts as the convenience property here.
//Definition
public class MyView : ContentView
{
    public static BindableProperty NumberProperty = BindableProperty.Create(nameof(Number), typeof(int), typeof(MyView));

    public int Number { get => (int)GetValue(NumberProperty); set => SetValue(NumberProperty, value); }

    public int Numberp1 { get => Number + 1; set => Number = value - 1; }
}

//Usage
<local:MyView Number="{Binding Number}"/>

Things go well until a customer discovers that Numberp1 isn't bindable and would like me to make it bindable.
<local:MyView Numberp1="{Binding Numberp1}"/>
//error : No property, bindable property, or event found for 'Numberp1', or mismatching type between value and property.

How would I make both of these properties bindable but make them update each other? I tried investigating using Converters but they seem to only be usable at the Binding, not the BindableProperty definition.

A:
Things go well until a customer discovers that Numberp1 isn't bindable and would like me to make it bindable.

Please create another BindableProperty for Numberp1,the Placeholder for the BindableProperty 'Numberp1Property ' should always match the name without 'Property'.
   public static BindableProperty NumberProperty = BindableProperty.Create(nameof(Number), typeof(int), typeof(MyView11), null, propertyChanged: OnNumberChanged);

    private static void OnNumberChanged(BindableObject bindable, object oldValue, object newValue)
    {
        var num = (MyView11)bindable;
        num.Number = (int)newValue;
    }

    public static BindableProperty NumberpProperty = BindableProperty.Create(nameof(Numberp), typeof(int), typeof(MyView11), null, propertyChanged: OnNumber1Changed);

    private static void OnNumber1Changed(BindableObject bindable, object oldValue, object newValue)
    {
        var num = (MyView11)bindable;
        num.Numberp = (int)newValue;
    }

    public int Number
    {
        get => (int)GetValue(NumberProperty);
        set => SetValue(NumberProperty, value);
    }

    public int Numberp
    {
        get => Number + 1;
        set => Number = value - 1;
    }

Adding propertyChanged event for BindableProperty.

A: They both have to be defined as BindableProperty.  Unfortunately, you can't rely on the setter methods being called, because the runtime doesn't necessarily go through the setter, it can directly call SetValue, which updates the definitive source of the value for a BindableProperty.
However you can rely on the fact that BindableProperty does get you PropertyChanged notifications automatically for either of your linked properties.
So, first define both properties:
    public static BindableProperty Number1Property = BindableProperty.Create(nameof(Number1), typeof(int), typeof(MyView));
    public static BindableProperty Number2Property = BindableProperty.Create(nameof(Number2), typeof(int), typeof(MyView));
    public int Number1 { get => (int)GetValue(Number1Property); set => SetValue(Number1Property, value); }
    public int Number2 { get => (int)GetValue(Number2Property); set => SetValue(Number2Property, value); }

Then, in the constructor, listen for changes:
public MyView ()
{
    InitializeComponent();

    PropertyChanged += MyView_PropertyChanged;
}

And finally, make sure that changes to either one is propagated to the other, where Number2 = Number1 + 1:
    private void MyView_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
    {
        if (e.PropertyName == Number1Property.PropertyName)
        {
            if (Number1 + 1 != Number2)
                Number2 = Number1 + 1;
        }
        if (e.PropertyName == Number2Property.PropertyName)
        {
            if (Number1 + 1 != Number2)
                Number1 = Number2 - 1;
        }
    }

EDIT As noted by @Knoop, the OP wanted the values to be related, not exactly the same.


text:
Q: Error message when submitting HIT to Amazon Mechanical Turk I have a problem submitting a HIT to Amazon Mechanical Turk sandbox.
I'm using the following code to submit a HIT:
external_content = """"
<ExternalQuestion xmlns="http://mechanicalturk.amazonaws.com/AWSMechanicalTurkDataSchemas/2006-07-14/ExternalQuestion.xsd">
  <ExternalURL>https://MY_HOST_GOES_HERE/</ExternalURL>
  <FrameHeight>400</FrameHeight>
</ExternalQuestion>
"""

import boto3

import os

region_name = 'us-east-1'

aws_access_key_id = 'MYKEY'
aws_secret_access_key = 'MYSECRETKEY'

endpoint_url = 'https://mturk-requester-sandbox.us-east-1.amazonaws.com'

# Uncomment this line to use in production
# endpoint_url = 'https://mturk-requester.us-east-1.amazonaws.com'

client = boto3.client('mturk',
                      endpoint_url=endpoint_url,
                      region_name=region_name,
                      aws_access_key_id=aws_access_key_id,
                      aws_secret_access_key=aws_secret_access_key,
                      )

# This will return $10,000.00 in the MTurk Developer Sandbox
print(client.get_account_balance()['AvailableBalance'])

response = client.create_hit(Question=external_content,
                             LifetimeInSeconds=60 * 60 * 24,
                             Title="Answer a simple question",
                             Description="Help research a topic",
                             Keywords="question, answer, research",
                             AssignmentDurationInSeconds=120,
                             Reward='0.05')

# The response included several helpful fields
hit_group_id = response['HIT']['HITGroupId']
hit_id = response['HIT']['HITId']

# Let's construct a URL to access the HIT
sb_path = "https://workersandbox.mturk.com/mturk/preview?groupId={}"
hit_url = sb_path.format(hit_group_id)

print(hit_url)

The error message I get is:
botocore.exceptions.ClientError: An error occurred (ParameterValidationError) when calling the CreateHIT operation: There was an error parsing the XML question or answer data in your request.  Please make sure the data is well-formed and validates against the appropriate schema. Details: Content is not allowed in prolog. (1493572622889 s)

What might be the reason here? The xml fully agrees with xml schema located on amazon servers.
The html returned by the external host is:
<!DOCTYPE html>

<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'/>

<form name='mturk_form' method='post' id='mturk_form' action='https://workersandbox.mturk.com/mturk/externalSubmit'>
<input type='hidden' value='' name='assignmentId' id='assignmentId'/>

Please name the company that created the iPhone

<textarea name='answer' rows=3 cols=80></textarea>

<input type='submit' id='submitButton' value='Submit' />
</form>

Thank you

A: This message "Details: Content is not allowed in prolog." is the clue. It turns out that what this is saying is that you can't have content outside of where it is expected. This is what usually happens when a junk character (think smart-quotes or non-printable ASCII value) appears in there. These can be a real pain in the butt to diagnose.
In your case, it's a little easier to debug but still just as frustrating. Check out this line:
external_content = """"

It turns out that Python only needs three quotes (""") in order to acknowledge a multi-line string definition. Thus your fourth " was actually rendering as part of the XML. Change that line to this:
external_content = """

And you're golden. I just tested it and it works. Sorry for all the frustration, but hopefully this unblocks you. Happy Sunday!