text:
Q: Burger Menu Drop Down Navbar background colour First of all, I have not coded properly in around nine years, so I'm trying to re-learn from scratch pretty much.
I'm having an issue with the background colour of a drop down menu from a burger menu. The burger menu appears when you minimise the screen. I want the background to be white when you click the burger menu but instead it's coming out a dark grey.
In Codepen it is fine, the background is white. However, on my laptop in all the folders it comes out dark grey. So, I've uploaded the code onto Code Pen and all my folders to Github for folk to try and find the discrepancy which I've been really struggling to spot and understand.
enter code herehttps://codepen.io/cmc89/pen/RwoYZRR)
GitHub: https://github.com/cmc1989/website-toggle.git
<!DOCTYPE html>

    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
    <link rel="stylesheet" type="text/css" href="css/style.css"/>

    <title>Website</title>

            Artwork

            Programming

            Writing

            Talking

            Production

            CV

            About

A Feeling for the Organism (2020)

Organs (2020)

Private Lives (2019)

these were the things that made the step familiar (2019)

A Strange American Funeral (2019)

Handwave (2019)

playback (2018)

correct (2017)

Magnificent Beach

© 2020 Website

CSS:
   * {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    height: 100%;
    background-color:#ffffff;
}

.p1 {
  font-family: prestige-elite-std, monospace;
  font-weight: bold;
  font-size: 20px;
  font-style: italic;
}

.p2 {
  font-family: prestige-elite-std, monospace;
}

.p3 {
  font-family: TNYAdobeCaslonPro,Times New Roman,Times,serif;
  font-size: 18px;
}

#wrapper{
  background-color:#ccc2c2;
  width: 100%;
  max-width: 1200px;
  position: relative;
  margin: 0 auto;
  padding: 5px 0;
}

.navbar {
    display: flex;
    position: relative;
    justify-content: space-between;
    align-items: center;
    background-color: #ffffff;
    margin: 10px 0 0 0;
}

.logo {
    font-size: 1.5rem;
    margin: .5rem;
}

.navbar-links {
    height: 100%;
}

.navbar-links ul {
    display: flex;
    margin: 0;
    padding: 0;
}

.navbar-links li {
    list-style: none;
    padding: 0 20px 0 20px;
}

.navbar-links li a {
    font-family: vollkorn, serif;
    font-size: 20px;
    display: block;
    text-decoration: none;
    color: #262626;
    padding: 5px;

}

.navbar-links li:hover {

}

.navbar-links ul li .underline {
    height: 3px;
    background-color: transparent;
    width: 0%;
    transition: width 0.8s, background-color 0.5s;
    margin: 0 auto;

}

.navbar-links ul li.active-link .underline {
    width: 100%;
    background-color: #262626;
}

.navbar-links ul li:hover .underline {
    background-color: #262626;
    width: 100%;

}

.navbar-links ul li:hover a {
}

.navbar-links ul li:active a {
    transition: none;
    color: rgba(255,255,255,0.76);
}

.navbar-links ul li:active .underline {
    transition: none;
    background-color: rgba(255,255,255,0.76);
}

.toggle-button {
    position: absolute;
    top: 25px;
    right: 1rem;
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
}

.toggle-button .bar {
    height: 4px;
    width: 100%;
    background-color: #262626;
    border-radius: 10px;
}

@media (max-width: 1028px) {
    .navbar {
        flex-direction: column;
        align-items: flex-start;
        background: #FFFFFF;

    }

    .toggle-button {
        display: flex;
    }

    .navbar-links {
        display: none;
        width: 100%;

    }

    .navbar-links ul {

        flex-direction: column;
        text-align: left;
        width: 40%;
        position:relative;
        left: 35%;
    }

    .navbar-links ul li {
        padding: 10px 0;
        text-align: center;
        width: auto;
    }

    .navbar-links ul li a {
        padding: .5rem 1rem;
        font-family: Arial;

    }

    .navbar-links.active {
        display: flex;

    }
}

#content {
  padding: 5px 0 5px 0 ;
  position: relative;
  overflow: hidden;

}

.container {
  position: relative;
  clear: both;
  width: 100%;
  max-width: 1200px;
  padding: 0;
  overflow: hidden;
  background: #FFFFFF;
}

/* GRID */

.grid-card {
  border: 1px solid #E5E5E5;
  margin-bottom: 20px;
}

.grid-card:hover{
  opacity: 0.7;
}

.grid-card-image {
  max-width: 100%;
 max-height: 100%;

}

.grid-card-content {
  padding: 5px;
}

.grid-card-content h3 {
  margin-top: 0;
  margin-bottom: 0;
  font-size: 13px;
}

.grid-card-content p {
  margin: 0.5em 0;
}

* {
  box-sizing: border-box;
}

/* Grid measurements:
 *
 *   960px wide including 12 gutters (half gutters on both edges)
 *
 *   60px columns (12)
 *   20px gutters (two half-gutters + 11 full gutters, so 12 total)
 *
 *
 *   For smaller screens, we always want 20px of padding on either side,
 *   so 960 + 20 + 20 => 1000px
 *
 **/
.grid-row {
  max-width: 1200px;
  padding-left: 20px;
  padding-right: 20px;
  margin: 0 auto;
}

/* Clearfix */
.grid-row::before,
.grid-row::after {
  display: table;
  content: '';
}

.grid-row::after {
  clear: both;
}

.col-3, .col-4, .col-6, .col-12 {
  float: left;

  /* Gutters:
   * Each column is padded by half-a-gutter on each side,
   *
   * Half a gutter is 10px, 10/960 (context) = 1.041666%
   *
   */
  padding-left: 1.04166666%;
  padding-right: 1.04166666%;
}

/* Mobile defaults */
.col-3, .col-4, .col-6, .col-12 {
  width: 100%;
}

/* Non-mobile, grid */
@media only screen and (min-width: 550px) {
  /* 3 columns, 3/12 in % */
  .col-3 {
    width: 25%;
  }

  /* 4 columns, 4/12 in % */
  .col-4 {
    width: 33.333333%;
  }

  /* 6 columns, 6/12 in % */
  .col-6 {
    width: 50%;
  }

  /* 12 columns, 12/12 in % */
  .col-12 {
    width: 100%;
  }
}

/* End of GRID */

/* FOOTER */

footer {
  text-align: center;
  padding: 3px;
  background-color: #FFFF00;
  color: #262626;
  font-family: prestige-elite-std, monospace;

}

JavaScript:
const toggleButton = document.getElementsByClassName('toggle-button')[0]
const navbarLinks = document.getElementsByClassName('navbar-links')[0]

toggleButton.addEventListener('click', () => {
  navbarLinks.classList.toggle('active')
})

Thank you for your time.


text:
Q: C# sql insert count of one table to another Hello as I am inserting the count of one table data to another table I don't know how to do it as I am new to SQL and c# .net.Below is my code attached. data is inserting when i write this query:
Insert into compareresult(title,repeat) select  title, COUNT(*) as repeat from glassdoor  GROUP BY title HAVING COUNT(*) > 1 union select  title, COUNT(*) as repeat from mitula GROUP BY title HAVING COUNT(*) > 1 union select   title, COUNT(*) as repeat  from trovoit GROUP BY title HAVING   COUNT(*) > 1 union   select title, COUNT(*) as repeat from indeed GROUP BY title HAVING   COUNT(*)  > 1 intersect select   title, COUNT(*)  as repeat from alldata_table GROUP BY title HAVING COUNT(*) > 1

but it doesnt work when i use in .net web forms. code will be preferred.
void getIntersectedData()
    {

        try
        {
            con.Open();
            string query = @" select  title, COUNT(*) as repeat from glassdoor
            GROUP BY title HAVING COUNT(*) > 1 union select  title, COUNT(*) as repeat from mitula GROUP BY title HAVING COUNT(*) > 1
            union select   title, COUNT(*) as repeat  from trovoit GROUP BY title HAVING   COUNT(*) > 1 union
            select title, COUNT(*) as repeat from indeed GROUP BY title HAVING   COUNT(*)  > 1 intersect
            select   title, COUNT(*)  as repeat from alldata_table GROUP BY title HAVING COUNT(*) > 1";
            SqlCommand cmd = new SqlCommand(query, con);
            SqlDataReader dr = cmd.ExecuteReader();
            while (dr.Read())
            {
                insert(dr);
            }
            con.Close();

        }
        catch (Exception e)
        {

        }

    }
    private void insert(SqlDataReader dr)
    {
        con.Open();
        string insertquery = @"Insert into compareresult(title,count) values('" + dr[0].ToString() + "','" + dr[1].ToString() + "')";
        SqlCommand cmds = new SqlCommand(insertquery, con);
        cmds.ExecuteNonQuery();
        con.Close();
    }

A: My first guess even though I need more details:
If the count(*) for each table is the same, union will ignore the duplicates. In this case, I would use union all to make sure it is the same.  Second, you might want to store the counts with a reference to the table you are taking the counts from.  Maybe another column to indicate the table?

redpajama_set_name: RedPajamaStackExchange


text:
Q: An unexpected error has occurred! Ampscript Error I have implemented a custom subscription center for one of my customer,  All works good and I am able to update the subscriptions also back in salesforce. But the issue is when the email is opened after some specific time(After a week or so), I get an error as attached in the screenshot. Please note that all works well if someone opens the subscription center (microsite) link immediately or in a week.

I guess the issue is with the data content of _subscriberkey.
Any ideas or suggestions are most welcome.
Many Thanks,
Kalpesh

A: I'm not a big fan of using raw personalization strings anywhere.  This is a good example for why you shouldn't do it.
I'm assuming you arrived at the page from Send Preview or directly without a Subscriber context.
I'd suggest replacing the line referenced in your screenshot with this:
var @sk
set @sk = AttributeValue("_Subscriberkey")
set @LOG = concat(@LOG, "<br/>_subscriberkey: ",@sk)

AttributeValue() handles this situation because it returns an empty string if the attribute doesn't exist. You can combine the use of AttributeValue() with the empty() function to proactively deal with personalization strings not existing.


text:
Q: Tracking IP address with a switch sandwiched between a client and server There are two application servers(IIS). There is a switch or a virtual IP which load balances requests for the 2 servers.
I need to track requestor(client) IP address from my .NET application.
The code Request.ServerVariables["REMOTE_ADDR"] is giving the switch IP address.
The request first hits switch then request is diverted to either of the server, in this process my application is getting switch IP address for that code and client IP is masked.


text:
Q: Colab: Unable to access webpage using flask-ngrok I'm trying to run flask application on colab but I keep seeing the following when I go to the tunneled page:-

Code:-
# flask_ngrok_example.py
from flask import Flask
from flask_ngrok import run_with_ngrok

app = Flask(__name__)
run_with_ngrok(app)  # Start ngrok when app is run

@app.route("/")
def hello():
    return "Hello World!"

if __name__ == '__main__':
    app.run()

A: On Colab, you can run these commands:
!pip install pyngrok==4.1.1
!ngrok authtoken 'your authtoken'


text:
Q: How to map domain to docker container? I have a Redhat server. Here I installed docker and Apache for reverse Proxy. I ran multiple containers in it.
I would like to map domains to each container, So I setup a Reverse Proxy in Apache like this
For Example: http://example.com map to http://40.76.25.1:9999/
<VirtualHost *:80>
            ServerName       example.com
            ServerAlias      www.example.com.com

            LogLevel debug
            ProxyRequests off

            ProxyPreserveHost On

            #ProxyPass /public/static/ http://52.206.215.249/public/static/ retry=1 acquire=3000 timeout=600 Keepalive=On
            #ProxyPassReverse /public/static/ http://52.206.215.249/public/static/
            ProxyPass / http://40.76.25.1:9999/ retry=1 acquire=3000 timeout=600 Keepalive=On
            ProxyPassReverse / http://40.76.25.1:9999/   ##(Hostip Address)

            ErrorLog logs/1356.thapos.net_error_log
            TransferLog logs/1356.thapos.net_access_log

            SetEnvIf User-Agent ".*MSIE.*" nokeepalive

</VirtualHost>

But This mapping was not working for me.
I don't know if this is the correct process or not. If this is not the right process let me know how we map domains for Docker Containers via Apache.


text:
Q: Sending data to firebase: data.push() is not a function I am trying to send data to firebase using html and Jquery. Here is my code:-
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdn.firebase.com/js/client/2.2.0/firebase.js"></script>
<!--<script src="https://www.gstatic.com/firebasejs/4.11.0/firebase.js"></script>-->
<script>
  // Initialize Firebase
    var config = {
        apiKey: "demoAPIkey",
        authDomain: "demoAuthDomain",
        databaseURL: "demoDBurl",
        projectId: "demoProjectID",
        storageBucket: "demo.appspot.com",
        messagingSenderId: "demoSendingID"
    };
    firebase.initializeApp(config);
</script>
<script>
    $(function(){
        //make a variable to keep track of data coming from firebase
        var data= [];

        //create new connection to firebase
        var ref= new Firebase('http://demoDBurl/food');

        //listen to data updates from firebase
        ref.on("value", function (snapshot){
            console.log(snapshot.val());
            //when the data updates at firebase, put it in the data variable
            data= snapshot.val();
        })

        //Entire Form (handler)
        $('#saveFoodForm').on('click',function(event) {

            event.preventDefault();
            var $form = $(this);
            console.log("Submit to Firebase");

            //disable submit button
            $form.find("#saveForm").prop('disabled', true);

            //get values to send to Firebase
            var titleToSend = $('#foodTitle').val();
            console.log(titleToSend);

            var descriptionToSend = $('#foodDescription').val();
            console.log(descriptionToSend);

            var categoryToSend= $('#foodCategory').val();
            console.log(categoryToSend);

            //take the values from the form, and put them in an object
            var newFood = {
                "description": descriptionToSend,
                "title": titleToSend,
                "type": categoryToSend
            };

            //put new object in data array
            data.push(newFood);
            //send the new data to Firebase
            ref.set(data, function(err){
                if(err)
                {
                    alert(err);
                }
            });

            return false;
        });
    })
</script>

I am getting an error:
Uncaught TypeError: data.push is not a function
    at HTMLInputElement.<anonymous> (index.html:61)
    at HTMLInputElement.dispatch (jquery.min.js:2)
    at HTMLInputElement.y.handle (jquery.min.js:2)

How can I solve it?

A: According to the docs:

val() returns any type
Extracts a JavaScript value from a DataSnapshot.
Depending on the data in a DataSnapshot, the val() method may return a scalar type (string, number, or boolean), an array, or an object. It may also return null, indicating that the DataSnapshot is empty (contains no data).

This is data= snapshot.val(); returning an object, something like this:
data is { "name": "Ada", "age": 36 }

So the variable data contains an object that is why it is not working.
more info here:
https://firebase.google.com/docs/reference/js/firebase.database.DataSnapshot#val


text:
Q: jQuery - PHP - link href to other page ID not working I have a PHP site, with a nav that has links to ID's (sections) on the home page. When you click on the link it scrolls down to that section, and everything works how it's supposed to.
However, the nav also has links to other pages, and if you aren't on the home page, and you click on one of these ID hrefs, it doesn't scroll down to that section, it just goes to the top of the homepage.
I tried adding home.php#idname or ./#idname in the href, but neither seem to work. I'm guessing that I might need to get the baseUrl and add that to the href somehow, but I'm not sure. My Javascript/jQuery isn't the best.
How do I make the ID links go and scroll to the desired section, when you're on another page? I've looked up tons of related topics, and nothing seems to be working.
Below is my code:

$(document).ready(function() {

$('#navm li a').click(function(e) {

  var href = $(this).attr('href');

  var autoScrollPosition = parseInt($(href).offset().top - $('#header').outerHeight());

  if (window.location.hash) {

    $(scrollCheck).stop().animate({
      scrollTop: autoScrollPosition
    }, {
      duration: 750,
      easing: 'easeInOutExpo',
      queue: false,
      complete: function() {
        setTimeout(function() {
          enable_scroll();
        }, 50);
      }
    });

  }

});

});

Description

Specification

Downloads

Insights

Article 1


text:
Q: Jquery Blue-imp file-upload submitting additional data to a db when uploading multiple files I'm using Blue-imp file-upload to upload files.  I've created a cusomUploadHandler as follows to allow additional data to be persisted to the database as follows: (I got the code from some tutorial online - but can't find it now)
class CustomUploadHandler extends UploadHandler {

    protected function initialize() {
        $this->db = new mysqli(
            $this->options['db_host'],
            $this->options['db_user'],
            $this->options['db_pass'],
            $this->options['db_name']
        );
        parent::initialize();
        $this->db->close();
    }

    protected function handle_form_data($file, $index) {
        $file->title = @$_REQUEST['title'][$index];
        $file->description = @$_REQUEST['payroll_type'];
    }

    protected function handle_file_upload($uploaded_file, $name, $size, $type, $error,
            $index = null, $content_range = null) {
        $file = parent::handle_file_upload(
            $uploaded_file, $name, $size, $type, $error, $index, $content_range
        );
        if (empty($file->error)) {
            $sql = 'INSERT INTO `'.$this->options['db_table']
                .'` (`name`, `size`, `type`, `title`, `description`)'
                .' VALUES (?, ?, ?, ?, ?)';
            $query = $this->db->prepare($sql);
            $query->bind_param(
                'sisss',
                $file->name,
                $file->size,
                $file->type,
                $file->title,
                $file->description
            );
            $query->execute();
            $file->id = $this->db->insert_id;
        }
        return $file;
    }

    protected function set_additional_file_properties($file) {
        parent::set_additional_file_properties($file);
        if ($_SERVER['REQUEST_METHOD'] === 'GET') {
            $sql = 'SELECT `id`, `type`, `title`, `description` FROM `'
                .$this->options['db_table'].'` WHERE `name`=?';
            $query = $this->db->prepare($sql);
            $query->bind_param('s', $file->name);
            $query->execute();
            $query->bind_result(
                $id,
                $type,
                $title,
                $description
            );
            while ($query->fetch()) {
                $file->id = $id;
                $file->type = $type;
                $file->title = $title;
                $file->description = $description;
            }
        }
    }

    public function delete($print_response = true) {
        $response = parent::delete(false);
        foreach ($response as $name => $deleted) {
            if ($deleted) {
                $sql = 'DELETE FROM `'
                    .$this->options['db_table'].'` WHERE `name`=?';
                $query = $this->db->prepare($sql);
                $query->bind_param('s', $name);
                $query->execute();
            }
        }
        return $this->generate_response($response, $print_response);
    }

}

My problem is that when there are multiple files uploaded the CustomUploadHandler is called several times and it doesn't submit the data in the description to the database. Only the last record is persisted correctly.  Here's the HTML for the form:
<form id="fileupload" action="/assets/plugins/jquery-file-upload/server/php/UploadHandler.php" method="POST" enctype="multipart/form-data">

                                                     Add files...

                                                <input type="file" name="files[]" multiple="">

                                </form>

Each of file titles are being correctly persisted, but it is a problem with the dropdown select options that is lost when there are multiple file uploads.  The select boxes look like this:
 <select id="payroll_type" class="form-control" name="payroll_type">
   <option name="payroll_variations" value="">Select File Type</option>
       <option name="payroll_variations" value="Payroll Variations">Payroll Variations</option>
       <option name="starters" value="Starters">Starters</option>
       <option name="leavers" value="Leavers">Leavers</option>
       <option name="ss_changes" value="Master Data Changes">Master Data Changes</option>
 </select>

And the only file that has it's description saved is the last one in the queue.  All the previous files will have lost the value selected in their respective select option.
Sorry I don't know how to explain this better.
Thanks in advance.

A: Sorry this answer is so late.
In my case there was no reason in supplying data if the file didn't upload; so I made uploading then gathering data about the files a two step process.
I added the additional inputs required to the template that displays the uploaded files. (blue imp has this labeled as "download template)
A single save button kicks off javascript function to update file data.
Within that function JQRY visits each row of the "download template" it creates a JSON object to transfer the data to be saved.  Then posts to a "web method" in the aspx code behind.
Details:
slight modification to blue Imp download template


text:
Q: Changing between multiple classes with jquery I have the following code:

<button id="start">Begin</button>

When the user clicks on the Button, the class assigned to the DIV element should change from drawing1 to drawing5, passing through each drawing in between (There are 5 drawings in total). It should also have a delay() of about 500. My first thought was:
$('div').delay(800).toggleClass('drawing1 drawing2');

Which works but when I try to add the rest of the drawings (Tried several methods using toggleclass and add/remove class), it either jumps to the last one or only does the second one.
How can I set this up so I can go from one drawing class to the next, going through each one, one by one with the delay applied for each.

A: var i = 2; //Assumes drawing1 is already applied to the div
var nextDrawing = function(){
    $("div").removeClass()
            .addClass("drawing"+i);

    i = ((i + 1) % 5); //To cycle from 1 to 5
    i = i == 0 ? 5 : i;
}
$('#start').click(function(){
    setInterval(nextDrawing, 500);
});

Should do the trick.
Edit: The following modification may be useful to someone for clearing the interval if someone clicks the button more than once.
var i = 2; //Assumes drawing1 is already applied to the div
var nextDrawing = function(){
    $("div").removeClass()
            .addClass("drawing"+i);

    i = ((i + 1) % 5); //To cycle from 1 to 5
    i = i == 0 ? 5 : i;
}

var intervalID = undefined;
$('#start').click(function(){
    if( intervalID != undefined )
    {
        clearInterval(intervalID);
    }
    intervalID = setInterval(nextDrawing, 500);
});

Here is a working example: http://jsfiddle.net/ajhuU/

A: var leMethod = function(){ // wrapping in a method localizes variables
  var max = 5;             // nr of drawings
  var activeIdx = 0;       // active drawing
  var timeout = 500;       // the time between changes
  var originalClass = 'some classes that are always there';

  setTimeout(function(){               // execute the method on timeout expiration
    var el = $('div');                 // get whatever element you wish to manage
    el.attr('class', originalClass);   // restore original class
    el.addClass('classNr'+activeIdx);  // add your cycle class
    activeIdx = (activeIdx+1) % max;   // update index
  }, timeout);
};

leMethod();


text:
Q: How to clear SQL Server Extended Events Event File How to clear SQL Server extended events that are stored in a file?
Background
Where are the files for SQL Server Extended Events Event File target stored?
I want to delete months worth of log files; but SQL Server doesn't tell me where the files are:

I would follow the advice on Microsoft's SQL Server forums:

Clear events in file target?
Simply stop the session and delete .xel file if it's no longer required.

Attempt#3
I tried doing the single most obvious thing that any user interface designer worth their salt would have created from the beginning:  Right-click the event file target, and select:

*

*Clear

*Delete

*Purge

*Empty

Except there is no option to do any of those obvious things:

Attempt#4
I also tried going into the Extended Events menu, and clicking Clear Data. But the option is inexplicably disabled:

Attempt#5
I also tried to script the Extended Events Session, in order to see where it is storing the files. But of course SQL Server team is not helpful:
ADD TARGET package0.event_file(SET filename=N'Expensive Queries',max_file_size=(25),max_rollover_files=(4)),

Attempt#6
In SQL Server Profiler. If you wanted to clear the events you pushed the button to clear the events:

SQL Profiler is deprecated, and it's replacement provides no way to clear the events.

What is the way to clear the events?
Bonus Reading

*

*Query to clear sql server logs over a certain age

*Clear events in file target?

*BOL: Targets for Extended Events in SQL Server

*BOL: Event File Target

A: By default the path seems like it would be
C:\Program Files\Microsoft SQL Server\MSSQLXX.MSSQLSERVER\MSSQL\Log\*.xel

or basically wherever the system files are kept for SQL Server (i.e. the default ERRORLOG location).  If there is nothing there then it may be that your Extended Event is set to ring buffer in which case only the latest information is kept and it's stored in memory.  Seems the only way to clear the log in this case would be to stop and start the session.

A: You can also use
DECLARE @SQLDataRoot VARCHAR(400)
EXEC master..xp_instance_regread @rootkey = 'HKEY_LOCAL_MACHINE',
 @key = 'SOFTWARE\Microsoft\MSSQLServer\Setup',
 @value_name = 'SQLDataRoot', @value = @SQLDataRoot OUTPUT
 SELECT @SQLDataRoot

A: Here's how you get the file path:
SELECT n.value('(@name)[1]','varchar(255)') AS FilePath
FROM
(
    SELECT CAST(t.target_data AS XML) target_data
    FROM sys.dm_xe_sessions s
        INNER JOIN sys.dm_xe_session_targets t ON t.event_session_address = s.address
    WHERE s.name = 'Your Session Name'
        AND t.target_name = N'event_file'
) AS tab
    CROSS APPLY [target_data].[nodes]('EventFileTarget/File') AS [q] ([n]);

The only way I've found to clear the data is to drop the session delete the files and then create the session again.

A: As is mentioned above, event file is in C:\Program Files\Microsoft SQL Server\MSSQLXX.MSSQLSERVER\MSSQL\Log\ - so you can delete it from disk (in case you have access and permission to do it). In case you have no acces/permission to SQL server or file (from any reason), you can do it from SQL Management studio.
In this case, you can remove current file and add (create) new file again. It can be done with or without stopping event. Path : Properties -> Data Storage
Open "Properties":

Go to "Data Storage" and remove file

Add new file:

A: *

*Detect event file file path with a query like this

SELECT CAST(t.target_data AS XML).value('(EventFileTarget/File/@name)[1]', 'VARCHAR(MAX)') FilePathAndName
FROM sys.dm_xe_sessions s WITH (NOLOCK)
JOIN sys.dm_xe_session_targets t WITH (NOLOCK) ON s.address = t.event_session_address
WHERE t.target_name = 'event_file'
    AND s.name = 'tempdbgrowth' -- <-- replace tempdbgrowth with extended event name

*Delete the file (or files) from file system

*SSMS right-click on extended-event (higher level then event file) and select "Refresh"


text:
Q: Navigation Links Overlapping So basically I want my navigation bar to be fixed when I scroll the page down. But by changing its position from absolute to fixed, the links seem to overlap each other. Margin and Padding aren't working. How can I make them fixed and give some gap between each link? If there is something wrong with my code please correct me.
HTML

.container {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: repeat(12, 1fr);
  width: 500px;
  height: 500px;
  grid-gap: 10px;
  background-color: white;
  width: 100%;
  height: 1500px;
  justify-content: center;
}

span {
  font-size: 30px;
  cursor: pointer;
}

#elem_1 {
  background-color: #F7F7F7;
  grid-column: 1 / -1;
  grid-row: 1 / 2;
  width: 100%;
}

#elem_1>img {
  width: 2.3vw;
  height: 4vh;
  position: relative;
  left: 220px;
  bottom: 9px;
}

#elem_1>h1 {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  color: #505050;
  position: relative;
  left: 120px;
  top: 30px;
}

nav a {
  position: sticky;
  right: 200px;
  float: left;
  margin-left: 20px;
  text-decoration: none;
  text-transform: uppercase;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  font-weight: 800;
  color: grey;
}

#list_item_1 {
  margin: 20px;
  padding: 20px;
}

#nav_bar {
  font-size: 20px;
}

nav a:hover {
  background-color: pink;
}

nav {
  display: block;
  position: absolute;
  bottom: 910px;
  left: 1500px;
  width: 100%;
}

nav ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

nav li {
  margin-bottom: 5px;
  margin: 12px;
}

#three_bars {
  display: none;
}

#three_bars:checked~nav {
  display: block;
}

#three_bars_label {
  position: fixed;
  right: 35px;
  top: 35px;
}

#elem_2 {
  background-color: greenyellow;
  grid-column: 1 / -1;
  grid-row: 2 / 3;
}

#elem_3 {
  background-color: aliceblue;
  grid-column: 1 / 9;
  grid-row: 3 / 12;
}

#elem_4 {
  background-color: antiquewhite;
  grid-column: 9 / -1;
  grid-row: 3 / 12;
}

#elem_5 {
  background-color: aquamarine;
  grid-column: 1 / -1;
  grid-row: 12 / -1;
}

RDMC

    <input type="checkbox" id="three_bars">

Home

Donate

About us

Contact

Content

Payment

Address

Contact

A: The main problem I could see with your css was the bottom:910px; and left:1500px positioning : you don't know how big the user's screen is going to be (I couldn't see the nav initially! ) I commented them out for a start, moved your margin for the list items into the list_item_1 css (shorthand for margin order is top right bottom left - clockwise - so I wrote it shorthand integrating the margin-bottom of 5px). Also, I added a  display:inline-block; to your nav li.
Another (important) point to mention is that I moved your nav a code to AFTER your nav/ nav ul/nav li/ css, as css is read in the order it is written. As such, you should keep your css in logical order.
Hope this helps

.container {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: repeat(12, 1fr);
  width: 500px;
  height: 500px;
  grid-gap: 10px;
  background-color: white;
  width: 100%;
  height: 1500px;
  justify-content: center;
}

span {
  font-size: 30px;
  cursor: pointer;
}

#elem_1 {
  background-color: #F7F7F7;
  grid-column: 1 / -1;
  grid-row: 1 / 2;
  width: 100%;
}

#elem_1>img {
  width: 2.3vw;
  height: 4vh;
  position: relative;
  left: 220px;
  bottom: 9px;
}

#elem_1>h1 {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  color: #505050;
  position: relative;
  left: 120px;
  top: 30px;
}

#nav_bar {
  font-size: 20px;
}

nav {
  display: inline-block;
  position: sticky;
 /* bottom: 910px;*/
  /*left: 1500px;*/
  width: 100%;
}

nav ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.list_item_1 {
  margin: 12px 12px 5px 12px;
  padding: 10px;
}

nav li {
  display:inline-block;
 /* margin: 12px 12px 5px 12px;*/
}

nav a {
  display:inline-block;
  float: left;
  margin-left: 20px;
  text-decoration: none;
  text-transform: uppercase;
  font-family: "Verdana", BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Open Sans, Helvetica Neue, sans-serif;
  font-weight: 800;
  color:#000000;
}

nav a:hover {
  background-color: pink;
}

#three_bars {
  display: none;
}

#three_bars:checked~nav {
  display: block;
}

#three_bars_label {
  position: fixed;
  right: 35px;
  top: 35px;
}

#elem_2 {
  background-color: greenyellow;
  grid-column: 1 / -1;
  grid-row: 2 / 3;
}

#elem_3 {
  background-color: aliceblue;
  grid-column: 1 / 9;
  grid-row: 3 / 12;
}

#elem_4 {
  background-color: antiquewhite;
  grid-column: 9 / -1;
  grid-row: 3 / 12;
}

#elem_5 {
  background-color: aquamarine;
  grid-column: 1 / -1;
  grid-row: 12 / -1;
}

RDMC

    <input type="checkbox" id="three_bars">

Home

Donate

About us

Contact

Content

Payment

Address

Contact


text:
Q: How to treat a hex as string? I have some hex number such as 0x61cc1000 and I want to input them to a function which only takes string. I want to treat the hex numbers as strings without any change.
If I use str() function it converts it to int and then treats it as string. But I want to keep the original hex value.

A: Your problem is that you're using str:
>>> str(0x61cc1000)
'1640763392'  # int value of the hex number as a string

That's because first 0x61cc1000 is evaluated as an int, then str performed on the resulted int.
You want to do:
"{0:x}".format(0x61cc1000)

Or
'{:#x}'.format(0x61cc1000)

As already stated in other answer, you can simply:
>>> hex(0x61cc1000)
'0x61cc1000'

See 6.1.3.1. Format Specification Mini-Language for details.

A: If you want the hex string representation of any integer, just pass it through the hex built-in.
>>> n = 0x61cc1000
>>> n
1640763392
>>> hex(n)
'0x61cc1000'

A: If you want to have 0x at the beginning you may use #x format like this:
'{:#x}'.format(74954)


text:
Q: run jquery code only if window scroll position is eqal to 0 I'm trying to write a code that will only works if the scroll position of my window is at 0, using If statement. once someone scrolled the page, the code should not work anymore.
when mouseenter my div .slideshow_2, the page should scroll from 75px, and when mouseleave, scroll back from 75px... but only if my window scroll position is at zero.
I have troubles to define the window scroll position, to check if it's at 0, and with my if condition.
here is my code :
if ($(window).scrollTop() == 0){

    $('.slideshow_2').mouseenter(function(){
        $("html , body").animate({ scrollTop: 75 }, 500)
    });

    $('.slideshow_2').mouseleave(function(){
        $("html , body").animate({ scrollTop: -75 }, 500);
    });
}

my condition is : if ($(window).scrollTop() == 0), I guess this is suppose to check that the page has not been scrolled yet, but there's something I'm doing wrong...
here is a jsfiddle : http://jsfiddle.net/uynrhr1c/
can anybody help me with this ?
thanks a lot

A: You need to add the condition inside the handlers:
 $('.slideshow_2').mouseenter(function(){
   if($(window).scrollTop() == 0){
      $("html , body").animate({ scrollTop: 75 }, 500)
   }
 });
  $('.slideshow_2').mouseleave(function(){
    if($(window).scrollTop() == 0)
    $("html , body").animate({ scrollTop: -75 }, 500);
 });

Working Demo


text: Q: Using Updatepanel to update html content of DIV element I have aspx page which has 6 div panels with various real time information. Page receive this information from product API.  I would like to update only 2 panels in real time and other panel in some time like every 5 min 2 and every 10 min other 2. How can I achieve this functionality using asp.net or MVC.


text:
Q: implementing "this" / "self" in a custom interpreted programming language I'm working on a custom interpreter for fun ;)
What I have so far is assigning variables, defining and calling functions, arrays, loops, if blocks etc...
I've started adding OOP elements to my language and I'm having trouble implementing the "this" / "self" keyword.
I just cannot figure out a solution to this problem.
I've thought about a few solutions:

*

*a class stores it's instances (as a dictionary) and when the "this" keyword appears, the interpreter ignores "private" and "public" keywords (to call a private method from a public one), creates a call to the method referenced by "this" and returns.

*the "this" keyword is a reference which under the hood is the instance itself, but the method access modifiers are dropped for that call. this is similar to the first one, but I cannot think of anything better.

Also it would be nice if you knew C# (primarly) or C++, since I'm heavily relying on OOP to create my interpreter.
heres a small sample of code that I would like to implement:
struct Dog has
    pub prop age;

    prv def bark() do
        println "woof woof";
    end

    pub def run(dist) do
        loop 0 to $dist with "d" do
            println ("the dog ran " + string $d) + " meters";
            $self.bark();
        end
    end
end

def main(args) do
    new Dog -> $dog;

    7 -> $dog.age;

    println $dog.age;

    $dog.run 30;
end

notice that the bark() method is "prv" (private). I would like to know how can I make the struct be aware of it's instances so I can make the dog bark each time it runs (calling a private method from a public method).
Thanks in advance

A: Your interpreter is going to need to keep an execution stack and environment (otherwise you wouldn't know where to return to after a method is finished, etc.).
In this execution stack/env, apart from a function pointer/signature, you'd also keep the object the method is being invoked on (if any, remember about static-like functions).
This reference that you'd store would then be also accessed when de-referencing $this. And actually this is both part 1 and 2 of your idea - you could put some kind of checks like visibility of methods etc. there.
Good luck, sounds like a fun project!


text:
Q: Importing MBOX file in Outlook 2010 (or converting to PST) I exported my e-mails from an old Gmail account using Google Takeout. The exported e-mails are now in an MBOX file. I somehow need to import this into MS Outlook 2010. Of course, it's also fine to convert the MBOX file to a PST file, so I can open that in Outlook.
All advice is welcome, because so far I'm not getting anywhere.

A: If the Gmail account still exists, the easiest thing would be to simply connect the Outlook client to the Gmail account, then download all of the messages to a PST file.
If 2-Factor authentication is enabled on your account, you can create app-specific passwords in your Google Account settings, under Sign-In and Security. These will allow setting up your account in Outlook without requiring 2-Factor in that application.

A: There's a MBOX Converter on TechNet that may work for you.
TechNet Link


text:
Q: Produce an inset in each facet of an R ggplot while preserving colours of the original facet content I would like to produce a graphic combining four facets of a graph with insets in each facet showing a detail of the respective plot. This is one of the things I tried:
    #create data frame

n_replicates <- c(rep(1:10,15),rep(seq(10,100,10),15),rep(seq(100,1000,100),15),rep(seq(1000,10000,1000),15))
sim_years <- rep(sort(rep((1:15),10)),4)
sd_data <- rep (NA,600)
for (i in 1:600) {
sd_data[i]<-rnorm(1,mean=exp(0.1 * sim_years[i]), sd= 1/n_replicates[i])
}
max_rep <- sort(rep(c(10,100,1000,10000),150))
data_frame <- cbind.data.frame(n_replicates,sim_years,sd_data,max_rep)

#do first basic plot
library(ggplot2)
plot1<-ggplot(data=data_frame, aes(x=sim_years,y=sd_data,group =n_replicates, col=n_replicates)) +
  geom_line() + theme_bw() +
  labs(title ="",  x = "year", y = "sd")
plot1

#make four facets
my_breaks = c(2, 10, 100, 1000, 10000)
facet_names <- c(
  `10` = "2, 3, ..., 10 replicates",
  `100` = "10, 20, ..., 100 replicates",
  `1000` = "100, 200, ..., 1000 replicates",
  `10000` = "1000, 2000, ..., 10000 replicates"
)
plot2 <- plot1 +
  facet_wrap( ~ max_rep, ncol=2, labeller = as_labeller(facet_names)) +
  scale_colour_gradientn(name = "number of replicates", trans = "log",
                         breaks = my_breaks, labels = my_breaks, colours = rainbow(20))
plot2

#extract inlays (this is where it goes wrong I think)
library(ggpmisc)
library(tibble)
library(dplyr)
inset <- tibble(x = 0.01, y = 10.01,
                    plot = list(plot2 +
                                  facet_wrap( ~ max_rep, ncol=2, labeller = as_labeller(facet_names)) +
                                  coord_cartesian(xlim = c(13, 15),
                                                  ylim = c(3, 5)) +
                                  labs(x = NULL, y = NULL, color = NULL) +
                                  scale_colour_gradient(guide = FALSE) +
                                  theme_bw(10)))

plot3 <- plot2 +
  expand_limits(x = 0, y = 0) +
  geom_plot_npc(data = inset, aes(npcx = x, npcy = y, label = plot)) +
  annotate(geom = "rect",
           xmin = 13, xmax = 15, ymin = 3, ymax = 5,
           linetype = "dotted", fill = NA, colour = "black")

plot3

That leads to the following graphic:

As you can see, the colours in the insets are wrong, and all four of them appear in each of the facets even though I only want the corresponding inset of course. I read through a lot of questions here (to even get me this far) and also some examples in the ggpmisc user guide but unfortunately I am still a bit lost on how to achieve what I want. Except maybe to do it by hand extracting four insets and then combining them with plot2. But I hope there will be a better way to do this. Thank you for your help!
Edit: better graphic now thanks to this answer, but problem remains partially unsolved:
The following code does good insets, but unfortunately the colours are not preserved. As in the above version each inset does its own rainbow colours anew instead of inheriting the partial rainbow scale from the facet it belongs to. Does anyone know why and how I could change this? In comments I put another (bad) attempt at solving this, it preserves the colors but has the problem of putting all four insets in each facet.
library(ggpmisc)
library(tibble)
library(dplyr)

# #extract inlays: good colours, but produces four insets.
# fourinsets <- tibble(#x = 0.01, y = 10.01,
#                      x = c(rep(0.01, 4)),
#                      y = c(rep(10.01, 4)),
#                     plot = list(plot2 +
#                                   facet_wrap( ~ max_rep, ncol=2) +
#                                   coord_cartesian(xlim = c(13, 15),
#                                                   ylim = c(3, 5)) +
#                                   labs(x = NULL, y = NULL, color = NULL) +
#                                   scale_colour_gradientn(name = "number of replicates", trans = "log", guide = FALSE,
#                                                          colours = rainbow(20)) +
#                                   theme(
#                                     strip.background = element_blank(),
#                                     strip.text.x = element_blank()
#                                   )
#                                 ))
# fourinsets$plot

library(purrr)
pp <- map(unique(data_frame$max_rep), function(x) {

  plot2$data <- plot2$data %>% filter(max_rep == x)
  plot2 +
    coord_cartesian(xlim = c(12, 14),
                    ylim = c(3, 4)) +
    labs(x = NULL, y = NULL) +
    theme(
      strip.background = element_blank(),
      strip.text.x = element_blank(),
      legend.position = "none",
      axis.text=element_blank(),
      axis.ticks=element_blank()
    )
})
#pp[[2]]

inset_new <- tibble(x = c(rep(0.01, 4)),
                    y = c(rep(10.01, 4)),
                plot = pp,
                max_rep = unique(data_frame$max_rep))

final_plot <- plot2 +
  geom_plot_npc(data = inset_new, aes(npcx = x, npcy = y, label = plot, vp.width = 0.3, vp.height =0.6)) +
  annotate(geom = "rect",
           xmin = 12, xmax = 14, ymin = 3, ymax = 4,
           linetype = "dotted", fill = NA, colour = "black")

#final_plot

final_plot then looks like this:

I hope this clarifies the problem a bit. Any ideas are very welcome :)

A: I think this will get you started although its tricky to get the size of the inset plot right (when you include a legend).
#set up data
library(ggpmisc)
library(tibble)
library(dplyr)
library(ggplot2)

# create data frame
n_replicates <- c(rep(1:10, 15), rep(seq(10, 100, 10), 15), rep(seq(100,
  1000, 100), 15), rep(seq(1000, 10000, 1000), 15))
sim_years <- rep(sort(rep((1:15), 10)), 4)
sd_data <- rep(NA, 600)
for (i in 1:600) {
  sd_data[i] <- rnorm(1, mean = exp(0.1 * sim_years[i]), sd = 1/n_replicates[i])
}
max_rep <- sort(rep(c(10, 100, 1000, 10000), 150))
data_frame <- cbind.data.frame(n_replicates, sim_years, sd_data, max_rep)

# make four facets
my_breaks = c(2, 10, 100, 1000, 10000)
facet_names <- c(`10` = "2, 3, ..., 10 replicates", `100` = "10, 20, ..., 100 replicates",
  `1000` = "100, 200, ..., 1000 replicates", `10000` = "1000, 2000, ..., 10000 replicates")

Get overall plot:
# overall facet plot
overall_plot <- ggplot(data = data_frame, aes(x = sim_years, y = sd_data, group = n_replicates, col = n_replicates)) +
  geom_line() +
  theme_bw() +
  labs(title = "", x = "year", y = "sd") +
  facet_wrap(~max_rep, ncol = 2, labeller = as_labeller(facet_names)) +
  scale_colour_gradientn(name = "number of replicates", trans = "log", breaks = my_breaks, labels = my_breaks, colours = rainbow(20))

#plot
overall_plot

which gives:

Then from the overall plot you want to extract each plot, see here. We can map over the list to extract one at a time:
pp <- map(unique(data_frame$max_rep), function(x) {

  overall_plot$data <- overall_plot$data %>% filter(max_rep == x)
  overall_plot + # coord_cartesian(xlim = c(13, 15), ylim = c(3, 5)) +
  labs(x = NULL, y = NULL) +
  theme_bw(10) +
  theme(legend.position = "none")

})

If we look at one of these (I've removed the legend) e.g.
pp[[1]]
#pp[[2]]
#pp[[3]]
#pp[[4]]

Gives:

Then we want to add these inset plots into a dataframe so that each plot has its own row:
inset <- tibble(x = c(rep(0.01, 4)),
                y = c(rep(10.01, 4)),
                plot = pp,
                max_rep = unique(data_frame$max_rep))

Then merge this into the overall plot:
overall_plot +
  expand_limits(x = 0, y = 0) +
  geom_plot_npc(data = inset, aes(npcx = x, npcy = y, label = plot, vp.width = 0.8, vp.height = 0.8))

Gives:

A: Here is a solution based on Z. Lin's answer, but using ggforce::facet_wrap_paginate() to do the filtering and keeping colourscales consistent.
First, we can make the 'root' plot containing all the data with no facetting.
library(ggpmisc)
library(tibble)
library(dplyr)

n_replicates <- c(rep(1:10,15),rep(seq(10,100,10),15),rep(seq(100,1000,100),15),rep(seq(1000,10000,1000),15))
sim_years <- rep(sort(rep((1:15),10)),4)
sd_data <- rep (NA,600)
for (i in 1:600) {
  sd_data[i]<-rnorm(1,mean=exp(0.1 * sim_years[i]), sd= 1/n_replicates[i])
}
max_rep <- sort(rep(c(10,100,1000,10000),150))
data_frame <- cbind.data.frame(n_replicates,sim_years,sd_data,max_rep)

my_breaks = c(2, 10, 100, 1000, 10000)
facet_names <- c(
  `10` = "2, 3, ..., 10 replicates",
  `100` = "10, 20, ..., 100 replicates",
  `1000` = "100, 200, ..., 1000 replicates",
  `10000` = "1000, 2000, ..., 10000 replicates"
)

base <- ggplot(data=data_frame,
                aes(x=sim_years,y=sd_data,group =n_replicates, col=n_replicates)) +
  geom_line() +
  theme_bw() +
  scale_colour_gradientn(
    name = "number of replicates",
    trans = "log10", breaks = my_breaks,
    labels = my_breaks, colours = rainbow(20)
  ) +
  labs(title ="",  x = "year", y = "sd")

Next, the main plot will be just the root plot with facet_wrap().
main <- base + facet_wrap(~ max_rep, ncol = 2, labeller = as_labeller(facet_names))

Then the new part is to use facet_wrap_paginate with nrow = 1 and ncol = 1 for every max_rep, which we'll use as insets. The nice thing is that this does the filtering and it keeps colour scales consistent with the root plot.
nmax_rep <- length(unique(data_frame$max_rep))

insets <- lapply(seq_len(nmax_rep), function(i) {
  base + ggforce::facet_wrap_paginate(~ max_rep, nrow = 1, ncol = 1, page = i) +
    coord_cartesian(xlim = c(12, 14), ylim = c(3, 4)) +
    guides(colour = "none", x = "none", y = "none") +
    theme(strip.background = element_blank(),
          strip.text = element_blank(),
          axis.title = element_blank(),
          plot.background = element_blank())
})
insets <- tibble(x = rep(0.01, nmax_rep),
                 y = rep(10.01, nmax_rep),
                 plot = insets,
                 max_rep = unique(data_frame$max_rep))

main +
  geom_plot_npc(data = insets,
                aes(npcx = x, npcy = y, label = plot,
                    vp.width = 0.3, vp.height = 0.6)) +
  annotate(geom = "rect",
           xmin = 12, xmax = 14, ymin = 3, ymax = 4,
           linetype = "dotted", fill = NA, colour = "black")

Created on 2020-12-15 by the reprex package (v0.3.0)

A: Modifying off @user63230's excellent answer:
pp <- map(unique(data_frame$max_rep), function(x) {
  plot2 +
    aes(alpha = ifelse(max_rep == x, 1, 0)) +
    coord_cartesian(xlim = c(12, 14),
                    ylim = c(3, 4)) +
    labs(x = NULL, y = NULL) +
    scale_alpha_identity() +
    facet_null() +
    theme(
      strip.background = element_blank(),
      strip.text.x = element_blank(),
      legend.position = "none",
      axis.text=element_blank(),
      axis.ticks=element_blank()
    )
})

Explanation:

*

*Instead of filtering the data passed into plot2 (which affects the mapping of colours), we impose a new aesthetic alpha, where lines belonging to the other replicate numbers are assigned 0 for transparency;

*Use scale_alpha_identity() to tell ggplot that the alpha mapping is to be used as-is: i.e. 1 for 100%, 0 for 0%.

*Add facet_null() to override plot2's existing facet_wrap, which removes the facet for the inset.

Everything else is unchanged from the code in the question.


text:
Q: How to get uploaded image in serverside using Ember.js I'm new to Ember.js and I'm stuck with a problem I need to save the uploaded image in db but I dont know how to do that I wrote code for upload the image but i'm stuck with passing it to the server my current code is given below
App.js
App = Ember.Application.create();

App.PreviewImageView = Ember.View.extend({
        attributeBindings: ['name', 'width', 'height', 'src'],
        tagName: 'img',
        viewName: 'previewImageView',
        printme: function () {
            console.log('in previewImageView');
        }
});
App.FileField= Ember.TextField.extend({
    type: 'file',
    attributeBindings: ['name'],
    change: function (evt) {
        var input = evt.target;
        if (input.files && input.files[0]) {
            var reader = new FileReader();
            reader.onload = function (e) {
                this.$().parent(':eq(0)').children('img:eq(0)').attr('src', e.target.result);
                var view = that.getPath('parentView.previewImageView');
                view.set('src', e.target.result);
            }
            reader.readAsDataURL(input.files[0]);
        }
    }
});

html
<script type="text/x-handlebars">
                {{view App.FileField name="logo_image" contentBinding="content"}}
                {{view App.PreviewImageView width="200" height="100" }}
</script>

A: Assuming you are using ember-data, you can create a model to represent the image and then create/save from the reader's onload callback. For example:
App.LogoImage = DS.Model.extend({
  id: DS.attr('number'),
  attachment: DS.attr('string')
});

//in App.FileField...
reader.onload = function (e) {
  this.$().parent(':eq(0)').children('img:eq(0)').attr('src', e.target.result);
  var view = that.getPath('parentView.previewImageView');
  view.set('src', e.target.result);
  var file = e.srcElement.result;
  var logo = App.LogoImage.createRecord({ attachment: file });
  logo.save();
}

A: I think you can mix some traditional MVC methods to solve your problem. from your current code I can assume that showing a preview of the image is completed so to get that file in server side just use the following code in your html
@using (Html.BeginForm("FileUpload", "Home", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
<input type="file" name="file" {{view Wizard.FileField contentBinding="content"}} />
<input type="submit" id="btnUpload" value="Upload" />
}

and In you controller method you can access the file like this
public ActionResult FileUpload(HttpPostedFileBase file)
{
         // Do what you want
}

To save the image in db you have to convert it into bytes (sql server 2008 support image now but db like postgresql still need image as bytes) to do that use the following method
 MemoryStream target = new MemoryStream();
 file.InputStream.CopyTo(target);
 byte[] bytes= target.ToArray();
 return View();


text:
Q: How to fix "401Array{"errors":[{"message":"Permission denied, wrong credentials","field":null,"help":null}]}" error in PHP/Sendgrid/Heroku? BROWSER ERROR is: 401Array{"errors":[{"message":"Permission denied, wrong credentials","field":null,"help":null}]}
I have written this code to send an email using sendgrid addon of heroku. Instead of api_key I wrote my own. What is the problem? Why such error?
require("sendgrid-php/sendgrid-php.php");

$from = new SendGrid\Email(null, "kesursweta@yahoo.com");
$subject = "Hello World from the SendGrid PHP Library!";
$to = new SendGrid\Email(null, "kesursweta@yahoo.com");
$content = new SendGrid\Content("text/plain", "Hello, Email!");
$mail = new SendGrid\Mail($from, $subject, $to, $content);

$apiKey = getenv('my_api_key');
$sg = new \SendGrid($apiKey);

$response = $sg->client->mail()->send()->post($mail);
echo $response->statusCode();
echo $response->headers();
echo $response->body();

A: First try out running this code with composer and then create and set SENDGRID_API_KEY. After performing both this task your code will not show any error.For reference please checkout this links:
Download composer from here: https://gist.github.com/tomysmile/3b37ab4a1ddd604093fe724d0a882166
How to create and set API_KEY: https://github.com/sendgrid/sendgrid-php


text:
Q: Is it possible to have GoDaddy host my domain name but use AWS to host my website? I'm a little confused on what Aws is instructing me to do.  They are telling me to transfer the name to Route 53 first which cost 12 bucks.  Is there a way to not use Route 53 and still host my website using Aws?

A: Yes,
you can have your domain at any registrar and have your DNS zone hosted anywhere. Just modify DNS records to point to your AWS resources like ELB, EC2 or S3.
Amazon doesn't force you to use Route53.

A: AWS is boss, if you are trying to capitalize on the ACM and get a free SSL you do need to use Route53 to make it happen. Try to test a PTR - Pointer record to your ip address within the DNS to make everything working
Third Party Domain Registrar/DNS

*

*Create a hosted zone through Route53 and erase all DNS/Nameservers
from your domain.

*Add the four nameservers to your domain
registrar's DNS should have a mix of .org .com .net and .co.uk or
something similar. All four need to be insterted.

*After creating your instance and having your domain pointed to it you will
need point the ip address to Route 53 with an A record. Keep it that
way for now

*Generate a certificate with ACM as described above
Create an ELB as described above as well Now with the DNS first make
a *.domain.com A record to point to your dualstack.

*Then delete the original A record that pointed to your ip address

*Next make sure you point the A record now to your
dualstack.loadbalancer for your regular domain.com

*Next, here was the crucial part for me, make a PTR - Pointer record
to your ip address with domain.com as the name

*Viola free certificate will work with Wordpress

Oh, and if your design looks funky or any issues getting the green bar then it's something embeded so start with this plugin, make sure "HTTP_X_FORWARDED_PROTO (e.g. load balancer, reverse proxy, NginX)" is enabled and then move on from there with your typical ssl auditing. https://wordpress.org/plugins/ssl-insecure-content-fixer/11
A lot of cool info for AWS + Wordpress via bitnami and more details on the SSL here: https://community.bitnami.com/t/connecting-amazon-ssl-via-load-balancer-to-bitnami-aws-marketplace-instance/41460/29
Let me know if you have trouble getting started on actually launching the instance and getting wordpress up first. The domain pointing and ssl is one of the last steps.

A: Yes, this is pretty common.
In Route53, create a new zone for your domain.  When you do this, you'll get the NS and SOA records created by default. There will be 4 NS entries.  Add any other records you need.
Then, when you're ready to switcy, go to the godaddy DNS settings, and change the NS and SOA records to the values in the Route53 zone.  By default, I think godaddy only shows 2 NS records, but you can add all 4.


text:
Q: How many edges can you add to a tree with $n$ vertices so it stays planar? How many edges can you add to a tree with $n$ vertices so it stays planar?
My attempt:
Any planar graph has $|E|\le 3n-6$, and tree has $n-1$ edges, so we can add at most $2n-5$ edges.
I tried a lot of examples, and I was always able to add exactly $2n-5$ edges no matter in which order I placed them. But I am stuck without proof.

A: Thanks to JMoravitz, I think I got it.
Suppose That for each $n-1$ tree, we can add $2n-7$ edges. Now we take any $n$ tree and pick any leaf (which exists for any tree with $n>0$). We remove this leaf (or just pretend it doesn't exist) and add 2n-7 edges (which we can do by hypothesis).
Now in this new graph with $n-1$ vertices and $2n-7$ edges, each face  is incident to exactly $3$ vertices, if they were perhaps incident to $4$ vertices, we could just add an edge between $2$ which aren't connected, which would be a contradiction.
Finally we add back the leaf that we removed, which now lives on a face that is incident to his one neighbour and exactly 2 other vertices. We add the 2 edges and complete the proof.


text:
Q: how to recycle view in Recycler View I am using Recycler view to create List View. With in the List View, Each of the item has Horizontal Scroll bar. In the horizontal scroll bar, I display either one item or 3 items based on particular business logic. When listed, the first 2 scrolls display exactly what I wanted. But for further scrolls, I am having problem with the items that I display in the Horizontal Scroll view. It displays multiple items where only one item should be there. When investigated, I came to know that its because, the view is not recycled.
After searching, I override this function, onViewRecycled. This function is called when the issue starts (third and further on scrolls). I don't know how to fix this issue. I am passing List of History to adapter at the beginning itself.
Kindly help me to resolve this.
public class HistoryAdapter(users:List<HistoryItem>): RecyclerView.Adapter<HistoryAdapter.ViewHolder>() {

    val TAG = "HistoryAdapter"

    var historyList:List<HistoryItem>? =null
    var context: Context? =null

    init {
        historyList = users

    }

    override fun onViewRecycled(holder: ViewHolder?) {
        super.onViewRecycled(holder)
        Log.d(TAG,"********************************************************************************************************************************Views are recycled****************************")

        if (holder is HistoryAdapter.ViewHolder) {

            val handler = Handler()
            handler.post(Runnable { () -> notifyItemRemoved(holder.getOldPosition()) })
            //notifyItemRangeChanged(holder.getAdapterPosition(),historyList!!.size())
        }

    }

    override fun getItemId(position: Int): Long {
        return super.getItemId(position)
    }

    override fun onBindViewHolder(holder: ViewHolder?, position: Int) {
        var lung: Boolean? = false
        var tag: String? = null
        val historyItem: HistoryItem = historyList!!.get(position)

        holder!!.profileImg.setImageBitmap(BitmapFactory.decodeFile(File(Environment.getDataDirectory().getAbsolutePath(), "data/" + context!!.getPackageName() + "/files/users/" + historyItem.uuidVal + "/portrait.png").getAbsolutePath()))

        holder!!.notesTxt.setText(historyItem.sessionVal!!.getNote())

        val date = historyItem.sessionVal!!.getDate()
        var formatDayOfMonth  = SimpleDateFormat("dd");
        val day = Integer.parseInt(formatDayOfMonth.format(date));
        val dayStr = day.toString();

        formatDayOfMonth  = SimpleDateFormat("MMM")
        val month = formatDayOfMonth.format(date)

        formatDayOfMonth = SimpleDateFormat("yyyy")
        val year = formatDayOfMonth.format(date)

        formatDayOfMonth = SimpleDateFormat("hh:mm a")
        val currentTime = formatDayOfMonth.format(date)

        val dateStr = month+" "+dayStr+", "+year

        holder!!.dateTxt.setText(dateStr)
        holder!!.timeTxt.setText(currentTime)

        Log.d(TAG,"********************************************************************************************************************************************user =>"+historyItem.uuidVal);
        Log.d(TAG,"********************************************************************************************************************************************current time =>"+currentTime);

        var ambientTemp: Double? = null
        var surfaceTemp: Double? = null
        var coreBodyTemp: Double? = null

        var heartRate: Int? = null
        var lungAvailable: Boolean = false
        var heartAvailable: Boolean = false
        var tempAvailable: Boolean = false

        try {
            val tempRecording:TemperatureRecording = checkNotNull(historyItem.sessionVal!!.getTemperature())
            tempAvailable = true
            ambientTemp = tempRecording.getAmbientTemp()
            surfaceTemp = tempRecording.getSurfaceTemp()
            coreBodyTemp = TemperatureRecording.CalculateCoreBodyTemperature.getCoreBodyTemp(ambientTemp,surfaceTemp)
        } catch(i: IllegalStateException) {
            Log.w(TAG,"Temperature not available for user session")
            tempAvailable = false
        }

        try {
            val heartRecording:HeartRecording = checkNotNull(historyItem.sessionVal!!.getHeart())
            heartAvailable = true
            heartRate = heartRecording.getHeartRate()
        } catch(i: IllegalStateException) {
            Log.w(TAG,"Heart not available for user session")
            heartAvailable = false
        }

        try {
            val lungRecording:LungsRecording = checkNotNull(historyItem.sessionVal!!.getLungs())
            lungAvailable = true
        } catch(i: IllegalStateException) {
            Log.w(TAG,"Lung not available for user session")
            lungAvailable = false
        }

        Log.d(TAG,"********************************************************************************************************************************************temperature =>"+tempAvailable)
        Log.d(TAG,"********************************************************************************************************************************************heart =>"+heartAvailable)
        Log.d(TAG,"********************************************************************************************************************************************lung =>"+lungAvailable)

        //Log.d(TAG,"********************************************************************************************************************************************ambient temp val =>"+ambientTemp)
        //Log.d(TAG,"********************************************************************************************************************************************surface temp val =>"+surfaceTemp)
        //Log.d(TAG,"********************************************************************************************************************************************heart val =>"+heartRate)
        //Log.d(TAG,"********************************************************************************************************************************************lung val =>"+historyItem.sessionVal!!.getLungs())

        val parentLinearLayout = holder!!.readingsView
        //createLayout(holder!!.readingsView,tag,coreBodyTemp,heartRate)
        var childLinearLayout: LinearLayout? = null

        if(tempAvailable == true && heartAvailable == true && lungAvailable == true) {
            for(i in 1..3) {
                if(i == 1) {
                    val df = DecimalFormat("#.##");
                    childLinearLayout = createChildView(BitmapFactory.decodeResource(context!!.getResources(),R.drawable.temperature), df.format(coreBodyTemp).toString(), context!!.getString(R.string.temperatureStr))
                    parentLinearLayout.addView(childLinearLayout)
                    childLinearLayout = null
                } else if(i == 2) {
                    childLinearLayout = createChildView(BitmapFactory.decodeResource(context!!.getResources(),R.drawable.heart), heartRate.toString(), context!!.getString(R.string.heartRate))
                    parentLinearLayout.addView(childLinearLayout)
                    childLinearLayout = null
                } else if(i == 3) {
                    childLinearLayout = createChildView(BitmapFactory.decodeResource(context!!.getResources(),R.drawable.lung), "", "")
                    parentLinearLayout.addView(childLinearLayout)
                    childLinearLayout = null
                }
            }
        } else if (tempAvailable) {
            val df = DecimalFormat("#.##");
            childLinearLayout = createChildView(BitmapFactory.decodeResource(context!!.getResources(),R.drawable.temperature), df.format(coreBodyTemp).toString(), context!!.getString(R.string.temperatureStr))
            parentLinearLayout.addView(childLinearLayout)
            childLinearLayout = null
        } else if (heartAvailable) {
            childLinearLayout = createChildView(BitmapFactory.decodeResource(context!!.getResources(),R.drawable.heart), heartRate.toString(), context!!.getString(R.string.heartRate))
            parentLinearLayout.addView(childLinearLayout)
            childLinearLayout = null
        } else if (lungAvailable) {
            childLinearLayout = createChildView(BitmapFactory.decodeResource(context!!.getResources(),R.drawable.lung), "", "")
            parentLinearLayout.addView(childLinearLayout)
            childLinearLayout = null
        }

    }

    fun createChildView(icon: Bitmap,readingVal: String, readingTag: String) : LinearLayout {
        val lp = LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT)
        lp.weight = 1f
        val parent: LinearLayout = LinearLayout(context!!)
        parent.setOrientation(LinearLayout.HORIZONTAL)
        parent.setLayoutParams(lp)

        val imageView = ImageView(context!!)
        val layoutParams = LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT)
        layoutParams.weight = 0.4f
        layoutParams.leftMargin = 10
        layoutParams.rightMargin = 10
        layoutParams.topMargin = 10
        layoutParams.bottomMargin =10

        imageView.setLayoutParams(layoutParams)
        imageView.setImageBitmap(icon)
        parent.addView(imageView)

        val readingLayout = LinearLayout(context!!)
        readingLayout.setOrientation(LinearLayout.VERTICAL)
        val lp1 = LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT)
        lp1.weight = 0.6f
        lp1.topMargin = 10
        readingLayout.setLayoutParams(lp)

        val displayValue = TextView(context!!)
        val layoutParams1 = LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, 0)
        layoutParams1.weight = 0.7f
        displayValue.setLayoutParams(layoutParams1)
        displayValue.setText(readingVal)
        readingLayout.addView(displayValue)

        val displayTag = TextView(context!!)
        layoutParams1.weight = 0.3f
        displayTag.setLayoutParams(layoutParams1)
        displayTag.setText(readingTag)
        readingLayout.addView(displayTag)

        parent.addView(readingLayout)

        return parent

    }

override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): ViewHolder? {
        context = parent!!.getContext()
        // create a new view
        val v: View = LayoutInflater.from(parent!!.getContext())
                .inflate(R.layout.layout_history_row, parent, false);

        return ViewHolder(v)
    }

    override fun getItemCount(): Int {
        return historyList!!.size()

    }

    public class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
        public var profileImg: ImageView
        public var dateTxt: TextView
        public var timeTxt: TextView
        public var locationTxt: TextView
        public var notesTxt: TextView
        //public var icon: ImageView
        //public var readingTxt: TextView
        //public var readingDescTxt: TextView

        public var readingsView: LinearLayout

        init {
            profileImg = itemView.findViewById(R.id.profileImage) as ImageView
            dateTxt = itemView.findViewById(R.id.date) as TextView
            timeTxt = itemView.findViewById(R.id.time) as TextView
            locationTxt = itemView.findViewById(R.id.location) as TextView
            notesTxt = itemView.findViewById(R.id.notes) as TextView
            //readingTxt = itemView.findViewById(R.id.readings) as TextView
            //readingDescTxt = itemView.findViewById(R.id.readingsDesc) as TextView
//            icon = itemView.findViewById(R.id.icon) as ImageView
            readingsView = itemView.findViewById(R.id.readingsView) as LinearLayout
        }
    }
}

Activity code
val history = findViewById(R.id.history) as RecyclerView
for(user in allUsers) {
            val uuid: String? = user.getId()
            Log.d(TAG,"*****************************************************************************************************************UUID=>"+uuid+"FirstName=>"+user.getFirstName()+",sessions size =>"+user.getSessions().size())
            for(session in user.getSessions()) {
                historyItems.add(HistoryItem(user.getId(),session))
            }
        }

history.setHasFixedSize(true);
        history.setAdapter(HistoryAdapter(historyItems))
        history.setLayoutManager(LinearLayoutManager(this))

A: I don't know what kind of "recycling" you're expecting, but what the RecyclerView does is that it will call onCreateViewHolder() until it has enough viewholders to cover slightly more than what is visible on the screen.
It will then call onBindViewHolder() to populate the data in the created viewholders.
When you start scrolling, it will grab one of the already created viewholders and feed it back into onBindViewHolder() with a new position. It doesn't do any magic resetting of the viewholder.
In your case, you're never resetting the readingsView, so the adapter keeps adding children to it (which is why it contains more children than expected as you scroll further through the data). In onBindViewHolder() you'll need to remove all existing children from readingsView before you start adding new ones.


text:
Q: Teamcity only running first MSTest - ignores the rest I would to run Visual Studio 2019 tests in Teamcity. I have configured a step as per the screenshot below. Teamcity runs the test dll under the "Test file names" setting but only the first one and ignores the second one. It does not matter what order I put the dll paths in, it always only runs the first one only. I also tried adding a comma at the end of a dll. Am I missing something?

A: have a look at this one
Understanding wildcards when specifying test assemblies for the MSTest runner in TeamCity 7
I guess
**\bin\*\*\*Test.dll
**\*\bin\*\*Test.dll

should work for you.


text:
Q: Can I keep a copy of a table of one database in another database in a microservice architecture? I am currently new to microservice architecture so thanks in advance.
I have two different services a User Service and a Footballer Service each having their individual databases.(User database and Footballer database).
The Footballer service has a database with a single table storing footballer informations.
The User service has a database which stores User details along with other user related data.
Now a User can add footballers to their team by querying the Footballer service and I need to store them somewhere in order to be displayed later.
Currently I'm storing the footballers for each user in a table in the User database whereby I make a call to the Footballer service to give me the details of a specific footballer by ID and save them in the USer database by mapping against the USer ID.
So is this a good idea to do that and by any chance does it mean im replicating data between two services
and if it is than what other ways can i achieve the same functionality ?

A:
Currently I'm storing the footballers for each user in a table in the User database whereby I make a call to the Footballer service to give me the details of a specific footballer by ID and save them in the USer database by mapping against the USer ID.

"Caching" is a fairly common pattern.  From the perspective of the User microservice, the data from Footballer is just another input which you might save or not.  If you are caching, you'll usually want to have some sort of timestamp/version on the cached data.
Caching identifiers is pretty normal - we often need some kind of correlation identifier to connect data in two different places.
If you find yourself using Footballer data in your User domain logic (that is to say, the way that User changes depends on the Footballer data available)... that's more suspicious, and may indicate that your boundaries are incorrectly drawn / some of your capabilities are in the wrong place.
If you are expecting the User Service to be autonomous - that is to say, to be able to continue serving its purpose even when Footballer is out of service, then your code needs to be able to work from cached copies of the data from Footballer and/or be able to suspend some parts of its work until fresh copies of that data are available.

A: People usually follow DDD (Domain driven design) in case of micro-services  :
So here in your case there are two domains i.e. 2 services :

*

*Users

*Footballers

So, user service should only do user specific tasks, it should not be concerned about footballer's data.
Hence, according to DDD, the footballers that are linked to the user should be stored in football service.
Replicating the ID wouldn't be considered replication in case of microservices architecture.


text:
Q: C++ Memory Allocation/Deallocation & FreeSpace Bug Error I am practicing memory allocation and disk management with C++. I just all of the work.. it just looks and seem's a little too easy. I am not sure if my pointer and my allocation and deallocations are correct. My Total FreeSpace looks like it will work, but it looks too basic. I just need someone's programming experience. When I try to run this code it gives me some kind of Error.
Bug Error
Please DO NOT ADD any new Global Variable.
const int MMSIZE = 60136;
  char MM[MMIZE];

 //** Initialize set up any data needed to manage the memory
void initializeMemory(void)
{
  //**increments through the POOL_SIZE
  for (int a = 0; a < MMSIZE; a++) {
      MM[a] = 'NULL';
  }
}

// return a pointer inside the memory
// If no chunk can accommodate aSize call onOutOfMemory()
void* allocate(int size)
{
  //******NOT SURE*******
  int *p = new int;
  *p = 5;

return ((void*) 0);
}

// Free up a chunk previously allocated
void deallocate(void* mPointer)
{

//******NOT SURE*******
  int *p = new int;
  delete p;
  p = 0;
  p = new int(10);

}

//Scan the memory and return the total free space remaining
int remaining(void)
{
//******NOT SURE*******
  int free = 0;
  for (int a = 0; a < MMSIZE; a++)
  {
      if (MM[a] < MMSIZE)
      {
          free += a;
      }
  }

  int free2 = free - MMSIZE;
return free2;
}

A: This code looks unfinished for even a sample but
 //** Initialize set up any data needed to manage the memory
void initializeMemory(void)
{
  //**increments through the POOL_SIZE
  for (int a = 0; a < MMSIZE; a++) {
      MM[a] = 'NULL';// <=== this should not even compile as the single quote should only take one character like '\x0' or 'N'
  }
}

should not even compile as the single quote should only take one character like '\x0' or 'N'
but post the complete module and i can help you more and maybe explain a few things.

A: Without discussing other aspects of your code (such as memory leaking etc), the specific error you are getting most likely comes from *int_pointer = 0xDEADBEEF; line. int_pointer is equal to 0, because int_pointer = (long *)allocate(sizeof(long)); and your void* allocate(int size) with its return ((void*) 0); always returns 0. So you are getting exactly that exception: attempting to write 0xDEADBEEF at address 0x00000000, which is a forbidden operation (there is some OS specific stuff at low addresses).


text:
Q: Picking Unique Combination of records between columns SOURCE_DATA
Hi,
I am getting source data like above. Basically the 2 tables are describing relationships(actual) between two individuals.
TABLE_1 lists all INDV on application.
TABLE_2 has record for each indv and relation with each member on application.
I need to find unique combination between ID and ID2 fields starting with SEQ_NBR at top. Eldest to youngest.
The data is just for one record. SEQ_NBR 999 can have father there as well and aunt, grandma, etc...

A:
I just need unique combination of all vlaues for 1st and 2nd column.

If you want all combination of the values in the two columns, then use cross join:
select *
from (select distinct RCPT_NBR from t) x1 cross join
     (select distinct REL_RCPT_NBR from t) x2

A: Your data are highly denormalized.
Simple decide which relationship you will use and ignore the other.
Example - limiting only to mother relationship shows all three persons involved (IDs are simplified)
select * from tab
where relationship = 'MOTHR';

  PERSON_1   PERSON_2 RELAT
---------- ---------- -----
       224        218 MOTHR
       224        217 MOTHR

If you want to order the output from eldest to youngest usi a hierarchical query (I added two new persons to the data)
WITH t1(person_1, person_2, lvl) AS (
  SELECT person_1,
         person_2,
         1 lvl
  FROM   tab
  WHERE  person_1 In (select person_1 from tab where relationship = 'MOTHR'
                      minus
                      select person_2 from tab where relationship = 'MOTHR')
         and relationship = 'MOTHR'
  UNION ALL
  SELECT t2.person_1,
         t2.person_2,
         t1.lvl + 1 lvl
  FROM   tab t2, t1
  WHERE  t2.person_1 = t1.person_2 and relationship = 'MOTHR'
)
SEARCH DEPTH FIRST BY person_1 SET order1
SELECT person_1,
       person_2,
       lvl
FROM   t1
order by order1;

  PERSON_1   PERSON_2        LVL
---------- ---------- ----------
       224        217          1
       224        218          1
       218        222          2
       222        223          3

The column LVL shows the generation i.e. grandmother (1), mother(2) and daugther (3).
To get the mother on a highest level you use the MINUS query in the anchor part:
(select person_1 from tab where relationship = 'MOTHR'
 minus
select person_2 from tab where relationship = 'MOTHR')

This selects all mothers that are not daughters, which is what you need.


text:
Q: Adding headers to navigation drawer I've been trying to add headers/sections to my navigation drawer, but unfortunately unsuccessfully.
I looked in those questions here in StackOverFlow :
Android Navigation Drawer ListView Headers
Navigation Drawer with Headers/Sections
Here's what I am trying to do.
I want to make a navigation drawer having (Icons and text in each row), and have between some headers.(for example in item 2 and item 6).
I'd appreciate if you tell me what to add/change in my code, to make it possible.(but more detailed then "Override function X and Override function Y", cause I am a beginner and I'm having bad time trying to implement it to my code → I've tried 6 times today, but It crashes).
MainActivity:
import java.util.ArrayList;
import java.util.List;

import android.app.Activity;
import android.content.res.Configuration;
import android.content.res.TypedArray;
import android.os.Bundle;
import android.support.v4.app.ActionBarDrawerToggle;
import android.support.v4.widget.DrawerLayout;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.SectionIndexer;

public class MainActivity extends Activity {
    public String[] drawerListViewItems;
    public ListView drawerListView;
    public ActionBarDrawerToggle actionBarDrawerToggle;
    public DrawerLayout drawerLayout;
    TypedArray menuIcons;
// nav drawer title
private CharSequence mDrawerTitle;
private CharSequence mTitle;
private List<RowItem> rowItems;
private CustomAdapter adapter;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // organize the title of the navigation drawer
    mTitle = mDrawerTitle = getTitle();

    // get list items from strings.xml
    drawerListViewItems = getResources().getStringArray(
            R.array.Navigation_Drawer);
    // get list icons from the strings
    menuIcons = getResources().obtainTypedArray(R.array.icons);

    // get ListView defined in activity_main.xml
    drawerListView = (ListView) findViewById(R.id.left_drawer);

    // Set the adapter for the list view
    drawerListView.setAdapter(new ArrayAdapter<String>(this,
            R.layout.drawer_listview_item, drawerListViewItems));
    // row items array list "RowItem" it's a class
    rowItems = new ArrayList<RowItem>();
    // adds the icons to each item sync
    for (int i = 0; i < drawerListViewItems.length; i++) {
        RowItem items = new RowItem(drawerListViewItems[i],
                menuIcons.getResourceId(i, -1));
        rowItems.add(items);
    }

    drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);

    /*
     * LayoutInflater inflater = getLayoutInflater(); ViewGroup mTop =
     * (ViewGroup)inflater.inflate(R.layout.flats, drawerListView, false);
     * drawerListView.addHeaderView(mTop);
     */

    actionBarDrawerToggle = new ActionBarDrawerToggle(this, /* host Activity */
    drawerLayout, /* DrawerLayout object from line 31 */
    R.drawable.ic_drawer, /* nav drawer icon to replace 'Up' caret */
    R.string.drawer_open, /* "open drawer" description */
    R.string.drawer_close /* "close drawer" description */
    ) {
        public void onDrawerClosed(View view) {
            getActionBar().setTitle(mTitle);
            // calling onPrepareOptionsMenu() to show action bar icons
            invalidateOptionsMenu();
        }
        public void onDrawerOpened(View drawerView) {
            getActionBar().setTitle(mDrawerTitle);
            // calling onPrepareOptionsMenu() to hide action bar icons
            invalidateOptionsMenu();
        }
    };

    menuIcons.recycle();

    adapter = new CustomAdapter(getApplicationContext(), rowItems);
    drawerListView.setAdapter(adapter);
    drawerLayout.setDrawerListener(actionBarDrawerToggle);
    getActionBar().setDisplayHomeAsUpEnabled(true);

    drawerListView.setOnItemClickListener(new DrawerItemClickListener());

}

@Override
public boolean onCreateOptionsMenu(Menu menu) {

    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
    actionBarDrawerToggle.onConfigurationChanged(newConfig);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {

    // call ActionBarDrawerToggle.onOptionsItemSelected(), if it returns
    // true
    // then it has handled the app icon touch event
    if (actionBarDrawerToggle.onOptionsItemSelected(item)) {
        return true;
    }
    return super.onOptionsItemSelected(item);
}
@Override
protected void onPostCreate(Bundle savedInstanceState) {
    super.onPostCreate(savedInstanceState);
    // Sync the toggle state after onRestoreInstanceState has occurred.
    actionBarDrawerToggle.syncState();
}
private class DrawerItemClickListener implements
        ListView.OnItemClickListener {
    @Override
    public void onItemClick(AdapterView parent, View view, int position,
            long id) {
        SelectItem(position);
    }
}

public void SelectItem(int position) {
    // TODO Auto-generated method stub
    switch (position) {
    case 0:
        setTitle(drawerListViewItems[position]);
        drawerLayout.closeDrawer(drawerListView);
        break;
    case 1:
        setTitle(drawerListViewItems[position]);
        drawerLayout.closeDrawer(drawerListView);
        break;
    case 2:
        setTitle(drawerListViewItems[position]);
        drawerLayout.closeDrawer(drawerListView);
        break;
    case 3:
        setTitle(drawerListViewItems[position]);
        drawerLayout.closeDrawer(drawerListView);
        break;
    case 4:
        setTitle(drawerListViewItems[position]);
        drawerLayout.closeDrawer(drawerListView);
        break;
    case 5:
        setTitle(drawerListViewItems[position]);
        drawerLayout.closeDrawer(drawerListView);
        break;
    case 6:
        setTitle(drawerListViewItems[position]);
        drawerLayout.closeDrawer(drawerListView);
        break;
    case 7:
        setTitle(drawerListViewItems[position]);
        drawerLayout.closeDrawer(drawerListView);
        break;
    case 8:
        setTitle(drawerListViewItems[position]);
        drawerLayout.closeDrawer(drawerListView);
        break;
    default:
        break;
    }
}

@Override
public void setTitle(CharSequence title) {
    mTitle = title;
    getActionBar().setTitle(mTitle);
}
}

CustomAdapter:
import java.util.List;
import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
 public class CustomAdapter extends BaseAdapter {
Context context;
List<RowItem> rowItem;

CustomAdapter(Context context, List<RowItem> rowItem) {
    this.context = context;
    this.rowItem = rowItem;
}

private class ViewHolder {
    ImageView icon;
    TextView title;
}

@Override
public int getViewTypeCount() {
    return super.getViewTypeCount();
}

@Override
public int getItemViewType(int position) {
    return super.getItemViewType(position);
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {

ViewHolder holder = null;

LayoutInflater mInflater = (LayoutInflater) context
        .getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
if (convertView == null) {
    convertView = mInflater.inflate(R.layout.list_item, null);
    holder = new ViewHolder();
    holder.icon = (ImageView) convertView.findViewById(R.id.icon);
    holder.title = (TextView) convertView.findViewById(R.id.title);

    RowItem row_pos = rowItem.get(position);
    // setting the image resource and title
    holder.icon.setImageResource(row_pos.getIcon());
    holder.title.setText(row_pos.getTitle());
    convertView.setTag(holder);
} else {
    holder = (ViewHolder) convertView.getTag();
}
return convertView;
}
@Override
public int getCount() {
    return rowItem.size();
}
@Override
public Object getItem(int position) {
    return rowItem.get(position);
}
@Override
public long getItemId(int position) {
    return rowItem.indexOf(getItem(position));

 }

}

RowItem:
  public class RowItem {

private String title;
private int icon;
String ItemName;
public RowItem(String title, int icon) {
    this.title = title;
    this.icon = icon;
}
public String getItemName() {
    return ItemName;
}
public void setItemName(String itemName) {
    ItemName = itemName;
}
public String getTitle() {
    return title;
}
public void setTitle(String title) {
    this.title = title;
}
public int getIcon() {
    return icon;
}
public void setIcon(int icon) {
    this.icon = icon;
}
}

drawerlistviewitem.xml
    <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="48dp"
    android:padding="2dp" >
    <ImageView
        android:id="@+id/icon"
        android:layout_width="50dp"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_centerVertical="true"
        android:layout_marginLeft="12dp"
        android:layout_marginRight="12dp"
        android:contentDescription="desc"
        android:src="@drawable/firstlogo" />
    <TextView
        android:id="@+id/title"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_marginTop="10dp"
        android:layout_toRightOf="@id/icon"
        android:gravity="center_vertical"
        android:text="abccc"
        android:textColor="#000000"
        android:textSize="20sp" />
</RelativeLayout>

A: Hope you got your answer or problem has been already solved.
But if not, you can try example from https://github.com/AndGitRepo/NavDrawer/tree/master/NavDrawer
You can create interface for list items. Then implement that interface in two classes: one is for list item and second is for Section/Header item of list.
public class NavMenuSection implements NavDrawerItem {

public static final int SECTION_TYPE = 0;
private int id;
private String label;

private NavMenuSection() {
}

public static NavMenuSection create( int id, String label ) {
    NavMenuSection section = new NavMenuSection();
    section.setLabel(label);
    return section;
}

@Override
public int getType() {
    return SECTION_TYPE;
}

public String getLabel() {
    return label;
}

public void setLabel(String label) {
    this.label = label;
}

@Override
public boolean isEnabled() {
    return false;
}

public int getId() {
    return id;
}

public void setId(int id) {
    this.id = id;
}

@Override
public boolean updateActionBarTitle() {
    return false;
}

}
And another class for list item is
public static final int ITEM_TYPE = 1 ;

private int id ;
private String label ;
private int icon ;
private boolean updateActionBarTitle ;

private NavMenuItem() {
}

public static NavMenuItem create( int id, String label, String icon, boolean updateActionBarTitle, Context context ) {
    NavMenuItem item = new NavMenuItem();
    item.setId(id);
    item.setLabel(label);
    item.setIcon(context.getResources().getIdentifier( icon, "drawable", context.getPackageName()));
    item.setUpdateActionBarTitle(updateActionBarTitle);
    return item;
}

@Override
public int getType() {
    return ITEM_TYPE;
}

public int getId() {
    return id;
}

public void setId(int id) {
    this.id = id;
}

public String getLabel() {
    return label;
}

public void setLabel(String label) {
    this.label = label;
}

public int getIcon() {
    return icon;
}

public void setIcon(int icon) {
    this.icon = icon;
}

@Override
public boolean isEnabled() {
    return true;
}

@Override
public boolean updateActionBarTitle() {
    return this.updateActionBarTitle;
}

public void setUpdateActionBarTitle(boolean updateActionBarTitle) {
    this.updateActionBarTitle = updateActionBarTitle;
}

Now update adapter code
public class NavDrawerAdapter extends  ArrayAdapter<NavDrawerItem>{

private LayoutInflater inflater;

public NavDrawerAdapter(Context context, int textViewResourceId, NavDrawerItem[] objects ) {
    super(context, textViewResourceId, objects);
    this.inflater = LayoutInflater.from(context);
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    View view = null ;
    NavDrawerItem menuItem = this.getItem(position);
    if ( menuItem.getType() == NavMenuItem.ITEM_TYPE ) {
        view = getItemView(convertView, parent, menuItem );
    }
    else {
        view = getSectionView(convertView, parent, menuItem);
    }
    return view ;
}

public View getItemView( View convertView, ViewGroup parentView, NavDrawerItem navDrawerItem ) {

    NavMenuItem menuItem = (NavMenuItem) navDrawerItem ;
    NavMenuItemHolder navMenuItemHolder = null;

    if (convertView == null) {
        convertView = inflater.inflate( R.layout.navdrawer_item, parentView, false);
        TextView labelView = (TextView) convertView
                .findViewById( R.id.navmenuitem_label );
        ImageView iconView = (ImageView) convertView
                .findViewById( R.id.navmenuitem_icon );

        navMenuItemHolder = new NavMenuItemHolder();
        navMenuItemHolder.labelView = labelView ;
        navMenuItemHolder.iconView = iconView ;

        convertView.setTag(navMenuItemHolder);
    }

    if ( navMenuItemHolder == null ) {
        navMenuItemHolder = (NavMenuItemHolder) convertView.getTag();
    }

    navMenuItemHolder.labelView.setText(menuItem.getLabel());
    navMenuItemHolder.iconView.setImageResource(menuItem.getIcon());

    return convertView ;
}

public View getSectionView(View convertView, ViewGroup parentView,
        NavDrawerItem navDrawerItem) {

    NavMenuSection menuSection = (NavMenuSection) navDrawerItem ;
    NavMenuSectionHolder navMenuItemHolder = null;

    if (convertView == null) {
        convertView = inflater.inflate( R.layout.navdrawer_section, parentView, false);
        TextView labelView = (TextView) convertView
                .findViewById( R.id.navmenusection_label );

        navMenuItemHolder = new NavMenuSectionHolder();
        navMenuItemHolder.labelView = labelView ;
        convertView.setTag(navMenuItemHolder);
    }

    if ( navMenuItemHolder == null ) {
        navMenuItemHolder = (NavMenuSectionHolder) convertView.getTag();
    }

    navMenuItemHolder.labelView.setText(menuSection.getLabel());

    return convertView ;
}

@Override
public int getViewTypeCount() {
    return 2;
}

@Override
public int getItemViewType(int position) {
    return this.getItem(position).getType();
}

@Override
public boolean isEnabled(int position) {
    return getItem(position).isEnabled();
}

private static class NavMenuItemHolder {
    private TextView labelView;
    private ImageView iconView;
}

private class NavMenuSectionHolder {
    private TextView labelView;
}}

Then from main activity add list items as section and/or items
 NavDrawerItem[] menu = new NavDrawerItem[] {
            NavMenuSection.create( 100, "Logged in user details"),
            //NavMenuItem.create(101,"List/Detail (Fragment)", "navdrawer_friends", true, this),
            //NavMenuItem.create(102, "Airport (AsyncTask)", "navdrawer_airport", false, this),
            //NavMenuSection.create(200, "General"),
            NavMenuItem.create(202, "Rate this app", "drawer_shadow", false, this),
            NavMenuItem.create(203, "Nav", "drawer_shadow", false, this),
            NavMenuItem.create(204, "Quit", "drawer_shadow", false, this)};

    NavDrawerActivityConfiguration navDrawerActivityConfiguration = new NavDrawerActivityConfiguration();
    navDrawerActivityConfiguration.setMainLayout(R.layout.activity_nav_drawer);
    navDrawerActivityConfiguration.setDrawerLayoutId(R.id.drawer_layout);
    navDrawerActivityConfiguration.setLeftDrawerId(R.id.left_drawer);
    navDrawerActivityConfiguration.setNavItems(menu);
    navDrawerActivityConfiguration.setDrawerShadow(R.drawable.drawer_shadow);
    navDrawerActivityConfiguration.setDrawerOpenDesc(R.string.drawer_open);
    navDrawerActivityConfiguration.setDrawerCloseDesc(R.string.drawer_close);
    navDrawerActivityConfiguration.setBaseAdapter(
        new NavDrawerAdapter(this, R.layout.navdrawer_item, menu ));

For complete code you can use github link. because I can't paste complete code here.


text:
Q: HTML Write side by side I want to type words side by side.When I type words, they come one after the other.
Here's my problem:
problem
I want to write this words side by side.Thanks for your help.

A: There are two methods to achieve this.
First:
Use inline-block on children

privacy

policy

Second:
Use flex on parent element

privacy

policy

A: By default the HTML elements are in display: block , they appear one after another, this applies to all the elements
you can change this by changing the display property of the parent  like
   .dflex{
    display:flex
    }

A

B

here all those children inside the parent will appear one after another


text:
Q: Установка PostreSQL на Windows 2008 r2 Пытаюсь поставить PostreSQL 10.9 на Win 2008 r2 x64.
В конце установки постоянно вываливается ошибка инициализации кластера. Как итог папка data пустая, пользователь postgres не создаётся, служба postgresql-x64-10 не появляется.
Нашёл много топиков, в которых советовали ставить не в Program Files, докидывать права вручную и реинсталить, инсталить от имени вручную созданного юзера postgres с правами всемогущего — не спасло ничего.
Сообщение в конце установки выглядит вот так:

Problem running post-install step: The database cluster init failed

A: Спасла статья с хабра:
https://habr.com/ru/post/101678/
Коротко, батник:
@ECHO ON
@SET PATH="%CD%\bin";%PATH%
@SET PGDATA=%CD%\data
@SET PGDATABASE=postgres
@SET PGUSER=postgres
@SET PGPORT=5439
@SET PGLOCALEDIR=%CD%\share\locale
REM %CD%\bin\initdb -U postgres -A trust
%CD%\bin\pg_ctl -D %CD%/data -l logfile start
ECHO "Нажмите Enter чтобы остановить работу сервера"
pause
%CD%\bin\pg_ctl -D %CD%/data stop

При первом старте раскоментить строку:
REM %CD%\bin\initdb -U postgres -A trust
После закоментить и стартовать сервак через этот батник.