text:
Q: Return Select * from PHP PDO Stored Procedure In MS SQL For future users: The bottom of this question contains the corrected working code.
I know Select * is not the best, but in this example, I am trying to call a stored procedure from php and return the ENTIRE result set so I can loop through the array in my code.
Here is my current stored procedure:
USE [hanoncs_AskMe]
GO

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET NOCOUNT ON;
GO

CREATE PROCEDURE [hanoncs_hanoncs].[CommentsTemp]
    @QuestionID INT

 AS
 BEGIN
    BEGIN TRANSACTION

        IF Object_id('#viewquestioncomments', 'U') IS NOT NULL DROP TABLE #viewquestioncomments;

        CREATE TABLE #viewquestioncomments
                     (
                                  commentid INT DEFAULT ((0)),
                                  userid    INT DEFAULT ((0)),
                                  comment   VARCHAR(max) DEFAULT '',
                                  datemodified SMALLDATETIME,
                                  username NVARCHAR(200) DEFAULT '',
                                  points   INT DEFAULT ((0))
                     );

                     INSERT INTO #viewquestioncomments
                    (
                                commentid,
                                userid,
                                comment,
                                datemodified
                    )
        SELECT id,
               userid,
               comment,
               datemodified
        FROM   hanoncs_askme.hanoncs_hanoncs.comments
        WHERE  postid=1
        AND    status=1;

        UPDATE #viewquestioncomments
        SET       username = m.username
        FROM      #viewquestioncomments c
        LEFT JOIN hanoncs_securelogin.hanoncs_hanoncs.members m
        ON        m.id = c.userid;

        UPDATE #viewquestioncomments
        SET    points =
               (
                      SELECT Count(*)
                      FROM   hanoncs_askme.hanoncs_hanoncs.commentvotes
                      WHERE  postid=c.commentid)
        FROM   #viewquestioncomments c;

        SELECT *
        FROM   #viewquestioncomments;

        IF @@ERROR != 0
        ROLLBACK TRANSACTION
        ELSE
            COMMIT TRANSACTION
 END

In MS SQL Management Studio, this returns the temp table like I want:
EXEC [hanoncs_hanoncs].[CommentsTemp] @QuestionID = 1

I am calling it in php with:
    $stmt = $PDO->prepare('EXEC [hanoncs_hanoncs].[CommentsTemp] @QuestionID = ?');
    $stmt->bindParam(1, $QuestionID, PDO::PARAM_INT);
    $stmt->execute();
    $rows6 = $stmt->fetch(PDO::FETCH_BOTH);

The error I get is:
PDOException  SQLSTATE[IMSSP]: The active result for the query contains no fields.

/
EDIT:For future users!!! The working code is below.
Stored Procedure:
USE [hanoncs_AskMe]
GO

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER PROCEDURE [hanoncs_hanoncs].[CommentsTemp]
    @QuestionID INT OUTPUT

 AS

 BEGIN
 SET NOCOUNT ON;
    BEGIN TRANSACTION

        IF Object_id('#viewquestioncomments', 'U') IS NOT NULL DROP TABLE #viewquestioncomments;

        CREATE TABLE #viewquestioncomments
                     (
                                  CommentID INT DEFAULT ((0)),
                                  UserID    INT DEFAULT ((0)),
                                  Comment   VARCHAR(max) DEFAULT '',
                                  DateModified SMALLDATETIME,
                                  UserName NVARCHAR(200) DEFAULT '',
                                  Points   INT DEFAULT ((0)),
                                  Avatar nvarchar(200) DEFAULT ''
                     );

                     INSERT INTO #viewquestioncomments
                    (
                                commentid,
                                userid,
                                comment,
                                datemodified
                    )
        SELECT id,
               userid,
               comment,
               datemodified
        FROM   hanoncs_askme.hanoncs_hanoncs.comments
        WHERE  postid=1
        AND    status=1;

        UPDATE #viewquestioncomments
        SET       username = m.username , Avatar = m.avatar
        FROM      #viewquestioncomments c
        LEFT JOIN hanoncs_securelogin.hanoncs_hanoncs.members m
        ON        m.id = c.userid;

        UPDATE #viewquestioncomments
        SET    points =
               (
                      SELECT Count(*)
                      FROM   hanoncs_askme.hanoncs_hanoncs.commentvotes
                      WHERE  postid=c.commentid)
        FROM   #viewquestioncomments c;

        SELECT *
        FROM   #viewquestioncomments;

        IF @@ERROR != 0
        ROLLBACK TRANSACTION
        ELSE
            COMMIT TRANSACTION
 END

PHP:
   $stmt = $PDO->prepare('EXEC [hanoncs_hanoncs].[CommentsTemp] @QuestionID = ?');
   $stmt->bindParam(1, $QuestionID, PDO::PARAM_INT);
   $stmt->execute();
   $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);

A: Try adding SET NOCOUNT ON; inside the stored procedure (not above where you are creating the procedure).
Add it after the AS BEGIN and before the BEGIN TRANSACTION;
Like so:
CREATE PROCEDURE [hanoncs_hanoncs].[CommentsTemp]
    @QuestionID INT
 AS  BEGIN
    SET NOCOUNT ON;
    BEGIN TRANSACTION

From what it looks like to me, your result set will contain the row counts of affected rows first, then the actual data you want back.


text:
Q: Read from Excel File and Insert into Access I am new at coding and I have a problem: I use Apache Poi to read an Excel File with only one column and about 20 rows. I want to read that information and insert it into my Access Database but I couldn't figure out how.
This is my first method:
Workbook readWorkbook = WorkbookFactory.create(new FileInputStream(FileChooser.FileChoose()));
Sheet sheet = readWorkbook.getSheetAt(4);
DataFormatter dataFormatter = new DataFormatter();

String cellValue = null;
for (int i = 16; i < 20; i++) {  //Statt 20 soll hier 39
    Row row = sheet.getRow(i);
    if(row == null) {
        continue;
    }
    for (int j = 2; j < 4; j++) {
        Cell cell = row.getCell(j);
        if(cell == null) {
            continue;
        }
        cellValue = dataFormatter.formatCellValue(cell);
        System.out.print(cellValue + "\n");
    }
}
return cellValue;

And this is my Insert Code:
try {
    Connection conn=DriverManager.getConnection("jdbc:ucanaccess://"+FileChooser.FileChoose());
    Statement stment = conn.createStatement();

    String query = "INSERT INTO Maschine (com_id, typ, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) VALUES ('"+DatenBankInsert.ForEachLoop()+"')";
    stment.executeUpdate(query);

    System.out.println("successfull");
}
catch (Exception e) {
    System.out.println("Not connected"+e);
}
return null;

redpajama_set_name: RedPajamaStackExchange


text:
Q: One MSI for 32-bit and 64-bit Can anyone give me a good example or set me on the correct direction to enable my installers for 32-bit and 64-bit. I am using Wix 3.6.
I have tried this:
<?if $(var.Platform) = x64 ?>
<?define ProductName = "InsomniacGeek: Windows Setup Test (64 bit)" ?>
<?define Win64 = "yes" ?>
<?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?>
<?else ?>
<?define ProductName = "InsomniacGeek: Windows Setup Test" ?>
<?define Win64 = "no" ?>
<?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?>
<?endif ?>

<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" Platform="$(var.Platform)" />

It doesn't like this however, its says the Platform attribute is invalid, has anyone got this functioning and could help me please?

A: That's exactly the way I do it, and it works perfectly well.
You get a squiggly line and a warning in Votive because the literal text $(var.Platform) isn't one of the platform enumeration values defined in the XML Schema for WiX source files. Once the preprocessor finishes with the file, the attribute's value is valid and candle will happily accept it.
Edited to add: This question and its answers are a great WiX resource.


text:
Q: How to view CommandLineParser parsing errors in Visual Studio 2015? I'm trying to see the errors that occur when parsing command-line arguments using the CommandLineParser package and Visual Studio Professional 2015 (Update 3).  Here is the code I'm working with:
using System;
using System.IO;

namespace SampleParser
{
    class Program
    {
        static void Main(string[] args)
        {
            // Set the CommandLineParser configuration options.
            var commandLineParser = new CommandLine.Parser(x =>
            {
                x.MutuallyExclusive = true;
                x.HelpWriter = Console.Error;
                x.IgnoreUnknownArguments = false;
            });

            // Parse the command-line arguments.
            var options = new CommandLineOptions();
            var optionsAreValid = commandLineParser.ParseArguments(args, options);

            if (!optionsAreValid)
            {
                return;
            }
        }
    }
}

I was expecting to see some helpful info about the problems that cause optionsAreValid to be set to false appear in the Debug > Windows > Output window.  However, nothing's showing up... am I doing something wrong, am I looking in the wrong place, or are there other settings that need to be toggled before I'll see this info?
UPDATE #1
Here is the class that models the command line options after being (successfully) parsed:
namespace SampleParser
{
    class CommandLineOptions
    {
        [Option(HelpText = @"When set to ""true"", running the application will not make any changes.", Required = false)]
        public bool Preview { get; set; }

        [HelpOption]
        public string GetUsage()
        {
            return HelpText.AutoBuild(this, current => HelpText.DefaultParsingErrorsHandler(this, current));
        }
    }
}

A: I mistakenly assumed that the HelpText property would send info to the Visual Studio Output window; however, I was wrong.  Instead, it's how the CommandLineParser gets the info it needs to write info to the console window, which pops up when running a console application project (tx @NicoE ).
Here is some boilerplate code (targeting the v2.1.1-beta NuGet package) which, while still not giving me as much info as I'd like about parser errors, exposes them in a fashion that is easier for me to handle programmatically.
// Set the CommandLineParser configuration options.
var commandLineParser = new CommandLine.Parser(x =>
{
    x.HelpWriter = null;
    x.IgnoreUnknownArguments = false;
    //x.CaseSensitive = false;
});

// Parse the command-line arguments.
CommandLineOptions options;
var errors = new List<CommandLine.Error>();

var parserResults = commandLineParser.ParseArguments<CommandLineOptions>(args)
    .WithNotParsed(x => errors = x.ToList())
    .WithParsed(x => options = x)
;

if (errors.Any())
{
    errors.ForEach(x => Console.WriteLine(x.ToString()));
    Console.ReadLine();
    return;
}

A: I know this is a very old question, but it is still ranked first result in google for my particular search. Since there is no satisfying solution given, I'm going to add one:
To just print the errors you can use the SentenceBuilder provided by the library itself:
using System;
using CommandLine;
using CommandLine.Text;

...

var result = Parser.Default.ParseArguments<Options>(args);
result
    .WithParsed(opt => ...)
    .WithNotParsed(errors => {
        var sentenceBuilder = SentenceBuilder.Create();
        foreach (var error in errors)
            Console.WriteLine(sentenceBuilder.FormatError(error));
    });

To print the full help information including the errors encountered use the following:
using System;
using CommandLine;
using CommandLine.Text;

...

var result = Parser.Default.ParseArguments<Options>(args);
result
    .WithParsed(opt => ...)
    .WithNotParsed(errors => {
        var helpText = HelpText.AutoBuild(result,
                                          h => HelpText.DefaultParsingErrorsHandler(result, h),
                                          e => e);
        Console.WriteLine(helpText);
    });

I hope this helps someone in the future!


text:
Q: Why CSS by rem unit and border-radius can't make a circle I'm using rem unit for my project. I set a block width and height equal, and border radius 50%. But block does not make a circle.
Here is the code
.khXSxJ:before {
    content: "";
    display: block;
    width: 0.8rem;
    height: 0.8rem;
    position: absolute;
    top: 50%;
    margin-top: -0.4rem;
    left: 2rem;
    background-color: #00BCCA;
    border-radius: 50%;
}

And then the result

And here is the computed value

When I set it to 8px for both dimension (My root font size is 62.5%), it works. So why this strange behavious
Updated: 2021/11/20 My font size is 60%, not 62.5% and this may be a bug by Google Chrome (Firefox & Safari work well). In Chrome, I have to set root font exact 62.5% to get this expect behaviour.

A: I have noticed this exact same problem when using values other than px. Instead of a circle i get an oval, even though i have border-radius either set to 9999px or 50%. The solution for me is just to use an iconfont which has a circle in it (or draw one in Inkscape yourself and drag-drop into fontello.com), or use a svg image instead of hard-coded css dot.


text:
Q: How to check whether a user has write access to a field I recently got this error:
Faraday::ClientError: INVALID_FIELD_FOR_INSERT_UPDATE: Unable to create/update fields: LeadSource. Please check the security settings of this field and verify that it is read/write for your profile or permission set.

I'm using the Salesforce web API (no APEX component), and would like to know how I would find out whether a user has write permission to it.
I'm using the Salesforce ruby gem.

A: If you are trying to do it programatically, you'd need to look at the Describe Results for each field, and check if it is updateable:

isUpdateable()
Returns true if the field can be edited by the current user, or child
  records in a master-detail relationship field on a custom object can
  be reparented to different parent records; false otherwise.

A: You can follow these steps

*

*Go to Mange Users in Setup.

*Click on Profiles.

*Select the system admin profile.

*Select Object settings.

*Select the object on whic you want to change or update the access.

*Click on edit to change the accessebility.


text:
Q: complex json to csv using python and pandas dataframe i know this problem has been asked many times but still i am not able to convert it to json.
my json file look like this:
{
    "itemCostPrices": {
        "Id": 1,
        "costPrices": [{
            "costPrice": 83.56,
            "currencyCode": "GBP",
            "startDateValid": "2010-09-06",
            "endDateValid": "2011-05-01",
            "postCalculatedCostPriceFlag": false,
            "promoCostPriceFlag": true
        }]
    },
    "eventId": null,
    "eventDateTime": null
}

A: Try this code:
import json
import pandas as pd

def flatten_dict(d, acc={}):
    for k, v in d.items():
        if isinstance(v, dict):
            flatten_dict(v, acc)
        elif isinstance(v, list):
            for l in v:
                flatten_dict(l, acc)
        else:
            acc[k] = v
    return acc

with open('tmp.json') as f:
    data = json.load(f)

df = pd.DataFrame([flatten_dict(d, {}) for d in data])
df.to_csv('tmp.csv', index=False)

Code explanation:
1) Read and import your json file into a dictionary:
with open('tmp.json') as f:
        data = json.load(f)

and you get:
[{'eventDateTime': None,
  'eventId': None,
  'itemCostPrices': {'Id': 1,
                     'costPrices': [{'costPrice': 83.56,
                                     'currencyCode': 'GBP',
                                     'endDateValid': '2011-05-01',
                                     'postCalculatedCostPriceFlag': False,
                                     'promoCostPriceFlag': True,
                                     'startDateValid': '2010-09-06'}]}},
 {'eventDateTime': None,
  'eventId': None,
  'itemCostPrices': {'Id': 2,
                     'costPrices': [{'costPrice': 99.56,
                                     'currencyCode': 'EUR',
                                     'endDateValid': '2017-05-01',
                                     'postCalculatedCostPriceFlag': False,
                                     'promoCostPriceFlag': True,
                                     'startDateValid': '2018-09-06'}]}}]

2) Flatten the dictionary:
flat_data = [flatten_dict(d, {}) for d in data]

and you get the following list of flatten dict:
[{'Id': 1,
  'costPrice': 83.56,
  'currencyCode': 'GBP',
  'startDateValid': '2010-09-06',
  'endDateValid': '2011-05-01',
  'postCalculatedCostPriceFlag': False,
  'promoCostPriceFlag': True,
  'eventId': None,
  'eventDateTime': None},
 {'Id': 2,
  'costPrice': 99.56,
  'currencyCode': 'EUR',
  'startDateValid': '2018-09-06',
  'endDateValid': '2017-05-01',
  'postCalculatedCostPriceFlag': False,
  'promoCostPriceFlag': True,
  'eventId': None,
  'eventDateTime': None}]

3) Load the dictionary in a pandas dataframe
df = pd.DataFrame(flat_data)

and you get:
   Id  costPrice currencyCode endDateValid eventDateTime eventId  postCalculatedCostPriceFlag  promoCostPriceFlag startDateValid
0   1      83.56          GBP   2011-05-01          None    None                        False                True     2010-09-06
1   2      99.56          EUR   2017-05-01          None    None                        False                True     2018-09-06

4) Save your dataframe as csv
df.to_csv('tmp.csv', index=False)


text: Q: Play notification on fixed device My headset is constantly plugged into my Windows 10 laptop, but I often miss Outlook's e-mail reminders. Is there a way to make the reminder sound to (also) play on my laptop's speakers, even though a headset is plugged in. Of course, all other sounds (calls, videos) should still be played on the headset only.


text:
Q: Accessing data from an array irrespective of scope (GLOBAL simulation) PHP I have some secure user information which is inserted as at the top of my template (I am using CMS Made Simple, pages are built from various component parts, so code is split between locations).
I want to access the array of user attributes at multiple points in the site, the solution that sprung to mind was to, at point of arrival, store the attributes in MySQL and then call on them directly from that where ever I am in the site.
My simple question: is this a good way to do things? Or is there an accepted way to get arrays globally accessible (I hear that actually using the global array is frowned on these days?)

A: You can use sessions if its user specific data

A: If the variables you are accessing are user specific, this is exactly the sort of thing that the $_SESSION variable was created for. Don't forget to make call to session_start() at the beginning of each script that accesses it, or none of your previously set values will be there (and any values you set will not be saved).

A: Avoiding globals is a good idea when developing an OOP application, but this does not mean strictly $GLOBALS.
It means that you should avoid designs that rely on global scope.
So don't avoid the $GLOBALS array, avoid needing it.. If you're 'simulating' it, that's probably actually worse.
The simple answer: just create a function that returns the data, or a class with a method that does.


text:
Q: SQL Server 2000 incorrect message: duplicate key with unique index Database server: SQL Server 2000 - 8.00.760 - SP3 - Standard Edition
I have a table with 5 columns, in which I want to add a large (300.000) number of records. There is a unique index on the combination of two columns. If I add the records with this unique index in place, SQL Server gives this error message:

Msg 2601, Level 14, State 3, Line 1
  Cannot insert duplicate key row in object 'TESTTABLE' with unique index 'test'.
  The statement has been terminated.
(0 row(s) affected)

However, if I delete the unique index and then add the records, I do not get any error when I create this unique index afterwards.

A: Check which fields constitute your unique index.
You have duplication in your source data on those fields which is causing your INSERT to fail.
What you do about that depends on the nature of your data.  If it's just that one row is newer than other, making the original obsolete, then you can get rid.  Otherwise, speak to your business people about :-

*

*what you should do with the dupe data

*whether the unique constraint on the
columns is necessary

Some problems can be solved easily.  For this one, most of your solutions are actually non-technical.

A: One of your assumptions has to be wrong.  Re-visit them.  Either the nature of your index, the data coming in, the pre-existing data (if any), the collation (case-insensitive/case-sensitive).

A: Unique constraint (not index) that uses WITH NOCHECK in the ALTER TABLE?


text:
Q: How to rewrite URL to include variables and remove php while allowing directories I have the following htaccess
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/?user=$1

which works as expected for example
http://example.com/index.php?user=USERNAME -> http://example.com/USERNAME

However I have created a form on the page index.php which posts to /directory/save.php
How do I remove .php while allowing for the directory so that I can post to /directory/save/ instead?

A: directory/ might have it's own rewrite rules and not have a physical save.php, that's why !-f might not work. Try adding a new rewrite condition to stop rewriting for directory/
RewriteCond %{REQUEST_URI} !^directory

A: if it is going to one and only such file in /directory then probably hard code it by adding following before the above rules?
RewriteRule ^directory/save$ /directory/save.php [L]

A: Try to check this one if it's rewriting /directory/save.php file to directory /directory/save/
RewriteCond %{REQUEST_URI} ^/directory/save\.php$
RewriteRule ^(.+) /directory/save/ [NC]


text:
Q: UIView Overlayed over UIWindow Passes Clicks Through SwiftUI View I need to overlay an UIView on top of SwiftUI content. Instead of using UIViewController.present(_:animated:completion:), I simply add it to UIWindow hierarchy and apply constraints (I need it for additional customization, not important here).
But I ran into a problem. Overlayed UIView passes tap gestures through itself, and underlying SwiftUI View gets clicked. You can see, that successive clicks make screen redder and redder—they basically insert more subviews.
Weird thing is, that drag gestures, such as scrolling, don't go through.

What are the implications here? Why is tap going through, and not drag?
struct ContentView: View {
    var body: some View {
        ScrollView(content: {
            Button("Click", action: overlayView)
        })
    }

    private func overlayView() {
        let overlay: UIView = .init()
        overlay.translatesAutoresizingMaskIntoConstraints = false
        overlay.isUserInteractionEnabled = true
        overlay.backgroundColor = .red.withAlphaComponent(0.1)

        let windowView: UIView = UIApplication.shared.activeWindow!.rootViewController!.view

        windowView.addSubview(overlay)

        NSLayoutConstraint.activate([
            overlay.leadingAnchor.constraint(equalTo: windowView.leadingAnchor),
            overlay.trailingAnchor.constraint(equalTo: windowView.trailingAnchor),
            overlay.topAnchor.constraint(equalTo: windowView.topAnchor),
            overlay.bottomAnchor.constraint(equalTo: windowView.bottomAnchor)
        ])
    }
}

extension UIApplication {
    var activeWindow: UIWindow? {
        connectedScenes
            .filter { $0.activationState == .foregroundActive }
            .first { $0 is UIWindowScene }
            .flatMap { $0 as? UIWindowScene }?
            .windows
            .first { $0.isKeyWindow }
    }
}

The same problem doesn't occur when launching from pure UIKit:
final class ViewController: UIViewController {
    override func viewDidLoad() {
        super.viewDidLoad()

        view.backgroundColor = .systemBackground

        let button: UIButton = .init()
        button.translatesAutoresizingMaskIntoConstraints = false
        button.addTarget(self, action: #selector(overlayView), for: .touchUpInside)
        button.setTitle("Click", for: .normal)
        button.setTitleColor(.systemBlue, for: .normal)

        view.addSubview(button)

        NSLayoutConstraint.activate([
            button.centerXAnchor.constraint(equalTo: view.centerXAnchor),
            button.centerYAnchor.constraint(equalTo: view.centerYAnchor)
        ])
    }

    @objc private func overlayView() {
        let overlay: UIView = .init()
        overlay.translatesAutoresizingMaskIntoConstraints = false
        overlay.isUserInteractionEnabled = true
        overlay.backgroundColor = .red.withAlphaComponent(0.1)

        let windowView: UIView = UIApplication.shared.activeWindow!.rootViewController!.view

        windowView.addSubview(overlay)

        NSLayoutConstraint.activate([
            overlay.leadingAnchor.constraint(equalTo: windowView.leadingAnchor),
            overlay.trailingAnchor.constraint(equalTo: windowView.trailingAnchor),
            overlay.topAnchor.constraint(equalTo: windowView.topAnchor),
            overlay.bottomAnchor.constraint(equalTo: windowView.bottomAnchor)
        ])
    }
}

I would appreciate if you could help with actually cutting off the tap gestures.


text:
Q: SSRS - return multiple queries in one stored procedure I am attempting to create a new SSRS report that will return and display the values of a SQL Server stored procedure. I will pass a parameter @clientID to the stored procedure. This parameter is used in 3 different BEGIN/END statements. Each BEGIN`END` statement takes the parameter and makes a query, returning specific data.
When I create the SSRS report, I point the datasource to this stored procedure, but only the result set from the first BEGIN/END statement is returned. If I run the stored procedure in SSMS, I get 3 different result sets, as expected.
How can I get those 3 BEGIN/END result sets into a single report?
Sample code:
CREATE PROCEDURE pClientData (@clientID varchar(30))
AS

    DECLARE @Orders table (
            ...
            );

    DECLARE @Results table (
            ...
            );

    DECLARE @Status table (
            ...
            );

    BEGIN
        SET NOCOUNT ON;

        -- Get all the orders by client
        INSERT INTO @Orders
        SELECT ...

        -- Return the results --
        SELECT *
        FROM @Orders;

    END

    BEGIN
        SET NOCOUNT ON;

        -- Determine the Results

        INSERT INTO @Results
        SELECT ...

        SELECT *
        FROM @Results;

    END

    BEGIN
        SET NOCOUNT ON;

        SET @Status = (
        SELECT ...
        );

        SELECT @Status as Status;

    END
    GO

Query call from SSRS:
EXEC pClientData @clientID

A: Unfortunately, this is not possible.
According to the book Applied Microsoft SQL Server 2008 Reporting Services
From Section 4.3.5 - Working with Stored Procedures:

If a stored procedure returns multiple rowsets (executes multiple SELECT statements), only the first rowset is processed by the report. If you need all results, consider implementing a wrapper stored procedure that merges the multiple rowsets in a temporary table and returns all rows with one SELECT statement.

As suggested, you'll have to make some sort of adjustment to your stored procedure in order to accomplish this. Either create a wrapper to return all results in a single set, or split your existing stored procedure into three.

Note: At the moment, you can get a pdf of the ebook here, but it might get taken down.

A: Just add one more param: ResultSetN and output corresponsing result set, depending of that param.
1 will return Orders
2 will return Results
3 will return Status
You can then call your stored procedure 3 times with corresponding #.
EXEC pClientData @clientID ,1
EXEC pClientData @clientID ,2
EXEC pClientData @clientID ,3


text:
Q: Getting the Value of A Variable from another file I have 2 files and in the 1st file, I have textbox where the user can enter a value. I want to take that value and bring it to the other file. In that program, I have the user entering a value also in a textbox. If the value they enter is higher than the other you get an error.
For example: File 2 ask how many snickers you want to eat and File 1 (ask the user how many snickers we have). If what you want to eat is more than what you have you get an error.
I'm not sure how I can get this value in the other file.
FILE 1:
protected void Page_Load(object sender, EventArgs e)
    {
            //create string and set it equal to the textbox text
            string snickersInventory = txtInventorySnickers.Text;
            //create a int and turn the string into an int
            int stockSnickers = Int32.Parse(snickersInventory);

     }

FILE 2:
protected void btnSubmit_Click(object sender, EventArgs e)
    {
      //Check to see if the stockSnickers is lower than the amount of Snickers Value
    }

A: I hope this is something similar to what you're interested in:
/* Program 1 - Save our snicker count to a file */
var snickerInventory = txtInventorySnickers.Text;

// No need to convert to number if you're going to write directly to file.
System.IO.File.WriteAllText(@"c:\snickersInventoryCount.txt", snickerInventory);

/* Program 2 - Try to eat some snickers. */
var howManySnickersToEat = int.Parse(txtInventorySnickers.Text);
var snickersOnHandFileData = System.IO.File.ReadAllText(@"c:\snickersInventoryCount.txt");
var snickersOnHand = int.Parse(snickersOnHandFileData);

if(snickersOnHand < howManySnickersToEat) { /* Do error stuff here */ }

You'll definitely want to add error handling when parsing strings to ints. Take a look at int.TryParse(), especially if you are working with user input.
That's basically the gist of a simple write to/reading from a file. This is fine if the programs aren't running at the same time. You'll have problems if you're trying to read/write from the file at the same time.
You might consider using a database instead of a file as a means to share information between two applications.

A: Declare your File1's Textbox Modifier as public .
System.Web.Application.File f = System.Web.Application.["WebForm1"];
And in File2 Declare the following:
protected void btnOn_Click(object sender, EventArgs e)
    {
      var howMany = txt_howManySneakers.text;     // File1
      var EatSneakers = ((WebForm1)f).txtbox1.Text;  // File2

      if (EatSneaker > howMany )
        {
           // DO ERROR
        }
    }

A: very simple, put the user entered value in a session object in file 1 like below
//create string and set it equal to the textbox text
string snickersInventory = txtInventorySnickers.Text;
//create a int and turn the string into an int
int stockSnickers = Int32.Parse(snickersInventory);

Session["stockSnickers"]=stockSnickers;

and get above value in file 2 like below
if(Session["stockSnickers"] != null)
{
   int stockSnickers = Convert.ToInt32(Session["stockSnickers"]);
   // do something with above value
}

I hope it helps....:)


text:
Q: "cannot open source file"- headers included, Visual Studio 2015 I keep receiving the error "cannot open source file" in Visual Studio 2015 when trying to compile the "simpleLite.c" from AR Toolkit. This occurs despite placing the the full paths to the headers in the project options include setting and also pasting  the headers into the project headers folder.
AR Toolkit is installed as C:\Program Files (x86)\ARToolKit5
The include paths, which are pasted into the project include setting, are:
C:\Program Files (x86)\ARToolKit5\include\AR;
C:\Program Files (x86)\ARToolKit5\include\win32-i386\GL
All include files fail to open:

Is anyone aware of additional needed configuration?

A:
The include paths, which are pasted into the project include setting, are: C:\Program Files (x86)\ARToolKit5\include\AR; C:\Program Files (x86)\ARToolKit5\include\win32-i386\GL

Seeing that the #include directives start with AR and GL, you probably should not have those subdirectories in your include paths, but just
C:\Program Files (x86)\ARToolKit5\include; C:\Program Files (x86)\ARToolKit5\include\win32-i386


text:
Q: How do I get the change picture arrows to be on the sides of the picture? So I have a picture slideshow that has arrow buttons that allow the user to go to the next or last image. How do I get these arrows to be on or in the picture on the appropriate side (left middle for previous image and right middle for next image)?
Here is my current code:

  <title>change picture</title>

   <button type="button" onclick="displayPreviousImage()"> &laquo</button>

  <button type="button" onclick="displayNextImage()"> &raquo</button>

A: Wrap your image in a container to get an HTML structure like this:

     <button class="leftButton"></button>

     <button class="rightButton"></button>

Then apply CSS such as this one:
 .imgContainer {
   position: relative;
 }

 .leftButton {
    position: absolute;
    left: 0; bottom: 50%;
 }
  .rightButton {
    position: absolute;
    right: 0; bottom: 50%;
 }

By specifying the position property of your buttons to be absolute, you're making them position themselves relative to their closest parent with an absolute or relative position.
This is why we set .imgContainer's position to relative.
We can now position the buttons within the container with the left, right, top and bottom properties.
Check this article for a more in-depth explanation: Absolute Positioning Inside Relative Positioning.
Perfect vertical centering of the buttons is more tricky and requires yet another hack so for now you can just use the bottom: 50%;, or dive into the art of Centering in CSS when you feel ready.


text:
Q: How can I return the Lucene score of my query when using the Neo4J REST server? I have been able to use the Lucene query syntax so far.  Now I need to be able to return the scores and number of hits on nodes by modifying my query line:
GET http://localhost:7474/db/data/index/node/myIndex?query=myKey:myValue
In other words, I do not want to have to create an embedded graph database because I am trying to access the data I have saved in my REST server.  Any suggestions on how to return the score and hits?
Could I perhaps create an instance of a class that Lucene offers to do this?
Thanks!

A: to do this, you will probably have to write a small scoring Neo4j Server unmanaged extension, since this is outside the core REST API, see http://docs.neo4j.org/chunked/snapshot/server-unmanaged-extensions.html for details. As parameters you could take the index, and the scoring parameters and the query.
Would that help?
/peter


text:
Q: Cant upgrade Ubuntu from 16.04 to 18.04-Hash sum mismatch I'm unable to upgrade from 16.04 to 18.04
All the packages get downloaded but then this error pops up:
dialog box that shows the error
 It says "Could not download the upgrades The upgrade has aborted. Please check your Internet connection or installation media and try again. All files downloaded so far have been kept."
and "Failed to fetch http://in.archive.ubuntu.com/ubuntu/pool/universe/f/freepats/freepats_20060219-1_all.deb Hash Sum mismatch
"

A: I solved this problem by installing freepats from debian package for freepats


text:
Q: How is this solution an example of dynamic programming? A lecturer gave this question in class:
[question]

A sequence of n integers is stored in
  an array A[1..n]. An integer a in A is
  called the majority if it appears more
  than n/2 times in A.
An O(n) algorithm can be devised to
  find the majority based on the
  following observation: if two
  different elements in the original
  sequence are removed, then the
  majority in the original sequence
  remains the majority in the new
  sequence.   Using this observation, or
  otherwise, write programming code to
  find the majority, if one exists, in
  O(n) time.

for which this solution was accepted
[solution]
int findCandidate(int[] a)
{
    int maj_index = 0;
    int count = 1;
    for (int i=1;i<a.length;i++)
    {
        if (a[maj_index] == a[i])
            count++;
        else
            count--;

        if (count == 0)
        {
            maj_index =i;
            count++;
        }
    }
    return a[maj_index];
}

int findMajority(int[] a)
{
    int c = findCandidate(a);
    int count = 0;
    for (int i=0;i<a.length;i++)
        if (a[i] == c) count++;

    if (count > n/2) return c;
    return -1;//just a marker - no majority found
}

I can't see how the solution provided is a dynamic solution.  And I can't see how based on the wording, he pulled that code out.

A: The origin of the term dynamic programming is trying to describe a really awesome way of optimizing certain kinds of solutions (dynamic was used since it sounded punchier). In other words, when you see "dynamic programming", you need to translate it into "awesome optimization".

A: 'Dynamic programming' has nothing to do with dynamic allocation of memory or whatever, it's just an old term. In fact, it has little to do with modern meaing of "programming" also.
It is a method of solving of specific class of problems - when an optimal solution of subproblem is guaranteed to be part of optimal solution of bigger problem. For instance, if you want to pay $567 with a smallest amount of bills, the solution will contain at least one of solutions for $1..$566 and one more bill.
The code is just an application of the algorithm.

A: This is dynamic programming because the findCandidate function is breaking down the provided array into smaller, more manageable parts.  In this case, he starts with the first array as a candidate for the majority.  By increasing the count when it is encountered and decreasing the count when it is not, he determines if this is true.  When the count equals zero, we know that the first i characters do not have a majority.  By continually calculating the local majority we don't need to iterate through the array more than once in the candidate identification phase.  We then check to see if that candidate is actually the majority by going through the array a second time, giving us O(n).  It actually runs in 2n time, since we iterate twice, but the constant doesn't matter.


text:
Q: Kubernetes Job to create a volume snapshot I have a job, which I want to run regularly in Kubernetes 1.19.3 (DigitalOcean).
For this job, I need to take a snapshot of a PVC and do stuff to it. I know how can I run a job and mount a volume to the pod it runs, but I have a hard time finding out how to take that snapshot at the beginning of this job.
Is there any way to do it?

A: The tool of choice to take PV snapshots in K8s is VolumeSnapshots.
The trouble with them is that they don't come  yet) with functionality for periodic triggering. So, you would have to create them from a K8s CronJob. However, doing so is not terribly straight forward, since your CronJob Pod would need to have a K8s client installed and require access to the K8s API Server with RBAC.
There are a couple of options to get there, reaching from writing your own image from scratch to using open-source solutions based on the clients from this project k8s client libraries.
Seeing that dynamic K8s manifest applying is somewhat badly supported by K8s, I actually started an open source project myself, that you could use for this purpose: K8sCrud.


text:
Q: AppCompat action bar size differ from ActionBarSherlock's size I've decided to migrate from ActionBarSherlock (ABS) to AppCompat-v7. I ran into a problem. ActionBar became 56dp size instead of 48dp as it was in Holo theme. As I found in AppCompat resources the default action bar size is equal 56dp as in Material design. But I want my action bar looks like action bar in Holo theme. How can I specify necessary size for action bar? Maybe there is AppCompat-v7 with Holo instead of Material?

A: It is normal.
Appcompat v21 library enables you to bring the Material designs to older Android platforms.
If you would like to change the height you can use a Toolbar in your layout and set your favorite height.
<android.support.v7.widget.Toolbar
    android:id="@+id/my_awesome_toolbar"
    android:layout_height="48dp"
    android:layout_width="match_parent"
    android:background="?attr/colorPrimary" />

In any case I suggest you to adopt the Material Desing and use the standard dimens.
You can find more info here.

A: Use height attribute, actionBarSize if for something else.
<item name="android:height">@dimen/bar_height</item>

A: The new AppCompat is meant to implement Material Design, so I encourage you to comply with the guidelines and use the default size. However, if you want to use a non-standard size for your material Action Bar, you can override actionBarSize in your theme:
<item name="actionBarSize">@dimen/bar_height</item>

If you want a true Holo ActionBar, you need to use AppCompat version 20.0.0, which is the last version to support Holo. But then you are stuck and can't use any new version of the support library.


text:
Q: Writing a function for a single line of code? I am currently working with a pandas DataFrame and came across a problem. Should there be a separate function for setting the index or does it make the code to complex since you could simply write the one line of code anyway.
def set_time_as_index(df):
    return df.set_index('time')

Simplified version of current code:
def create_df_rdy_for_export(input_data):
    dframe = pd.DataFrame(input_data)
    dframe = set_time_as_index(dframe)
    return dframe

Or is it better to write:
def create_df_rdy_for_export(input_data):
    dframe = pd.DataFrame(input_data)
    dframe = dframe.set_index('time')
    return dframe

I am simply setting the index to the time-column. And since it only appears only one time in the script, there is no need to write a separate function but I am so used to it, that it feels odd, without a function.
Are there any conventions or performance trade-offs?

A: This is an opinion-based question, but one I will answer because there are conventions when working with Pandas dataframes.
A common practice is to chain operations. You can simply apply methods sequentially. For example (adding an extra method for clarity):
def create_df_rdy_for_export(input_data):
    dframe = pd.DataFrame(input_data)\
               .set_index('time')\
               .set_axis(['col1', 'col2', 'col3'], axis=1)
    return dframe

Each line represents a distinct method. In my opinion, there's no need to write a separate function to call a single method. For more complex dataframe manipulations you can use pd.DataFrame.pipe. For example:
def format_dataframe(df):
    df = df.set_index('time')\
           .set_axis(['col1', 'col2', 'col3'], axis=1)
    return df

def create_df_rdy_for_export(input_data):
    dframe = pd.DataFrame(input_data).pipe(format_dataframe)
    return dframe

The benefit here is you can reuse just the manipulation part of your logic for other uses, and pipe still allows you to chain additional methods.


text:
Q: how do i approach this error given in array and i want the error to populate on my Bootstrap alert how do i approach this error given in array and i want the error to populate on my Bootstrap alert
Ajax code
 $.ajax({
            type: type,
            url: ajaxurl,
            data: formData,
            dataType: 'json',
            success: function (data) {

               if(data.status){
                SuccessMessage();
                setTimeout(function() {
                    location.reload();
                }, 300);
            }
        },
        error: function (data) {

            console.log('Error:', data.responseJSON.errors);

            }
        });
    });

json response
{name: Array(1), email: Array(1), password: Array(1)}
email: ["The email field is required."]
name: ["The name field is required."]
password: ["The password field is required."]

Bootstrap alert:

A: Please try it:
 $.ajax({
    type: type,
    url: ajaxurl,
    data: formData,
    dataType: 'json',
    success: function (data) {

        if (data.status) {
            SuccessMessage();
            setTimeout(function () {
                location.reload();
            }, 300);
        }
    },
    error: function (data) {
        const errors = Object.values(data.responseJSON.errors)
        if (errors.length === 0) {
          return
        }

        errors.forEach(item => {
          $('.alert-danger').append(`<h1>${item}<h1>`)
        })

        $('.alert-danger').show();
    }
});

With specific columns:
error: function (data) {
        const errors = Object.keys(data.responseJSON.errors)

        if (errors.length === 0) {
            return
        }

        const errorKeys = Object.keys(errors)
        errorKeys.forEach(item => {
            const errorItems = errors[item];
            errorItems.forEach(error => {
                $(`.invalid-feedback-${item}`).append(`<h1>${error}<h1>`)
            })
        })

        // Please test it. I'm not sure the below function works
        $('[class^=invalid-feedback-]').show()
    }

A:

Validation failed!

error: function (data) {

$('#alert').text(data.responseJSON.errors.join(", "))
$('.alert').alert()
}


text:
Q: How to combine similar nodes in neo4j I have defined few nodes and relationships in neo4j graph database but the output is bit different from expected one as each node is representing its own data and attributes. I want combination of same node showcasing different relationships and attributes
`LOAD CSV WITH HEADERS FROM "file:///data.csv" AS line
CREATE(s:SourceID{Name:line.SourceID})
CREATE(t:Title{Name:line.Title})
CREATE(c:Coverage{Name:line.Coverage})
CREATE(p:Publisher{Name:line.Publisher})
MERGE (p)-[:PUBLISHES]->(t)
MERGE (p)-[:Coverage{covers:line.Coverage}]->(t)
MERGE (t)-[:BelongsTO]->(p)
MERGE (s)-[:SourceID]->(t)`

In given picture there are two nodes with Springer Nature and i wish to have only one node namely, Springer Nature and all the associated data of both the nodes to be present in single node.

A: First of all, I would recommend you to set a CONSTRAINT before adding data.
It seems that the Nodes can have duplicates when creating them because you are merging patterns and the cypher query does not specify that the nodes have to be identified unique nodes.
So in your case try this first for each of the node labels:
CREATE CONSTRAINT publisherID IF NOT EXISTS FOR (n:Publisher) REQUIRE (n.Name) IS UNIQUE;
CREATE CONSTRAINT sourceID IF NOT EXISTS FOR (n:SourceID) REQUIRE (n.Name) IS UNIQUE;
CREATE CONSTRAINT titleID IF NOT EXISTS FOR (n:Title) REQUIRE (n.Name) IS UNIQUE;
CREATE CONSTRAINT coverageID IF NOT EXISTS FOR (n:Coverage) REQUIRE (n.Name) IS UNIQUE;

Even better would be to not use the name but a publisher ID. But this is your choice, and if there aren't thousands of publishers in the data, this will be no issue at all.
Also, I would not use CREATE for creating the nodes but use MERGE instead. Because the cypher query goes line-by-line, if you want to create a node which already exists—which could happen on the second line or on the fiftieth line—the query would fail if you set the CONSTRAINT above.
And try everything on a blank database; for example, by deleting all nodes:
MATCH (n) DETACH DELETE n

So to sum up the Cypher Query in one go, you send the queries separately:
CREATE CONSTRAINT publisherID IF NOT EXISTS FOR (n:Publisher) REQUIRE (n.Name) IS UNIQUE;
CREATE CONSTRAINT sourceID IF NOT EXISTS FOR (n:SourceID) REQUIRE (n.Name) IS UNIQUE;
CREATE CONSTRAINT titleID IF NOT EXISTS FOR (n:Title) REQUIRE (n.Name) IS UNIQUE;
CREATE CONSTRAINT coverageID IF NOT EXISTS FOR (n:Coverage) REQUIRE (n.Name) IS UNIQUE;

LOAD CSV WITH HEADERS FROM "file:///data.csv" AS line
MERGE(s:SourceID{Name:line.SourceID})
MERGE(t:Title{Name:line.Title})
MERGE(c:Coverage{Name:line.Coverage})
MERGE(p:Publisher{Name:line.Publisher})
MERGE (p)-[:PUBLISHES]->(t)
MERGE (p)-[:Coverage{covers:line.Coverage}]->(t)
MERGE (t)-[:BelongsTO]->(p)
MERGE (s)-[:SourceID]->(t)
RETURN count(p), count(t), count(c), count(s);


text:
Q: Gradle error "Attribute "xxx" has already been defined" in Android Studio I created a project in Android Studio and added a few dependencies using Maven Central and when I try to compile, I run into this type of errors:
Error:Gradle: Attribute "titleTextStyle" has already been defined
Error:Gradle: Attribute "subtitleTextStyle" has already been defined
[...]

And so on... Here is my build.gradle file:
buildscript {
    repositories {
    mavenCentral()
    }
    dependencies {
    classpath 'com.android.tools.build:gradle:0.5.+'
    }
}
apply plugin: 'android'

repositories {
    mavenCentral()
}

android {
    compileSdkVersion 18
    buildToolsVersion "17.0.0"

    defaultConfig {
    minSdkVersion 8
    targetSdkVersion 18
    }
}

dependencies {
    // Support Libraries
    compile 'com.android.support:support-v4:18.0.0'
    compile 'com.android.support:appcompat-v7:18.0.0'
    compile 'com.android.support:support-v13:18.0.0'

    // Third-Party Librairies
    compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
    compile 'ch.acra:acra:4.5.0'

}

Sadly the Make Console doesn't speak as much as Eclipse's Console, so I have no idea of the problem's origin.
Does anyone have an idea of what causes these compile errors?

A: You should remove this line in your dependencies :
compile 'com.android.support:appcompat-v7:18.0.0'

A: The last version of Google Play Services now uses appcompat-v7, so u can't use it with actionbarsherlock. You have to use only appcompat-v7 or the previous version of play services:
compile 'com.google.android.gms:play-services:7.0.0'


text:
Q: RavenDB - Indexing and querying complex hierarhical data (nested properties) I have a docuemnt like this:
public class Order
{
    public string ClientName { get; set; }
    public List<OrderItem> Items { get; set; }
}

public class OrderItem
{
    public string ProductCode { get; set; }
    public int Quantity { get; set; }
}

And I need to query collection of theese documents like this:
var q = session.Query<Order_Index.Result, Order_Index>()
    .Where(o => o.ClientName.StartsWith("Jho") &&
                o.Items.Any(i => i.ProductCode == "Book" && i.Quantity >= 10))
    .OfType<Order>();

Every example of indexing and querying hierarhical data, that I found, shows only case, when only one property of complex nested object is used in separate query expression. e.g.:
var q = session.Query<Order_Index.Result, Order_Index>()
    .Where(o => o.ClientName.StartsWith("Jho") &&
                o.ItemProductCodes.Any(c => c == "Book") &&
                o.ItemQuantities.Any(qty => qty >= 10))

but none of them consider my situation.
I tried to index ProductCode and Quantity as separate collections and then join them by collection index while querying, but this throws some kind of Linq translation exception. I wonder, is there any opportunity to do this kind of querying in RavenDB?

A: Try following :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            List<Order> session = new List<Order>() {
                new Order() { ClientName = "Jho", Items = new List<OrderItem>() {
                        new OrderItem() { ProductCode = "abc", Quantity = 1},
                        new OrderItem() { ProductCode = "def", Quantity = 4},
                        new OrderItem() { ProductCode = "Book", Quantity = 5},
                        new OrderItem() { ProductCode = "jkl", Quantity = 10}
                   }
                },
                new Order() { ClientName = "Mary", Items = new List<OrderItem>() {
                        new OrderItem() { ProductCode = "mno", Quantity = 2},
                        new OrderItem() { ProductCode = "pqr", Quantity = 3},
                        new OrderItem() { ProductCode = "stu", Quantity = 4},
                        new OrderItem() { ProductCode = "vwx", Quantity = 5}
                    }
                },
                new Order() { ClientName = "Jho", Items = new List<OrderItem>() {
                        new OrderItem() { ProductCode = "abc", Quantity = 28},
                        new OrderItem() { ProductCode = "cdf", Quantity = 7},
                        new OrderItem() { ProductCode = "Book", Quantity = 26},
                        new OrderItem() { ProductCode = "jkl", Quantity = 5}
                    }
                }
            };

            var q = session.Where(o => o.ClientName.StartsWith("Jho") && o.Items.Where(i => i.ProductCode == "Book" && i.Quantity >= 10).Any()).ToList();
        }
    }

    public class Order
    {
        public string ClientName { get; set; }
        public List<OrderItem> Items { get; set; }
    }

    public class OrderItem
    {
        public string ProductCode { get; set; }
        public int Quantity { get; set; }
    }

}


text:
Q: How to cache static files when using Vapor framework for Swift There are some css files in Public/css/. I'm accustomed to setting cache rules in the .htaccess for Apache server. How can I make the browswer cache static files when using Vapor?

A: Vapor serves files using its FileMiddleware. You can see that it respects the browser's use of If-None-Match, returning 304 Not Modified as appropriate.
If you need more advanced cache rules, you can roll-your-own file middleware to do this.
The better option, however, is not to use Vapor for static files and instead deploy it behind nginx (or Apache), configuring caching in the HTTP server.


text:
Q: How can I tell VIFM to filter binary files, ".hi" files and ".o" files? I've managed to filter ".hi" and ".o" with:
:filter '\.(o|hi)$'

But how do I filter binary files too?

A: There is no way to do this. It's file name filter and names do not suggest whether file content is binary or not.
There are basically two possible ways to implement this:

*

*query mime-type of each file

*examine content of each file to evaluate its kind

Both options involve reading files, and that's something you don't really want to do as it can kill performance (look at file managers that display file previews, they are quite slow even in the presence of caches). For the second option something like first 512 bytes would be enough, still if you open directory containing 1000 files (/usr/bin, for example) all those files should be located on your storage, which is very slow unless they are already cached by your OS kernel.


text:
Q: Conjecture: $\lim_{x\to\infty} \frac{256}{163x}\sum_{n=1}^{\lfloor x\rceil} |\sin n|=1$ I conjecture:  $$\lim_{x\to\infty} \frac{256}{163x}\sum_{n=1}^{\lfloor x\rceil} |\sin n|=1$$
Is this provable? If this is false, then can I have a function $f$ such that:
$$\lim_{x\to\infty} f(x)\sum_{n=1}^{\lfloor x\rceil} |\sin n|=1$$

A: We will show that
$$\lim_{N \to +\infty} \frac{\pi}{2N} \sum_{n = 1}^N | \sin n| = 1.$$
Then your statement (with $256/163$ replaced by $\pi/2$) will follow since $\lfloor x \rceil /x \to 1$ as $x \to + \infty$.
Let $f(x)$ be any left-continuous step function on $[0,\pi]$ satisfying $f(x) \leq \sin x$. Say $0 = x_0 < x_1 < \dots < x_r = \pi$ and $f(x) = a_k$ on $[x_{k-1},x_k)$. Then
$$\sum_{n = 1}^N | \sin n| \geq \sum_{n=1}^N f(n \operatorname{mod} \pi) = \sum_{k=1}^r a_k S_{k,N}$$
where $S_{k,N}$ is the number of elements in the set $\{n \operatorname{mod} \pi\ \mid n = 1, \dots N\} \cap [x_{k-1},x_k).$ Since the sequence $n \operatorname{mod} \pi$ is equidistributed in $[0,\pi]$, we have $S_{k,N}/N \to (x_k - x_{k-1})/\pi$ as $N \to +\infty$. Thus
$$\frac{\pi}{2N} \sum_{n = 1}^N | \sin n| \geq \frac{\pi}{2}\sum_{k=1}^r a_k \frac{S_{k,N}}{N} \xrightarrow[N \to +\infty]{} \frac{1}{2} \sum_{k=1}^r a_k (x_k - x_{k-1}) = \frac{1}{2} \int_0^{\pi} f(x) \, dx.$$
Therefore
$$\liminf_{N \to +\infty} \frac{\pi}{2N} \sum_{n = 1}^N | \sin n| \geq \frac{1}{2} \int_0^{\pi} f(x) \, dx.$$
The supremum of the right-hand side as $f$ is allowed to vary among left-continuous step functions $\leq \sin x$ is $\frac{1}{2} \int_{0}^{\pi} \sin x \, dx = 1$, hence
$$\liminf_{N \to +\infty} \frac{\pi}{2N} \sum_{n = 1}^N | \sin n| \geq 1.$$
Arguing similarly with step functions $g(x) \geq \sin x$, we find that
$$\limsup_{N \to +\infty} \frac{\pi}{2N} \sum_{n = 1}^N | \sin n| \leq 1.$$
Combining the two inequalities, we have proved that
$$\lim_{N \to +\infty} \frac{\pi}{2N} \sum_{n = 1}^N | \sin n| = 1.$$


text:
Q: :src in vue.js is sending me error in GET method Here is the code in vue.js:
<b-img center :src="img" fluid></b-img>

And in the script:
img: require('../../../../img/quiz-background.png'),

Usually this is the way, that it worked for me, but today I have this error:

I know that it doesn't work because of "/words/". If I would find a way to delete "/words/", it would work.
Does anyone know how to fix this?
Thanks.

A: Try replace.
Like this:
<b-img center :src="img.replace('/words', '')" fluid></b-img>
or create another variable like
var sterilizedImg = this.img.replace('/words', '');
and then
<b-img center :src="sterilizedImg" fluid></b-img>


text:
Q: No package libnautilus-extension to build ubuntu-wipe from source Ubuntu MATE 22.10 As the nautilus-wipe tool cannot be installed on MATE 22.10, I tried to configure/build from source script on MATE 22.10 results in the following error:
No package 'libnautilus-extension' found
Configure log:
nautilus-wipe-0.3.1$ ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking how to print strings... printf
checking whether make supports the include directive... yes (GNU style)
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /usr/bin/dd
checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1
checking for mt... mt
checking if mt is a manifest tool... no
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking whether gcc understands -c and -o together... (cached) yes
checking dependency style of gcc... (cached) gcc3
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9... yes
checking for itstool... itstool
checking for xmllint... xmllint
checking for GTK package to use... gtk+-2.0
checking for GLIB... yes
checking for GTK... yes
checking for LIBNAUTILUS_EXTENSION... no
configure: error: Package requirements (libnautilus-extension >= 2.0) were not met:

No package 'libnautilus-extension' found

All libnautilus-extension installed:
$ apt search nautilus-extension
Sorting... Done
Full Text Search... Done
libnautilus-extension-dev/kinetic-updates,kinetic-security,now 1:43.0-1ubuntu2.1 amd64 [installed]
  libraries for nautilus components - development version

libnautilus-extension4/kinetic-updates,kinetic-security,now 1:43.0-1ubuntu2.1 amd64 [installed]
  libraries for nautilus components - runtime version

nautilus-extension-gnome-terminal/kinetic,now 3.46.2-1ubuntu1 amd64 [installed]
  GNOME terminal emulator application - Nautilus extension

What is the procedure to configure/build nautilus-wipe to fix No package 'libnautilus-extension' found on MATE 22.10?


text:
Q: C# unable to cast object of type 'system.string' to type 'system.int32' I am getting the error unable to cast object of type 'system.string' to type 'system.int32' when retrieving a varchar column that contains data and trying it to display it in a ComboBox.
Here is my code:
private void GetFinancialCatDeactivate(int active)
        {
            try
            {
                using (var Connect = new SqlConnection(connstr))
                {
                    Connect.Open();
                    using (var Command = new SqlCommand("[dbo].[spParametresFinancesTb_GetCategories]", Connect))
                    {
                        Command.CommandType = CommandType.StoredProcedure;
                        Command.Parameters.Add("@active", SqlDbType.VarChar).Value = active;
                        SqlDataReader dr = Command.ExecuteReader();
                        while (dr.Read())
                        {
                            string catlist = dr.GetString(0)

                            ComboBoxFinanceNameDeactivate.Items.Add(catlist);
                            ComboBoxFinanceNameDeactivate.Text = catlist;
                            ComboBoxFinanceDefaultNameEdit.Items.Add(catlist);
                            ComboBoxFinanceDefaultNameEdit.Text = catlist;

                        }
                        dr.Close();
                    }

                    Connect.Close();
                }
            }
            catch (Exception ex)
            {

                MessageBox.Show(ex.Message);
            }
        }

The code is executing a stored procedure which is here:
ALTER PROCEDURE [dbo].[spParametresFinancesTb_GetCategories]
(
    @active numeric(1)
 )
AS
BEGIN
    BEGIN TRY
        SET NOCOUNT ON
            BEGIN
                    select category
                    from dbo.PARAMETRES_FINANCES
                    where active = @active;
                END;
    END TRY
    BEGIN CATCH
        SELECT
        ERROR_PROCEDURE () as ProcedureErreur,
        ERROR_MESSAGE () as MessageErreur,
        ERROR_LINE () as LigneErreur,
        ERROR_SEVERITY () as SeveriteErreur
    END CATCH
END;

The error is appearing here: ComboBoxFinanceDefaultNameEdit.Text = catlist; in the code-behind.
I find it very weird since the fist combobox is not displaying the error.
Here is how both comboboxes are made (XAML):
<ComboBox Name="ComboBoxFinanceDefaultNameEdit" Style="{StaticResource ComboBoxStyle}" SelectionChanged="ComboBoxFinanceDefaultNameEdit_SelectionChanged"/>

<ComboBox Name="ComboBoxFinanceNameDeactivate" Grid.Column="1" Style="{StaticResource ComboBoxStyle}"/>

I tried changing the ComboBoxFinanceDefaultNameEdit.Text = catlist; to ComboBoxFinanceDefaultNameEdit.SelectedItem= catlist; but it dind't change a thing.
Any idea what is going on here?
I am on .Net Core 3.1.101
EDIT
I have updated the question to add more information about the problem.
EDIT 2
I have noticed that the problem is appearing mainly on comboboxes where I have implemented a selectionchanged event. Without this event, no error. Still investigating how to fix this.
EDIT 3
I would like to mention that the error is shown as a messagebox. When I debug, it doesn't throw an exception but rather a messagebox. However, the data is still displayed in the combobox. The combobox where this problem appears is the one where I have a selectionchange event

A: I think the problem is with the @active parameter. You see you have defined it as SqlDbType.VarChar
 Command.Parameters.Add("@active", SqlDbType.VarChar).Value = active;

But in your stored procedure you have marked it as @active numeric(1).


text:
Q: How to sum a specific number of rows within a column? So I am working with a CSV file in RStudio. I am trying to find out in which row does the sum of the numbers in a specific column add up to cumulative number 0.8 (80%) (or a close value).
This is what the column looks like when I extract it
 [1] 0.165705620 0.087013121 0.066435240 0.058204088 0.046089979 0.044273757 0.038910088 0.038449322 0.027019652 0.026174169
 [11] 0.021463624 0.021065487 0.016690451 0.014252419 0.010874963 0.009340568 0.009192944 0.007493033 0.007475139 0.007403564
 [21] 0.007340935 0.006933851 0.006446245 0.006423877 0.006312041 0.006294147 0.006231519 0.006074948 0.005641023 0.005596289
 [31] 0.005046054 0.004992373 0.004285567 0.004088735 0.004079788 0.004075315 0.003838222 0.003762173 0.003574288 0.003493766
 [41] 0.003457979 0.003431138 0.003422191 0.003220886 0.003149310 0.003131417 0.003059841 0.002970372 0.002943532 0.002934585
 [51] 0.002916691 0.002863009 0.002809328 0.002733279 0.002424611 0.002415664 0.002402244 0.002361983 0.002187518 0.002174098
 [61] 0.002169624 0.002102523 0.002093576 0.002008580 0.001977266 0.001968319 0.001865430 0.001802801 0.001767014 0.001695438
 [71] 0.001690965 0.001588076 0.001588076 0.001538868 0.001529921 0.001516500 0.001449399 0.001418084 0.001382297 0.001324142
 [81] 0.001292828 0.001270460 0.001261514 0.001163098 0.001131783 0.001095996 0.001073629 0.001060208 0.001042314 0.001024421
 [91] 0.001006527 0.000979686 0.000979686 0.000975213 0.000966266 0.000926005 0.000908111 0.000908111 0.000881270 0.000876797
[101] 0.000854429 0.000845482 0.000832062 0.000787328 0.000787328 0.000782854 0.000769434 0.000733646 0.000724699 0.000697859
[111] 0.000693385 0.000693385 0.000671018 0.000671018 0.000657597 0.000644177 0.000639704 0.000621810 0.000612863 0.000581549
[121] 0.000572602 0.000572602 0.000572602 0.000550235 0.000536814 0.000536814 0.000532341 0.000523394 0.000514447 0.000509974
[131] 0.000505500 0.000505500 0.000501027 0.000496553 0.000492080 0.000469712 0.000469712 0.000465239 0.000451819 0.000442872
[141] 0.000438398 0.000429451 0.000429451 0.000424978 0.000416031 0.000416031 0.000411558 0.000407084 0.000407084 0.000389190
[151] 0.000389190 0.000384717 0.000380243 0.000380243 0.000375770 0.000366823 0.000348929 0.000339982 0.000339982 0.000339982
[161] 0.000335509 0.000335509 0.000331035 0.000317615 0.000317615 0.000313142 0.000313142 0.000304195 0.000299721 0.000299721
[171] 0.000295248 0.000286301 0.000281827 0.000281827 0.000277354 0.000272881 0.000272881 0.000268407 0.000263934 0.000259460
[181] 0.000259460 0.000259460 0.000254987 0.000250513 0.000237093 0.000232620 0.000228146 0.000228146 0.000228146 0.000223673
[191] 0.000223673 0.000223673 0.000210252 0.000205779 0.000201305 0.000201305 0.000201305 0.000201305 0.000196832 0.000196832
[201] 0.000196832 0.000192358 0.000187885 0.000187885 0.000183412 0.000183412 0.000178938 0.000174465 0.000174465 0.000169991
[211] 0.000169991 0.000169991 0.000169991 0.000165518 0.000165518 0.000161044 0.000161044 0.000156571 0.000156571 0.000156571
[221] 0.000152097 0.000152097 0.000152097 0.000152097 0.000152097 0.000152097 0.000152097 0.000147624 0.000147624 0.000147624
[231] 0.000143150 0.000138677 0.000138677 0.000138677 0.000138677 0.000134204 0.000129730 0.000120783 0.000120783 0.000116310
[241] 0.000116310 0.000116310 0.000116310 0.000111836 0.000111836 0.000111836 0.000111836 0.000107363 0.000107363 0.000107363
[251] 0.000107363 0.000102889 0.000102889 0.000102889 0.000098400 0.000098400 0.000093900 0.000093900 0.000093900 0.000093900
[261] 0.000093900 0.000093900 0.000089500 0.000089500 0.000089500 0.000089500 0.000089500 0.000089500 0.000085000 0.000085000
[271] 0.000085000 0.000080500 0.000080500 0.000080500 0.000076000 0.000076000 0.000076000 0.000071600 0.000071600 0.000071600
[281] 0.000071600 0.000067100 0.000067100 0.000067100 0.000067100 0.000067100 0.000067100 0.000062600 0.000062600 0.000062600
[291] 0.000062600 0.000058200 0.000058200 0.000058200 0.000058200 0.000058200 0.000058200 0.000058200 0.000058200 0.000053700
[301] 0.000053700 0.000053700 0.000053700 0.000053700 0.000053700 0.000053700 0.000053700 0.000049200 0.000049200 0.000049200
[311] 0.000049200 0.000049200 0.000049200 0.000049200 0.000049200 0.000044700 0.000044700 0.000044700 0.000044700 0.000044700
[321] 0.000044700 0.000044700 0.000044700 0.000044700 0.000044700 0.000044700 0.000044700 0.000044700 0.000044700 0.000044700
[331] 0.000044700 0.000040300 0.000040300 0.000040300 0.000040300 0.000040300 0.000040300 0.000040300 0.000040300 0.000040300
[341] 0.000040300 0.000035800 0.000035800 0.000035800 0.000035800 0.000035800 0.000035800 0.000035800 0.000035800 0.000035800
[351] 0.000035800 0.000035800 0.000035800 0.000035800 0.000035800 0.000031300 0.000031300 0.000031300 0.000031300 0.000031300
[361] 0.000031300 0.000031300 0.000031300 0.000031300 0.000031300 0.000031300 0.000026800 0.000026800 0.000026800 0.000026800
[371] 0.000026800 0.000026800 0.000026800 0.000026800 0.000026800 0.000026800 0.000026800 0.000026800 0.000026800 0.000026800
[381] 0.000026800 0.000026800 0.000022400 0.000022400 0.000022400 0.000022400 0.000022400 0.000022400 0.000022400 0.000022400
[391] 0.000022400 0.000022400 0.000022400 0.000022400 0.000022400 0.000022400 0.000022400 0.000022400 0.000022400 0.000022400
[401] 0.000022400 0.000022400 0.000022400 0.000017900 0.000017900 0.000017900 0.000017900 0.000017900 0.000017900 0.000017900
[411] 0.000017900 0.000017900 0.000017900 0.000017900 0.000017900 0.000017900 0.000017900 0.000017900 0.000017900 0.000017900
[421] 0.000017900 0.000017900 0.000017900 0.000017900 0.000017900 0.000017900 0.000017900 0.000017900 0.000017900 0.000017900
[431] 0.000017900 0.000017900 0.000013400 0.000013400 0.000013400 0.000013400 0.000013400 0.000013400 0.000013400 0.000013400
[441] 0.000013400 0.000013400 0.000013400 0.000013400 0.000013400 0.000013400 0.000013400 0.000013400 0.000013400 0.000013400
[451] 0.000013400 0.000013400 0.000013400 0.000013400 0.000013400 0.000013400 0.000013400 0.000013400 0.000013400 0.000013400
[461] 0.000013400 0.000013400 0.000013400 0.000013400 0.000013400 0.000013400 0.000008950 0.000008950 0.000008950 0.000008950
[471] 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950
[481] 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950
[491] 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950
[501] 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950
[511] 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950
[521] 0.000008950 0.000008950 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470
[531] 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470
[541] 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470
[551] 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470
[561] 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470
[571] 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470
[581] 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470
[591] 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470
[601] 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470
[611] 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470
[621] 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470
[631] 0.000004470

I tried using the sum function but couldn't figure out a way to sum a specific amount of rows so the function ends up summing the entire row.
library(ggplot2)

#Step 1

SumWeldInfo <- read.csv(file="C:\\Users\\ahmed\\Documents\\Assignment 4\\sum_weld_info.csv", header=TRUE, sep=",")
sum(SumWeldInfo$work.proportion)

I have also tried messing around with ggplots to see if there's a way to graph it out and figure out the number but no luck graphing the cumalative percentage. I could only graph the individual percentages.
So basically I need a function that lets me sum up a specific amount of rows in this column within a csv file OR  a function that lets the sum of a specific amount of rows equal to 0.8 and outputs how many rows it took to reach that number

A: You can use which.max to select the first TRUE value from the logcial vector created by checking the cumsum agaisnt your cutoff threshold (in this case, 0.8), and it will give you the first time the cumsum of your column is greater than or equal to 0.8:
which.max(cumsum(your_col) >= .8)
[1] 33

In the future, please include a dput() of your output, or some way for users to create a reproducible example of your question.
Data:
your_col <- c(0.165705620, 0.087013121, 0.066435240, 0.058204088, 0.046089979, 0.044273757, 0.038910088, 0.038449322, 0.027019652, 0.026174169,
0.021463624, 0.021065487, 0.016690451, 0.014252419, 0.010874963, 0.009340568, 0.009192944, 0.007493033, 0.007475139, 0.007403564,
0.007340935, 0.006933851, 0.006446245, 0.006423877, 0.006312041, 0.006294147, 0.006231519, 0.006074948, 0.005641023, 0.005596289,
0.005046054, 0.004992373, 0.004285567, 0.004088735, 0.004079788, 0.004075315, 0.003838222, 0.003762173, 0.003574288, 0.003493766,
0.003457979, 0.003431138, 0.003422191, 0.003220886, 0.003149310, 0.003131417, 0.003059841, 0.002970372, 0.002943532, 0.002934585,
0.002916691, 0.002863009, 0.002809328, 0.002733279, 0.002424611, 0.002415664, 0.002402244, 0.002361983, 0.002187518, 0.002174098,
0.002169624, 0.002102523, 0.002093576, 0.002008580, 0.001977266, 0.001968319, 0.001865430, 0.001802801, 0.001767014, 0.001695438,
0.001690965, 0.001588076, 0.001588076, 0.001538868, 0.001529921, 0.001516500, 0.001449399, 0.001418084, 0.001382297, 0.001324142,
0.001292828, 0.001270460, 0.001261514, 0.001163098, 0.001131783, 0.001095996, 0.001073629, 0.001060208, 0.001042314, 0.001024421,
0.001006527, 0.000979686, 0.000979686, 0.000975213, 0.000966266, 0.000926005, 0.000908111, 0.000908111, 0.000881270, 0.000876797,
0.000854429, 0.000845482, 0.000832062, 0.000787328, 0.000787328, 0.000782854, 0.000769434, 0.000733646, 0.000724699, 0.000697859,
0.000693385, 0.000693385, 0.000671018, 0.000671018, 0.000657597, 0.000644177, 0.000639704, 0.000621810, 0.000612863, 0.000581549,
0.000572602, 0.000572602, 0.000572602, 0.000550235, 0.000536814, 0.000536814, 0.000532341, 0.000523394, 0.000514447, 0.000509974,
0.000505500, 0.000505500, 0.000501027, 0.000496553, 0.000492080, 0.000469712, 0.000469712, 0.000465239, 0.000451819, 0.000442872,
0.000438398, 0.000429451, 0.000429451, 0.000424978, 0.000416031, 0.000416031, 0.000411558, 0.000407084, 0.000407084, 0.000389190,
0.000389190, 0.000384717, 0.000380243, 0.000380243, 0.000375770, 0.000366823, 0.000348929, 0.000339982, 0.000339982, 0.000339982,
0.000335509, 0.000335509, 0.000331035, 0.000317615, 0.000317615, 0.000313142, 0.000313142, 0.000304195, 0.000299721, 0.000299721,
0.000295248, 0.000286301, 0.000281827, 0.000281827, 0.000277354, 0.000272881, 0.000272881, 0.000268407, 0.000263934, 0.000259460,
0.000259460, 0.000259460, 0.000254987, 0.000250513, 0.000237093, 0.000232620, 0.000228146, 0.000228146, 0.000228146, 0.000223673,
0.000223673, 0.000223673, 0.000210252, 0.000205779, 0.000201305, 0.000201305, 0.000201305, 0.000201305, 0.000196832, 0.000196832,
0.000196832, 0.000192358, 0.000187885, 0.000187885, 0.000183412, 0.000183412, 0.000178938, 0.000174465, 0.000174465, 0.000169991,
0.000169991, 0.000169991, 0.000169991, 0.000165518, 0.000165518, 0.000161044, 0.000161044, 0.000156571, 0.000156571, 0.000156571,
0.000152097, 0.000152097, 0.000152097, 0.000152097, 0.000152097, 0.000152097, 0.000152097, 0.000147624, 0.000147624, 0.000147624,
0.000143150, 0.000138677, 0.000138677, 0.000138677, 0.000138677, 0.000134204, 0.000129730, 0.000120783, 0.000120783, 0.000116310,
0.000116310, 0.000116310, 0.000116310, 0.000111836, 0.000111836, 0.000111836, 0.000111836, 0.000107363, 0.000107363, 0.000107363,
0.000107363, 0.000102889, 0.000102889, 0.000102889, 0.000098400, 0.000098400, 0.000093900, 0.000093900, 0.000093900, 0.000093900,
0.000093900, 0.000093900, 0.000089500, 0.000089500, 0.000089500, 0.000089500, 0.000089500, 0.000089500, 0.000085000, 0.000085000,
0.000085000, 0.000080500, 0.000080500, 0.000080500, 0.000076000, 0.000076000, 0.000076000, 0.000071600, 0.000071600, 0.000071600,
0.000071600, 0.000067100, 0.000067100, 0.000067100, 0.000067100, 0.000067100, 0.000067100, 0.000062600, 0.000062600, 0.000062600,
0.000062600, 0.000058200, 0.000058200, 0.000058200, 0.000058200, 0.000058200, 0.000058200, 0.000058200, 0.000058200, 0.000053700,
0.000053700, 0.000053700, 0.000053700, 0.000053700, 0.000053700, 0.000053700, 0.000053700, 0.000049200, 0.000049200, 0.000049200,
0.000049200, 0.000049200, 0.000049200, 0.000049200, 0.000049200, 0.000044700, 0.000044700, 0.000044700, 0.000044700, 0.000044700,
0.000044700, 0.000044700, 0.000044700, 0.000044700, 0.000044700, 0.000044700, 0.000044700, 0.000044700, 0.000044700, 0.000044700,
0.000044700, 0.000040300, 0.000040300, 0.000040300, 0.000040300, 0.000040300, 0.000040300, 0.000040300, 0.000040300, 0.000040300,
0.000040300, 0.000035800, 0.000035800, 0.000035800, 0.000035800, 0.000035800, 0.000035800, 0.000035800, 0.000035800, 0.000035800,
0.000035800, 0.000035800, 0.000035800, 0.000035800, 0.000035800, 0.000031300, 0.000031300, 0.000031300, 0.000031300, 0.000031300,
0.000031300, 0.000031300, 0.000031300, 0.000031300, 0.000031300, 0.000031300, 0.000026800, 0.000026800, 0.000026800, 0.000026800,
0.000026800, 0.000026800, 0.000026800, 0.000026800, 0.000026800, 0.000026800, 0.000026800, 0.000026800, 0.000026800, 0.000026800,
0.000026800, 0.000026800, 0.000022400, 0.000022400, 0.000022400, 0.000022400, 0.000022400, 0.000022400, 0.000022400, 0.000022400,
0.000022400, 0.000022400, 0.000022400, 0.000022400, 0.000022400, 0.000022400, 0.000022400, 0.000022400, 0.000022400, 0.000022400,
0.000022400, 0.000022400, 0.000022400, 0.000017900, 0.000017900, 0.000017900, 0.000017900, 0.000017900, 0.000017900, 0.000017900,
0.000017900, 0.000017900, 0.000017900, 0.000017900, 0.000017900, 0.000017900, 0.000017900, 0.000017900, 0.000017900, 0.000017900,
0.000017900, 0.000017900, 0.000017900, 0.000017900, 0.000017900, 0.000017900, 0.000017900, 0.000017900, 0.000017900, 0.000017900,
0.000017900, 0.000017900, 0.000013400, 0.000013400, 0.000013400, 0.000013400, 0.000013400, 0.000013400, 0.000013400, 0.000013400,
0.000013400, 0.000013400, 0.000013400, 0.000013400, 0.000013400, 0.000013400, 0.000013400, 0.000013400, 0.000013400, 0.000013400,
0.000013400, 0.000013400, 0.000013400, 0.000013400, 0.000013400, 0.000013400, 0.000013400, 0.000013400, 0.000013400, 0.000013400,
0.000013400, 0.000013400, 0.000013400, 0.000013400, 0.000013400, 0.000013400, 0.000008950, 0.000008950, 0.000008950, 0.000008950,
0.000008950, 0.000008950, 0.000008950, 0.000008950, 0.000008950, 0.000008950, 0.000008950, 0.000008950, 0.000008950, 0.000008950,
0.000008950, 0.000008950, 0.000008950, 0.000008950, 0.000008950, 0.000008950, 0.000008950, 0.000008950, 0.000008950, 0.000008950,
0.000008950, 0.000008950, 0.000008950, 0.000008950, 0.000008950, 0.000008950, 0.000008950, 0.000008950, 0.000008950, 0.000008950,
0.000008950, 0.000008950, 0.000008950, 0.000008950, 0.000008950, 0.000008950, 0.000008950, 0.000008950, 0.000008950, 0.000008950,
0.000008950, 0.000008950, 0.000008950, 0.000008950, 0.000008950, 0.000008950, 0.000008950, 0.000008950, 0.000008950, 0.000008950,
0.000008950, 0.000008950, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470,
0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470,
0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470,
0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470,
0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470,
0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470,
0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470,
0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470,
0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470,
0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470,
0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470, 0.000004470)

A: As you have specified that you want to know how many rows should it take to sum upto 0.8, I guess you require random rows from your list of rows that sum upto 0.8. So what you can do is that start with 1 row and start increasing the number of rows till you get the sum =0.8.
If you can give me your data as a reproducible example, I will suggest you how to do it. Please give me your above data in a format so that it can be loaded into R.


text:
Q: Redis: Find keys matching a pattern How I can find keys matching a pattern like this:
Eg:
I have some keys:
abc:parent1
abc:parent2
abc:parent1:child1
abc:parent2:child2
How can I find only
abc:parent1
abc:parent2

A: Keys is specifically noted as a command not to be run in production due to the way it works. What you need here is to create an index of your keys. Use a set for storing the key names of the pattern you want. When you add a new we key, add the name of it to the set. For example:
Set abc:parent1:child1 breakfast
Sadd abc:parent1:index abc:parent1

Then when you need the list:
Smembers abc:parent1:index

Will give you the list, without the penalties and problems associated with using the "evil" keys command. Additionally you would remove an entry with sremove on key deletion. You also get as a benefit the ability to know how many keys are in the index with a single call.
If you absolutely, positively, MUST avoid using an index use SCAN instead of keys. The only time you should even consider keys is if you are running a debug slave where the only process using it is your debugging process.

A: Command KEYS pattern
will help you for the same, if it is not a production environment. (Never use keys in production)
ex:
redis> MSET one 1 two 2 three 3 four 4
OK
redis> KEYS *o*
1) "two"
2) "one"
3) "four"

For your specific example, the below command will work:
redis 127.0.0.1:6379> keys *parent[0-9]
1) "abc:parent2"
2) "abc:parent1"

Here's the detailed description of the command.
Update: Though the suggestion above helps you get the desired output, the redis KEYS command is evil as the others mentioned. KEYS is blocking and can consume a lot of RAM while preparing the response.

Don't use KEYS in your regular application code. If you're looking for a way to find keys in a subset of your keyspace, consider using SCAN or sets.

Thanks The Real Bill and Itamar, I got a better understanding.


text:
Q: Virtualized II7 page runs slow when querying against SQL server OK… I've been tasked to figure out why an intranet site is running slow for a small to medium sized company (less than 200 people).  After three days of looking on the web.  I've decided to post what I'm looking at.  Here is what I know:
Server:  HP DL380 Gen9 (new)
OS:  MS Server 2012 – running hyper-v
RAM:  32GB
Server 2012 was built to run at most 2 to 3 VMs at most (only running one VM at the moment)
16GB of RAM dedicated for the VHD (not dynamic memory)
Volume was created to house the VHD
The volume has a fixed 400GB VHD inside it.
Inside that VHD is server 2008r2 running SQL 2008r2 and hosting an iis7 intranet.
Here is what's happening:
A page in the intranet is set to run a couple of stored procedures that do some checking against data in other tables as well as insert data (some sort of attendance db) after employee data is entered.  The code looks like it creates and drops approximately 5 tables in the process of crunching the data.  The page takes about 1min50secs to run on the newer server.  I was able to get hold of the old server & run a speed test:  14 seconds.
I'm at a loss… a lot of sites say alter the code.  However it was running quick before.
Old server is a 32bit 2003 server running SQL2000… new is obviously 64bit.
Any ideas?

A: You should find out where the slowness is coming from.
The bottleneck could be in SQL-Server, in IIS, in the code, on the network?

*

*Find the SQL statements that are executed and run them directly in SQL server.

*Run the code outside of IIS web pages

*Run the code from a different server

A: Solved my own issue... just took a while for me to get back to this.  Hopefully this will help others.
Turned on SQL Activity Monitor under tools\options => at startup => Open Object Explorer and Activity Monitor.
Opened Recent Expensive Queries.  Right clicked on the top queries and selected Show Execution Plan.  This showed a missing index for the db.  Added index by clicking the plan info at the top.  Added the index.
Hope this helps!


text:
Q: Pybrain Reinforcement Learning dynamic output Can you use Reinforcement Learning from Pybrain on dynamic changing output. For example weather: lets say you have 2 attributes Humidity and Wind and the output will be either Rain or NO_Rain ( and all attributes are either going to have a 1 for true or 0 for false in the text file i am using). can you use Reinforcement Learning on this type of problem? the reason I ask is sometime even if we have humidity it does not guaranty that its going to rain.

A: It is certainly possible to train a neural network (based on pybrain or otherwise) to make predictions of this sort that are better than a coin toss.
However, weather prediction is a very complex art, even for people who do it as their full-time profession and have been for decades.  Those weather forecasters have much bigger neural networks inside their head than pybrain can simulate.  If it were possible to make accurate predictions in the way you describe, then it would have been done long ago.  For this reason, I  wouldn't expect to do better than (or even as well as) the local weather forecaster.  So, if your goal is to learn pybrain, I would pick a less complex system to model, and if your goal is to predict the weather, I would suggest www.wunderground.com.


text:
Q: Deploying MVC Program with separate stylesheets I am trying to deploy an ASP.NET MVC project. The resulting output shows that the stylesheets have not been picked up.
This is my code referencing the stylesheets:
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    <link href= "<%= Url.Content("~/Content/Site.css") %>" rel="stylesheet" type="text/css"/>
    <link href= "<%= Url.Content("~/Content/style_custom.css") %>" rel="stylesheet" type="text/css"/>
    <link href= "<%= Url.Content("~/Content/styleIFrame_custom.css") %>" rel="stylesheet" type="text/css"/>
</asp:Content>

In Publish/Package settings, I can select Items to deploy. I have choice of:

*

*Only files needed to run this application.

*All files in this project.

*All files in this project folder.

Not sure which one to pick, but I have tried all 3. The wrong option leads to an enormous deployment package.
On the deployment machine, my source code resolves to this:
<link href= "/KeyStone/Content/Site.css" rel="stylesheet" type="text/css"/>
<link href= "/KeyStone/Content/style_custom.css" rel="stylesheet" type="text/css"/>
<link href= "/KeyStone/Content/styleIFrame_custom.css" rel="stylesheet" type="text/css"/>

Maybe my only option is to put the styles in the page itself and scrap the stylesheets. Any suggestions?


text:
Q: How to save persistent variable into .mat file? I have a model of device which have internal state between calls.
Previously I passed that state in function call and returned a new state when exited from function.
Then, I found out about persistent variables which was exactly what I need. But problem is when I need to debug model or design between multiple calls it's hard to reproduce the exact call that I need.
For example, I have function foo:
function [y] = foo(x)
    persistent k;
    if isempty(k)
        k = 0;
    end
    y = k*x;
    k = k+1; %% or even k = rand
end

I have multiple runs:
x = 1:5;
for i = 1:5
    y = foo(x(i))
end

and have an error in 4'th call. Currently I need to run first three calls to get function state that actual for 4'th call (and if k was equal rand, I will not be able reach that state at all).
I tried to save workspace between calls to have an option to load all states but that doesn't work:
for i = 1:3
    y = foo(x(i))
end
save foo3.mat
for i = 4:5
    y = foo(x(i))
end
clear all
load foo3.mat
foo(3)

ans =
 0

So how can I save that function state?
Actually, I can save that variable while function is run by putting save statement in code of function but for me that's seems not right. I think that statement should be at the top-script.

A: I suppose the most appropriate solution to my question is replace persistent variable by global one. In that case I have minimum changes to original code:
function [y] = foo(x)
    global k;
    if isempty(k)
        k = 0;
    end
    y = k*x;
    k = k+1; %% or even k = rand
end

And debugging like:
x = 1:5;
for i = 1:3
    y = foo(x(i))
end
global k;
save("foo3.mat","k")
clear all
load foo3.mat
foo(4)

The best solution I found is to create class-based model and move variables that stores state into class property. I can save class-object like any other variable so I can save any intermediate state of model:
classdef foo < handle
    properties(Access = private)
       k;
    end
    methods
        function self = foo()
            self.k = 0;
        end
        function [y] = bar(self, x)
            y = self.k*x;
            self.k = self.k+1; %% or even k = rand
        end
    end
end

And debug like:
f = foo();
x = 1:5;
for i = 1:3
    y = f.bar(x(i))
end
save bar3.mat
for i = 4:5
    y = f.bar(x(i))
end
clear f
load bar3.mat
f.bar(4)

In that case I don't need to pass and return states and I can load any inermediate state.

A: A couple of options:
clear
Dont use 'clear all'.   You rarely if ever need to do clear all, a simple clear is usually sufficient.
mlock
Put mlock in your function, note this has other implications which you should understand by looking at the documentation.  Primarily you have to unlock (munlock) it to edit the function file.
Note this will keep your persistent variable for the matlab session only.
function [y] = foo(x)
    persistent k;
    mlock;
    if isempty(k)
        k = 0;
    end
    y = k*x;
    k = k+1; %% or even k = rand
end


text:
Q: PHP error_reporting: what does "reporting" mean? I have a PHP REST API endpoint that throws an error:
PHP message: PHP Fatal error:  Uncaught Exception: Accessing static property...as non static in...

with the default error_reporting value but returns a correct value if error_reporting is set to 1, which I believe is E_ERROR.
Doesn't error_reporting just control the logging? This seems to control whether the exception is thrown as well, allowing the code to continue as normal.
I come from a Java background, used to using Logback and similar logging frameworks. In these frameworks, the log level refers to a filter for the recipient of the logs, commonly a log file. A log level X means that messages need to be at least level X (or lower than, I forget which) to be logged, but it doesn't affect whether the exception is thrown to begin with.
I had assumed that this was the case with PHP's error_reporting, however, based on the above behavior I am not sure.
I've looked through the PHP docs, but I haven't found a detailed explanationof how error_reporting works
So, my question: What does "reporting" mean here? Does error_reporting control more besides which exceptions/errors are logged?

A: error_reporting is a bit different with the log level, the argument is a set of toggles for each error type.
For example error_reporting(E_ERROR) only reports errors and error_reporting(E_NOTICE) only reports notices and error_reporting(E_ERROR|E_NOTICE) reports both errors and notices but doesn't report warnings.
FYI the error level of this message "Accessing static property...as non static in..." is E_STRICT in PHP 5 and E_NOTICE in PHP 7 by default.
This is weired because you got an exception, I guess the problem that changes the behaviour of the error is in your error handler.


text:
Q: How to iterate ngcontainer tag in angular 6 I'm trying to create a table using angular material, code given below is working fine so far, but it seems duplicating 'ng-container' for each columns. Is there any way to iterate through this in Typescript?
HTML
<div class="example-container mat-elevation-z8">

<!-- Name Column -->
<ng-container matColumnDef="name" sticky>
  <th mat-header-cell *matHeaderCellDef> Name </th>
  <td mat-cell *matCellDef="let element"> {{element.name}} </td>
</ng-container>

<!-- Position Column -->
<ng-container matColumnDef="position">
  <th mat-header-cell *matHeaderCellDef> No. </th>
  <td mat-cell *matCellDef="let element"> {{element.position}} </td>
</ng-container>

<!-- Weight Column -->
<ng-container matColumnDef="weight">
  <th mat-header-cell *matHeaderCellDef> Weight </th>
  <td mat-cell *matCellDef="let element"> {{element.weight}} </td>
</ng-container>

Please suggest.

A: Here is the code in typescript. You can convert to angular using NgFor keyPair pipe.
let element = {
  name: 'test 1',
  position: 0,
  weight: 500
};

for(let itemkey in element){

  console.log(elem);

  <ng-container matColumnDef="{{itemkey}}" sticky>
  <th mat-header-cell *matHeaderCellDef> {{itemkey.charAt(0).toUpperCase()}} </th>
  <td mat-cell *matCellDef="let element"> {{element[itemkey]}} </td>
  </ng-container>

}


text:
Q: cant unzip file in GCP jupyterlab notebook: 'End-of-central-directory signature not found.' I am running python 3
I am trying to unzip my train.zip dataset on a GCP notebook instance, however whenever I try to I get a various error:
First I tried:
import os
from zipfile import ZipFile

os.path.exists('/home/jupyter/kerasProject/original_dataset/train.zip')
True

zip_file = ZipFile('/home/jupyter/kerasProject/original_dataset/train.zip')

Error:
BadZipFile: File is not a zip file

Then I tried:
!unzip '/home/jupyter/kerasProject/original_dataset/train.zip'

Error:
Archive:  /home/jupyter/kerasProject/original_dataset/train.zip
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
unzip:  cannot find zipfile directory in one of /home/jupyter/kerasProject/original_dataset/train.zip or
        /home/jupyter/kerasProject/original_dataset/train.zip.zip, and cannot find /home/jupyter/kerasProject/original_dataset/train.zip.ZIP, period.

For some reason in both cases it does not recogise the file as a .zip file, I tried reuploading it but it doesn't help, I can unzip it on my mac no problems so I don't think it can be corrupt, what have I done wrong?


text:
Q: Overlapping lightmap using auto generated UVs (Unreal) Sorry if this is something basic, I'm quite new to unreal. I have a project with a cube grid mesh and wanted to bake lighting, yet when I do I get an "Overlapping lightmaps" error for the CubeGrid mesh.

I auto-generated the lightmap UVs, set the "Light Map Coordinate Index" to 1, and set the "Light Map Resolution" high enough that it's green.

here is what UV channel 1 looks like

These are all the steps I saw online, so there's got to be something I'm missing. All help is greatly appreciated!