text:
Q: Winforms Auto-scaling with Localization I'm having significant issues getting Winforms (C#) auto-scaling working correctly.
First of all, it doesn't seem to even do anything across DPIs. When I create a simple application, all of the controls appear the same size on 100% and 125% DPI, however the fonts in all of my controls have been scaled up in 125% DPI. I would expect that the Form would be scaled up to allow for the larger fonts, but this is not the case. This may be due to the fact the application is not "DPI-Aware", and so it uses XP Style font scaling instead, but I'm not really sure. Here's how it looks:
Application at 100% DPI, Not Localized:

Application at 125% DPI, Not Localized:

The issues above are frustrating, but not deal breaking. Unfortunately, there is another issue. When my simple form has its "Localizable" property set to true (so all the controls' sizes and locations are stored in a resx file):

... the RichTextBox control becomes far, far too tall:
Application at 125% DPI, Localized:

Unfortunately, the application I'm working on is a very old one. It has over 500 controls/dialogs designed in Winforms, so moving to WPF is not a possibility.
So, my question is basically this: why does simply having the control locations in a resx file ruin the layout at 125% DPI? How can I fix this?
Here is the source for the above example program:
[Download]
Thanks for any help!
EDIT: Here are the relevant sources:
Form1.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml.Serialization;

namespace DPITest
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            richTextBox1.Text = richTextBox1.Size.ToString();
        }
    }
}

Form1.Designer.cs
namespace DPITest
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
            this.label1 = new System.Windows.Forms.Label();
            this.richTextBox1 = new System.Windows.Forms.RichTextBox();
            this.panel1 = new System.Windows.Forms.Panel();
            this.SuspendLayout();
            //
            // label1
            //
            resources.ApplyResources(this.label1, "label1");
            this.label1.Name = "label1";
            //
            // richTextBox1
            //
            resources.ApplyResources(this.richTextBox1, "richTextBox1");
            this.richTextBox1.Name = "richTextBox1";
            //
            // panel1
            //
            this.panel1.BackColor = System.Drawing.Color.Black;
            resources.ApplyResources(this.panel1, "panel1");
            this.panel1.Name = "panel1";
            //
            // Form1
            //
            resources.ApplyResources(this, "$this");
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.Controls.Add(this.panel1);
            this.Controls.Add(this.richTextBox1);
            this.Controls.Add(this.label1);
            this.Name = "Form1";
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.RichTextBox richTextBox1;
        private System.Windows.Forms.Panel panel1;

    }
}

Form1.resx
<?xml version="1.0" encoding="utf-8"?>
<root>
  <!--
    Microsoft ResX Schema

    Version 2.0

    The primary goals of this format is to allow a simple XML format
    that is mostly human readable. The generation and parsing of the
    various data types are done through the TypeConverter classes
    associated with the data types.

    Example:

    ... ado.net/XML headers & schema ...
    <resheader name="resmimetype">text/microsoft-resx</resheader>
    <resheader name="version">2.0</resheader>
    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
        <value>[base64 mime encoded serialized .NET Framework object]</value>
    </data>
    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
        <comment>This is a comment</comment>
    </data>

    There are any number of "resheader" rows that contain simple
    name/value pairs.

    Each data row contains a name, and value. The row also contains a
    type or mimetype. Type corresponds to a .NET class that support
    text/value conversion through the TypeConverter architecture.
    Classes that don't support this are serialized and stored with the
    mimetype set.

    The mimetype is used for serialized objects, and tells the
    ResXResourceReader how to depersist the object. This is currently not
    extensible. For a given mimetype the value must be set accordingly:

    Note - application/x-microsoft.net.object.binary.base64 is the format
    that the ResXResourceWriter will generate, however the reader can
    read any of the formats listed below.

    mimetype: application/x-microsoft.net.object.binary.base64
    value   : The object must be serialized with
            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
            : and then encoded with base64 encoding.

    mimetype: application/x-microsoft.net.object.soap.base64
    value   : The object must be serialized with
            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
            : and then encoded with base64 encoding.

    mimetype: application/x-microsoft.net.object.bytearray.base64
    value   : The object must be serialized into a byte array
            : using a System.ComponentModel.TypeConverter
            : and then encoded with base64 encoding.
    -->
  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
    <xsd:element name="root" msdata:IsDataSet="true">
      <xsd:complexType>
        <xsd:choice maxOccurs="unbounded">
          <xsd:element name="metadata">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" />
              </xsd:sequence>
              <xsd:attribute name="name" use="required" type="xsd:string" />
              <xsd:attribute name="type" type="xsd:string" />
              <xsd:attribute name="mimetype" type="xsd:string" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="assembly">
            <xsd:complexType>
              <xsd:attribute name="alias" type="xsd:string" />
              <xsd:attribute name="name" type="xsd:string" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="data">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="resheader">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" />
            </xsd:complexType>
          </xsd:element>
        </xsd:choice>
      </xsd:complexType>
    </xsd:element>
  </xsd:schema>
  <resheader name="resmimetype">
    <value>text/microsoft-resx</value>
  </resheader>
  <resheader name="version">
    <value>2.0</value>
  </resheader>
  <resheader name="reader">
    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <resheader name="writer">
    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
  <data name="label1.AutoSize" type="System.Boolean, mscorlib">
    <value>True</value>
  </data>
  <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
  <data name="label1.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
    <value>NoControl</value>
  </data>
  <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
  <data name="label1.Location" type="System.Drawing.Point, System.Drawing">
    <value>96, 125</value>
  </data>
  <data name="label1.Size" type="System.Drawing.Size, System.Drawing">
    <value>38, 15</value>
  </data>
  <data name="label1.TabIndex" type="System.Int32, mscorlib">
    <value>8</value>
  </data>
  <data name="label1.Text" xml:space="preserve">
    <value>label1</value>
  </data>
  <data name=">>label1.Name" xml:space="preserve">
    <value>label1</value>
  </data>
  <data name=">>label1.Type" xml:space="preserve">
    <value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </data>
  <data name=">>label1.Parent" xml:space="preserve">
    <value>$this</value>
  </data>
  <data name=">>label1.ZOrder" xml:space="preserve">
    <value>2</value>
  </data>
  <data name="richTextBox1.Location" type="System.Drawing.Point, System.Drawing">
    <value>15, 12</value>
  </data>
  <data name="richTextBox1.Size" type="System.Drawing.Size, System.Drawing">
    <value>200, 110</value>
  </data>
  <data name="richTextBox1.TabIndex" type="System.Int32, mscorlib">
    <value>0</value>
  </data>
  <data name="richTextBox1.Text" xml:space="preserve">
    <value />
  </data>
  <data name=">>richTextBox1.Name" xml:space="preserve">
    <value>richTextBox1</value>
  </data>
  <data name=">>richTextBox1.Type" xml:space="preserve">
    <value>System.Windows.Forms.RichTextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </data>
  <data name=">>richTextBox1.Parent" xml:space="preserve">
    <value>$this</value>
  </data>
  <data name=">>richTextBox1.ZOrder" xml:space="preserve">
    <value>1</value>
  </data>
  <data name="panel1.Location" type="System.Drawing.Point, System.Drawing">
    <value>15, 121</value>
  </data>
  <data name="panel1.Size" type="System.Drawing.Size, System.Drawing">
    <value>200, 1</value>
  </data>
  <data name="panel1.TabIndex" type="System.Int32, mscorlib">
    <value>4</value>
  </data>
  <data name=">>panel1.Name" xml:space="preserve">
    <value>panel1</value>
  </data>
  <data name=">>panel1.Type" xml:space="preserve">
    <value>System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </data>
  <data name=">>panel1.Parent" xml:space="preserve">
    <value>$this</value>
  </data>
  <data name=">>panel1.ZOrder" xml:space="preserve">
    <value>0</value>
  </data>
  <metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    <value>True</value>
  </metadata>
  <data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
    <value>7, 15</value>
  </data>
  <data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
    <value>232, 148</value>
  </data>
  <data name="$this.Font" type="System.Drawing.Font, System.Drawing">
    <value>Segoe UI, 9pt</value>
  </data>
  <data name="$this.Text" xml:space="preserve">
    <value>Form1</value>
  </data>
  <data name=">>$this.Name" xml:space="preserve">
    <value>Form1</value>
  </data>
  <data name=">>$this.Type" xml:space="preserve">
    <value>System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </data>
</root>

Program.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DPITest
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
    }
}

A: I have had many battles with the zoom issue.  I will share my ways of dealing with it.
First, there is the "cheating" way: on all UserControls and Windows, set the property "AutoScaleMode" to "None".  I call that cheating because I believe it basically ignores the zoom and keeps it at 100%, which the end user may not appreciate.
Second, the best way I found to deal with it is use "TableLayoutPanel".  I found that once I got good with TableLayoutPanel I was making controls faster, cleaner, resizable, and zoomable.
The trick is to NEVER set a fixed width.  A fixed width will fix the cell size, and when the control is zoomed, it will go out of that cell size.  For controls such as a label (that will always be a set size once it is on the screen), set the row/column to autozie.  For controls such as a rich textbox, set it to a %.  If you need blank space around sides, make an empty row/column and give it a % value.
Finally, because all these are % values, things will look bad when they get too small.  To allow users to be able to use your application no matter what size they make their window, in the designer shrink it down to whatever you want the min size of the control to be, then set "AutoScrollMinSize" to that size.  This will bring up scroll bars when the control gets smaller than what you set.
I hope this helps in your efforts to handle zoom!


text:
Q: Open default browser as as build goal Is it possible to set an execution goal for maven so that the default browser is opened in a given url?

A: In my experience, Maven doesn't have the notion of a default system browser, nor does Java.  There's some information here if you're looking to do this on Windows:
http://groups.google.com/group/comp.lang.java.programmer/msg/bd52c25dad8c1589
That solution also says that this is a platform specific detail.
My advice would be to write your own Maven plugin (surprisingly easy to do) and just set an execution for it under the part of the lifecycle you desire.  If you could give me more details of the context under which you want to open a URL, I could help you with that.  In my experience, any execution you define for Maven for a phase will happen after that phase.  So, setting something for the deploy phase will cause your plugin to run immediately after the artifact is uploaded.
As far as actually opening the browser is concerned, I would recommend using Selenium 2 to accomplish that:
http://code.google.com/p/selenium/wiki/GettingStarted
The nice thing about Selenium 2/WebDriver (they're in the same API) is that it takes care of the logistics of finding default installations of things like Firefox and Chrome, and knows how to interact with that browser and open a URL.  You could opt for a platform inspecific default (Firefox would be a good candidate), and if you have an exception opening it, launch Internet Explorer instead (there's no longer current Safari support in Selenium 2 however).
Combining those two things, Selenium 2 inside of a Maven plugin, should accomplish your goal quite well :)

redpajama_set_name: RedPajamaStackExchange


text:
Q: Trigger on database not table only When we insert or update data in a table, at time I want the primary key and table name to be inserted in another table.
I need this to reconcile at the end of day,  all tables that are updated today.
Please suggest. Thank you.

A: Take a look at CDC - Change Data Capture
Or Paul Nielsen's AutoAudit.

A: SELECT name
FROM sys.objects
WHERE DATEDIFF(D,modify_date, GETDATE()) < 1

By using this query you can able to get all the modification of your database. In place of 1 you can able to give no of days you want to see the change.

A: I've worked out something like this...I hope it answers your question.

*

*Create a few test tables for demonstration

*Create the SQL to create triggers on all the tables

*Simple insert statements.

   CREATE TABLE [dbo].[log_table](
          [table_name] [varchar](1000) NULL,
          [column_name] [varchar](1000) NULL,
          [column_value] [varchar](1000) NULL,
          [datetime] [datetime] NULL
        )
        GO

    CREATE TABLE [dbo].[Animals](
        [AnimalID] [int] IDENTITY(1,1) NOT NULL,
        [AnimalName] [varchar](50) NULL,
     CONSTRAINT [PK_Animals] PRIMARY KEY CLUSTERED
    ([AnimalID] ASC)
    )

    GO

    CREATE TABLE [dbo].[Countries](
        [CountryID] [uniqueidentifier] NOT NULL,
        [CountryName] [varchar](50) NULL,
     CONSTRAINT [PK_Countries] PRIMARY KEY CLUSTERED
    ([CountryID] ASC))
    ALTER TABLE [dbo].[Countries] ADD  CONSTRAINT [DF_Countries_countryID]  DEFAULT (newid()) FOR [CountryID]
    GO

    SELECT
  ' IF OBJECT_ID ('+ CHAR(39) + SCHEMA_NAME(tbl.SCHEMA_ID) + '.trg_' + tbl.name + CHAR(39) + ',''TR'') IS NOT NULL ' +
  ' DROP TRIGGER ' + SCHEMA_NAME(tbl.SCHEMA_ID) + '.trg_'+ tbl.name + ';' +
  ' EXEC (' + CHAR(39) +
  ' CREATE TRIGGER ' + SCHEMA_NAME(tbl.SCHEMA_ID) + '.trg_'+ tbl.name +
  ' ON '+ SCHEMA_NAME(tbl.SCHEMA_ID) + '.' + tbl.name + ' FOR INSERT,UPDATE AS ' +
  ' DECLARE @newval varchar(1000) ' +
  ' SELECT @newval ='+ COL_NAME(tbl.object_id, ic.column_id) + ' FROM INSERTED' +
  ' INSERT INTO log_table(table_name,column_name,column_value,datetime) VALUES('+
  CHAR(39)+ CHAR(39) + SCHEMA_NAME(tbl.SCHEMA_ID)  +'.'+  tbl.name + CHAR(39)+ CHAR(39) + ' ,'+
  CHAR(39)+ CHAR(39) + COL_NAME(tbl.object_id, ic.column_id) + CHAR(39)+ CHAR(39) + ' ,'+
  '@newval,getdate()'+ ')' + CHAR(39)+ ')'
FROM
  sys.tables AS tbl
  INNER JOIN  sys.key_constraints AS kc ON kc.parent_object_id = tbl.object_id
  INNER JOIN sys.indexes AS i  ON kc.unique_index_id = i.index_id  AND kc.parent_object_id = i.object_id
  INNER JOIN sys.index_columns AS ic  ON i.object_id = ic.object_id  AND i.index_id = ic.index_id
WHERE  tbl.type = 'U'  AND ic.is_included_column = 0 and tbl.name NOT IN ('sysdiagrams','log_table')
ORDER BY  tbl.object_id,  ic.key_ordinal;

Now insert into our tables

INSERT INTO Countries(CountryName) VALUES('South Africa')
INSERT INTO Countries(CountryName) VALUES('USA')
INSERT INTO Countries(CountryName) VALUES('Brazil')
INSERT INTO Countries(CountryName) VALUES('Zimbabwe')
INSERT INTO Countries(CountryName) VALUES('Africa is not a country')

INSERT INTO Animals(AnimalName) VALUES ('Lion')
INSERT INTO Animals(AnimalName) VALUES ('African Elephant')
INSERT INTO Animals(AnimalName) VALUES ('Rhinoceros')
INSERT INTO Animals(AnimalName) VALUES ('Leopard')
INSERT INTO Animals(AnimalName) VALUES ('Cape Buffalo')


text:
Q: Access iCloud mail via http from iPhone There are times when you can't use any TCP ports other than 80 (HTTP) or 443 (HTTPS), so you can't use Mail accounts that communicate with iCloud via IMAP/POP3/SMTP. But when you go to iCloud.com, it redirects you to the iPhone applications. Is there some way to access iCloud mail via HTTP(S)?

A: You can use a 3rd party browser to access icloud.com without being redirected to https://www.icloud.com/iphone_welcome. But beware, as you will see, icloud.com is not designed for a small display size like the iPhone's.
The key to accessing icloud.com is that the web browser doesn't identify itself as Safari Mobile.
Many browsers I tried, including Opera, Mercury and vBrowse, didn't work. I could finally find one which offered exactly this functionality: the full version of Atomic Web (note: I'm not affiliated with Atomic Web in any way) lets you set the browser identity to Firefox, Internet Explorer or Safari Desktop.
I chose Firefox 15 and could successfully load icloud.com. However, I soon noticed how uncomfortable it is to browse icloud.com from an iPhone.
To begin with, I couldn't sign in. I pinched and swiped but the display's contents didn't zoom out nor scroll. This is what I saw:

I had to switch to full screen to be able to partially see the Apple ID field:

I tapped on the Apple ID field, the metallic iCloud sign-in window gained focus and could log in.
As I feared, only the left top area of icloud.com's main page was displayed. Luckily, Mail's icon was visible and I could start it:

It was a frustrating experience. I changed orientation several times because, as before, I couldn't reliably scroll. My happiness faded and eventually, tired of trying, I gave up.
I tried Safari Desktop, the WAP browser and IE, but same result (or worse).
So there is a good reason why icloud.com redirects you to use the iPhone apps: icloud.com is not designed to be used with such a small display.
If you really need to have access to iCloud's webmail do yourself a favor and consider getting a tablet. If it's an iPad, install something like Atomic Web. If it isn't, you will be able to access it using the device's default browser.

A: Just install a browser that support changing the user agent. For the iPad I could recommend Terra. But there should be a lot of alternate browsers for iPhone as well (I think I remember Opera for iPhone).
Another way to use the native app would be to use any kind of VPN.

A: As a web developer I understand that there are simply some limitations to websites. It is indeed possible to make, as Apple with iCloud has done, it impossible for users operating certain browsers (user agents, or other means of user-sniffing) to access the site, or a particular page of the site.
As you have seen when you go to www.icloud.com on your "iPhone", it will redirect you to www.icloud.com/iphone-welcome/. They have some pretty specific, and intense (in a way) server redirects that are happening at the server level to send you to a different page, and you will find it impossible (unless they change configuration) to get to the desired, and normal operation of www.iCloud.com. If you open iCloud.com -> Mail you will notice, if you resize your browser horizontally that at a certain point horizontal scroll bars appear. This is obviously undesirable on any device, and they have apparently opted to get around that by simply routing users to the iPhone welcome.
Again, you can use a different browser that allows you to change the user agent, but because www.iCloud.com is so Javascript heavy, it makes it almost impossible to navigate, as noted by @jaume. If Apple developers would have given us not-so-fancy a site, with less javascript, changing the user agent, likely would have worked very well. Javascript enables all the nice UI animations, and such beautifications - as long as you are using a desktop browser.
Interesting side note: you can't access www.iCloud.com at all on an Android browser. You get an "Unsupported" error message.

A: Yeah, I just purchased the full version of Atomic Web, and it bars your from going to the "non-Sign-Up-to-iCloud" page like every other browser.  Just wasted my money.  You should update your page to reflect this.

A: I had this issue as well, trying to bring up iCloud notes for a second account on an iPhone.

*

*You can use mobile Chrome.  The trick here is Request Desktop Site.

*Good luck with browsing. As others have said, since Apple expects
you to use Apps on iOS to use iCloud services, they pay close to
zero effort to make this work on an iPhone screen


text:
Q: Stored Procedure timing out Trying to collect some heirarchical data to send out to a third party, and was directed to this post.
After attempting to tweak it to my use case on SQL Fiddle, the stored procedure keeps timing out.
So I tried it on locally twice (via PhpMyAdmin).
When I try to reload PMA in the browser after calling the stored procedure, I just get an eternal "waiting for response" spinner (more than 10 or 20 minutes).
I'm presuming there's something wrong with my SP code ???
CREATE TABLE foo
    (`id` int, `name` varchar(100), `parentId` int, `path` varchar(100))
//

INSERT INTO foo (`id`, `name`, `parentId`, `path`)
VALUES (1, 'discrete', 0, NULL),
       (2, 'res', 1, NULL),
       (3, 'smt', 2, NULL),
       (4, 'cap', 1, NULL),
       (5, 'ind', 1, NULL),
       (6, 'smt', 4, NULL),
       (7, 'tant', 6, NULL),
       (8, 'cer', 6, NULL)
//

CREATE PROCEDURE updatePath()
BEGIN
DECLARE cnt, n int;
    SELECT COUNT(*) INTO n FROM foo WHERE parentId = 0;
    UPDATE foo a, foo b SET a.path = b.name WHERE b.parentId IS NULL AND a.parentId = b.id;
    SELECT count(*) INTO cnt FROM foo WHERE path IS NULL;
    while cnt > n do
        UPDATE foo a, foo b SET a.path = concat(b.path, '|', b.id) WHERE b.path IS NOT NULL AND a.parentId = b.id;
        SELECT count(*) INTO  cnt FROM foo WHERE path IS NULL;
    end while;
END//

EDIT
Expected results:
VALUES (1, 'discrete', 0, '1'),
       (2, 'res', 1, '1|2'),
       (3, 'smt', 2, '1|2|3'),
       (4, 'cap', 1, '1|4'),
       (5, 'ind', 1, '1|5'),
       (6, 'smt', 4, '1|4|6'),
       (7, 'tant', 6, '1|4|6|7'),
       (8, 'cer', 6, '1|4|6|8');

A: After a good nights sleep, I took @Drew's lead and I went through it one pc at a time.
Got it working. Here's where I'm leaving it:
CREATE TABLE foo
    (`id` int, `name` varchar(100), `parentId` int, `path` varchar(100))
//

INSERT INTO foo
    (`id`, `name`, `parentId`, `path`)
VALUES
    (1, 'dscr', 0, NULL),
    (2, 'res', 1, NULL),
    (3, 'smt', 2, NULL),
    (4, 'cap', 1, NULL),
    (5, 'ind', 1, NULL),
    (6, 'chp', 4, NULL),
    (7, 'tant', 6, NULL),
    (8, 'cer', 6, NULL)
//

CREATE PROCEDURE updatePath()
BEGIN
DECLARE cnt, n int;

    SELECT COUNT(*) INTO n FROM foo WHERE parentId = 0; -- n is now 1
    SELECT COUNT(*) INTO cnt FROM foo WHERE path IS NULL; -- cnt is now 8

    UPDATE foo child, foo parent        -- each child now has its parent and own ID's in the path
      SET child.path = CONCAT(parent.id, '|', child.id)
      WHERE parent.parentId = 0
      AND child.parentId = parent.id;

    WHILE cnt > n DO
        UPDATE foo child, foo parent    -- concat parent's path and own ID into each empty child's path
          SET child.path = concat( parent.path,'|',child.id )
          WHERE parent.path IS NOT NULL
          AND child.parentId = parent.id;

        SELECT COUNT(*) INTO  cnt  -- decrement cnt
          FROM foo
          WHERE path IS NULL;

    END WHILE;

    UPDATE foo  -- set path for any top-level categories
      SET path = id
      WHERE path IS NULL;

END//

call updatePath()//

Feel free to critique.
Hope this helps someone else some time.

A: Are you trying to do a self-referencing join to create the hierarchy?
select
    a.name,
    parentName = b.name
from
            foo a  ,
outer join  foo b   on
(
    a.id = b.parentId
)


text:
Q: Gradle Scala Plugin - how to specify zincClasspath I am trying to use the Scala plugin with Gradle to build my project on an Ubuntu VM. This is what my build.gradle file looks like:
apply plugin: 'scala'
repositories {
     mavenCentral()
}

dependencies {
    compile 'org.scala-lang:scala-library:2.11.8'
}

when I run gradle build from the command line, I get the following error:
FAILURE: Build failed with an exception.

* What went wrong:
A problem was found with the configuration of task ':compileScala'.
> No value has been specified for property 'zincClasspath'.

I have looked around for where to specify this zincClasspath property, but can't find anything.
I have tried to force the zincClasspath to use an older version of the scala library, but it doesn't seem to work.
Any help is much appreciated
Edit:
One thing to add, this exact project builds fine on my local Windows machine, but not on my Ubuntu VM....

A: Fixed this myself in the end, the clue was that it was running on my Local machine but not my VM... of course my Gradle version was different.
Upgrading to Gradle 3.0 fixed this

A: I ran into this issue again recently, adding the following to my Gradle build script seemed to fix it:
ScalaCompileOptions.metaClass.daemonServer = true
ScalaCompileOptions.metaClass.fork = true
ScalaCompileOptions.metaClass.useAnt = false
ScalaCompileOptions.metaClass.useCompileDaemon = false


text:
Q: Element type is invalid: expected a string (for built-in > components) or a class/function (for composite components) but got: > object I am getting a warning and an error when I load my project. I am at video 68 at the moment.
Warning:

Warning: React.createElement: type should not be null, undefined,
  boolean, or number. It should be a string (for DOM elements) or a
  ReactClass (for composite components). Check the render method of
  WeatherList.

And an error:

Error: Element type is invalid: expected a string (for built-in
  components) or a class/function (for composite components) but got:
  object. Check the render method of WeatherList.

When I check my render method for the WeatherList component I don't see anything that would cause this error:
render() {
    return (

                    City
                    Temperature (C)
                    Pressure (hPa)
                    Humidity (%)

{this.props.weather.map(this.renderWeather)}

    );
 }

They both point to this render method as the source of the error.
Edit:
The WeatherList component is being imported and rendered in the App component.
import WeatherList from "../containers/weather_list";

export default class App extends Component {
  render() {
    return (

        <SearchBar />
        <WeatherList />

    );
  }
}

The renderWeather funtion returns table data from mapping over an array:
renderWeather(cityData) {
    const name = cityData.city.name;
    const temps = _.map(
      cityData.list.map(weather => weather.main.temp),
      temp => temp - 273
    );
    const pressures = cityData.list.map(weather => weather.main.pressure);
    const humidities = cityData.list.map(weather => weather.main.humidity);
    const { lon, lat } = cityData.city.coord;
    return (

          <GoogleMap lon={lon} lat={lat} />

          <Chart data={temps} color={"red"} units="C" />

          <Chart data={pressures} color={"green"} units="hPa" />

          <Chart data={humidities} color={"blue"} units="%" />

    );
  }


text:
Q: Alternative to SOA? So I've been looking at No SOA record -- what are the implications? which shows that SOA records aren't obligatory but a good idea.
As of today - 0-21.ru doesn't have an SOA record. It has a Whois record so is there an alternative way to tracking down through dig that this domain is in fact alive (even though I guess technically its not) when it doesn't have an SOA record?
The examples in the question I reference would still require knowing what the nameserver is for the domain.

A: As per the spec each zone must have a SOA record, even though the usage is somewhat situational.
I suppose what you read a bit too much into in the answers to the other question is that, while it's not optional, if you were to violate the spec in this regard (I see no reason why you would want to) it will only break some things, not everything.
From what I can see at this time, the statement 0-21.ru doesn't have an SOA record is not obviously true.
The actual situation at this time seems to be that all the nameservers for 0-21.ru are unresponsive, making it impossible to look up any records at all. Ie, it's not possible to tell if there is a SOA record or not.
As for the other aspect of your question, you could check for the existence of a delegation in the parent zone.
Eg dig +trace +all 0-21.ru NS would show the chain of delegations. Normally you would see the responses all the way to the authoritative nameservers, but in this case it currently ends at delegation from the ru nameservers as the authoritative servers for 0-21.ru are MIA.
Or, for that matter, if you know the nameservers of the parent zone (in this case ru) you could do eg:
$ dig @d.dns.ripn.net 0-21.ru +norec

; <<>> DiG 9.11.20-RedHat-9.11.20-1.fc32 <<>> @d.dns.ripn.net 0-21.ru +norec
; (2 servers found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 52492
;; flags: qr; QUERY: 1, ANSWER: 0, AUTHORITY: 2, ADDITIONAL: 3

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;0-21.ru.                       IN      A

;; AUTHORITY SECTION:
0-21.ru.                345600  IN      NS      ns1.0-21.ru.
0-21.ru.                345600  IN      NS      ns2.0-21.ru.

;; ADDITIONAL SECTION:
ns1.0-21.ru.            345600  IN      A       185.242.84.104
ns2.0-21.ru.            345600  IN      A       185.242.84.105

;; Query time: 80 msec
;; SERVER: 2001:678:18:0:194:190:124:17#53(2001:678:18:0:194:190:124:17)
;; WHEN: Fri Jul 03 10:54:24 UTC 2020
;; MSG SIZE  rcvd: 104

$

To see that there does indeed exist a delegation.


text:
Q: не грузится картинка из css файла не грузится картинка из css файла хотя все подключено верно вот код

    <title>123</title>
    <link rel="stylesheet" href="css/styles.css" type="text/css">

            sd

и css
.top{
  background-image: url(../images/WKR8byV.png);
}

A: решил с помощью увеличение области где грузится картинка


text:
Q: Is there any way to fix azure cli import pyparsing error on mac? I'm trying to run azure CLI after reinstalling it I'm getting:
$ az
Traceback (most recent call last):
  File "/usr/local/Cellar/python@3.8/3.8.11/Frameworks/Python.framework/Versions/3.8/lib/python3.8/runpy.py", line 185, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/usr/local/Cellar/python@3.8/3.8.11/Frameworks/Python.framework/Versions/3.8/lib/python3.8/runpy.py", line 111, in _get_module_details
    __import__(pkg_name)
  File "/usr/local/Cellar/azure-cli/2.25.0/libexec/lib/python3.8/site-packages/azure/__init__.py", line 1, in <module>
    __import__('pkg_resources').declare_namespace(__name__)
  File "/usr/local/Cellar/azure-cli/2.25.0/libexec/lib/python3.8/site-packages/pkg_resources/__init__.py", line 78, in <module>
    __import__('pkg_resources.extern.packaging.requirements')
  File "/usr/local/Cellar/azure-cli/2.25.0/libexec/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/requirements.py", line 9, in <module>
    from pkg_resources.extern.pyparsing import stringStart, stringEnd, originalTextFor, ParseException
  File "/usr/local/Cellar/azure-cli/2.25.0/libexec/lib/python3.8/site-packages/pkg_resources/extern/__init__.py", line 52, in create_module
    return self.load_module(spec.name)
  File "/usr/local/Cellar/azure-cli/2.25.0/libexec/lib/python3.8/site-packages/pkg_resources/extern/__init__.py", line 44, in load_module
    raise ImportError(
ImportError: The 'pyparsing' package is required; normally this is bundled with this package so if you get this warning, consult the packager of your distribution.

I checked the python binary path and I saw I already have this package.

A: Found the issue.
One of the sub-packages that called in the pyparsing package was called to a local folder script that has the same name. and as a result the import faild.
$ /usr/local/Cellar/azure-cli/2.25.0/libexec/bin/python
Python 3.8.11 (default, Jun 29 2021, 03:08:07)
[Clang 12.0.5 (clang-1205.0.22.9)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyparsing
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/Cellar/azure-cli/2.25.0/libexec/lib/python3.8/site-packages/pyparsing.py", line 104, in <module>
    import copy
  File "/Users/shprayev/copy.py", line 4, in <module>
    from pymongo import MongoClient
ModuleNotFoundError: No module named 'pymongo'

So pyparsing imports copy and I had copy.py in my path.
after rename the script it worked


text:
Q: Partner Account and Deploy I have a developer account and would like to try AppExchnage.
I registered in partners.salesforce.com five days ago and do not see any feedback. How can I call to SF support to remind about my request.
Is there any short way for developers purposes to deploy App and install this App from another account? Does SF have sandbox for AppExchange?
Thank you.

A: There's a FAQ where you register to become a partner along with a couple of videos. You'll eventually be contacted by a representative of the ISV program who'll want to discuss your product plans with you. As I recall, once that's done they'll admit you to the partner community and you file a case to get access to Environment Hub and other things. I believe some of these things have been changing, so the FAQ will have the latest info.


text:
Q: Creating SEO friendly urls in Classic ASP I have to make all links SEO friendly on our website.
I have the following url: http://newark.storeboard.com/board.asp?RegionID=353&ClassAdCatID=740&IsEvent=1&IsCoupon=0&IsBlog=0
I need it be: http://neward.storeboard.com/classifieds/events/ConcertsLiveMusic
I have no way of accessing the IIS so this has to be done thru code.  Any ideas about how to achieve this would be greatly appreciated.
Many Thanks,
Paul

A: The standard way of solving this as far as I know is to use a rewrite engine in IIS (such as ISAPI_rewite or IIS7 url rewrite module)
However, you don't have access to IIS you say... That makes it tricky. Two thoughts come to mind:
1) Could you create a dynamic (asp) 404 page that then looks at the request header and does a transfer according to the page requested?
2) Or, and this is rather lame, could you create a static folder structure that goes some way to looking like that url structure?

A: If you upgrade to IIS7 and use ASP.Net then you can control the URL rewrite module from your code.
I've done something similar to Matts suggestion 1 in the past and it can work.  The important thing is you make the 404 page directly feed the true page content and not do a redirect. Otherwise your defeating the point of SEF URLs for SEO gain.
From the few references I still have to the code. asp has a Server.Transfer() function but you may have issues that you can't pass query string parameters. I think I ended up streaming the real page through the 404 page using the MSXMLServerXMLHTTP object and Response.BinaryWrite().


text:
Q: wxWidgets: unbind event as its triggered I'm coding a wxWidgets GUI that involves dynamically adding and removing rows of controls inside a gridsizer through buttons.
Each row of controls has a "remove" button that triggers an event that:

*

*Removes the controls from their sizer

*Hides the controls

*Unbinds theremove button event

*Flags the controls as available in the reusable controls pools (I'm
re-using controls because wxWidgets doesn't like deleting stuff at
runtime)

Now I don't think unbinding the event inside the event handler itself is a good thing. Is there a better way to achieve this behaviour?
this is how I dynamically create my controls
bool filtermanager::add()
{
    if (!grid || !box || !form || !bsizer)
        return false;

    dbgcode(log->d(tag, "add: adding a new filter row"));

    // add and index filter in the filter map and refresh layout
    filter *flt = new filter(this, box, grid);
    filters[flt->removebutton()->GetId()] = flt;
    refreshlayout();

    return true;
}

filtermanager::filter::filter(filtermanager *parent,
    wxStaticBox *box, wxGridSizer *grid)
    : parent(parent), grid(grid)
{
    controlpool *ctl = parent->ctl;

    // initialize filter row elements
    property = ctl->makeComboBox(box, "property");
    value = ctl->makeTextCtrl(box, "value");
    button = ctl->makeButton(box, "Remove");

    // add filter row to the grid sizer
    grid->SetRows(grid->GetRows() + 1);
    grid->Add(property, 0, wxALL | wxEXPAND, 0);
    grid->Add(value, 0, wxALL | wxEXPAND, 0);
    grid->Add(button, 0, wxALL | wxEXPAND, 0);

    // bind remove button
    button->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &filtermanager::OnRemoveClicked, parent);
}

this is the event handler:
void filtermanager::OnRemoveClicked(wxCommandEvent &e)
{
    wxButton *b = dynamic_cast<wxButton *>(e.GetEventObject());
    filter *flt = filters[b->GetId()];

    dbgcode(log->d(tag,
        strfmt() << "OnRemoveClicked: remove button event caught" <<
        " property=" << flt->propertycombo() <<
        " value=" << flt->valuetext() <<
        " button=" << flt->removebutton())
    );

    removebyflt(flt);
}

void filtermanager::removebyflt(filter *flt)
{
    int id = flt->id();

    // dealloc filter from the map
    delete filters[id];
    filters[id] = NULL;
    filters.erase(id);
}

filtermanager::filter::~filter()
{
    controlpool *ctl = parent->ctl;

    // unbind button
    button->Unbind(wxEVT_COMMAND_BUTTON_CLICKED, &filtermanager::OnRemoveClicked, parent);

    // remove the filter from the gui
    if (!grid->Detach(property))
        parent->log->e(tag, "~filter: failed to remove property from sizer");

    if (!grid->Detach(value))
        parent->log->e(tag, "~filter: failed to remove value from sizer");

    if (!grid->Detach(button))
        parent->log->e(tag, "~filter: failed to remove button from sizer");

    grid->SetRows(grid->GetRows() - 1);

    // refresh panels as usual
    parent->refreshlayout();

    ctl->free(property);
    ctl->free(value);
    ctl->free(button);
}

By the way, the purpose of this GUI is adding search filters for properties in a loaded XML file.

A: It's fine to unbind the event from its handler, I really don't see any problem, even potentially, with doing this.
Also, wxWidgets doesn't have any special problems with deleting the controls during run-time, generally speaking, and using a pool of hidden controls seems more trouble than just deleting and recreating them as needed. However, deleting a control from a handler for the event generated by this control is indeed a bad idea and may result in crashes. The canonical solution for this is to hide the control immediately and delete it "slightly later", i.e. during the next event loop iteration. This can be done by explicitly using wxEVT_IDLE in all version of wxWidgets or, more conveniently, by using CallAfter() in wxWidgets 2.9.5 or later.


text:
Q: Adding GMail-like "archive" functionality to Windows Explorer  One of the things I love about GMail is the one-click ability to move files out of my inbox without throwing them out.
What's the best way to add a hook to Windows Explorer (Windows 7) to do the same for my local files? Ideally, it would be a right-click menu item (or keyboard shortcut) to move (not just copy) the files to C:\User\USERID\Archive, or something like that, and automatically rename conflicting files.


text:
Q: При создании потока появляется ошибка "Кадр не находится в модуле" только начинаю учить процессы и потоки, создал процесс который должен выполнять функцию вычисления факториала, однако при попытке запуска появляется ошибка "Кадр не находится в модуле". Подскажите с чем это может быть связано и как это исправить.
Код:
int gn = 0;
scanf_s("%d", &gn);
HANDLE h = CreateThread(
    NULL,
    0,
    factorial(gn),
    NULL,
    NULL,
    NULL
);
CloseHandle(h);
return 0;


text:
Q: Mock HTTP request and response with request payload I'm using following code to mock HTTP request and response object using node-mocks-http;
   var request  = httpMocks.createRequest({
        method: 'POST',
        url: '/test',
        body : "some body",
    });
    var response = httpMocks.createResponse({
        eventEmitter: require('events').EventEmitter,
        req : request
    });

    response.on('end', function() {
        console.log(response._getData())
        expect(response._getData()).toEqual("kill me");
        expect(response.statusCode ).toEqual(200);
        expect(response._isEndCalled()).toBe(true);
        done();
    });

    handleReqRes(request,response);

But it doesn't trigger any event of request.
function handleReqRes(req,res){
    req.on("data", chunk => {
        console.log(chunk);
    });
    req.on("end", () => {
        console.log("end");
    });
    res.end("kill me");
}

So for above call it just logs "kill me". It is fine if it works with other mocking library I can switch to that.

A: I found the solution. I actually need to emit the event myself at the end
request.emit('data', Buffer.from(data));
request.emit('end');

I'll update the original plugin to have a method to do this.


text:
Q: How to remove Grand Total columns from Matrix Report in salesforce? I have a Matrix Report and i want to remove the Grand Total Column and row in the table.Below is the Image of the report.

A: I was able to find this article that looks to show an option in Lightning to remove Grand Totals and Subtotals.  I will warn you that once a report is edited in Lightning, it is no longer available in Salesforce Classic.
https://help.salesforce.com/apex/HTViewSolution?id=000240316&language=en_US


text:
Q: issue in inflating layout I have a class a class showProduct which extends BaseAdapter. I am trying to infalte a layout in getView method but when i am taking ids(R.id.tvName) of views in the layout it do not takes the ids. I have set the ids in the layout.
class showProduct extends BaseAdapter{

    @Override
    public int getCount() {
        return rows;
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        convertView = getLayoutInflater().inflate(R.layout.show_product,null);
        TextView tvName,textViewDesc;

        tvName = (TextView)convertView.findViewById(R.id.tvName);
        return null;
    }
}

A: Set return convertView; instead of return null; in getView()
also in getItem() you should return something like return items.get(position);


text:
Q: How to use Overloading in Iron Python? I wanted to use overloading in Iron Python but seems it's not working :
import sys
import clr

def  af(a, b):
     c = a+b
     print c
     return c
def af(j):
  y = j*j
  print y
  return y

 af(6,7)
 af(5)

I get a error =\
Is there any way to use overloading ?
my purpose is to write a function : foo(doAction,numTimes)
when by default if I use foo(action): it will do it once,
 or I'll write : foo(action,6)
thanks a lot!!!

A: IronPython might run on the CLR but that doesn't make it C#. In any kind of Python, you can only define a function once. Defining a function is really just assigning to a name, so in your code you assign a function to af, then assign another one to the same name, so the first one is simply discarded.
The way to do this in Python is via default arguments:
def aj(a, b=None):
    if b is not None:
        result = a + b
    else:
        result = a * a
    print result
    return result

For your actual use case of course you can define numtimes with a default of 1:
def foo(action, numtimes=1):
    # whatever


text:
Q: Preparing CliMond data for Maxent I had been working with BioClim data and that was working in Maxent. I could clip files and realign them etc.
Now I have some data from CliMond which is in two formats:
Either as text files
CM10_1975H_Bio01_V1.2.txt
CM10_1975H_Bio02_V1.2.txt
CM10_1975H_Bio03_V1.2.txt
etc
Or sets of data (lots of folders Bio1 to Bio40) as ESRI format files
/bio40$ ls
dblbnd.adf
hdr.adf
metadata.xml
prj.adf  sta.adf
w001001.adf
w001001x.adf
Is there a way that I can batch clip these to a format that is usable in Maxent (python or Qgis)?


text:
Q: Java Arrays increasing I need help with one of my methods that lengthen an array. So if the array is ABC i want the void method to make it AABBCC. Here is my code so far:
public void lengthen(){
    double[]t = new double[samples.length];

    for(int i = 0;i<samples.length;i++){
        t[i] = samples[i];
    }
    samples = new double[t.length*2];
    for(int i = 0; i < samples.length;i++){
        samples[(2*i)] = t[i];
        samples[(2*i)+1] = t[i];
    }
}

A: You want the second array to only increment to a maximum of i/2 as you are filling two array elements in the loop body.

A: Your problem is that your loop iterates over the indexes of the doubly-sized array and uses that to index the singly-sized array, hence you out-of-bounds exception.
It can be done quite simply with something like:
public void lengthen() {
    // Create new array, twice as many elements.

    double [] t = new double[samples.length * 2];

    // Transfers the elements, n -> 2n, 2n+1, n ranging from 0 to N-1 inclusive.

    for (int i = 0; i < samples.length; i++) {
        t[i*2]   = samples[i]; // 0->0, 1->2, 2->4, ..., (N-1)->(2N-2).
        t[i*2+1] = samples[i]; // 0->1, 1->3, 2->5, ..., (N-1)->(2N-1).
    }

    // Load into member variable.

    samples = t;
}


text:
Q: Iconography to summarize a table I am building up a table summarizing several methodologies for a presentation. And I would like to place some coloring iconography to grasp some information at a glance.
Here is the problem definition. My problem has 3 different stages. Some methodologies address all of them, others only some parts and some others fuse some stages. To address the stages several characteristics can be used to address any of those stages.
Therefore I would like to build up a table where i classify the methodologies plus they description and add and extra column where i put such iconography as in the example.

I guess that the proper way to go is using \tikzset, having as many macros as colors combinations and use parameters to color it. But My problem comes when i want to fuse stages.
Is there any elegant solution to it?

A: I give the \icon macro that takes two mandatory arguments and one optional argument.  The mandatory arguments are a primary (left side) and secondary (right side) colors, the optional argument, if "e" means it is elliptical, rather than circular.  If #3 is left as {}, it will be just filled with color #2.  If both #2 and #3 are left as {}, you will get an empty icon with a black border.
\documentclass{article}
\usepackage{stackengine}
\usepackage{xcolor}
\usepackage{bbding}
\usepackage{scalerel}
\usepackage{graphicx}
\usepackage{ifthen}
\newcommand\icon[3][c]{%
 \if e#1\def\cstretch{2}\else\def\cstretch{1}\fi%
 \kern-1pt%
 \hstretch{\cstretch}{%
  \raisebox{3pt}{\rotatebox{-45}{%
   \ifthenelse{\equal{#2}{}}{%
      \stackinset{c}{}{c}{}%
        {\scalebox{.9}{\textcolor{white}{\CircleSolid}}}%
        {\textcolor{black}{\CircleSolid}}%
   }{%
    \ifthenelse{\equal{#3}{}}{%
      \mbox{\textcolor{#2}{\CircleSolid}}%
    }{%
      \stackengine{0pt}{\textcolor{#2}{\CircleSolid}}%
        {\textcolor{#3}{\HalfCircleRight}}{O}{r}{F}{F}{L}%
    }%
   }%
  }}%
 }%
 \kern-.8pt%
}
\newcommand\X{\textsf{X}\,\,}
\parskip 2em
\begin{document}
x \icon[e]{blue}{black}\icon{red}{}\icon{}{}\icon{black}{yellow}

\begin{tabular}{c|c|lc}
      & STAGE &&\\
CLASS & 1\,~~2~~\,3 & CHARACTERISTICS & \\
\hline
& \icon{}{}\icon{black}{red}\icon{yellow}{} &
  USES A, BBB, CCC, DDD; & [xx]\\
& ~~\X \icon[e]{green}{} & BBB & [xx]\\
& \icon[e]{green}{red}\icon{green}{blue} & BBB, CCC, EEE & [xx]\\
\end{tabular}
\end{document}


text:
Q: How to change the sampling rate for android touch event? I've searched in google and android develop site about the issue that the
sampling rate of the touch event is too low. However, most of the information
obtained is in opposite side. Many docs discuss about that the sampling rate is
too high such that it causes game programming to slow down the frame rate.
It's said that this is fixed in some android version.
Now I come up with the problem. I desired to develop a handwriting note app
which requires the touch event handling. I noticed that the touch event triggered (or to said, captured in onTouch function) is not as frequently as I want. It seems only tens of touch events captured in onTouch() and the points are not enough to make a smooth handwriting.
Does anyone knows how to increase the sampling rate of the touch event? I wonder
whether this is a hardware issue or because of android framework may filter some of the
event. Any suggestion will be appreciated. Thanks....
BR
Yi-Ju

A: You set the rate when you register a sensor listener. However as the documentation states it is just a hint to the system, the actual rate will most likely be hardware dependent
http://developer.android.com/reference/android/hardware/SensorManager.html#registerListener(android.hardware.SensorEventListener, android.hardware.Sensor, int, android.os.Handler)


text:
Q: Given a parametrization, find the function Consider a parametrization of $x$ and $y$ by $t$ (all real variables), say $y=f(t)$, $x=g(t)$. Given a function $f$ and a function $h$, we would like to find the function $g$ such that $y=h(x)$. Perhaps this question is trivial, but I am too tired to think at the moment: find a nessecary and sufficient condition concerning $f,h$ such that such a $g$ exists.
For example, given $f=t^2,h=x$ we choose $g=t^2$.

A: $$
g(t) = x = h^{-1}(y) = h^{-1}(f(t)),
$$
so $g = h^{-1}\circ f$.
As @abiessu says, this requires $h$ to be invertible.


text:
Q: how to use @queuebinding with @rabbitlistener? Seems since spring-amqp version 1.5, there is a new annotation @queuebinding。But how to use it, i don't know if it can be used on a class or a method? Does it exist any example?

A: Not sure what problem you have, but here is a sample exactly from the Reference Manual:
@Component
public class MyService {

  @RabbitListener(bindings = @QueueBinding(
        value = @Queue(value = "myQueue", durable = "true"),
        exchange = @Exchange(value = "auto.exch"),
        key = "orderRoutingKey")
  )
  public void processOrder(String data) {
    ...
  }

And yes, it can be use as on class level as well as on method level.


text:
Q: Maintain a git repository in all dask.distributed worker / scheduler What would be the best way for all Dask (distributed) workers / schedulers to understand a custom git repository's python modules?
It would be a plus if the new commits to the git repository are reflected on the Dask workers / schedulers the same way.
I have tried the following things:
(1) Using client.upload_file API, copy the files from master node to worker nodes. Copying the files individually loses the module / directory structure so zipping the files then uploading that could work. But updates to the git repository wouldn't be reflected in the zipped repositories of master and worker nodes.
(2) (From Amazon EMR) In the bootstrap script, I included "pip install git+https://github.com/my_repo.git", so that all nodes would have the repository upon cluster instantiation. But same as (1); updates to the git repository wouldn't be reflected in the installed packages under site-packages/.

A: Dask does not manage user software environments.  Typically people handle this with Docker images or Network File Systems (NFS)


text:
Q: The execution plan for mixed LEFT JOIN and INNER JOIN in SQL query I am testing a in-house relational DB and I cannot figure out the why the optimizer could figure out this query plan.
SELECT * from A LEFT JOIN B on A.x = B.x INNER JOIN C on B.y = C.y

The execution plan reported by this database could be written like below psuedo-code:
For each tupleB in B
   For each tupleC in C
     INNER JOIN tupleB and tupleC
     For each tupleA in A
         INNER JOIN tupleA

The result for this plan is correct.
If all the JOINs are INNER joins, this plan looks reasonable to me since INNER JOIN is both commutative and associative.
However, when the LEFT JOIN and INNER JOIN are mixed, how does the optimizer could figure out INNER_JOIN(INNER_JOIN(B,C),A) share the same result with INNER_JOIN(LEFT_JOIN(A,B),C)?
Is there a theory to prove this or this just happens case by case?

A: The equivalence of plans INNER_JOIN(LEFT_JOIN(A,B),C) and INNER_JOIN(INNER_JOIN(B,C),A) has two steps:

*

*INNER_JOIN(LEFT_JOIN(A,B),C) is equivalent to INNER_JOIN(INNER_JOIN(A,B),C)

*INNER_JOIN(INNER_JOIN(A,B),C) is equivalent to INNER_JOIN(INNER_JOIN(B,C),A)
The first equivalence is the more difficult to see. Once you perform LEFT_JOIN(A,B) you may have rows from A not having a counterpart in B. These rows are the only rows that are not in INNER_JOIN(A,B). These rows will have NULL values in B attributes. Subsequently, you perform an inner join with C using B.y and those extra rows have to disappear in the final result since the B.y is NULL and the join condition B.y = C.y is always evaluated to uknown. Therefore, in the final result you have only those rows which are product of INNER_JOIN(A,B) even if you process the LEFT_JOIN(A,B).
The second equivalence is commes from the join associativity


text:
Q: "Specified cast is not valid" on SQL "OUTPUT" parameter I'm working on an ASP.NET site and have stumbled across an issue. I've been converting an ASP.NET Forum into ASP.NET 4.5. I've fixed everything and the site runs fantastic on my local dev machine. Once I upload it to my web host I get the following error.

Server Error in '/' Application.
Specified cast is not valid.

I've been trying to figure it out and I am stumped. Here is the code, SQL table and the stored procedure.
    public static int GetWebIDAndFolder(string host, out string folder)
    {
        SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["CrzyForumConnectionString"].ConnectionString);
        SqlCommand cmd = new SqlCommand("CWF_GetWebIDAndFolder", conn);

        host = host.Replace("www.", "");

        cmd.CommandType = CommandType.StoredProcedure;
        cmd.Parameters.Add("@WebDomain", SqlDbType.NVarChar, 50);
        cmd.Parameters.Add("@WebID", SqlDbType.Int, 4);
        cmd.Parameters.Add("@Folder", SqlDbType.NVarChar, 50);
        cmd.Parameters[0].Value = host;
        cmd.Parameters[1].Direction = ParameterDirection.Output;
        cmd.Parameters[2].Direction = ParameterDirection.Output;

        conn.Open();
        cmd.ExecuteNonQuery();

        int webID = (int)cmd.Parameters[1].Value;

        if (Convert.IsDBNull(cmd.Parameters[2].Value))
            folder = string.Empty;
        else
            folder = (string)cmd.Parameters[2].Value;

        conn.Close();

        return webID;
    }

SQL Table:
CREATE TABLE [dbo].[CWF_Webs] (
[WebDomain] NVARCHAR (50) COLLATE Latin1_General_CI_AS NOT NULL,
[WebID]     INT           NOT NULL,
[Folder]    NVARCHAR (50) COLLATE Latin1_General_CI_AS NULL
);

Stored Procedure
CREATE PROCEDURE [indie_world].CWF_GetWebIDAndFolder
(
@WebDomain  nvarchar(50),
@WebID      int OUTPUT,
@Folder     nvarchar(50) OUTPUT
)
AS

SELECT @WebID = (SELECT WebID FROM CWF_Webs WHERE WebDomain = @WebDomain)
SELECT @Folder = (SELECT Folder FROM CWF_Webs WHERE WebDomain = @WebDomain)

Any and all help will be appreciated. The code, table, and procedure are all from The project is from the following url. http://www.codeproject.com/Articles/4291/Riverside-Internet-Forums. It is the application im converting to base a simple forum off of and start expanding it.

A: I see now that the params were output,  I see that you are SELECTING the values into the parameters.  Whenever I have used OUTPUT parameters that also have a RESULTSET (i.e. SELECT statement) I have to close the reader first.
Have you tried one of the following?
Change the SPROC:
SET @WebID = (SELECT WebID FROM CWF_Webs WHERE WebDomain = @WebDomain)
SET @Folder = (SELECT Folder FROM CWF_Webs WHERE WebDomain = @WebDomain)

Or don't change the SQL and use a DataReader and then close it after you finish Reading():
using( System.Data.Common.DbDataReader rdr = cmd.ExecuteReader() )
{
   while(rdr.Read())
   {
   }
}
int webID = (int)cmd.Parameters[1].Value;

A: I would change the parameters assigment for using keys instead indexes
cmd.Parameters["@WebDomain"].Value = host;
cmd.Parameters["@WebID"].Direction = ParameterDirection.Output;
cmd.Parameters["@Folder"].Direction = ParameterDirection.Output;

and the use the key to get the value
int webID = cmd.Parameters["@WebID"].Value as int;
if(webID==0){
// something is wrong with your query
}

A: I figured it out after a day of messing around with it. Thanks guys for all the great feed back. The issue was the host in the database table. I had added http:// to it were it was just looking for url.com not http://url.com.


text:
Q: I want to save a CSV with Aggregate Report in JMeter. I need to save this file in my local repository where the JMX file is I want to save a CSV with Aggregate Report in JMeter. I need to save this file in my local repository where the JMX file is. How I can indicate the path? Please help.

A: You can generate the CSV file with Aggregate Report data out of the .jtl file containing your test results using JMeter Plugins Command Line Graph Plotting Tool

*

*Install JMeter Plugins Command Line Tool using JMeter Plugins Manager

you may also need to install Synthesis Report if you don't have it

*Run your JMeter test in command-line non-GUI mode like:
jmeter -n -t test.jmx -l result.jtl

*Once your test is complete you can generate Aggregate Report CSV representation as follows:
JMeterPluginsCMD --generate-csv aggregate-report.csv --input-jtl result.jtl --plugin-type AggregateReport

this aggregate-report.csv is a relative path to the current folder, you can make it absolute like:
JMeterPluginsCMD --generate-csv c:/somefolder/someotherfolder/aggregate-report.csv --input-jtl result.jtl --plugin-type AggregateReport

More information: How to Use the JMeterPluginsCMD Command Line


text:
Q: Try and catch C++ I am having trouble getting the try and catch to work properly in this code. It keeps the code from getting "loopy" when a char is entered instead of a number, however, it does not give the cout<<"Invalid entry"; response I am looking for. My Professor hinted to use the try and catch method if there is a better way to catch a char where there should be an int I am open to suggestions.
Here is the code. It is for an assignment FizzBuzz.
int main() {
    int choice, choiceArray;
    string userArray;

    cout << "Welcome to the FizzBuzz program!"<< endl;

    cout << "This program will check if the number you enter is divisible by 3, 5, or both." << endl;

    try {
        while(true) {
            cout << "Enter a positive number"<< endl;
            cin >> choice;
            cout << endl;

            if (choice % 3 == 0 && choice % 5 == 0) {
                cout << "Number " << choice << " - FizzBuzz!" << endl;
                break;
            }
            else if (choice % 3 == 0) {
                cout << "Number " << choice << " Fizz!" << endl;
                break;
            }
            else if (choice % 5 == 0) {
                cout << "Number " << choice << " Buzz!" << endl;
                break;
            }
            else {
                cout << "Number entered is not divisible by 3 or 5, please try again." << endl;
            }
        }
    }
    catch (...) {
        cout << "Invalid entry" << endl;
    }
}

A: cin doesn't use exceptions by default, you can turn them on with
cin.exceptions(std::ifstream::failbit);

Without exceptions, you can also detect bad input by checking the stream state explicitly, like
if (cin >> choice) { /* ok */ }
else { /* bad input */ }

Either way, you have to reset the failure state (cin.clear()) and remove the bad data from the stream (std::numeric_limits<std::streamsize>::max()) before trying again.

A: Besides what @Ben said, it's a fairly bad idea to catch any exeption unspecified with
catch (...) {
    cout << "Invalid entry" << endl;
}

That should be the absolutely last resort, and you can't reliably tell that it was an exception because of an "Invalid entry" or any different reason.
At least you should catch a std::exception before instead
catch (const std::exception& e) {
   cout << "Exception caught: '" << e.what() << "'!" << endl;
}
catch(...)  {
   cout << "Exception caught: Unspecified reason!" << endl;
}

and use the what() function to provide more specific information.


text:
Q: Is there a way to add a path variable on macOS with a single bundled archive? I've got an install4j program which contains 2 launchers, 1 GUI launcher and 1 command line interface launcher.
Currently the program uses a single bundle archive to install on macOS and it would very time consuming to change this. I was wondering if there was any way I could add some sort of path variable or symlink which would allow users to run my CLI launcher anytime from terminal. (The GUI launcher is installed and set up perfectly already!)

A: Modifying the PATH environment variable is not easily possible on macOS and a change like that might not be appreciated by some users.
I would recommend adding symlinks to /usr/local/bin, that directly is already in the path. You can do that with "Create a symbolic link" actions.


text:
Q: How does the IQueryable builds the query? I have this project in c# where I have several possible types of conditions, let's say they are title and level just to put it simply.
I'm trying to make the query but I'm not sure if it's built in the correct way.
Cases:

*

*Title is given, I have to go for all the titles that match that one.

*Level is given, it's the same as title

so I have
query = query.Where(x => x.Title == title);

and later on
query = query.Where(x => x.Level == level)

My question is, how does this translate?
Like this:
from * myTable WHERE Title = title and Level = level

or like this (this is the way I need it)
from * myTable WHERE Title = title or Level = level

I have to do some validations and I can't create the query in the same place,

A: In general the same series of operations on IEnumerable<T> and IQueryable<T> with the same contents should produce the same output... give or take case sensitive comparisons and so on.
Consider the following:
int[] data = new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
var query = data.Where(i => i > 3);
query = query.Where(i => i < 8);

When you enumerate over query (which is of type IEnumerable<int>) the operations are applied in sequence. Values which fail the first Where do not get evaluated by the second, so can never reach the result set:

Value
First Where
Second Where
Output

1
Fail
--
No

2
Fail
--
No

3
Fail
--
No

4
Pass
Pass
Yes

5
Pass
Pass
Yes

6
Pass
Pass
Yes

7
Pass
Pass
Yes

8
Pass
Fail
No

9
Pass
Fail
No

10
Pass
Fail
No

This is equivalent to:
query = data.Where(i => i > 3 && i < 8);

The equivalent SQL WHERE would then be:
WHERE i > 3 AND i < 8

While this works in the case of restrictive filters (where each term must applied), it doesn't do much for permissive filters (where any term may apply). Instead we have to look at other ways to do query composition.
For IEnumerable<T> we can simply use function composition:
string title = "A Title";
int level = 1;

Func<recordType, bool> predicate = x => x.Title == title;
predicate = x => predicate(x) || x.Level == level;

var query = data.Where(predicate);

Unfortunately this isn't quite as simple for IQueryable<T> since the predicate type is a LINQ Expression of type Expression<Func<T, bool>>, and we can't create a suitable expression tree from a Func<T, bool>. Instead we have to do lambda expression composition.
The simplest point to start at is implementing an OrElse expression compositor that takes two lambda expressions and invokes them as parameters to an OrElse expression:
public static Expression<Func<T, bool>> OrElse<T>(Expression<Func<T, bool>> left, Expression<Func<T, bool>> right)
{
    if (left is null)
        return right;

    if (right is null)
        return left;

    var parm = Expression.Parameter(typeof(T), "row");
    var result = Expression.Lambda<Func<T, bool>>
    (
        Expression.OrElse
        (
            Expression.Invoke(left, parm),
            Expression.Invoke(right, parm)
        ),
        parm
    );
    return result;
}

(This could be an extension method, but I think it's bad form to design extensions that explicitly permit targets.)
We can then use this to compose a predicate expression from optional parts:
// 'Book' in this case is a placeholder for your record type.
Expression<Func<Book, bool>> MakePermissiveFilter(string title, int? level)
{
    Expression<Func<Book, bool>> result = null;

    if (!string.IsNullOrEmpty(title))
        result = OrElse(result, b => b.Title == title);

    if (level is not null)
        result = OrElse(result, b => b.Level == level);

    // if nothing selected return a default 'always true' predicate
    if (result is null)
        result = b => true;

    return result;
}

Now we can invoke that to generate the required filter expression for your Where clause:
// 'query' previously defined with select and optional ordering
query = query.Where(MakePermissiveFilter(text, level));

This will work for any compliant IQueryable<T>: LinqToObjects, LinqToSQL, Entity Framework (all versions) and so on.

The resultant predicate is slightly inelegant, but SQL generation will reduce the noise in most cases. You might end up with a WHERE 1 = 1 in there if the filter terms are empty.
We could go a lot further and unwrap the supplied lamdba expressions, replace their parameters and build a new lambda, but it's a fair amount of work for relatively little gain.


text:
Q: Facebook and Twitter APIs performance I use http://urls.api.twitter.com/1/urls/count.json?url=example.com and https://graph.facebook.com/?ids=http://example.com to pull like and tweet counts from several URLs.
But because I use those two methods to get data about multiple URLs (up to 40), the page takes up to 24 second to load, which is huge.
Is there any other method to get the same data (i.e. like and tweet counts) faster ?
P.S. : I am using PHP.
This is the code :
function likes_count($url) {

  $url = urlencode($url);
  $json_string = file_get_contents('http://graph.facebook.com/' . $url);
  $json = json_decode($json_string, true);
  echo "fetching from facebook
";
  return intval($json['shares']);

}

function tweets_count($url) {

  $url = urlencode($url);
  $json_string = file_get_contents('http://urls.api.twitter.com/1/urls/count.json?url=' . $url);
  $json = json_decode($json_string, true);
  echo "fetching from twitter
";
  return intval($json['count']);

}


text:
Q: Grails 2.5.x clear form after submit I'm working on Grails 2.5.x.
When I submit a form and save successful, I press back on browser and the data in form still there, it may screw up the data.
How can I clear the form by using back-end.
I try to clear params but it doesn't work.
Any solutions will be appreciated.
Thanks.


text:
Q: Why is Safari asking the obvious when I programmatically print page with JavaScript? What does this dialog mean? Of course I want to print a page after pressing a "print" button, what's the purpose of it and how do get around it?
When I hit "print" it doesn't print straight away anyway but just shows the expected dialog with the print preview.

The code (it's vuejs) is simple. I'm waiting for some asynchronous stuff to finished and then I invoke the print when the promise is resolved:
this.$refs.export.prepare().then(() => {
    window.print();
});

All the other browsers are just fine with this.


text:
Q: Antd Date : how to set valid empty date in moment js I am using ANTD (https://ant.design/) for the project, ANTD is working fine with other components whereas I am facing issue while using DatePicker(https://ant.design/components/date-picker/).
DatePicker uses moment(https://momentjs.com/)
In a form initially, I want all the fields with a placeholder and once the user fills the form it will be displayed to him/her. Once added user can edit their data.
Setting data works fine but I am unable to set date field initially as empty so that I am able to show the user a field with a placeholder
I am setting the date field as
initialValue: moment(null) => invalid date
initialValue: moment('') => invalid date
initialValue: moment(undefined) => current date // i don't want current date i want empty (to show the placeholder instead)

where as when i am getting user selected while setting the date it works perfectly fine.
 initialValue: moment(userSelectedDate) =>  user selected date

A: This worked for me.
              <Space direction="horizontal">
            <DatePicker
              value={formik.values.next_reminder_date
                ? moment(formik.values.next_reminder_date) : undefined}
              placeholder="Next Reminder Date"
              name="next_reminder_date"
              onChange={(date) => {
                const isoDate = date?.toISOString();
                formik.setFieldValue('next_reminder_date', isoDate);
              }}
            />
          </Space>

A: Make an initial value in state as undefined and assign an initial value to defaultValue prop of datepicker.
Try the following code:
import React from 'react';
import ReactDOM from 'react-dom';
import 'antd/dist/antd.css';
import './index.css';
import { DatePicker } from 'antd';

const dateFormat = 'YYYY/MM/DD';
const initialValue=undefined; // this initial value should be in state

ReactDOM.render(

    <Form.Item >
      {getFieldDecorator('password', {
        rules: [{ required: true, message: 'Please input your Password!' }],
        initialValue:initialValue
      })(
        <DatePicker
      placeholder="please add date"
     format={dateFormat}
/>
      )}
    </Form.Item>

,
  document.getElementById('container'),
);

A: This worked for me.
<DatePicker

        placeholder="Date"
        format={DATE_FORMAT}
        defaultValue={
          (data?.openHouse?.date && moment(data.openHouse?.date, 'YYYY-MM-DD')) || ''
        }
        onChange={(momentDate: any) => {
          setValue('openHouse.date', momentDate?.format('YYYY-MM-DD'), {
            shouldValidate: true,
          });
        }}

      />

A: instead
initialValue: moment(null)

pass
initialValue: undefined.

works for me,

A: const getDateFormat = date => {
    var d = moment(date);
    return date && d.isValid() ? d : '';
  };

In your input tag value={getDateFormat(value)}


text:
Q: Paaing multiple parameters to this function? I have been messing with this amazing function I found on the old forums. There is not much information on it.
I tried to figure it out on my own but to no avail. I could really use some help with. Here is the link to it.
So far I can only seem to pass one parameter to it, but reading his brief description it seems possible to pass multiple parameters to it. If I am mistaken please let me know.
I would like to invoke the function like this WinGetAll("Title", Class', 'Hwnd', 'Process', 'PID') , so that it will return all the properties of a window per  line:
[Window #1 Title],[Window #1 Class], [Window #1 Hwn], [Window #1 Process], [Window #1 PID]
[Window #2 Title],[Window #2 Class], [Window #2 Hwn], [Window #2 Process], [Window #2 PID]
[Window #3 Title],[Window #3 Class], [Window #3 Hwn], [Window #3 Process], [Window #3 PID]
<etc etc >

With my experimentations, I was only able to use two parameters at once:
WinTitles := WinGetAll("Title", "On")
WinTitles := WinGetAll("Title", "Off")

I am very new to AHK, There may be much better solutions. If so please let me know.
I just need a reliabe way to get every window and its properties listed in a single line:
[Window #1 Title],[Window #1 Class], [Window #1 Hwn], [Window #1 Process], [Window #1 PID]

With the option to hide system windows such as svchost.exe / csrss.exe / services.exe etc
Any help would be greatly appreciated!

A: Try this
WinGet, id, list
Loop, %id%
{
    this_ID := id%A_Index%
    WinGet, exStyle, exStyle, ahk_id %this_ID%
    If !(exStyle & 0x100)
        continue
    WinGetTitle, title, ahk_id %this_ID%
    If (title = "")
        continue
    WinGetClass, class, ahk_id %this_ID%
    WinGet, PID, PID, ahk_id %this_ID%
    WinGet, ProcessName, ProcessName, ahk_id %this_ID%
    Index++
    wins .= "Window #" Index . ":`ntitle = "  title "`n"  "class ="  class "`n"  "hwnd ="  this_ID  "`n"    "PID ="  PID  "`n"  "ProcessName ="  ProcessName "`n`n"
}
MsgBox, % wins


text:
Q: Flexbox child not reading height/width of parent I was experimenting with flexbox and created this layout. I'm trying to get the middle white box that says "hey" to be 90% width/height of the parent but percentages don't seem to affect it. (I have it set as 100px/100px currently which works)
It's strange since the parent has a defined width/height on inspection.
Can anyone tell me how to implement that? (also, general critique on how I used flexbox appreciated as well)
http://jsfiddle.net/yv3Lw5gy/1/
relevant class:
.super-thing{
    height: 100px;
    width: 100px;
    background-color: white;
    margin:auto;
    box-shadow: 2px 1px 1px #000;
}

A: The .body parent of .super-thing is display: flex so its children don't inherit its height or width if they don't have flex properties.
###The power of flex compels you!
Set flex: 1 on .super-thing so it grows and shrinks with a 1% margin  to create a gap. There is no need for a width or height.
.super-thing {
  background-color: white;
  margin: 1%;
  box-shadow: 2px 1px 1px #000;
  flex: 1;
}

###Complete Example
In this example, the box-sizing: border-box and the removal of the margin to be replaced with padding on , get the entire container properly sized in the viewport so there is no scrollbar.

* {
  background-color: rgba(255, 0, 0, .2);
  box-sizing: border-box;
}
* * {
  background-color: rgba(0, 255, 0, .2);
}
* * * {
  background-color: rgba(0, 0, 255, .2);
}
* * * * {
  background-color: rgba(255, 0, 255, .2);
}
* * * * * {
  background-color: rgba(0, 255, 255, .2);
}
* * * * * * {
  background-color: rgba(255, 255, 0, .2);
}
html,
body,
.container {
  height: 100%;
}

body {
  padding: 10px;
  margin: 0;
}

.container {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  align-items: stretch;
  /* align-content: center; */
}
.header {
  flex: 1 0 30px;
  display: flex;
}
.header-left {
  flex: 11 0 auto;
}
.header-right {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}
.header-right .small-item {
  width: 100%;
  outline: 1px solid #fff;
}
.main {
  background-color: #fff;
  flex: 10 0 30px;
  display: flex;
}
.left-column {
  flex: 3;
  flex-direction: column;
  display: flex;
  justify-content: center;
}
.left-column .story {
  flex: 2;
  outline: 1px solid white;
  /* margin:auto; */
}
.right-column {
  flex: 12;
  background-color: #f0f;
  display: flex;
  flex-direction: column;
}
.right-column-body {
  flex: 10;
  display: flex;
  flex-direction: column;
}
.right-column-body .header {
  flex: 1;
  display: flex;
  justify-content: center;
}
.thing {
  width: 20%;
  margin: 5px
}
.super-thing {
  background-color: white;
  margin: 1%;
  box-shadow: 2px 1px 1px #000;
  flex: 1;
}
.right-column-body .body {
  background-color: #ccc;
  flex: 5;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.right-column-footer {
  flex: 1;
  background-color: white;
}
.footer {
  flex: 1 0 30px;
}

Left

A

B

C

D

      A
      A
      A
      A

A

B

C

Hey

Footer

Footer


text:
Q: App Engine FilterPredicate returning nothing when querying for string I'm using Java 8 to build a hobby project on Google App Engine but my Query return null even though there entity exists in the datastore on my localhost.
From datastore
key: aglub19hcHBfaWRyGAsSC0dyb2NlcnlMaXN0GICAgICAgMAJDA ID/Name: 5348024557502464   created: Tue Dec 04 22:06:11 CET 2018   owner: 185804764220139100000

The "owner" Id I'm getting using the UserServiceFactory and the id is correct, checked it several times.
Here is how I query the entity I need
Query q = new Query("GroceryList")
          .setFilter(new FilterPredicate("owner", FilterOperator.EQUAL, currentUser.getUserId()));

        DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
        PreparedQuery pq = datastore.prepare(q);
        Entity result = pq.asSingleEntity();

But the entity is null, nothing is fetched. I used https://github.com/GoogleCloudPlatform/java-docs-samples/blob/2e5996c68440134a79f1511c57529fa5cf987628/appengine-java8/datastore/src/test/java/com/example/appengine/QueriesTest.java#L787 as a reference.
What am I doing wrong?


text:
Q: Unable to run docker without sudo I have followed the commands for the post-installation to run docker without sudo, but unfortunately, it still will not work.
I have done the following:

*

*Created the docker group Added the user to the group

*Did the newgrp docker command each time

*Rebooted the system (sudo reboot)

*Logged out/logged in

*Changed the docker.sock ownership to that user and the docker group

*Reviewed the .bashrc file to see if there was any commands related to docker that may affect it

*Checked the config docker file and the host is /var/run/docker.sock

*Deleted the docker group and re-did all the steps

I've read through multiple posts and still unable to get it working.
Command prompt snipit:
https://i.stack.imgur.com/UPbE8.png
Any ideas what may be the issue?
Thank you

A: To fix this, I created a new user and added that user to the docker group. That allowed me to run docker without sudo.


text:
Q: Expand Dataframe with Lists in the columns In Python, how do I expand this dataframe...

sect_id
sector
func_list
func_id

0
AAA
['A', 'B']
[1,2]

1
BBB
['C', 'D']
[3,4]

To this format?

sect_id
sector
func_list
func_id

0
AAA
A
1

0
AAA
B
2

1
BBB
C
3

1
BBB
D
4

Thanks for your advice.

A: Try:
from ast import literal_eval

# apply ast.literal_eval if necessary:
df["func_list"] = df["func_list"].apply(literal_eval)
df["func_id"] = df["func_id"].apply(literal_eval)

print(df.explode(["func_list", "func_id"]))

Prints:
   sect_id sector func_list func_id
0        0    AAA         A       1
0        0    AAA         B       2
1        1    BBB         C       3
1        1    BBB         D       4

A: import pandas as pd

table = pd.read_clipboard()

import ast

def unlist_stringlist(stringlst):
    x = stringlst
    x = ast.literal_eval(x)
    return(x)

df_tmp=[]
for i in range(len(table)):
    sctid = table.sect_id.values[i]
    sct = table.sector.values[i]
    funclist_tmp = unlist_stringlist(table['func_list'][i])
    funcid_tmp = unlist_stringlist(table['func_id'][i])
    len_stringlist = len(funclist_tmp)
    for j in range(len_stringlist):
        df_tmp.append([sctid,sct,funclist_tmp[j],funcid_tmp[j]])

df_result = pd.DataFrame(df_tmp)
df_result.columns = table.columns
df_result

This would work.

A: Try using explode with pandas 1.3.0+ with multi-column explode:
df.explode(['func_list', 'func_id'])

Output:
   sect_id sector func_list func_id
0        0    AAA         A       1
0        0    AAA         B       2
1        1    BBB         C       3
1        1    BBB         D       4

Given, df:
df = pd.DataFrame({'sect_id': [0, 1],
                   'sector' : ['AAA', 'BBB'],
                   'func_list': [['A', 'B'],['C', 'D']],
                   'func_id': [[1, 2], [3, 4]]})


text:
Q: Huge database table design issue In my DB design I've encountered an issue. My app consists of a workflow on specific kind of media which has 6 stages as follows :

*

*Resources

*Ingest

*Review

*VideoRepair

*Listing

*backup

Since in all the stages the type of data being added (or updated) to table is the same but only their names change for example in ingest we have following columns
CaptureSup_Name, Assign_DateByCaptureSup, AssignedCaptureOp_Name,
LastCapture_Date, LastCaptureOp_Name, LastCapture_Date,

and in review we have exactly same columns but only Ingest replaces with Review and almost the same happens for the other columns of table (with one or two columns more or less)and for the purpose of having better performance on select queries So I decided not to assign one table for each stage (tradition normalization) and on the contrary I wrapped them all in one unified table
And now my table has 30 columns and the number of 30 in columns is scaring me because I never designed such a big table. Which of the following scenarios is most suitable for my case considering my database is supposed to support huge amount of data (about 1500 records being added daily) and speed is vital?

*

*following the traditional normalization approach and break my big table into 6 or 7 tables each of which have about 5 or 6 columns o that I have to write (n-1) joins to retrieve complete data of cycle

*keep my current design (one table with 30 columns) and find solution for reducing size of logs because in this case logs would be more massive (because of updates)

A: 30 fields is not a wide table. SQL Server supports over 1,000 fields per table.
1,500 records per day is not a large volume of inserts. That is only about 500 thousand rows per year. SQL Server can handle billions of rows.
If you are having an issue with logs, then you have several options, such as:

*

*switching to simple recovery mode;

*periodically backing up the database and truncating the log; and,

*using database checkpoints.

You should break your table up into other tables, if that makes sense in terms of the relational model -- this is likely, because 30 columns in a table would often be combinations of other entities. But your data structure is easily in the realm of what databases readily support. And, it can grow much, much larger with no problems (assuming none of your columns are really humongous).


text:
Q: Should we share the public key for checking signing in the git repository? In the book Pro Git, Tagging Your Releases:
It shows a way to collect the public key into a blob in git,so users who sync it can add that public key and to verify the signed tag.
Is this way actually safe? Someone can change the public key blob and redo the signing.I think we should get the public key from a separate and authorized way, right?
The commands in the book are pasted as following:
$ git tag -s v1.5 -m 'my signed 1.5 tag'
You need a passphrase to unlock the secret key for
user: "Scott Chacon <schacon@gmail.com>"
1024-bit DSA key, ID F721C45A, created 2009-02-09

$ gpg --list-keys
/Users/schacon/.gnupg/pubring.gpg
---------------------------------
pub   1024D/F721C45A 2009-02-09 [expires: 2010-02-09]
uid                  Scott Chacon <schacon@gmail.com>
sub   2048g/45D02282 2009-02-09 [expires: 2010-02-09]

$ gpg -a --export F721C45A | git hash-object -w --stdin
659ef797d181633c87ec71ac3f9ba29fe5775b92

$ git tag -a maintainer-pgp-pub 659ef797d181633c87ec71ac3f9ba29fe5775b92

$ git show maintainer-pgp-pub | gpg --import

A: There's nothing wrong at sharing your signing key, even though it of course should not be considered a validated key unless verified through other means. Compare with not sharing the key at all, the other party would have to fetch them from a key server by the fingerprint reference contained in the signature -- the key would still not be trusted, but there is a dependency on key servers.
An example, why including the key might show up useful: lots of (enterprise) companies have very strict firewall rules for server systems. You might be able to get a clearance for the repository server (or even have a Github clearance by default), but adding references for key servers might be tedious. When building the software, you might well import the key from the repository -- and issue trust based on the hard-coded public key fingerprint. Still, this is better than statically storing the key locally, as for example rolling subkeys means a broken build unless the local key copy is updated. When the key is fetched from the repository (and validated through the public primary key fingerprint), no action has to be taken.
Furthermore, there is the concept of TOFU: "trust on first use". You expect no attacker being in place when you fetch the key for the first time (for example, during initial development), but want to be sure no manipulated sources will be distributed later on. A developer fetching the key on his local development machine and setting it up as trusted might already be fine, depending on your attack model and acceptable risks.
Anyway, also but the key (or at least fingerprint, never use short key IDs) on a trusted source, as you proposed. A website available through HTTPs with a trusted certificate is a start. Especially if you're into open source projects, try to get your key certified on open source conferences (or at least have the developer keys certified, which then can certify the project key).