text:
Q: Portfolio NavBar : HTML, CSS, FLEXBOX So, This is a very specific problem:

*

*I want you to run the code, and open it in a full window.

*Now please inspect the following code, and toggle the responsive mode.

*Now, change the dimensions to something small, until you can see a hamburger.

*Now click the hamburger. Works fine?

*Now close the hamburger.

*Scroll until the end of the page, in this mobile view.

*Now try opening the hamburger. Most probably it won't work.

*Now scroll to about just below the top of the page in the responsive mobile view. Here open the hamburger. You should be able to see a glitched out half menu like included in the image.

I don't know why or how this is happening. Could someone please reslove this? Any help will be appreciated.

<!DOCTYPE html>

    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Responsive Navbar</title>
    <link rel="stylesheet" href="styles/styles.css" />
    <link
      rel="stylesheet"
      href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.2/css/all.min.css"
    />

    <link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;800&family=Quicksand:wght@300&family=Roboto:wght@900&display=swap" rel="stylesheet">

        <input type="checkbox" id="check" />

        Nikita Gada

About Me

Education

Work

Contact

    Lorem ipsum dolor sit, amet consectetur adipisicing elit. Consequatur sapiente, distinctio ipsam rem eos ipsum ea praesentium repellat animi maxime adipisci exercitationem, vel facere? Commodi deserunt minima quas accusantium aliquid tenetur repudiandae quam dolor culpa aperiam voluptates id, quia nobis facilis ipsum perferendis blanditiis nemo sint doloribus hic? Veniam culpa aperiam sunt harum et! Ex eaque incidunt nostrum error corrupti ratione consequuntur obcaecati quaerat, beatae id praesentium quibusdam laborum ipsam dolorum voluptates nemo, omnis quia dolorem quos! Similique labore quos placeat minus illo doloribus iste est nisi necessitatibus, illum totam, inventore incidunt omnis molestiae corporis exercitationem quibusdam ipsum ullam excepturi. Ea exercitationem amet omnis sunt id sed, nobis perspiciatis quidem, tempore asperiores recusandae deserunt aut nihil, aperiam ducimus libero iste nisi debitis nulla voluptates quos nesciunt. Eligendi obcaecati a, nisi porro unde id explicabo! Asperiores vel omnis non alias debitis distinctio, minima nostrum architecto nulla iusto, qui sed accusamus, excepturi ratione? Dolorem doloremque quo autem velit iste quis dolores. Rem earum enim ducimus eaque animi repellendus voluptates debitis consequuntur assumenda autem amet, aperiam culpa inventore sed? Pariatur placeat nesciunt voluptatibus earum cupiditate fuga optio quia sunt suscipit voluptatum delectus facilis nihil ut, nemo itaque, voluptatem nulla consequatur aspernatur consequuntur libero, magnam sequi nobis incidunt asperiores? Sed aspernatur corporis fugiat, animi illum accusantium repellendus laudantium voluptate unde a modi nesciunt non sequi, reprehenderit asperiores doloremque eum necessitatibus quibusdam. A voluptate beatae perferendis natus, cupiditate nihil illo esse vero blanditiis voluptatibus tempore repellat unde numquam quam dignissimos laborum ipsam consectetur minus corrupti quasi! Molestias unde velit, dolor ullam iure debitis maiores et, rem facilis tempore odio, labore omnis aspernatur tempora sunt ratione quos cumque accusantium harum voluptatum. Consequatur aspernatur maxime nobis veritatis quasi provident perferendis veniam dolores nostrum deleniti, consequuntur reprehenderit amet excepturi, quae libero id dolorum voluptatibus assumenda praesentium, quibusdam est sint. Dignissimos fugiat ducimus minima alias dicta sit, excepturi maxime, maiores velit recusandae esse sed ad voluptatibus repudiandae iure quaerat soluta ab sequi officiis id aut. Ipsum error sit vel rerum exercitationem. Nulla ducimus nesciunt incidunt pariatur, quo nihil fugit ipsa dolores maxime eum reiciendis, maiores aliquam quas consequuntur quaerat vel! Ipsum error in itaque placeat accusantium autem, quos, necessitatibus dolores dignissimos perferendis tempora eligendi nobis quis quia tempore, rerum distinctio consectetur? Odit, quisquam a modi atque fugiat provident iste expedita voluptatem eveniet unde molestiae eos, nobis sunt est repudiandae obcaecati voluptatibus dolorum consectetur autem. Neque quidem, modi saepe quibusdam voluptatibus iste distinctio, eum eligendi aliquid cum nisi. Magnam, nulla consequuntur aliquid dolorem maiores odio placeat sint molestiae, quis, tenetur labore nemo! Ipsum reprehenderit ex dolorum nostrum cupiditate, dolore molestias iure eos a doloremque nisi possimus ducimus odio quo! Beatae non necessitatibus fuga accusamus,

A: I set a top : 80px on your navlinks in your @media (max-width: 800px) and it seems to be working. Take a look.

<!DOCTYPE html>

    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Responsive Navbar</title>
    <link rel="stylesheet" href="styles/styles.css" />
    <link
      rel="stylesheet"
      href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.2/css/all.min.css"
    />

    <link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;800&family=Quicksand:wght@300&family=Roboto:wght@900&display=swap" rel="stylesheet">

        <input type="checkbox" id="check" />

        Nikita Gada

About Me

Education

Work

Contact

    Lorem ipsum dolor sit, amet consectetur adipisicing elit. Consequatur sapiente, distinctio ipsam rem eos ipsum ea praesentium repellat animi maxime adipisci exercitationem, vel facere? Commodi deserunt minima quas accusantium aliquid tenetur repudiandae quam dolor culpa aperiam voluptates id, quia nobis facilis ipsum perferendis blanditiis nemo sint doloribus hic? Veniam culpa aperiam sunt harum et! Ex eaque incidunt nostrum error corrupti ratione consequuntur obcaecati quaerat, beatae id praesentium quibusdam laborum ipsam dolorum voluptates nemo, omnis quia dolorem quos! Similique labore quos placeat minus illo doloribus iste est nisi necessitatibus, illum totam, inventore incidunt omnis molestiae corporis exercitationem quibusdam ipsum ullam excepturi. Ea exercitationem amet omnis sunt id sed, nobis perspiciatis quidem, tempore asperiores recusandae deserunt aut nihil, aperiam ducimus libero iste nisi debitis nulla voluptates quos nesciunt. Eligendi obcaecati a, nisi porro unde id explicabo! Asperiores vel omnis non alias debitis distinctio, minima nostrum architecto nulla iusto, qui sed accusamus, excepturi ratione? Dolorem doloremque quo autem velit iste quis dolores. Rem earum enim ducimus eaque animi repellendus voluptates debitis consequuntur assumenda autem amet, aperiam culpa inventore sed? Pariatur placeat nesciunt voluptatibus earum cupiditate fuga optio quia sunt suscipit voluptatum delectus facilis nihil ut, nemo itaque, voluptatem nulla consequatur aspernatur consequuntur libero, magnam sequi nobis incidunt asperiores? Sed aspernatur corporis fugiat, animi illum accusantium repellendus laudantium voluptate unde a modi nesciunt non sequi, reprehenderit asperiores doloremque eum necessitatibus quibusdam. A voluptate beatae perferendis natus, cupiditate nihil illo esse vero blanditiis voluptatibus tempore repellat unde numquam quam dignissimos laborum ipsam consectetur minus corrupti quasi! Molestias unde velit, dolor ullam iure debitis maiores et, rem facilis tempore odio, labore omnis aspernatur tempora sunt ratione quos cumque accusantium harum voluptatum. Consequatur aspernatur maxime nobis veritatis quasi provident perferendis veniam dolores nostrum deleniti, consequuntur reprehenderit amet excepturi, quae libero id dolorum voluptatibus assumenda praesentium, quibusdam est sint. Dignissimos fugiat ducimus minima alias dicta sit, excepturi maxime, maiores velit recusandae esse sed ad voluptatibus repudiandae iure quaerat soluta ab sequi officiis id aut. Ipsum error sit vel rerum exercitationem. Nulla ducimus nesciunt incidunt pariatur, quo nihil fugit ipsa dolores maxime eum reiciendis, maiores aliquam quas consequuntur quaerat vel! Ipsum error in itaque placeat accusantium autem, quos, necessitatibus dolores dignissimos perferendis tempora eligendi nobis quis quia tempore, rerum distinctio consectetur? Odit, quisquam a modi atque fugiat provident iste expedita voluptatem eveniet unde molestiae eos, nobis sunt est repudiandae obcaecati voluptatibus dolorum consectetur autem. Neque quidem, modi saepe quibusdam voluptatibus iste distinctio, eum eligendi aliquid cum nisi. Magnam, nulla consequuntur aliquid dolorem maiores odio placeat sint molestiae, quis, tenetur labore nemo! Ipsum reprehenderit ex dolorum nostrum cupiditate, dolore molestias iure eos a doloremque nisi possimus ducimus odio quo! Beatae non necessitatibus fuga accusamus,

A: Well, The problem is you never define the top property of the .navlinks. Please check the snippet.

<!DOCTYPE html>

    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Responsive Navbar</title>
    <link rel="stylesheet" href="styles/styles.css" />
    <link
      rel="stylesheet"
      href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.2/css/all.min.css"
    />

    <link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;800&family=Quicksand:wght@300&family=Roboto:wght@900&display=swap" rel="stylesheet">

        <input type="checkbox" id="check" />

        Nikita Gada

About Me

Education

Work

Contact

    Lorem ipsum dolor sit, amet consectetur adipisicing elit. Consequatur sapiente, distinctio ipsam rem eos ipsum ea praesentium repellat animi maxime adipisci exercitationem, vel facere? Commodi deserunt minima quas accusantium aliquid tenetur repudiandae quam dolor culpa aperiam voluptates id, quia nobis facilis ipsum perferendis blanditiis nemo sint doloribus hic? Veniam culpa aperiam sunt harum et! Ex eaque incidunt nostrum error corrupti ratione consequuntur obcaecati quaerat, beatae id praesentium quibusdam laborum ipsam dolorum voluptates nemo, omnis quia dolorem quos! Similique labore quos placeat minus illo doloribus iste est nisi necessitatibus, illum totam, inventore incidunt omnis molestiae corporis exercitationem quibusdam ipsum ullam excepturi. Ea exercitationem amet omnis sunt id sed, nobis perspiciatis quidem, tempore asperiores recusandae deserunt aut nihil, aperiam ducimus libero iste nisi debitis nulla voluptates quos nesciunt. Eligendi obcaecati a, nisi porro unde id explicabo! Asperiores vel omnis non alias debitis distinctio, minima nostrum architecto nulla iusto, qui sed accusamus, excepturi ratione? Dolorem doloremque quo autem velit iste quis dolores. Rem earum enim ducimus eaque animi repellendus voluptates debitis consequuntur assumenda autem amet, aperiam culpa inventore sed? Pariatur placeat nesciunt voluptatibus earum cupiditate fuga optio quia sunt suscipit voluptatum delectus facilis nihil ut, nemo itaque, voluptatem nulla consequatur aspernatur consequuntur libero, magnam sequi nobis incidunt asperiores? Sed aspernatur corporis fugiat, animi illum accusantium repellendus laudantium voluptate unde a modi nesciunt non sequi, reprehenderit asperiores doloremque eum necessitatibus quibusdam. A voluptate beatae perferendis natus, cupiditate nihil illo esse vero blanditiis voluptatibus tempore repellat unde numquam quam dignissimos laborum ipsam consectetur minus corrupti quasi! Molestias unde velit, dolor ullam iure debitis maiores et, rem facilis tempore odio, labore omnis aspernatur tempora sunt ratione quos cumque accusantium harum voluptatum. Consequatur aspernatur maxime nobis veritatis quasi provident perferendis veniam dolores nostrum deleniti, consequuntur reprehenderit amet excepturi, quae libero id dolorum voluptatibus assumenda praesentium, quibusdam est sint. Dignissimos fugiat ducimus minima alias dicta sit, excepturi maxime, maiores velit recusandae esse sed ad voluptatibus repudiandae iure quaerat soluta ab sequi officiis id aut. Ipsum error sit vel rerum exercitationem. Nulla ducimus nesciunt incidunt pariatur, quo nihil fugit ipsa dolores maxime eum reiciendis, maiores aliquam quas consequuntur quaerat vel! Ipsum error in itaque placeat accusantium autem, quos, necessitatibus dolores dignissimos perferendis tempora eligendi nobis quis quia tempore, rerum distinctio consectetur? Odit, quisquam a modi atque fugiat provident iste expedita voluptatem eveniet unde molestiae eos, nobis sunt est repudiandae obcaecati voluptatibus dolorum consectetur autem. Neque quidem, modi saepe quibusdam voluptatibus iste distinctio, eum eligendi aliquid cum nisi. Magnam, nulla consequuntur aliquid dolorem maiores odio placeat sint molestiae, quis, tenetur labore nemo! Ipsum reprehenderit ex dolorum nostrum cupiditate, dolore molestias iure eos a doloremque nisi possimus ducimus odio quo! Beatae non necessitatibus fuga accusamus,

A: just add top: 90px; to @media (max-width: 800px) { .navlinks {top: 90px;}}

<!DOCTYPE html>

    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Responsive Navbar</title>
    <link rel="stylesheet" href="styles/styles.css" />
    <link
      rel="stylesheet"
      href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.2/css/all.min.css"
    />

    <link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;800&family=Quicksand:wght@300&family=Roboto:wght@900&display=swap" rel="stylesheet">

        <input type="checkbox" id="check" />

        Nikita Gada

About Me

Education

Work

Contact

    Lorem ipsum dolor sit, amet consectetur adipisicing elit. Consequatur sapiente, distinctio ipsam rem eos ipsum ea praesentium repellat animi maxime adipisci exercitationem, vel facere? Commodi deserunt minima quas accusantium aliquid tenetur repudiandae quam dolor culpa aperiam voluptates id, quia nobis facilis ipsum perferendis blanditiis nemo sint doloribus hic? Veniam culpa aperiam sunt harum et! Ex eaque incidunt nostrum error corrupti ratione consequuntur obcaecati quaerat, beatae id praesentium quibusdam laborum ipsam dolorum voluptates nemo, omnis quia dolorem quos! Similique labore quos placeat minus illo doloribus iste est nisi necessitatibus, illum totam, inventore incidunt omnis molestiae corporis exercitationem quibusdam ipsum ullam excepturi. Ea exercitationem amet omnis sunt id sed, nobis perspiciatis quidem, tempore asperiores recusandae deserunt aut nihil, aperiam ducimus libero iste nisi debitis nulla voluptates quos nesciunt. Eligendi obcaecati a, nisi porro unde id explicabo! Asperiores vel omnis non alias debitis distinctio, minima nostrum architecto nulla iusto, qui sed accusamus, excepturi ratione? Dolorem doloremque quo autem velit iste quis dolores. Rem earum enim ducimus eaque animi repellendus voluptates debitis consequuntur assumenda autem amet, aperiam culpa inventore sed? Pariatur placeat nesciunt voluptatibus earum cupiditate fuga optio quia sunt suscipit voluptatum delectus facilis nihil ut, nemo itaque, voluptatem nulla consequatur aspernatur consequuntur libero, magnam sequi nobis incidunt asperiores? Sed aspernatur corporis fugiat, animi illum accusantium repellendus laudantium voluptate unde a modi nesciunt non sequi, reprehenderit asperiores doloremque eum necessitatibus quibusdam. A voluptate beatae perferendis natus, cupiditate nihil illo esse vero blanditiis voluptatibus tempore repellat unde numquam quam dignissimos laborum ipsam consectetur minus corrupti quasi! Molestias unde velit, dolor ullam iure debitis maiores et, rem facilis tempore odio, labore omnis aspernatur tempora sunt ratione quos cumque accusantium harum voluptatum. Consequatur aspernatur maxime nobis veritatis quasi provident perferendis veniam dolores nostrum deleniti, consequuntur reprehenderit amet excepturi, quae libero id dolorum voluptatibus assumenda praesentium, quibusdam est sint. Dignissimos fugiat ducimus minima alias dicta sit, excepturi maxime, maiores velit recusandae esse sed ad voluptatibus repudiandae iure quaerat soluta ab sequi officiis id aut. Ipsum error sit vel rerum exercitationem. Nulla ducimus nesciunt incidunt pariatur, quo nihil fugit ipsa dolores maxime eum reiciendis, maiores aliquam quas consequuntur quaerat vel! Ipsum error in itaque placeat accusantium autem, quos, necessitatibus dolores dignissimos perferendis tempora eligendi nobis quis quia tempore, rerum distinctio consectetur? Odit, quisquam a modi atque fugiat provident iste expedita voluptatem eveniet unde molestiae eos, nobis sunt est repudiandae obcaecati voluptatibus dolorum consectetur autem. Neque quidem, modi saepe quibusdam voluptatibus iste distinctio, eum eligendi aliquid cum nisi. Magnam, nulla consequuntur aliquid dolorem maiores odio placeat sint molestiae, quis, tenetur labore nemo! Ipsum reprehenderit ex dolorum nostrum cupiditate, dolore molestias iure eos a doloremque nisi possimus ducimus odio quo! Beatae non necessitatibus fuga accusamus,

A: Please add CSS property in .navlink class. i have added " top:90px; " in this class. when applying position fixed to any element add specific two side values like left and top, Or top and right, Or right and bottom, Or left and bottom.
.navlinks {
    position: fixed;
    width: 100%;
    height: 100vh;
    text-align: center;
    transition: all 0.5s;
    right: -100%;
    top: 90px;
    background: #222831;
}


text:
Q: Reading only one character (avoiding newline), then a string (for implementing simple CLI I need to implement a simple CLI, which will initially read one character, and then will read the 2nd, or even 3rd part of the command specified by character.
For example, these would be the commands:
1. p all
2. r code
3. h
4. q

So as you can see there are commands that need only one character and others that need a character and a string.
What I've done so far is this:
//for the character
char init_command;
char command[30];
while(flag) {
    read(STDIN_FILENO, &init_command, 1)
    switch(init_command)
    {
       case ('p'):
            if (fgets(command, sizeof(command), stdin) == NULL)
            {
                perror("fgets print");
                exit(EXIT_FAILURE);
            }
            else
                sscanf(command, "%s", command);
            break;
       case ('h'):
           printfhelp();
           break;
       default:
           printf("Undefined command\n");
           break;
   }
}

I've ommitted the part of r code and q commands as it is the same.
So, what happens here is that if I type this:

p all

Everything is ok.
But when I type this:

h

It prints the output of printhelp() and instantly prints the undefined command message.
Now, this has to be with the \n charatcter, but I am in difficulty of correcting it.

A: If the \n is seen as "valid input", just add it to the case structures as:
case '\n':
  break;

This will allow other input to pass as error, but newlines ignored.

A: read(STDIN_FILENO, &init_command, 1);
fgets(command, sizeof(command), stdin);
switch(init_command)
{
   case ('p'):
            sscanf(command, "%s", command);
        break;
   case ('h'):
       printfhelp();
       break;
   default:
       printf("Undefined command\n");
       break;
}

redpajama_set_name: RedPajamaStackExchange


text:
Q: SAPUI5 - Can the Datepicker be configured Can the SAPUI5 Datepicker be configured to show only Sundays after a particular date (5 weeks from today) ?

A: <DatePicker id="DateOfBirth" change="handleChange"
                        class="sapUiSmallMarginBottom" width="78%" valueFormat="yyyy-MM-ddT00:00:00"
                        displayFormat="MM.dd.yyyy" />


text:
Q: SQL Trigger Not Working For updating same table I have created a trigger for after insert
ALTER TRIGGER [dbo].[UpdateClientNumber]
ON  [dbo].[APP_Clients]
AFTER INSERT
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;

DECLARE @Count bigint

DECLARE @ClientNumber nchar(15)

SELECT @Count = COUNT(*) FROM [dbo].[APP_Clients]

IF @Count = 0
BEGIN

    SET @ClientNumber = CONVERT(nchar(4), YEAR(GETDATE())) + '01' + '0001'

    UPDATE [dbo].[APP_Clients]
    SET [ClientNumber] = @ClientNumber
    FROM inserted i
    LEFT JOIN [dbo].[APP_Clients] j ON i.ID = j.ID

END
ELSE
BEGIN

    SELECT @ClientNumber = MAX(SUBSTRING([ClientNumber], 7, len([ClientNumber]) - 0))
    FROM [dbo].[APP_Clients]
    WHERE (SUBSTRING([ClientNumber], 1, len([ClientNumber]) - 6) = YEAR(GETDATE()))

    SET @ClientNumber = CONVERT(bigint, @ClientNumber) + 1

    SET @ClientNumber = CONVERT(nchar(4), YEAR(GETDATE())) + '01' + @ClientNumber

    UPDATE [dbo].[APP_Clients]
    SET [ClientNumber] = @ClientNumber
    FROM inserted i
    LEFT JOIN [dbo].[APP_Clients] j ON i.ID = j.ID

END
END

for table [dbo].[APP_Clients] with columns
[ID] [bigint] IDENTITY(1,1) NOT NULL,
[ClientName] [nvarchar](100) NULL,
[ClientNumber] [nchar](15) NULL,
[ClientGSM1] [nvarchar](50) NULL,
[ClientGSM2] [nvarchar](50) NULL,
[ClientEmail] [nchar](50) NULL,
[ClientOccupation] [nvarchar](50) NULL,
[ClientWorkPlace] [nvarchar](100) NULL

after insert ClientNumber is not Updating.
With Regards,
Mohammed

A: It depends on the recursion level for triggers currently set on the DB.
If you do this:
SP_CONFIGURE 'nested_triggers',0
GO
RECONFIGURE
GO

Or this:
ALTER DATABASE db_name
SET RECURSIVE_TRIGGERS OFF

That trigger above won't be called again, and you would be safe (unless you get into some kind of deadlock; that could be possible but maybe I'm wrong).
Still, I do not think this is a good idea. A better option would be using an INSTEAD OF trigger. That way you would avoid executing the first (manual) update over the DB. Only the one defined inside the trigger would be executed.

A: SQL Server (and Oracle) don't like you making changes to a mutating table within a trigger for that table. You either need to handle it a different way, or intercept the insert.
Since you are trying to alter the inserted data, you could use an Instead of rather than an after insert trigger:
Here is a very simplistic representation of how you would do it:
Create Trigger trg_App_Clients_Insert
On App_Clients
Instead of Insert
As
Begin
  Declare @no int;

  Select @no = IsNull(Max(ClientNumber), 0) + 1
  From App_Clients

  Insert into App_Clients (Name, ClientNumber)
  Select Name, @no
  From inserted
End
Go


text:
Q: Discord.js - CommandFile.Run() is not a function I'm currently trying to reorganize my Bot for my Discord Server by upgrading my Command Handler.
Most of the command I have also upgraded but one command stands out because it is not working.
When I try to run that command the following happens:
(node:11496) UnhandledPromiseRejectionWarning: TypeError: CommandFile.run is not a function
    at module.exports.run (C:\Users\DeepDev\OneDrive\Bureaublad\DiscordBot\DiscordBotV2.1\src\commands\Music\Play.js:43:32)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:11496) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:11496) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

And this is the code I have for the part that is currently not working:
        if (!Validate) {
            let CommandFile = require(`./Search.js`);
            return CommandFile.run(Client, message, args, ops);
        }

The Command Handler I'm using is from MenuDocs v12 Tutorial.
I've tried placing this part into a function outside the class and called the function after the if statement but to no avail.
            let CommandFile = require(`./Search.js`);
            return CommandFile.run(Client, message, args, ops);

I have also checked if it was the correct file location of the Search.js.
Search.js File:
const Command = require('../../Structures/Command.js');
const Discord = require("discord.js");
const Search= require('yt-search');

module.exports = class extends Command {
    // eslint-disable-next-line no-unused-vars
     async run(message, args, ops) {

     const Client = this.client

     //Search for videos based on arguments
     Search(args.join(' '), function(err, res) {
       //Error Handling
       let errembed = new Discord.MessageEmbed()
       .setColor("#218559")
       .setAuthor(Client.user.username, Client.user.displayAvatarURL({ dynamic:true }))
       .setDescription("Sorry, something went wrong")
       if (err) return message.channel.send(errembed);

       //Show first 10 results
       let Videos = res.videos.slice(0, 10);

       //Loop for output string
       let Resp = '';
       for (var i in Videos) {
         Resp += `**[${parseInt(i)+1}]:** \`${Videos[i].title}\`\n`;
       }

       //Text Info Instructions
       Resp += `\n**Choose a number between** \`1-${Videos.length}\``;

       //Embed
       let Embed = new Discord.MessageEmbed()
           .setColor("#218559")
           .setTitle("Search Results")
           .setAuthor(Client.user.username, Client.user.displayAvatarURL({ dynamic:true }))
           .setDescription(Resp)
           .setThumbnail(Client.user.displayAvatarURL({ dynamic:true }))

       //Send output
       message.channel.send(Embed);

       //Message collector
       const Filter = m => !isNaN(m.content) && m.content < Videos.length+1 && m.content > 0;
       //Filter accepts only numbers
       const Collector = message.channel.createMessageCollector(Filter);

       //Update collector variables
       Collector.videos = Videos;

       //Create Listener Event
       Collector.once('collect', function(m) {

         //Run play command, passing in the url as args[0]
         let CommandFile = require(`./Play.js`);
         CommandFile.run(Client, message, [this.videos[parseInt(m.content)-1].url], ops);
       });
     });
    }

};

This all worked with the previous command handler I was using.
The complete Play.js:
const Command = require('../../Structures/Command.js');
const Discord = require("discord.js");
const ytdl = require("ytdl-core");

module.exports = class extends Command {

  constructor(...args) {
    super(...args, {
      aliases: ['p']
    });
  }

    // eslint-disable-next-line no-unused-vars
    async run(message, args, ops) {

        const Client = this.client

        //Check if author is connected to a voice channel
        let AC = new Discord.MessageEmbed()
            .setColor("#218559")
            .setAuthor(Client.user.username, Client.user.displayAvatarURL({
                dynamic: true
            }))
            .setDescription("You have to be connected to a voice channel, you dummy!")
        if (!message.member.voice.channel) return message.channel.send(AC);

        //Check if author input an URL
        let VU = new Discord.MessageEmbed()
            .setColor("#218559")
            .setAuthor(Client.user.username, Client.user.displayAvatarURL({
                dynamic: true
            }))
            .setDescription("Hey Dumdum, you need a valid URL")
        if (!args[0]) return message.channel.send(VU);

        //Validate Info
        let Validate = await ytdl.validateURL(args[0]);

        //Check Validation
        if (!Validate) {
            let CommandFile = require(`./Search.js`);
            return CommandFile.run(Client, message, args, ops);
        }

        //Fetch video information
        let Info = await ytdl.getInfo(args[0]);

        //Fetch Active
        let Data = ops.active.get(message.guild.id) || {};

        //Update the Data
        if (!Data.Connection) Data.Connection = await message.member.voice.channel.join();
        if (!Data.Queue) Data.Queue = [];
        Data.guildID = message.guild.id;

        //Add song to queue
        Data.Queue.push({
            SongTitle: Info.videoDetails.title,
            Requester: message.author.tag,
            url: args[0],
            AnnounceChannel: message.channel.id
        })

        //If there is no dispatcher, run the play function
        let QA = new Discord.MessageEmbed()
            .setColor("#218559")
            .setAuthor(Client.user.username, Client.user.displayAvatarURL({
                dynamic: true
            }))
            .setDescription(`Added to Queue: ${Info.videoDetails.title} | Requested by my favourite dummy ${Data.Queue[0].Requester}`)
        if (!Data.Dispatcher) Play(Client, ops, Data);
        else {
            message.channel.send(QA);
        }

        //Update the Map
        ops.active.set(message.guild.id, Data);

    }
};

//Play Function
    async function Play(Client, ops, Data) {
    //Send Now Playing Message
    let NP = new Discord.MessageEmbed()
        .setColor("#218559")
        .setAuthor(Client.user.username, Client.user.displayAvatarURL({
            dynamic: true
        }))
        .setDescription(`Now playing: ${Data.Queue[0].SongTitle} | Requested by my favourite dummy ${Data.Queue[0].Requester}`)
    Client.channels.cache.get(Data.Queue[0].AnnounceChannel).send(NP);

    //Update Dispatcher Data
    Data.Dispatcher = await Data.Connection.play(ytdl(Data.Queue[0].url, {
        filter: "audioonly"
    }));
    Data.Dispatcher.guildID = Data.guildID;

    //Listener event
    Data.Dispatcher.once("finish", function() {
        //Finish Function
        finish(Client, ops, this);
    });
}

    function finish(Client, ops, Dispatcher) {
    //Fetch Guild Object from Map
    let Fetched = ops.active.get(Dispatcher.guildID);

    //Remove the previous SongTitle
    Fetched.Queue.shift();

    //Check if Queue is empty
    if (Fetched.Queue.length > 0) {

        //Update the map with the new queue
        ops.active.set(Dispatcher.guildID, Fetched);

        //Play the next song
        Play(Client, ops, Fetched);

    } else {
        //Delete the guild object from the Map
        ops.active.delete(Dispatcher.guildID);

        //Leave the voice channel
        let vc = Client.guilds.cache.get(Dispatcher.guildID).me.voice.channel;
        if (vc) vc.leave();
    }
}

A: class Search extends Command {
  async run(message, args, ops) {
    /* things here */
  }
};

module.exports = { Search };

and use with the require at the top of the file.
const { Search } = require(`./Search.js`);

and invoke with
{
  ...
  return new Search().run(message, args, ops);
}

A: Please fix your search.js file first.
module.exports = class extends Command {
     // missing first parameter
     async run(Client, message, args, ops) {

     // this.client is undefined
     // const Client = this.client

then initialize the class before you use it.
 return new CommandFile().run(Client, message, args, ops);

I would suggest using named export like @Cehhiro answer


text:
Q: Wi-Fi connection timeouts on a specific MacBook Running OS X 10.10 Yosemite, and keep running into connection timeouts. Initially suspecting the home router or infrastructure issue, however all the other laptops in the house don't get any timeouts - so this must be something related to my own machine. I have no idea what that may be and how to diagnose and find the root cause. Perhaps it is a hardware issue with the Wi-Fi adapter?
All the computers are using DHCP.
Will appreciate any suggestions.
Info:
Pinging the gateway results in timeouts of sometimes minutes.
64 bytes from 192.168.1.1: icmp_seq=2385 ttl=64 time=2.558 ms
64 bytes from 192.168.1.1: icmp_seq=2386 ttl=64 time=3.423 ms
Request timeout for icmp_seq 2387
Request timeout for icmp_seq 2388
...
...

Pinging from another Mac at the same time shows no timeouts.

A: The issue was Discoveryd component in Yosemite which was causing the problem. Apple replaced the component with mDNSResponder in 10.10.4 which solved the issue. If you are running 10.10 to 10.10.3, you should upgrade immediately to 10.10.5 which is more stable with plenty of bug fixes.


text:
Q: What the right setting for django-dbbackup? Using django 1.10, django-dbbackup 3.0, postgresql-9.5.4
I'm wrote in config settings from the docs http://django-dbbackup.readthedocs.io/en/stable/installation.html, but got this error:
Traceback (most recent call last):
  File "/home/user/envs/siteEnv/lib/python3.5/site-packages/django/utils/module_loading.py", line 23, in import_string
    return getattr(module, class_name)
AttributeError: module 'dbbackup.storage' has no attribute 'filesystem_storage'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/home/user/envs/siteEnv/lib/python3.5/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
    utility.execute()
  File "/home/user/envs/siteEnv/lib/python3.5/site-packages/django/core/management/__init__.py", line 359, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/user/envs/siteEnv/lib/python3.5/site-packages/django/core/management/base.py", line 305, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/user/envs/siteEnv/lib/python3.5/site-packages/django/core/management/base.py", line 356, in execute
    output = self.handle(*args, **options)
  File "/home/user/envs/siteEnv/lib/python3.5/site-packages/dbbackup/utils.py", line 99, in wrapper
    func(*args, **kwargs)
  File "/home/user/envs/siteEnv/lib/python3.5/site-packages/dbbackup/management/commands/dbbackup.py", line 49, in handle
    self.storage = get_storage()
  File "/home/user/envs/siteEnv/lib/python3.5/site-packages/dbbackup/storage.py", line 30, in get_storage
    return Storage(path, **options)
  File "/home/user/envs/siteEnv/lib/python3.5/site-packages/dbbackup/storage.py", line 66, in __init__
    self.storageCls = get_storage_class(self._storage_path)
  File "/home/user/envs/siteEnv/lib/python3.5/site-packages/django/core/files/storage.py", line 469, in get_storage_class
    return import_string(import_path or settings.DEFAULT_FILE_STORAGE)
  File "/home/user/envs/siteEnv/lib/python3.5/site-packages/django/utils/module_loading.py", line 27, in import_string
    six.reraise(ImportError, ImportError(msg), sys.exc_info()[2])
  File "/home/user/envs/siteEnv/lib/python3.5/site-packages/django/utils/six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "/home/user/envs/siteEnv/lib/python3.5/site-packages/django/utils/module_loading.py", line 23, in import_string
    return getattr(module, class_name)
ImportError: Module "dbbackup.storage" does not define a "filesystem_storage" attribute/class
(siteEnv)

A: It's an old documentation by your link, try to look here or use previous version (2.5.x) of app.

A: It's a bug in the documentation: https://github.com/django-dbbackup/django-dbbackup/issues/216
This seems to be the correct settings:
DBBACKUP_STORAGE = 'django.core.files.storage.FileSystemStorage'
DBBACKUP_STORAGE_OPTIONS = {'location': '/var/backups'}


text:
Q: In C# how to run unix command on remote SSH using TcpClient I am trying to run a UNIX command on remote host from my C# application.
I have seen various post over internet including SO for doing this using various libraries like SmartSsh any many others. And some others using command line commands.
I do not want to use any third party library.
Hence I tried using TcpClient class with example shown here on MSDN. I am passing hostname as : user@servername and port 22. When I run this code it trows an exception
SocketException (0x80004005): No such host is known
at System.Net.Sockets.TcpClient..ctor(String hostname, Int32 port)

Is it because my server/host expect a password for user, if yes then how do I provide that?

A: A socket is only about a connection, see it as calling a person over the phone. The socket makes sure you have a conncetion with the other person but you still need a language (protocol) to communicate. Over the phone, that is a common language. When you want to execute unix commands you also need a language that both the you and the target understand. One of those protocols is SSH, port 22. SSH also defines authentication, so you need to implement the SSH protocol or better, use a 3th party library to do that for you


text:
Q: Running a jar file from cygwin is throwing error where from commad prompt it is running, why? (in windows) this is the command.
java -cp clojure.jar;sum.jar CalculateSum
sum.jar is a jar file made from clojure and java code.
CalculateSum is file which contains main method of java.
error from cygwin
can't execute binary file, Error 126

A: Cygwin provides you with a *nix environment within Windows, so that you might have to change the classpath separator to colons:
java -cp clojure.jar:sum.jar CalculateSum

A: Try:
java -cp clojure.jar:sum.jar:. CalculateSum

If you execute in the place you have the root of packages for CalculateSum.class

A: java -cp "clojure.jar;sum.jar" CalculateSum this is working


text:
Q: Passing Data Between Multiple Activities I have three activities, say I have the data from ActivityA, and I want ActivityC to retrieve it but it must go through ActivityB which I don't want it do anything about the passed data. Is there anyway to do it?
I have tried
ActivityA.java
Intent i = new Intent(this, ActivityB.class);
i.putExtra("DATA1", "Hello");
i.putExtra("DATA2", "World");
startActivity(i);

ActivityB.java doesn't do anything about it but it must be seen before ActivityC.
ActivityC.java
Bundle b = getIntent().getExtras();
String data1 = b.getString("DATA1");
String data2 = b.getString("DATA2");

But it gives me this exception
11-30 02:12:05.165: W/dalvikvm(1134): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
11-30 02:12:05.185: E/AndroidRuntime(1134): FATAL EXCEPTION: main
11-30 02:12:05.185: E/AndroidRuntime(1134): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.src.test/com.src.test.ActivityC}: java.lang.NullPointerException
11-30 02:12:05.185: E/AndroidRuntime(1134):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
11-30 02:12:05.185: E/AndroidRuntime(1134):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
11-30 02:12:05.185: E/AndroidRuntime(1134):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
11-30 02:12:05.185: E/AndroidRuntime(1134):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
11-30 02:12:05.185: E/AndroidRuntime(1134):     at android.os.Handler.dispatchMessage(Handler.java:99)
11-30 02:12:05.185: E/AndroidRuntime(1134):     at android.os.Looper.loop(Looper.java:123)
11-30 02:12:05.185: E/AndroidRuntime(1134):     at android.app.ActivityThread.main(ActivityThread.java:4627)
11-30 02:12:05.185: E/AndroidRuntime(1134):     at java.lang.reflect.Method.invokeNative(Native Method)
11-30 02:12:05.185: E/AndroidRuntime(1134):     at java.lang.reflect.Method.invoke(Method.java:521)
11-30 02:12:05.185: E/AndroidRuntime(1134):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
11-30 02:12:05.185: E/AndroidRuntime(1134):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
11-30 02:12:05.185: E/AndroidRuntime(1134):     at dalvik.system.NativeStart.main(Native Method)
11-30 02:12:05.185: E/AndroidRuntime(1134): Caused by: java.lang.NullPointerException
11-30 02:12:05.185: E/AndroidRuntime(1134):     at com.src.test.ActivityC.onCreate(ActivityC.java:98)
11-30 02:12:05.185: E/AndroidRuntime(1134):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
11-30 02:12:05.185: E/AndroidRuntime(1134):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)

which points to String data1 = b.getString("DATA1");
Is there any way to do this correctly?
Any help would be greatly appreciated.

A: When calling from B to C, add to your intent:
myIntent.putExtras(getIntent().getExtras());

A: It's because your ActivityB doesn't push it to ActivityC:
Intent newIntent = new Intent(ActivityB.this, ActivityC.class);
Bundle bundle = getIntent().getExtras();
if (bundle != null) {
    newIntent.putExtras(bundle);
}
startActivity(newIntent);

A: do this in activity B:
Bundle b = getIntent().getExtras();
String data1 = b.getString("DATA1");
String data2 = b.getString("DATA2");

Intent i = new Intent(this, ActivityC.class);
i.putExtra("DATA1", data1);
i.putExtra("DATA2", data2);
startActivity(i);


text:
Q: Evolving answers and outdated comments Many comments highlight a problem with an answer or a question. The author often acts on the comments and addresses them, making them obsolete.
It would be nice to let authors explicitly address comments as both helpful and "to be obsoleted" when updating answers/questions. (This is now typically done with yet more comments, which somehow pollute the final answer). In this sense, comments can often be seen as issue-tickets in a bug-tracking system. Once resolved, they don't add much to the discussion.
Another take on this is to provide actual context for the comment - if a comment was made while viewing version 1 of an answer, after version 3 is reached, the comment should contain a small (v1) annotation with a link to the version it was written for...

A: I think as a community we can do a better job of self-deleting our own comments when the issues they raise are addressed. I use comments quite often to point out flaws or limitations in an answer, or to request clarification or further details from a question. In most cases once the issue has been addressed I'll delete my comment. And in other cases where I've lost interest they may be flagged by other users.
The problem with your last paragraph is this: who is the judge that correlates the revision history with the comment's act of becoming obselete? This sounds like a lot of extra work to me, regardless of who does it.

A: Your idea may be workable on slower moving questions, but I would question its efficacy on fast moving questions. Consider this flow:

OP posts question.
  Reader leaves comment: "Your question suX0rs because..."
  OP edits question.
  OP changes their mind and edits their question again.

This flow frequently happens within the space of 5 or 10 minutes. Theoretically the question can be on to v3 or v4, but it could still be quite deficient. It is important that the original comment stays around, unversioned, during this time - then the next lot of readers can see that someone has already commented. Having the original comment versioned could mean subsequent "Your question still sucks" type comments.
Adding an option of notifying the comment author once a revision has been made is also problematic. The comment author would have to be notified for every revision during the lifetime of their comment. You then have to rely on the comment author to actually do something - I'd bet a dollar that many comments would never get actioned because comments tend to be dump-and-leave, the comment author may never come back to that question and may treat the revision notifications as just noise.
For anyone that really cares about the context of the comment, it has a timestamp which can be quite easily visually compared to the timestamp of the latest edit. If anyone is actually paying attention to the comment and cares enough they can simply flag it as obsolete.


text:
Q: PLay framework Routing with multiple parameters issue I don't seem to be able to resolve the following scenario where no routes are found.
Got my route file with the following entry:

GET     /reports/items/{date}                          Reports.items(field:'all')

and the controller defined with

public static void items(@Required Date date, String field){
...
}

the view is using @{items(date)} or @{items(date,'all')}
the url translates to:
localhost:9000/reports/items/19-07-2011?field=all
I always seem to get not found with:

tried the following route
GET       /                                                 Reports.index
GET       /reports/items/{date}                             Reports.items

Any idea on how I can route and default field to 'all' if it is not provided?

A: I believe what you need is this:
GET       /reports/items/{date}                     Reports.items(field:'all')
GET       /reports/items/{date}/{field}             Reports.items

First the system will match the request with only date (which will use 'all' as default value for field).
If it doesn't match, because you added the field, it will go to the second GET where both parameters will be mapped to the controller.


text:
Q: Object gets dealloc'd before UIAlertView Delegate gets called I have two view controllers on a Navigation stack.  In the first view controller, I have a method that shows an alert to go to a website and navigate away from the app.  If they click NO, nothing happens, if YES, then it opens the link.  This all works.  My problem is now if I want to call this method from the second view controller on the navigation stack, my first view controller gets dealloc'd, and the delegate never gets called.  Here's some pseudo code of what is going on.
In SecondViewcontroller:
- (void)TargetSelectionPressed:(NSNotification *)notification {

    FirstViewController *dummyCtlr = nil;
    BOOL shouldPushToFistCtlr = NO;

    NSArray *controllers = [[NSArray alloc] initWithArray:[self.navigationController viewControllers]];

    for (UIViewController *ctlr in controllers) {
        if ([ctlr isKindOfClass:[FirstViewController class]]) {
            dummyCtlr = (FirstViewController *)ctlr;
            break;
        }
    }
    if (dummyCtlr == nil) {
        FirstViewController *gtc = [[[FirstViewController alloc] init] autorelease];
        dummyCtlr = gtc;
        shouldPushToFistCtlr = YES;
    }

    switch (targetSelection) {
        case TARGET_LOCATION:
            break;
        case TARGET_CONDITION: {
            if (shouldPushToGTC) {
                [self.navigationController pushViewController:dummyCtlr animated:YES];
            }
            else {
                [self.navigationController popToViewController:dummyCtlr animated:YES];
            }
            break;
        }
        case TARGET_LINK: {
            [dummyCtlr BuildURL:link];
            break;
        }
        default:
            break;
    }
    [controllers release];
}

FirstViewcontroller
- (void)BuildURL:(NSString* )link {
    self.ExternalLink = link;     NSString *message = [[NSString alloc] initWithFormat:@"Would you like to open %@ in Safari?", link];
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Open Safari" message:message delegate:self cancelButtonTitle:@"No" otherButtonTitles:@"Yes", nil];
    [alert show];
    self.SafariAlertView = alert;
    self.SafariAlertView.delegate = self;
    [alert release];
    [message release];
}

- (void)dealloc {
    [safariAlertView release];
    self.SafariAlertView.delegate = nil;
    [super dealloc];
}

A: Check if *dummyCtlr is nil rather than if dummyCtlr is nil.

A: I found that if I made a property for the dummyCtlr, the object would stay around long enough for the delgate to be called.


text:
Q: Getting selected values in Angular I've got the following HTML (building hybrid app using steroids):
<select>
    <option value="1">Once a day</option>
    <option value="2">Once a week</option>
</select>

    <input type="checkbox" value="resumes">

  Resumes

    <input type="checkbox" value="linkedin">

  LinkedIn

    <input type="checkbox" value="mycco">

  myCCO

Is there a way in Angular to get the selected value from the select and all of the selected checkboxes?

A: Sure just add ng-model to each
<select ng-model="data.period">
    <option value="1">Once a day</option>
    <option value="2">Once a week</option>
</select>

    <input  ng-model="data.resumes" type="checkbox" value="resumes">

  Resumes

    <input  ng-model="data.linkedin" type="checkbox" value="linkedin">

  LinkedIn

    <input ng-model="data.mycco"  type="checkbox" value="mycco">

  myCCO

In your controller:
// Contains all your data
$scope.data = {};

However you might consider doing the whole form validation/submit thing such as https://scotch.io/tutorials/angularjs-form-validation


text:
Q: Why the image is not changed when to hit the text field of Login Id and Password? Why is the image not changed when to hit the text field with Login Id and Password?  I am a newbie to iOS, I don't know what's the issue with this code. When I want to hit the LogID and Password field then icons are not changed. Can somebody please tell me how to solve this issue.

UITextField (Extension)
class TextField
{
    static func imgTFEmail1(tfLgnID: UITextField)
    {
        if UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiom.pad
        {
            //Set image within username textfield
            tfLgnID.leftViewMode = .always
            imgViewLgn = UIImageView(frame: CGRect(x: tfLgnID.frame.origin.x + 3, y: tfLgnID.frame.origin.y + 20, width: 35, height: 30))
            imgViewLgn.contentMode = .scaleAspectFit
            imgLogin = UIImage(named: "user1")!
            imgViewLgn.image = imgLogin
            tfLgnID.leftView = imgViewLgn

            //Text and Placeholder Font Size Large
            let attributes = [
                NSAttributedStringKey.foregroundColor: UIColor.lightGray,
                NSAttributedStringKey.font : UIFont(name: "Avenir-Heavy", size: 25)!
            ]
            tfLgnID.attributedPlaceholder = NSAttributedString.init(string: "Login Id", attributes: attributes)

            //Label Detail increase the font weight and family
            tfLgnID.font = UIFont(name: "Avenir-Heavy", size: 28)
        }
        else if UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiom.phone
        {
            //Set image within username textfield
            tfLgnID.leftViewMode = .always
            imgViewLgn = UIImageView(frame: CGRect(x: -5, y: 0, width: 25, height: 22))
            imgViewLgn.contentMode = .scaleAspectFit
            imgLogin = UIImage(named: "user1")!
            imgViewLgn.image = imgLogin
            tfLgnID.leftView = imgViewLgn
        }
    }

    static func imgTFPwd1(tfPwd: UITextField)
    {
        if UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiom.pad
        {
            //Set image within password textfield
            tfPwd.leftViewMode = .always
            imgViewPwd = UIImageView(frame: CGRect(x: tfPwd.frame.origin.x + 3, y: tfPwd.frame.origin.y + 20, width: 35, height: 30))
            imgViewPwd.contentMode = .scaleAspectFit
            imgPwd = UIImage(named: "password1")!
            imgViewPwd.image = imgPwd
            tfPwd.leftView = imgViewPwd

            //Text and Placeholder Font Size Large
            let attributes = [
                NSAttributedStringKey.foregroundColor: UIColor.lightGray,
                NSAttributedStringKey.font : UIFont(name: "Avenir-Heavy", size: 25)!
            ]
            tfPwd.attributedPlaceholder = NSAttributedString.init(string: "Password", attributes: attributes)

            //Label Detail increase the font weight and family
            tfPwd.font = UIFont(name: "Avenir-Heavy", size: 28)
        }
        else if UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiom.phone
        {
            //Set image within password textfield
            tfPwd.leftViewMode = .always
            imgViewPwd = UIImageView(frame: CGRect(x: -5, y: 0, width: 25, height: 22))
            imgViewPwd.contentMode = .scaleAspectFit
            imgPwd = UIImage(named: "password1")!
            imgViewPwd.image = imgPwd
            tfPwd.leftView = imgViewPwd
        }
    }

ViewController
override func viewDidLayoutSubviews() {
        super.viewDidLayoutSubviews()

        //Show the horizontal line in the bottom of text fields
        self.designTextField()

        TextField.imgTFEmail1(tfLgnID: tfLgnID)
        TextField.imgTFPwd1(tfPwd: tfPwd)

    }

func textFieldDidBeginEditing(_ textField: UITextField)
    {
        //Move the screen up when tap on TextField
        self.view.frame.origin.y -= 80

        if textField == self.tfLgnID
        {
            bottomTFEmail.backgroundColor = UIColor(red: 11/255, green: 174/255, blue: 250/255, alpha: 1).cgColor

            TextField.imgTFEmail2(tfLgnID: tfLgnID)
            TextField.imgTFPwd2(tfPwd: tfPwd)

        }
        else if textField == self.tfPwd
        {
            imgPwd = UIImage(named: "password2")!

            bottomTFPwd.backgroundColor = UIColor(red: 11/255, green: 174/255, blue: 250/255, alpha: 1).cgColor
        }
    }

    func textFieldDidEndEditing(_ textField: UITextField)
    {
        self.view.frame.origin.y = 0

        if textField == self.tfLgnID
        {

            bottomTFEmail.backgroundColor = UIColor.lightGray.cgColor
            imgLogin = UIImage(named: "user1")!
            imgViewLgn.image = imgLogin
            tfLgnID.leftView = imgViewLgn

            if !(Utility.validateEmail(candidate: self.tfLgnID.text!))
            {
                let alertController = UIAlertController.alertCtrl(title: "Warning", message: "Please enter your correct email address", buttonTitle: "OK")
                self.present(alertController, animated: true, completion: nil)
            }
        }
        else if textField == self.tfPwd
        {
            bottomTFPwd.backgroundColor = UIColor.lightGray.cgColor
            imgPwd = UIImage(named: "password1")!
            imgViewPwd.image = imgPwd
            tfPwd.leftView = imgViewPwd
        }
    }

Results
Without Hitting

When Hitting


text:
Q: How to open current working directory (OS X/Linux/Win) Is there a way to open the current working directory in python?
current_wkd = os.getcwd()
print(current_wkd)
.../User/Bob/folder

Say at the end of my program, I want to open the current working directory. I know how to open specific files, but I am interested in the "/User/Bob/folder" opening once the program is complete. How to open "folder" at the end of the script?
What is the best way to do this in OSX/Linux/Win.
Thank you.
For example,
In the terminal one can use:
pwd  # get current wkd
../User/Bob/folder
cd /User/Bob/folder  # change directory to /User/Bob/folder
open folder # To open the directory named "folder"

Is this possible as part of the python script. At the end, for the directory to open as in the above "open folder" command in the terminal. I know how to find the current wkd and change it using:
os.getcwd()
os.chdir()

How do you open the current directory? In other words, at the end of my script I want the directory/folder to open. Similarly to when opening a web browser using:
webbrowser.open_new()

Thank you e9T (below) for the guidance!
ANSWER: I ended up using this as part of my script at the end:
import subprocess

current_directory = os.getcwd()

subprocess.check_call(['open', '--', current_directory]) # This is for OS X

A: You can use subprocess to open up a file explorer for a given path.
import subprocess
import sys

def open_folder(path):
    if sys.platform == 'darwin':
        subprocess.check_call(['open', '--', path])
    elif sys.platform == 'linux2':
        subprocess.check_call(['gnome-open', '--', path])
    elif sys.platform == 'win32':
        subprocess.check_call(['explorer', path])

open_folder(path=".")  # open current directory


text:
Q: How can I disable Task Runner Explorer in Visual Studio? The Task Runner Explorer just throws errors for me in Visual Studio 2015 RC and I just want to disable it and run my gulp file from the command line like I always have.  Is there a way to turn off the Task Runner Explorer?

A: In Visual Studio 2015 you can prevent Gulp from running on every build.

*

*Open the Task Runner Explorer

*Click on the Bindings tab (shown below)

*Select any entries in the tree and press Delete
When that is done, the bindings tree should look as shown with zeroes after each top level item.

Note that making the above changes via the UI ultimately removes items from the gulpfile.js itself, so you can just as easily make this change by removing anything resembling:
/// <binding AfterBuild='default' />
/// <binding Clean='clean' />

A: The links at the bottom explain how to disable packages (extensions) that are built into Visual Studio.
Basically:

*

*Navigate to C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Web Tools.

*Backup the extension.vsixmanifest file and the TaskRunnerExplorer directory.

*Look in the TaskRunnerExplorer\*.pkg files and take note of GUID keys at the top of the files (e.g. [$RootKey$\Packages\{b483c4e7-43a6-4f7b-a9a1-79e2c5d12148}]).

*Edit the extension.vsixmanifest file and remove any mention of TaskRunnerExplorer.

*Delete the TaskRunnerExplorer directory.

*Backup and delete the GUID key(s) from the registry, inside of HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\14.0_Config\Packages\. Currently, those keys are {8da206d4-9521-4f38-92c9-a8d5d0af611c} and {b483c4e7-43a6-4f7b-a9a1-79e2c5d12148}.

Note: To edit files in Program Files (x86), you either have to run your notepad app in Admin mode or edit a copy from within a directory that you own and then overwrite the original.
http://blog.spinthemoose.com/2012/12/28/how-to-unregister-a-visual-studio-package-extension/
http://blog.spinthemoose.com/2013/01/02/the-correct-way-to-uninstall-visual-studio-packages-extensions/

A: I've been having problems with Visual Studio 2015 spinning up a gazillion instance of node.exe, over and over and over again whenever I open our web site solution. That caused the McAfee nannyware and the Dell encryption software they've installed on our dev boxes to go nuts.
Between it all, it was pretty much consuming the entire CPU. Needless to say, this made it...difficult...to get things done.
So, I got to thinking about things, and I figured that if I could stub out the node, npm and gulp binaries, they at least wouldn't be able to consum any CPU. So, I wrote about the simplest stub console apps imaginable. My own versions of

*

*node.exe

*gulp.exe

*npm.exe

*and an npm.cmd that simply ran my npm.exe, passing its command line arguments long.

The only thing each of these executables do is to use log4net and write a line to a log file, with the name of the executable and listing the arguments the executable was invoked with. I parked the 4 of these in a directory by themselves and used the post Synchronize Node.JS Install Version with Visual Studio to configure Visual Studio 2015 to put my stubbed executables at the top of the search path.
WELL ...
It works out that Visual Studio 2015 was repeatedly invoking npm like this:
npm ls -g

So I went to the root of our project and ran that same command (using the real binaries). Lo and behold, npm was hurling and reporting errors, trying to open a non-existent package.json located in the tree rooted at
C:\Users\{user-id}\AppData\Roaming\npm\node_modules

It looked to be cruft leftover from some time back that had left empty directories out there. Once I removed the empty directories where it was trying to open a non-existent package.json, life is good.
NOTE: Somebody requested the stub executables I describe here via a comment. You can find the source code for them in Github at https://github.com/nbcarey/vs2015-node-stubs/
Enjoy.

A: After all I was able to solve the problem of disabling any unnecessary Visual Studio package in a clean and minimally invasive way, which does not require changing of VS configuration files or fiddling with the registry! This includes Task Runner facility, VsHub facility which causes a lot of VS instability and slowdown as well as any other VS Package out of 150+ it ships with.
Here is a short recap:
Basic functionality component for VS is a Package (don't mix it up with NuGet packages – those are not relevant here).
All extensions you may install from Web (as well as many preinstalled ones) are in the form of VSIX which is extended Package format.
Visual Studio has an API (unpublished, but still) which can work with VSIX packages, including finding them and Enable/Disable them. Unfortunately it only can handle VSIX and does not see pure VS Packages. This is declared by design – pure VS Packages are considered system components and do not have supported way to Disable them. Or so they say…
I have decompiled official (although badly outdated) MS plugin for extensions diagnostics and found that it does a lot of fiddling directly with the registry to obtain information about installed VSPackages, but does not even try to change anything there (think Disable).
My own investigation of HKCU\Software\Microsoft\VisualStudio discovered that huge and elaborate data structure there is useless to fiddle with as it is merely the cache of VS internal state which VS refreshes randomly and often, so even if we figure out how to disable the package through registry it would be pointless as VS would overwrite it right away.
Two clues which finally brought me to the final solution were those:
1.  There is a file C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.pkgdef The content of that file is not particularly interesting, but my C++ past gave me a hint that if there is PkgDef, there is a good chance there may be PkgUnDef also, even though it is normally not present. ProcMon confirmed that during startup VS checks for devenv.pkgundef file presence and I was on the right path.
2.  Second hint – I know that some other products (think SQL Server Management Studio) use VS Shell in disguise (that's why you still see VS 2010 in your Add\Remove programs – it is SQL SMS). And those other products obviously have a way to cut out most of VS functionality and only leave a few features they really need from it. So I learned how they do it and here you go – pkgundef file again!
It was a matter of a few probes and registry scans to write the correct content for devenv.PkgUnDef to get rid of the packages I don't like with no visible side effects or bad consequences.
My C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.pkgundef looks like that:
// Exclude TaskRunnerExplorer
[$RootKey$\Packages\{b483c4e7-43a6-4f7b-a9a1-79e2c5d12148}]
// Exclude VsHubServicePackage
[$RootKey$\Packages\{F419E6BB-F72F-42CF-ACFE-D0D0E17FCB17}]
// Exclude JavaScriptWebExtensionsPackage
[$RootKey$\Packages\{30db8f9b-ec9f-44d6-b377-83c7c27a1a8b}]

To check what specific packages you have loaded there is Extension Analyser. It is rather dated, so I hacked together a version which works with VS 2015 here.
Another way to see what slows VS down is to run it with the /Log parameter and apply Activity Log Proviler.
Hope it helps people to regain their slim and fast Visual Studio!
Konstantin

A: Open the Task Runner pane and disable all "On Build" actions.

A: This isn't "in Visual Studio", but you can open up your gulpfile.js and delete the generated line at the top of the file. You might also need to reload your solution afterward, I'm not sure.
I came here looking for an answer as well and just noticed that there was a new line in my gulpfile.js. I looked for when this started and it turns out that when I upgraded my Azure SDK to 2.7 and started using Visual Studio 2015 RTM, it injected this line in my gulpfile.
If someone does find a way to do this through Visual Studio rather than hacking out generated lines in a file, I'd also like to know.


text:
Q: This simple mergeSort code is giving an incorrect answer. Can someone find the bug? The problem seems to be that the mergeSort partitions [300,200, 100] into [300,200] and [100]. Then it successfully merges and sorts [300,200] into [200,300]. The problem occurs now: instead of merging [200,300] with [100], the algorithm runs a sort procedure between [300] with [100]. I have a suspicion that the problem is because of Javascript's closure, because of which the value of j gets interpreted differently at some point. Can someone help me?
function mergeSort(A,start,end){
    console.log("Sorting " + A + " between " + start + " and " + end)
    if (start==end){
        console.log("Reached singleton element: " + A[start])
        return;
    }

    j = Math.floor((end+start)/2);

    mergeSort(A,start,j);
    console.log("Sorted " + A + " between " + start + " and " + j + ". Now sorting between " + (j+1) + " and " + end)
    mergeSort(A,(j+1),end);
    merge(A,start,(j+1),end);
    return A
}

function merge(A,s,p,e){
    var i = s;
    var j = p;
    var finalArray = [];
    while(i < p && j < e+1){
        if (A[i] <= A[j]){
            finalArray[i+j-s-p] = A[i];
            i++
        }
        else if (A[j] < A[i]){
               finalArray[i+j-s-p] = A[j];
               j++
        }
    }

    if (i == p){
        while (j < e+1 ){
            finalArray[i-s+j-p] = A[j];
            j++
        }
    }

    if (j == e+1){
        while (i < p ){
            finalArray[i-s +j-p] = A[i];
            i++
       }
    }

    for(var q = s; q <e+1;q++){
        A[q] = finalArray[q-s]
    }
}

A = [300,200, 100] // Gives [ 200, 100, 300 ]
mergeSort(A, 0, (A.length-1));

A: It is a scoping issue. Changing the declaration of j fixes it:
let j = Math.floor((end+start)/2);

I refactored the merge function. Only reason I didn't rename the variables is that I'm on mobile. Someone with more js knowledge probably has more improvements:
function merge(A,s,p,e) {
    let i = s;
    let j = p;
    let finalArray = [];
    while(i < p && j <= e) {
        if (A[i] <= A[j]) {
            finalArray.push(A[i])
            i++
        }
        else {
            finalArray.push(A[j])
            j++
        }
    }

    while (j <= e) {
        finalArray.push(A[j]);
        j++
    }

    while (i < p) {
        finalArray.push(A[i]);
        i++
    }

    for(let q = s; q <= e; q++) {
        A[q] = finalArray[q-s]
    }
}


text:
Q: Access: hide nulls fields on a report I'm trying to show a report on MS-ACCESS.
But I need to hide null fields.
report
If the textbox "actividad" is null then the checkbox hides
I tried this code but does not work
Private Sub Detalle_Format(Cancel As Integer, FormatCount As Integer)
  MsgBox "qqddqw"
If IsNull(Me.actividad) Or Me.actividad = "" Then
    Me.realizado.Visible = False
Else
    Me.realizado.Visible = True
End If

End Sub

Can you help me?


text:
Q: How to find the line of memory leak in Memory Analyze Tool in Java I have a code with some memory leaks. I've found Memory Analyze Tool (MAT) which is said to be one of the best for Java. It looks fancy and gives a lot of details for problems, so much information about them. However, it doesn't say the first thing to be said or I couldn't find.
Let say my code is as follow:
class LeakyClass{
    //do some stuff in thousands of lines
    void leaky_method(){
        char[] chars = //some how cause memory leak --> line 12434
    }
    //do more stuff in thousands of lines
}

Consider, there are 30-40 more classes like this and it is not written by me.
The problem is MAT tells that I have problems with char[] but it doesn't say anything about line 12434 or I'm not able to find. Is there a way to find that line or at least class or method name? If there was only one line, I'd search for the line but leaks might be everywhere?
Here is an image for memory-leaks:

By the way, I read couple of tutorial but couldn't find anything about it.
Thanks in advance,

A: If you only have an HPROF heap dump, then this information is not available. You need a profiling agent that records allocation stack traces for each allocation.
For example, JProfiler has this capability. Activate allocation recording in the session startup dialog and then take a heap dump.
In the "Classes" view of the heap walker, select "char[]" and create a new object set. Then go to the "Allocations" tab of the heap walker, and check the cumulated stack traces of all such allocations.

Disclaimer: My company develops JProfiler.


text:
Q: Matrix Multiplication doesn't work Below here is my C++ code for the multiplication of 2 matrices. First input is the dimensions: so rows and columns of matrix 1 and rows and columns of matrix 2. Then you need to input all the elements of both matrices. When that is done, the 2 matrices should be multiplied and the resulting matrix should be shown. However for one reason, after I inputted all the elements, it's getting stuck. Is there someone of you understand what I'm doing wrong?
#include <iostream>
#include "Matrix_functions.hpp"

using namespace std;

int read_matrix(int** matrix, int rows, int cols)
{
    for(int i = 0; i < rows; i++)
    {
        matrix[i] = new int[cols];
        for(int j = 0; j < cols; j++)
        {
            cin >> matrix[i][j];
        }
    }

    return **matrix;
}

int print_matrix(int** result, int rows, int cols)
{
    for(int i = 0; i < rows; i++)
    {
        for(int j = 0; j < cols; j++)
        {
            cout << result[i][j];
        }
    }

    cout << endl;

    return **result;
}

int multiply_matrix(int** matrix, int rows, int cols, int** matrix1, int rows1, int    cols1, int** result)
{
    for(int i = 0; i < rows; i++)
    {
        for(int j = 0; j < cols1; j++)
        {
            result[i][j] = 0;

            for(int k = 0; k < cols; k++)
            {
                result[i][j] = result[i][j] + (matrix[i][k] * matrix1[k][j]);
            }
        }
    }

    return **result;
 }

int main ()
{
    //matrices and dimensions
    int rows1, cols1, rows2, cols2;
    int **matrix1, **matrix2, **result = 0;

    cout << "Enter matrix dimensions" << endl;
    cin >> rows1 >> cols1 >> rows2 >> cols2;

    cout << "Enter a matrix" << endl;

    matrix1 = new int*[rows1];

    // Read values from the command line into a matrix
    read_matrix(matrix1, rows1, cols1);

    cout << "Enter a matrix" << endl;

     matrix2 = new int*[rows2];

    read_matrix(matrix2, rows2, cols2);

    // Multiply matrix1 one and matrix2, and put the result in matrix result
    multiply_matrix(matrix1, rows1, cols1, matrix2, rows2, cols2, result);

    print_matrix(result, rows1, cols2);

    //TODO: free memory holding the matrices

    return 0;
}

Also, right now, my matrix gets printed as a 1d horizontal vector (1 2 3 4) rather than a matrix (1 2 and 3 4 below that). Anyone can explain me how to solve this?

A: If you want the matrix printed on different lines, then print a newline character.  The C++ way to do this is with std::endl.
for(int i = 0; i < rows; i++)
{
    for(int j = 0; j < cols; j++)
    {
        cout << result[i][j];
    }
    cout << endl; ///< ADD THIS LINE
}

A: multiply_matrix(matrix1, rows1, cols1, matrix2, rows2, cols2, result);
`new` for result? Forgot?

Something like this:
result = new int*[rows1];
for(int i = 0; i < rows1; i++)
{
   result[i] = new int[cols2];
}
multiply_matrix(matrix1, rows1, cols1, matrix2, rows2, cols2, result);

You haven't allocated memory for result matrix.
Hence you're a victim of undefined behavior.
Regarding printing in matrix form you need to print newline.
There is no need to return the elements from the read and multiply functions.
Also, check the validity for the multiplication of two matrices i.e cols1 == rows2 before multiplying.


text:
Q: Use encrypted password for logging in open fire through jsxc I'm using JSXC as a client side chat solution so i need to pass my login details to server to do the login process,
jsxc.init({
    xmpp: {
        url: 'http://hasan-pc:7070/http-bind/'
    },
    root: '/MAM/resources/assets/global/jsxc',
    autoLang: false,
    defaultLang: 'fr'
});

$(function(){
    var myItems;
    $.getJSON('resources/assets/global/jsxc/test.json', function(data) {
        myItems = data;
        jsxc.storage.setItem('debug', false);
        var rid= ''+Math.random()+'';
        rid=rid.substr(2, 12)
        var username = myItems.username;
        var password = myItems.password;
        var domain = myItems.domain;
        var jid = username + '@'+domain;
        jsxc.start(jid , password);
    }).error(function(data) {
        console.log("Error!");
    });;
});

I need to know how can i send a encrypted password and validate it server-side in openfire, which class in open fire is the listener then i can change the behavior.
and i would be happy if anyone else has a better idea to have an encrypted login.
Thank you for your help!!


text:
Q: Discrepency in unanswered questions counts On Raspberry Pi Beta, I notice that if I use the lower "unanswered" tab (the one in line with "All Questions"), the count is 1,432 questions.
If I use the upper "Unanswered" tab (in line with the site title), I get 1,383 "questions with no upvoted or accepted answers".  This changes the options in the lower tab, one of which is "no answers".  Clicking here, I now get 1,083 "questions with no answers".
If I run
select Id from Posts where PostTypeId=1 and AnswerCount=0;

in the Data Explorer, I get 1158 rows back.
Which of these is correct, and why is the first one (1,432) so much higher than the others?  I understand that the numbers may only be updated periodically, but that difference in particular seems much too great for this to be the reason.
To clarify:

*

*1,432 is the number of "unanswered questions".

*1,383 is the number of "questions with no upvoted or accepted answers".

*1,083 is the number of "questions with no answer"

*1,158 is the number of questions with no answer in the data explorer.  This is not live data, but that means it should be smaller, not larger, than 1,083.  I promise we did not offset this with answers to the tune of 80 questions this week.

The first three are obviously live because they fluctuate. The difference between the first two is ~50, implying they actually don't refer to the same thing, and the difference between the last two seems too great (and in the wrong direction) to be explained by the a live vs. data explorer source.

A: Both are correct.
The definition of "Unanswered" is questions that have no answers with a positive score (or no accepted answers).
Additionally, the data explorer is not live data - it is a weekly snapshot, so it is out of date.


text:
Q: RxJava: Can you give me a real live scenario to use flatMap instead of map I can't really understand when to use flatmap instead of map, nor do I find a good example.
Can you come up with a good scenrio to choose flat map over map?
Thanks.

A: For example, we want to do 2 requests, A and B, over web. However, request B must be requested after request A finishes because request B needs some result of request A. This is a good scenrio of flatMap. The example codes are as follow:
interface Movie {

}

interface UserInfo {
    List<Long> getFavoriteMovies();
}

public Observable<UserInfo> requestUserInfo(long userId) {
    // ...
}

public Observable<List<Movie>> requestMovieList(List<Long> movieIds) {
    // ...
}

public Observable<List<Movie>> requestUserMovieList(long userId) {
    return requestUserInfo(userId).flatMap(new Func1<UserInfo, Observable<List<Movie>>>() {
        @Override
        public Observable<List<Movie>> call(UserInfo user) {
            return requestMovieList(user.getFavoriteMovies());
        }
    });
}

In addition, Ben Christensen's slide has some good examples of RxJava: https://speakerdeck.com/benjchristensen/rxjava-goto-aarhus-2013


text:
Q: Extracting only a specific subfolder 7zip I'm working on a python script that will automatically update Calibre since it does not contain an autoupdater and updates weekly.  My script downloads the portable zip file, and then should extract a specific subfolder of the zip file (I don't need all the files).
What I have so far:
os.system("7z x install.zip -y -r -oc:\\\"Program Files (x86)\\\"Calibre2");
This works for everything except downloading the specific sub directory I need.  Any suggestions?

A: As given in How to partially extract a folder from a 7z file using powershell:
os.system("7z x install.zip subfolder -y -r -oc:\\\"Program Files (x86)\\\"Calibre2")

should be ok for you

A: Below is a zip version of a similar answer I gave for tar files.
Usage:
unzipdir.py path/to/zipfile zip/folder [output/folder]

Script:
import sys, os
from zipfile import ZipFile

def get_members(zip, prefix):
    if not prefix.endswith('/'):
        prefix += '/'
    offset = len(prefix)
    for zipinfo in zip.infolist():
        name = zipinfo.filename
        if len(name) > offset:
            zipinfo.filename = name[offset:]
            yield zipinfo

args = sys.argv[1:]

if len(args):
    zip = ZipFile(args[0])
    path = args[2] if len(args) > 2 else '.'
    zip.extractall(path, get_members(zip, args[1]))


text:
Q: Analyzing effects of sixth order transfer function This question is in relation to this question asked before (Settling time of sixth order denominator transfer function), but formulated in greater details.
So I have a transfer function which looks as follows:
$$
\frac{V_o(s)}{V_i(s)}=\frac {\text{numerator}(s)}{a_1 s^6 + a_2 s^5 + a_3 s^4 + a_4 s^3 + a_5 s^2 +a_6 s + a_7}.
$$
Each coefficient contains number of variables, but there are only two variables i have the freedom to play with, the rest are fixed. For example: if \$ a6= C1\cdot Rx+C1\cdot R1+C2\cdot R2+C3\cdot Ry + C3\cdot (R1+R2)\$, then I have the freedom to play with \$ R1 \$ and \$R2 \$ and other variables are constant. The rest of the co-efficients i.e \$a1,a2,a3,a4,a5\$ are an algebraic addition and subtraction of \$ R1 \$ and \$R2 \$ and more variable i.e \$a1,a2...a6=f(R1,R2,Rx,Cx,Lx...) \$.  Also \$ R1 \$ and \$R2 \$ do not appear in the numerator and hence numerator is ignored. Unfortunately it is not possible to post the circuit due to legal reasons.
The goal is to find how these two variables affect settling time.
Now I need to elaborate my question, which I found lacking in the previous post as pointed out by others.
What I would like to know is which direction should i proceed from the present values of \$ R1 \$ and \$R2 \$ such that settling time is minimized. I know there is no analytical solution to the sixth order denominator, but I am not trying to find a solution, but a relation between these two variables and settling time. Numerical analysis will give me two values of \$ R1 \$ and \$R2 \$ for which minimum settling time can be obtained. But is it possible by numerical analysis to graph the approximate relation between \$ R1 \$, \$R2 \$ and settling time?
What is the purpose or use case to find the relation?
This is a complicated circuit, and based on the environment this circuit is employed in, the values of other variables, apart from \$ R1 \$ and \$R2 \$ can change slightly, and hence \$ R1 \$ and \$R2 \$ need to be tweaked in order to either minimize the settling time or to bring it back to original value, if the settling time has increased. I will not always have access to a computer, let alone numerical analysis tools. Also in controlled environment there is a need to understand the effects of the two variables on settling time.
From the post earlier, I have come to following inferences.

*

*The denominator is of the sixth order hence there are six poles. If the denominator can be factorized, assuming there are complex conjugate poles \$A+Bj\$ and \$A-Bj\$ to seperate out  \$s^2 + 2As + A^2 + B^2\$ from the denominator, then there are four more poles remaining, which when expanded lead to  4th order polynomial, i.e \$den=(s+A+Bj)\cdot (s+A-Bj) \cdot(s+p3) \cdot(s+p4) \cdot(s+p5) \cdot(s+p6)\$. Now if A is very close to zero then it wont affect \$ s+p6\$ when multiplied, hence the effect of sixth order term can be isolated. The problem however is the fact that the complex poles only exist for a specific set of values of \$ R1 \$ and \$R2 \$. The moment i change the values of \$ R1 \$ and \$R2 \$, the complex roots might not exist close to zero and hence this analysis wont be valid. Although a very nice idea, courtesy @user287001. It could be helpful to to others, and I hope i understood user287001's answer correctly.

*Another way is to take the derivative of coefficients to settling time. This will tell me how much does the settling time change by change of one coefficient, keeping other coefficients unchanged. That is to take \$ \frac{d settling time}{d a1},\frac{d settling time}{d a2}...\$. individually. In this way one can find which co-efficient affects the most on settling time. For example if \$ a5 \$ affects the most then one can concentrate only on \$ a5 \$ leading to an approximate graphical solution which can be converted to an analytical solution by curve fitting. I can change the absolute values of each coefficient after substituting the numerical value of \$ R1 \$ and \$ R2 \$. If i find out that \$ a3 \$ affects the settling time the most, then changing values of \$ R1 \$ and \$ R2 \$ in \$ a3\$ will also change the other coefficients (\$a1,a2,a4,a5,a6\$, since they are a function of \$ R1 \$ and \$ R2 \$) which could make the system unstable. This is chicken and egg problem. Had \$ R1 \$ and \$ R2 \$ appeared in only three or less coefficients i think this solution could have been feasible.

*At all times system stability needs to be guaranteed. Hence finding the bounds of each coefficient keeping other coefficients unchanged will atleast put some constrains on \$ R1 \$ and \$ R2 \$. But I think it will lead to the same problem as in the second point.
I have run out of ideas, but I am certain that this is not a new problem, and there must be people out there dealing with higher order systems to find approximate analysis. Like I mentioned before, I am not after the solution of the denominator polynomial, but to use numerical analysis to get to an approximate relation between \$ R1 \$ and \$ R2 \$ and settling time. Any thoughts comments will be more than welcome.

A: I'll reply given your information that you added in the comments:

it is a matching network with only resistors caps and inductors, hence it is difficult to isolate them into second order systems. No opamps in the circuit, hence no high impedance nodes

What you want is impossible without a numerical solver, or a symbolic one that can handle that polynomial. This is because a completely passive network cannot be isolated in sections due to the loading effect. Therefore the transfer function for such a circuit must be determined a priori and, once placed in the circuit, it should not be altered. Any modifications will affect the entire transfer function, because almost all the coefficients will be affected and, thus, all the roots will be displaced.
Simple 3rd order case:

The transfer function is seen in the Laplace source, above (ignore the opening '+' at the beginning of the lines). The two plots show the differences between the original transfer function and the one with only a modified Rx (0.4, instead of 0.3). The response is shown with the group delay, rather than the phase, and the impulse response, to show the time domain differences. And here are the roots, shown in full precision to show that even the single, real root is affected (a bit), despite the plot below:
-0.4312319661454532
 1.037404105974689i-0.28855068359394
-1.037404105974689i-0.28855068359394

-0.431294440041699
 1.02877420167959i-0.3176861133124839
-1.02877420167959i-0.3176861133124839

Small differences but you can see effects overall. Therefore the conclusion remains: an exact solution is not possible without numerical solvers, and changing any component will affect the entire tranfer function.

If you can live with these differences then I have to wonder why bother asking so many questions about 6th order polynomials when you can simply "ogle" and change values as needed. This is why your whole question seems strange: you say you need to perform changes "on the field" and without helpers, but you are looking for deep analysis of 6th order polynomials; you say it's an impedance matching network, yet you use the control-system, analysis, stability tags. What sort of field intervention requires one changing a passive network for impedance adaptation, used in a control system with stability concerns, and without proper tools but which needs a polynomial evaluation in order to reduce the step response?


text:
Q: TypeError: $(...) is null My requirement is when I mouseover on helpText values will be displayed with hyperlinks in it, after clicking on hyperlink mouseout event should occur. For that I added a click event and then mouseout event. But getting error.
My code is:

            <apex:outputLink styleClass="helpLink" onmouseover="$('{!$Component.Foo}').style.display = 'block';">
                <apex:image value="/s.gif" styleClass="helpIcon" />
            </apex:outputLink>
            <apex:outputPanel id="Foo" styleClass="video" title="help" >
               link
               Video
            </apex:outputPanel>

Getting error:

TypeError: $(...) is null

A: I've always used jQuery.noConflict() to return a different alias to use in order to avoid conflicts with other libraries that may be using $. By no means is it necessary to do this, but I find it helps avoid confusion.
That said, Salesforce does some unexpected things with element IDs on VF pages (but if you specify an ID in your VF markup, it will at least show up in the ID of the generated HTML somewhere), so I would recommend using a selector that grabs all elements with IDs containing what you're looking for, such as jq$("[id*='Foo']").
<apex:includeScript value="{!$Resource.jquery}" />

<apex:outputLink styleClass="helpLink" onmouseover="$('{!$Component.Foo}').style.display = 'block';">
    <apex:image value="/s.gif" styleClass="helpIcon" />
</apex:outputLink>
<apex:outputPanel id="Foo" styleClass="video" title="help" >
    link
    Video
</apex:outputPanel>


text:
Q: edge detection on multiples files in a directory I am trying to the do edge detection and apply laplacian, HOG on multiple images stored in a folder at a time for feature extraction but I am unable to do so.
I have actually saved the images of the directory in a list and now when i am trying to process these images, it is throwing an error.
import numpy as np
import cv2
import os
import matplotlib.pyplot as plt
def resize():
    data = []
    img_size = 244
    data_dir = r'C:\technocolab project2\testing'
    for img in os.listdir(data_dir):
        try:
            imgPath = os.path.join(data_dir,img)
            global images
            images = cv2.imread(imgPath, cv2.IMREAD_GRAYSCALE)
            global image_resized
            image_resized = cv2.resize(images,(img_size,img_size))
            data.append(image_resized)
        #except Exception as e:
            #print(e)
        except:
            pass
    return data

data = resize()

for i in range(len(data)):
    data[i]=data[i].astype('float32')

splitting the dataset
training = data[:int(0.2*len(data))]
validation = data[int(0.2*len(data)):int(0.4*len(data))]
testing = data[int(0.4*len(data)):int(0.5*len(data))]

train_norm =[]
valid_norm = []
test_norm = []

for a in range(len(training)):

    train_norm.append(training[a]/255)
print(train_norm[0])

for b in range(len(validation)):

    valid_norm.append(validation[b]/255)
print(valid_norm[0])

for c in range(len(testing)):

    test_norm.append(testing[c]/255)
print(test_norm[0])

train_edge =  []
for e in range(len(train_norm)):
    train_edge.append(cv2.Canny(train_norm[e],90,300))

OpenCV(4.6.0) D:\a\opencv-python\opencv-python\opencv\modules\imgproc\src\canny.cpp:829: error: (-215:Assertion failed) _src.depth() == CV_8U in function 'cv::Canny'


text:
Q: ERROR [karma-server]: UncaughtException: TypeError: Cannot read property 'pkg' of undefined I am having an error when I run npm test or ng test for my angular project.
I tried installing node_modules again but did not work. please help me understand what is the issue.
ERROR [karma-server]: UncaughtException: TypeError: Cannot read property 'pkg' of undefined
    at new Reporter (/Users/app/node_modules/istanbul-api/lib/reporter.js:24:43)
    at Object.createReporter (/Users/app/node_modules/istanbul-api/index.js:16:16)
    at createReport (/Users/app/node_modules/karma-coverage-istanbul-reporter/src/reporter.js:91:31)
    at/Users/app/node_modules/karma-coverage-istanbul-reporter/src/reporter.js:217:9
    at Array.forEach (<anonymous>:null:null)
    at BrowserCollection.forEach (/Users/app/node_modules/karma/lib/browser_collection.js:91:26)
    at CoverageIstanbulReporter.onRunComplete (/Users/app/node_modules/karma-coverage-istanbul-reporter/src/reporter.js:216:16)
    at Server.<anonymous> (/Users/app/node_modules/karma/lib/events.js:40:26)
    at Server.emit (node:events:406:35)
    at emitRunCompleteIfAllBrowsersDone (/Users/app/node_modules/karma/lib/server.js:320:14)
    at Server.<anonymous> (/Users/app/node_modules/karma/lib/server.js:356:9)
    at Server.emit (node:events:394:28)
    at Server.<anonymous> (/Users/app/node_modules/karma/lib/server.js:332:14)
    at Server.emit (node:events:406:35)
    at Browser.onComplete (/Users/app/node_modules/karma/lib/browser.js:94:20)
    at Socket.<anonymous> (/Users/app/node_modules/karma/lib/browser.js:216:44)
    at Socket.emit (node:events:394:28)
    at /Users/app/node_modules/socket.io/dist/socket.js:435:32
    at processTicksAndRejections (node:internal/process/task_queues:78:11)

I have simple test case for should create like following:
describe('TestComponent', () => {
    let component: TestComponent;
    let fixture: ComponentFixture<TestComponent>;

    beforeEach(waitForAsync(() => {
        TestBed.configureTestingModule({
            declarations: [TestComponent],
            imports: [
                BrowserAnimationsModule
            ],
            providers: []
        }).compileComponents();

        fixture = TestBed.createComponent(TestComponent);
        component = fixture.componentInstance;
        fixture.detectChanges();
    }));

    it('should create', () => {
        expect(component).toBeTruthy();
    });
});


text:
Q: center a specific set of node What is the command to force center a set of nodes on the page ? I'm trying to design a diagram with a center axis but adding nodes next to it will result in a decentered axis.

here I want the red part to be centered
here is the code :
\begin{figure}[H]

\begin{tikzpicture}
\node(engrenage)[contour]{
    \begin{tikzpicture}[node distance=4cm]
    %engrenage
    \node (cran1) [engrenage] {};
    \node (cran2) [engrenage, below of=cran1]{};
    \node (cran3) [engrenage, below of=cran2]{};
    \node (cran4) [engrenage, below of=cran3]{};
    \node (cran5) [engrenage, below of=cran4]{};
    \node (cran6) [engrenage, below of=cran5]{};

    \end{tikzpicture}

};

%cran
\node (cran_gauche) [cran, below of=cran3, xshift = -2cm, yshift = 10.15cm]{};
\node (cran_droit) [cran, below of =cran_gauche, xshift = 4cm, yshift = -0.8cm]{};
\end{tikzpicture}
\caption{position repos}
\end{figure}

A: Probably you are missing a \centering command supposing that you figure was symmetric.
In any case here you have another way of drawing something similar but avoiding nested tikzpictures. Main differences are the use of positioning, backgrounds and fit libraries.
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{fit,positioning, backgrounds}
\usepackage{float}

\begin{document}

\begin{figure}[H]
\centering
\begin{tikzpicture}[
    contour/.style={fill=red!30, draw, rounded corners},
    engrenage/.style={draw, fill=red!60, minimum width=2cm, minimum height=5mm, rounded corners},
    cran/.style={draw, fill=blue!30, minimum width=2.5cm, minimum height=5mm, rounded corners},
    node distance=2cm
]

    \node (cran1) [engrenage] {};
    \node (cran2) [engrenage, below = of cran1]{};
    \node (cran3) [engrenage, below = of cran2]{};
    \node (cran4) [engrenage, below = of cran3]{};
    \node (cran5) [engrenage, below = of cran4]{};
    \node (cran6) [engrenage, below = of cran5]{};

    \begin{scope}[on background layer]
    \node(engrenage)[contour, fit=(cran1) (cran6)] {};
    \end{scope}

%cran
\node (cran_gauche) [cran, below left = 0 and -2mm of cran3.south]{};
\node (cran_droit) [cran, above right = 0 and -2mm of cran4.north]{};
\end{tikzpicture}
\caption{position repos}
\end{figure}

\end{document}


text:
Q: MatchQ-ing Associations (MMA 10) Consider
{x->1}

which has FullForm
List[Rule[x, 1]]

and, therefore,
MatchQ[{x->1}, List[___Rule]]

produces True.
Now consider
<|x->1|>

which has FullForm
Association[Rule[x, 1]]

but
MatchQ[<|x->1|>, Association[___Rule]]

produces False
In fact,
MatchQ[<|x->1|>, Association[___]]

produces False.  Any ideas?  (I'm trying to make some MathLink xxxxxxxx WSTP functions for serializing C structs as Associations, and this lacuna is messing me up).

A: Association is atomic:
<|x -> 1|> // AtomQ

True

Therefore standard pattern matching inside the structure will not work.
You can still match on the implicit head using:
MatchQ[<|x -> 1|>, _Association]

True

There is also AssociationQ:
<|x -> 1|> // AssociationQ

True

MatchQ[<|x -> 1|>, _?AssociationQ]

True

I used the term atomic in a general way meaning an object that does not conform to the standard expression syntax and traversal rules.  Taliesin Beynon explains why this is conflating two different concepts in this chat transcript.

A: In Mathematica 10.4, Association can now be used in pattern matching. Here is the result of the OP's example:
MatchQ[<|x -> 1|>, Association[___Rule]]

True

and
MatchQ[<|x->1|>, Association[___]]

True

There's now also KeyValuePattern which is a pattern object specifically to match elements of an Association or list of rules. Here are some examples:
<|a -> 1, b -> 2, c -> 3|> /. KeyValuePattern[x_ -> 1] :> x

a

Cases[{
  <|"PartOfSpeech" -> "Noun", "Number" -> "Singular"|>,
  <|"PartOfSpeech" -> "Verb"|>},
 KeyValuePattern[{x : "PartOfSpeech" -> y : "Noun"}] :>
  Association[x -> y]]

{<|"PartOfSpeech" -> "Noun"|>}


text:
Q: Adding Icons to a folder - Changes folder to read-only - Removing read-only removes icon A gif speaks a thousand words.
OS Name:                   Microsoft Windows 10 Pro
OS Version:                10.0.18362 N/A Build 18362

See the problem.

*

*Add the icon file.

*Then refresh to show the icon.

*Run cmd as admin

*cd to the folder in question.

*Run attrib -r "%cd%"

*Run attrib -r "%cd%\*.*"

*The removes the read-only props and also the icon file as well.

Are there any ways around this problem of the folder becoming read-only?

A: There is no workaround. Windows will process the desktop.ini file only if the corresponding folder is marked read-only.
However, marking a folder read-only doesn't prevent you from creating/editing files in that folder. 'Read-only' has no meaning for folders.


text:
Q: Проверка ввода и вывода программы через subprocess.run() Програмирую на Python 3.5(новичок)
Начал писать автотест для проверки кода,столкнулся с модулем 'subprocess.run()'
У меня существует файл plus_ten.py с содержимом внутри:
x = input()
sum = x + x
print(sum)

Как мне реализовать проверку его вывода с помощью 'subprocess'?.Смог написать лишь этот кусочек:
import subprocess
file_path = r'plus_ten.py'
    with open(file_path, 'r') as test_file:
    stdin = test_file.read().strip()
    p = subprocess.run(stdin, ???)