text:
Q: Invalid property value for multiple backgrounds with image and linear-gradient I'm trying to set up a select element with multiple backgrounds (one image, and one linear-gradient). It worked while I was developing, but for some reason it stopped working when it was pushed to production.
Here's the code I started with (in SCSS):
$select-arrow-uri: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAAICAYAAAAvOAWIAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyNpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNS1jMDIxIDc5LjE1NDkxMSwgMjAxMy8xMC8yOS0xMTo0NzoxNiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIChNYWNpbnRvc2gpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOkExMjY4NTZGRTdCNTExRTNCOEJDRDIyQTAwRDQ5MzU2IiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOkExMjY4NTcwRTdCNTExRTNCOEJDRDIyQTAwRDQ5MzU2Ij4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6QTEyNjg1NkRFN0I1MTFFM0I4QkNEMjJBMDBENDkzNTYiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6QTEyNjg1NkVFN0I1MTFFM0I4QkNEMjJBMDBENDkzNTYiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz4L3nSlAAAAm0lEQVR42mL4//8/AwinpKQowtjIGCguB2MzMQBBampqF5A6D6TNGJAAkG8DpK4C6UYQnxGo0xhInwRiZiD+CMRus2fPPgVVuB2IeYD4FxAbMoKMB0rEAjnzkTRUAnEXksJooAFrwIqhViYAqTlQDTAAVwh2Bkwxkob5UO5fII6AKQQBJmQPASUWAKlEqMJoZIVgQCi4kDFAgAEAFOFxgtML2dkAAAAASUVORK5CYII=';

select{
    background-color: #f5f5f5;
    background-image: url("#{$select-arrow-uri}");
    background-image: url("#{$select-arrow-uri}"), -webkit-linear-gradient(bottom, #e5e5e5 0%, #f5f5f5 100%);
    background-image: url("#{$select-arrow-uri}"), linear-gradient(#e5e5e5 0%, #f5f5f5 100%);
    background-position: 95% center;
    background-repeat: no-repeat;
}

and this is how it is appearing in the browser:
background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAAICAYAAAAvOAWIAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyNpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNS1jMDIxIDc5LjE1NDkxMSwgMjAxMy8xMC8yOS0xMTo0NzoxNiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIChNYWNpbnRvc2gpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOkExMjY4NTZGRTdCNTExRTNCOEJDRDIyQTAwRDQ5MzU2IiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOkExMjY4NTcwRTdCNTExRTNCOEJDRDIyQTAwRDQ5MzU2Ij4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6QTEyNjg1NkRFN0I1MTFFM0I4QkNEMjJBMDBENDkzNTYiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6QTEyNjg1NkVFN0I1MTFFM0I4QkNEMjJBMDBENDkzNTYiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz4L3nSlAAAAm0lEQVR42mL4//8/AwinpKQowtjIGCguB2MzMQBBampqF5A6D6TNGJAAkG8DpK4C6UYQnxGo0xhInwRiZiD+CMRus2fPPgVVuB2IeYD4FxAbMoKMB0rEAjnzkTRUAnEXksJooAFrwIqhViYAqTlQDTAAVwh2Bkwxkob5UO5fII6AKQQBJmQPASUWAKlEqMJoZIVgQCi4kDFAgAEAFOFxgtML2dkAAAAASUVORK5CYII=) 95% center no-repeat,
linear,to bottom,#e5e5e5,#f5f5f5;

When I remove the background-image rule with linear-gradient, it works fine. It doesn't have any problems with the -webkit-linear-gradient line, just the linear-gradient line.
Is there a syntax issue? Could Sass be compiling weird? Is it trouble with the URI string?
Please help! Thanks!

A: Figured it out. I have the Bourbon library loaded, and there is a function for linear-gradient that is made to work with the background-image mixin, and that was being used without using the background-image mixin. I switched to the background-image mixin to get it to work, but I'll probably report this to them. Not cool Bourbon.


text:
Q: Find the standard deviation based on the mean and deviating sample For $1000$ gnomes, $390$ of them were found to deviate from the arithmetic mean in height by no more than $1.4$ inches ($\overline{x} = 57.3$ inches). Can an approximate value for the standard deviation be determined from this data if a normal distribution is assumed?
Attempt
We know that $39$ percent of the gnomes do deviate from the arithmetic mean. Then, find a corresponding $z$-score, which is $z = \pm1.23$. Since I don't know the exact sample values, I don't know how to proceed.

A: Yes, and we don't even need to know what the mean of the data is.

Due to symmetry, $P(x\leq \mu + 1.4) = 0.5 + \frac{0.39}{2} = 0.695.$
$\Phi^{-1}(0.695) = 0.510\ldots.$ Therefore, $\ 0.510\ldots = \frac{\mu+1.4 - \mu}{\sigma}\implies \sigma = \frac{1.4}{0.510\ldots} = 2.7447\ldots.$

redpajama_set_name: RedPajamaStackExchange


text:
Q: Azure SQL Data Sync blocks changes to database made with AJAX I am trying to use Azure SQL Data Sync to sync the data between my development and production databases, which are both hosted on Azure. The site promotes events, and each event has a page made from the data from the database. I also have an AJAX form built with jQuery that calls an API created with node, which allows an admin user to create, update, and delete events from the database. I have all of this working like I want it to, and I have a production site and a slot with a development version of the site that look at 2 different databases. So far, so good, I can update both databases with the AJAX form on the different sites.
The next step was to set up Azure SQL Data Sync so that I can keep both sites' databases in sync. The way I want this to eventually work is that a user can create/edit/delete an event page on the development site via the AJAX form and then show it to the manager, who approves it, at which point we'll sync the databases and push the new data to the production database. I would also like to be able to make small changes straight to the production site and have them also sync to the development database. Basically I want to have an approval step for big changes and an easy way to make small edits that don't need approval.
When I set up Azure SQL Data Sync, it syncs the first time just fine and if I use SQL Server Management Studio to edit a table on one of the databases and then sync them, it also syncs the changes as expected.
The problem is when I make a change with the AJAX form it is no longer saves the change to the database. I could make changes with the AJAX form before setting up Azure SQL Data Sync and if I delete the sync group I can make them again, but I need to be able to make changes with the form so that non-programmers can also edit the site.
I hope that explains my question well. Normally I'd paste code, but there is no code involved in setting up Azure SQL Data Sync, just settings on Azure. If there is code that you think would help or would like to see, please let me know and I'll post.
Thanks in advance for all the help!


text:
Q: #1064 SQL error I recently started learning some laravel and I am following this guide :
http://www.packtpub.com/article/laravel4-creating-a-simple-crud-application-in-hours
However , I am getting sql syntax error when I try to create the database. Does anyone have an idea what could be the problem in this query?
 CREATE TABLE IF NOT EXISTS 'users' (
  'id' int(10) unsigned NOT NULL AUTO_INCREMENT,
  'username' varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  'password' varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  'email' varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  'phone' varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  'name' varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  'created_at' timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  'updated_at' timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY ('id')
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
 AUTO_INCREMENT=3 ;

A: Get rid of '' across the column names and table name, you have added '' for table name and column names which is invalid. you can use backticks if you want, but not needed unless you are using some reserved keywords
CREATE TABLE IF NOT EXISTS users (
  id int(10) unsigned NOT NULL AUTO_INCREMENT,
  username varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  password varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  email varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  phone varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  name varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  created_at timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  updated_at timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (id)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
 AUTO_INCREMENT=3 ;

A: Error 1064 is unexpected litteral, you've got single quotes(') around your table and column names, not backticks(`).
CREATE TABLE IF NOT EXISTS `users` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `username` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `password` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `phone` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
 AUTO_INCREMENT=3 ;

A: Try,
Your Query is working Perfectly Except ''
 CREATE TABLE IF NOT EXISTS users (
      id int(10) unsigned NOT NULL AUTO_INCREMENT,
      username varchar(255) COLLATE utf8_unicode_ci NOT NULL,
      password varchar(255) COLLATE utf8_unicode_ci NOT NULL,
      email varchar(255) COLLATE utf8_unicode_ci NOT NULL,
      phone varchar(255) COLLATE utf8_unicode_ci NOT NULL,
      name varchar(255) COLLATE utf8_unicode_ci NOT NULL,
      created_at timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
      updated_at timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
      PRIMARY KEY (id)
    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
     AUTO_INCREMENT=3 ;

****select * from users****


text:
Q: Does the Uncharted 1&2 Twin Pack come with the bonuses of Uncharted 2 GOTY? Sony recently released an Uncharted 1 & 2 Twin Pack (in Australia at least). I haven't played either before and was wondering if getting this bundle was worth it. Uncharted 2 Game of the Year Edition comes with some perks that look good, but the Twin Pack seems like it contains the original version of #2 (from its cover art and list of features). This seems a bit odd to me considering the GOTY version came out a year or so previous.
Has anyone had experience with this Twin Pack? Or does someone know for sure what's included one way or another?

A: At least in the US, my copy of Uncharted 2 in the twin pack is the GOTY edition, and came with a PSN voucher code for all the bonus content.  I can't be sure this is the case with an Australian copy, but it doubly doesn't make sense for there to be a GOTY edition they're not giving you AND for there to be a version difference this significant between the regions.


text:
Q: Log Error Using The Grid Pluging on Wordpress Im creating a new website, and installed The Grid pluging because its mostly the best pluging for grid in wordpress, but when im going to use it im getting this console error, its the first time im getting this error have more than 10 pages with it.
This is the pluging: https://codecanyon.net/item/the-grid-responsive-wordpress-grid-plugin/13306812
https://imgur.com/a/5zPWoYQ
Any advice for whats going on
Its a fresh wordpress installation
Using CESIS THEME (Iñve used before this theme with the pluging, several websites)
Using last version of wordpress.
Tried disabling all my pluging except the grid.
I've tried several things.
If can help would appreciate
Thanks
Rodrigo Zuluaga
LOG ERROR
slider.min.js?ver=1.11.4:11 Uncaught TypeError: a.toFixed is not a function
    at a.<computed>.<computed>._calculateNewMax (slider.min.js?ver=1.11.4:11)
    at a.<computed>.<computed>._calculateNewMax (widget.min.js?ver=1.11.4:11)
    at a.<computed>.<computed>._create (slider.min.js?ver=1.11.4:11)
    at a.<computed>.<computed>._create (widget.min.js?ver=1.11.4:11)
    at a.<computed>.<computed>._createWidget (widget.min.js?ver=1.11.4:11)
    at new a.<computed>.<computed> (widget.min.js?ver=1.11.4:11)
    at HTMLSpanElement.<anonymous> (widget.min.js?ver=1.11.4:11)
    at Function.each (load-scripts.php?c=0…lupload&ver=5.2.4:2)
    at a.fn.init.each (load-scripts.php?c=0…lupload&ver=5.2.4:2)
    at a.fn.init.a.fn.<computed> [as slider] (widget.min.js?ver=1.11.4:11)
_calculateNewMax    @   slider.min.js?ver=1.11.4:11
(anonymous) @   widget.min.js?ver=1.11.4:11
_create @   slider.min.js?ver=1.11.4:11
(anonymous) @   widget.min.js?ver=1.11.4:11
_createWidget   @   widget.min.js?ver=1.11.4:11
a.<computed>.<computed> @   widget.min.js?ver=1.11.4:11
(anonymous) @   widget.min.js?ver=1.11.4:11
each    @   load-scripts.php?c=0…lupload&ver=5.2.4:2
each    @   load-scripts.php?c=0…lupload&ver=5.2.4:2
a.fn.<computed> @   widget.min.js?ver=1.11.4:11
(anonymous) @   tomb.js?ver=1.0:579
each    @   load-scripts.php?c=0…lupload&ver=5.2.4:2
each    @   load-scripts.php?c=0…lupload&ver=5.2.4:2
init    @   tomb.js?ver=1.0:575
init    @   tomb.js?ver=1.0:42
(anonymous) @   tomb.js?ver=1.0:18
i   @   load-scripts.php?c=0…lupload&ver=5.2.4:2
fireWith    @   load-scripts.php?c=0…lupload&ver=5.2.4:2
ready   @   load-scripts.php?c=0…lupload&ver=5.2.4:2
J   @   load-scripts.php?c=0…lupload&ver=5.2.4:2

2wp-auth-check.min.js?ver=5.2.4:1 Uncaught TypeError: Cannot read property 'hasClass' of undefined
    at HTMLDocument.<anonymous> (wp-auth-check.min.js?ver=5.2.4:1)
    at HTMLDocument.dispatch (load-scripts.php?c=0&load[]=jquery-core,jquery-migrate,utils,underscore,shortcode,moxiejs,plupload&ver=5.2.4:3)
    at HTMLDocument.r.handle (load-scripts.php?c=0&load[]=jquery-core,jquery-migrate,utils,underscore,shortcode,moxiejs,plupload&ver=5.2.4:3)
    at Object.trigger (load-scripts.php?c=0&load[]=jquery-core,jquery-migrate,utils,underscore,shortcode,moxiejs,plupload&ver=5.2.4:3)
    at Object.a.event.trigger (load-scripts.php?c=0&load[]=jquery-core,jquery-migrate,utils,underscore,shortcode,moxiejs,plupload&ver=5.2.4:8)
    at HTMLDocument.<anonymous> (load-scripts.php?c=0&load[]=jquery-core,jquery-migrate,utils,underscore,shortcode,moxiejs,plupload&ver=5.2.4:3)
    at Function.each (load-scripts.php?c=0&load[]=jquery-core,jquery-migrate,utils,underscore,shortcode,moxiejs,plupload&ver=5.2.4:2)
    at a.fn.init.each (load-scripts.php?c=0&load[]=jquery-core,jquery-migrate,utils,underscore,shortcode,moxiejs,plupload&ver=5.2.4:2)
    at a.fn.init.trigger (load-scripts.php?c=0&load[]=jquery-core,jquery-migrate,utils,underscore,shortcode,moxiejs,plupload&ver=5.2.4:3)
    at Object.<anonymous> (heartbeat.min.js?ver=5.2.4:1)
(anonymous) @ wp-auth-check.min.js?ver=5.2.4:1
dispatch @ load-scripts.php?c=0&load[]=jquery-core,jquery-migrate,utils,underscore,shortcode,moxiejs,plupload&ver=5.2.4:3
r.handle @ load-scripts.php?c=0&load[]=jquery-core,jquery-migrate,utils,underscore,shortcode,moxiejs,plupload&ver=5.2.4:3
trigger @ load-scripts.php?c=0&load[]=jquery-core,jquery-migrate,utils,underscore,shortcode,moxiejs,plupload&ver=5.2.4:3
a.event.trigger @ load-scripts.php?c=0&load[]=jquery-core,jquery-migrate,utils,underscore,shortcode,moxiejs,plupload&ver=5.2.4:8
(anonymous) @ load-scripts.php?c=0&load[]=jquery-core,jquery-migrate,utils,underscore,shortcode,moxiejs,plupload&ver=5.2.4:3
each @ load-scripts.php?c=0&load[]=jquery-core,jquery-migrate,utils,underscore,shortcode,moxiejs,plupload&ver=5.2.4:2
each @ load-scripts.php?c=0&load[]=jquery-core,jquery-migrate,utils,underscore,shortcode,moxiejs,plupload&ver=5.2.4:2
trigger @ load-scripts.php?c=0&load[]=jquery-core,jquery-migrate,utils,underscore,shortcode,moxiejs,plupload&ver=5.2.4:3
(anonymous) @ heartbeat.min.js?ver=5.2.4:1
i @ load-scripts.php?c=0&load[]=jquery-core,jquery-migrate,utils,underscore,shortcode,moxiejs,plupload&ver=5.2.4:2
fireWith @ load-scripts.php?c=0&load[]=jquery-core,jquery-migrate,utils,underscore,shortcode,moxiejs,plupload&ver=5.2.4:2
x @ load-scripts.php?c=0&load[]=jquery-core,jquery-migrate,utils,underscore,shortcode,moxiejs,plupload&ver=5.2.4:4
c @ load-scripts.php?c=0&load[]=jquery-core,jquery-migrate,utils,underscore,shortcode,moxiejs,plupload&ver=5.2.4:4
XMLHttpRequest.send (async)
send @ load-scripts.php?c=0&load[]=jquery-core,jquery-migrate,utils,underscore,shortcode,moxiejs,plupload&ver=5.2.4:4
ajax @ load-scripts.php?c=0&load[]=jquery-core,jquery-migrate,utils,underscore,shortcode,moxiejs,plupload&ver=5.2.4:4
j @ heartbeat.min.js?ver=5.2.4:1
k @ heartbeat.min.js?ver=5.2.4:1
m @ heartbeat.min.js?ver=5.2.4:1
(anonymous) @ heartbeat.min.js?ver=5.2.4:1
dispatch @ load-scripts.php?c=0&load[]=jquery-core,jquery-migrate,utils,underscore,shortcode,moxiejs,plupload&ver=5.2.4:3
r.handle @ load-scripts.php?c=0&load[]=jquery-core,jquery-migrate,utils,underscore,shortcode,moxiejs,plupload&ver=5.2.4:3


text:
Q: Sending multiple parameters from Asp.Net to my stored procedure in SQL Server I have a list box in Asp.Net from where the user selects one or multiple parameters and send it to a stored procedure. The selected of number of parameters depends completely on the user so I don't know how many parameters the user is going to choose from the list box. I also want to retrieve data back from the table with those parameters when I click on the Submit button and display on a gridview. The issue I am having is I can send one parameter and retrieve data back from my stored procedure but I really don't know how to send multiple parameters from the list box to my stored procedure.
Below is the code for single parameter in Asp.Net
protected void Button_Click(object sender, EventArgs e)
{
    string s = "Submit";
    SqlCommand cmd = new SqlCommand(s, con);

    cmd.CommandType = CommandType.StoredProcedure;

    cmd.Parameters.Add("@Name", SqlDbType.VarChar).Value = lbCT.SelectedItem.Value;

    con.Open();

    SqlDataAdapter da = new SqlDataAdapter(cmd);
    DataSet ds = new DataSet();
    da.Fill(ds);

    gvDS.DataSource = ds;
    gvDS.DataBind();

    con.Close();
}

Below is my stored procedure in SQL Server
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER PROCEDURE [Submit]
    @Name VARCHAR(12)
AS
BEGIN
    SELECT *
    FROM Employee
    WHERE Name = @Name
END

A: You are sending just parameter and using equals "=" operator. Instead of this, you should send all selected items and split your parameter by delimiter.
Please follow these steps:
1.Create a new sql function for split name/names
CREATE FUNCTION dbo.splitstring (@stringToSplit VARCHAR(MAX))
RETURNS
 @returnList TABLE ([Name] [nvarchar] (500))
AS
BEGIN

 DECLARE @name NVARCHAR(255)
 DECLARE @pos INT

 WHILE CHARINDEX(',', @stringToSplit) > 0
 BEGIN
  SELECT @pos  = CHARINDEX(',', @stringToSplit)
  SELECT @name = SUBSTRING(@stringToSplit, 1, @pos-1)

  INSERT INTO @returnList
  SELECT @name

  SELECT @stringToSplit = SUBSTRING(@stringToSplit, @pos+1, LEN(@stringToSplit)-@pos)
 END

 INSERT INTO @returnList
 SELECT @stringToSplit

 RETURN
END

2.Update your procedure

WHERE Name in (Select dbo.splitstring (@Names))

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER PROCEDURE [Submit]
    @Names VARCHAR(MAX)
AS
BEGIN
    SELECT *
    FROM Employee
    WHERE Name in (Select dbo.splitstring (@Names))
END

3.Update your Codebehind parameter

cmd.Parameters.Add("@Names", SqlDbType.VarChar).Value = join all
  selected items with ','

protected void Button_Click(object sender, EventArgs e)
{
    string s = "Submit";
    SqlCommand cmd = new SqlCommand(s, con);

    cmd.CommandType = CommandType.StoredProcedure;

    cmd.Parameters.Add("@Names", SqlDbType.VarChar).Value = /*join all selected items with ','*/

    con.Open();

    SqlDataAdapter da = new SqlDataAdapter(cmd);
    DataSet ds = new DataSet();
    da.Fill(ds);

    gvDS.DataSource = ds;
    gvDS.DataBind();

    con.Close();
}


text:
Q: Rok and Mog, robotic creatures in an Arthurian plot. Published in Asimov's or Analog within last 10 years Unusual story of two robot like creatures named Rok and Mog who lived on a dark, metallic planet, lots of clinks, clanks, and spires.  Had a sort of Arthurian plot where one of them scales a spire to save a female type robot/machine? I pictured them as metal spider creatures.  There was also a humanoid creature who got paid and wanted to buy 'a sex from a Johnny' or something like that.
I believe this is the same author who wrote a more recent story about economics and space/time travel, with immortal space ships with names like Dividends and Profit, that captured the protagonist and time traveled him to avoid an encroaching black hole that was eating the universe.  It time looped around with DNA clones of customers or shareholders to repopulate the universe.


text:
Q: cakephp pagination's and finds hi all I'm trying to have pagination in a table in one of my views, I have my find statement returning the correct set of results however I am unsure how I can make my table be able to sort the information I have found.
here is the controller, when I try paginate the find all i get is errors
public function index_admin(){
    //displays all disputes related to account.id
    //in a dashboard for an administrator user

    $this->set('title_for_layout', 'Dispute');
    $this->set('stylesheet_used', 'homestyle');
    $this->set('image_used', 'eBOXLogoHome.png');
    $this->layout='home_layout';

    //gets the User.account_id
    $id = $this->Auth->User('account_id');
    $conditions=array("OR"=> array(
        'Invoice.sender_id' => $id,
        'Invoice.receiver_id' => $id));

    $receiver=$this->Dispute->find('all',array(
    'conditions'=>$conditions));

    $this->set('receiver',$receiver);
    $this->paginate('Dispute');
    $this->set('id',$id);

}

here is the code for the view

                <?php echo $this->Paginator->sort('id', 'Invoice ID'); ?>
                <?php echo $this->Paginator->sort('dispute_date', 'Dispute Created'); ?>
                <?php echo $this->Paginator->sort('status', 'Status'); ?>
                Actions

    <?php foreach($receiver as $receivers):?>

        <?php echo $receivers['Invoice']['id'] ;?>
        <?php echo $receivers['Dispute']['dispute_date'] ;?>

    <?php

    if($receivers['Dispute']['active']==1)
    {
        $status = 'Active';
        $bgcol = '#B9FAEA';
    }
    else
    {
        $status = 'Resolved';
        $bgcol = '#FAB9B9';
    }
    ?><td align='center' bgcolor='<?php echo $bgcol ?>'><?php echo $status ?>
    <?php echo $this->Form->Html->link('View',
                                array('controller' => 'Messages','action'=>'viewMessage_admin',$receivers['Dispute']['id'])); ?>
                <?php echo $this->Form->Html->link('Resolve',
                                array('controller' => 'Disputes','action'=>'resolve',$receivers['Dispute']['id'])); ?>

<?php endforeach; ?>

A: You should call paginate instead of find, not after it:
$id = $this->Auth->User('account_id');
$conditions=array("OR"=> array(
    'Invoice.sender_id' => $id,
    'Invoice.receiver_id' => $id));

$receiver=$this->paginate('Dispute', $conditions);
$this->set('receiver',$receiver);
$this->set('id',$id);

A: CakePHP reference for pagination in controller side as wee as on view side so it will give you deep knowledge in paginator of cakePHP
http://book.cakephp.org/2.0/en/core-libraries/components/pagination.html
http://book.cakephp.org/1.3/view/1233/Pagination-in-Views
example
http://bakery.cakephp.org/articles/rtconner/2007/06/13/basic-pagination-overview-1-2


text:
Q: Cloudwatch near real time metrics & EC2 sends metric 1 minute periods http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-cloudwatch.html
Based on the above article and the FAQ, is there another article which can I help me better understand the near real time metrics and EC2 sending metric to Cloudwatch in 1-minute periods?
The FAQ did state near real time for events and log, "CloudWatch Events is a near real time stream" and "With CloudWatch Logs, you can monitor your logs, in near real time".
Is it, EC2 will send metrics in 1-minute interval to Cloudwatch. Metric which trigger an alarm will be sent to cloudwatch in near real time, not wait for the 1-minute interval.
  Thanks!

A: AWS have three levels of monitoring frequency

*

*"standard" the free tier 5 minute metrics

*"detailed" the pay for version, 1 minute metrics

*"high resolution" anything under 1 minute

You specifically asked about alarms.  Under high resolution, alarms can be configured for as fast as 10 seconds.
See https://aws.amazon.com/about-aws/whats-new/2017/07/amazon-cloudwatch-introduces-high-resolution-custom-metrics-and-alarms/ for an overview
The normal limit for putMetric adding data is 3 per second see
http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_limits.html
Also you mentioned EC2 specific, default metrics such as CPU and disk.
High resolution metrics are always custom metrics.  AWS metrics are not high resolution

Metrics produced by AWS services are standard resolution by default. When you publish a custom metric, you can define it as either standard resolution or high resolution. When you publish a high-resolution metric, CloudWatch stores it with a resolution of 1 second, and you can read and retrieve it with a period of 1 second, 5 seconds, 10 seconds, 30 seconds, or any multiple of 60 seconds.

(see http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/publishingMetrics.html)

A: CloudWatch Events sends metrics to Amazon CloudWatch every minute.
This article from Amazon will help you with more details:
http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cwe-metricscollected.html


text:
Q: Inverse of a matrix I have a variance covariance matrix $n \times n$ $$V = \sigma^2 \begin{pmatrix} 1 & \rho & \rho & ... & \rho \\ \rho & 1 & \rho & ... & \rho \\ ... & ... & ... & ... & ... \\ \rho &\rho & \rho & ... & 1\end{pmatrix} $$ where $\rho$ is the correlation coefficient and I write it as $$V =\sigma^2 [ (1-\rho)I_n + \rho J_n ] $$ where $I_n$ is the identity matrix and $J_n$ is a matrix with 1s. I want to show that the inverse matrix is $$V^{-1} = \frac{1}{\sigma^2} \Bigg[ \frac{J_n}{n[1+(n-1)\rho]} + \frac{1}{1-\rho}\Big( I_n  - \frac{1}{n}J_n \Big)  \Bigg] $$
How can I show that? Thank you...

A: Since for an invertible matrix $M$ and a scalar $\lambda \neq 0$, the inverse of $\lambda M$ is $\lambda^{-1}M$, it suffices to treat the case $\sigma=1$. A useful identity is $J_n^2=nJ_n$. Denote
$$
a= \frac{1}{n[1+(n-1)\rho]} - \frac{1}{n(1-\rho)   }  ; b=\frac 1{1-\rho}
$$
We have to prove that
$$
(aJ_n+bI_n)\left((1-\rho)I_n+\rho J_n\right)=I_n.
$$
Expanding the left hand side gives
$$
(aJ_n+bI_n)\left((1-\rho)I_n+\rho J_n\right)= a(1-\rho) J_n+a\rho nJ_n+b(1-\rho)I_n+b\rho J_n
$$
and since $b(1-\rho)=1$, this reduces to
$$
(aJ_n+b)\left((1-\rho)I_n+\rho J_n\right)=I_n+\left(a(1-\rho)+a\rho n+b\rho \right)J_n.
$$
Since
$$
a(1-\rho)+a\rho n=a\left(1+(n-1)\rho\right)=\frac 1n-\frac{1+(n-1)\rho}{n(1-\rho)}
,$$
we get
$$
a(1-\rho)+a\rho n+b\rho =\frac 1n+\frac{-1-(n-1)\rho+n\rho}{n(1-\rho)}=0.
$$


text:
Q: How can I recover system files damage when sfc isn't working? I have a lot of electricity outage in my area. It caused disk damage which lead to system files loss.
I've run Chkdsk and here's the results of the recent checks: CHKDSKResults.txt.
I've run sfc /scannow and it gives me this message as a result:
Windows Resource Protection found corrupt files but was unable to fix some of them. Details are included in the CBS.Log windir\Logs\CBS\CBS.log. For example C:\Windows\Logs\CBS\CBS.log. Note that logging is currently not supported in offline servicing scenarios.

Here's the mentioned file: CBS.log.
My operating system is Windows 8.1 Enterprise x64-bit.
How can I fix my system files in this case knowing that I don't have any backup images or restore points?

A: A file of inbox driver fro Canon printers can't be repaired:
2014-09-23 06:25:37, Info                  CSI    00000816 [SR] Cannot repair member file [l:36{18}]"Amd64\CNBJ2530.DPB" of prncacla.inf, Version = 6.3.9600.16384, pA = PROCESSOR_ARCHITECTURE_AMD64 (9), Culture neutral, VersionScope = 1 nonSxS, PublicKeyToken = {l:8 b:31bf3856ad364e35}, Type = [l:24{12}]"driverUpdate", TypeName neutral, PublicKey neutral in the store, hash mismatch
2014-09-23 06:25:37, Info                  CSI    00000818 [SR] Cannot repair member file [l:24{12}]"msxactps.dll" of Microsoft-Windows-Microsoft-Data-Access-Components-(MDAC)-Oledb-Interface-Remoting-XACTPS, Version = 6.3.9600.16384, pA = PROCESSOR_ARCHITECTURE_INTEL (0), Culture neutral, VersionScope = 1 nonSxS, PublicKeyToken = {l:8 b:31bf3856ad364e35}, Type neutral, TypeName neutral, PublicKey neutral in the store, hash mismatch
2014-09-23 06:25:38, Info                  CSI    0000081a [SR] Cannot repair member file [l:36{18}]"Amd64\CNBJ2530.DPB" of prncacla.inf, Version = 6.3.9600.16384, pA = PROCESSOR_ARCHITECTURE_AMD64 (9), Culture neutral, VersionScope = 1 nonSxS, PublicKeyToken = {l:8 b:31bf3856ad364e35}, Type = [l:24{12}]"driverUpdate", TypeName neutral, PublicKey neutral in the store, hash mismatch
2014-09-23 06:25:38, Info                  CSI    0000081c [SR] Cannot repair member file [l:24{12}]"msxactps.dll" of Microsoft-Windows-Microsoft-Data-Access-Components-(MDAC)-Oledb-Interface-Remoting-XACTPS, Version = 6.3.9600.16384, pA = PROCESSOR_ARCHITECTURE_INTEL (0), Culture neutral, VersionScope = 1 nonSxS, PublicKeyToken = {l:8 b:31bf3856ad364e35}, Type neutral, TypeName neutral, PublicKey neutral in the store, hash mismatch
2014-09-23 06:25:38, Info                  CSI    0000081f [SR] Could not reproject corrupted file [ml:520{260},l:106{53}]"\??\C:\Program Files (x86)\Common Files\System\Ole DB"\[l:24{12}]"msxactps.dll"; source file in store is also corrupted

This is a bug which Microsoft currently investigates. To repair the corrupted file run a new DISM command which downloads the corrupted files from the internet:
DISM /Online /Cleanup-Image /RestoreHealth


text:
Q: JAVA Initializing database environment
I am using berkeley database. You should open an environment (it is just some files in order to support locking etc) once and then using that environment open your database files...
The problem here is that Environment should be created once..
Having globals is considered bad idea...
What is the best practice to have it created one time only ?
Should i use Singleton pattern (enum implementation) or static , or another solution?

A: Singleton pattern is best.
Because even due to some reason if the environment or any object becomes null we can check in the getInstance() for null.
And if it is null we can create one. So every time there will be only one object.

A: Neither the Singleton anti-pattern nor static final is a really good idea. Your environment will be created once (I guess during startup of your system). This environment should be available to your system and your database manager can be passed to your DAOs from there.
Ideally, you'll want to use dependency injection to achieve this in the neatest way, such as that provided by the Spring framework.


text:
Q: Android Device Monitor is not working
can anybody help me to solve this?

A: Try to update Android SDK Tools
Make sure you have JAVA_HOME in your system environment variables
JAVA_HOME=C:/Program Files/Java/jdk1.8.0_11
1
JAVA_HOME=C:/Program Files/Java/jdk1.8.0_11


text:
Q: How to add EditText value in arraylist in Custom ListView I have created two TextView and one EditText in my first custom ListView,I want to add/store EditText value in Arraylist because i want to show EditText value in second Custom ListView one by one,so how to do this please give the hint or code to solve this problem..
public class Mmenu extends Activity {
ArrayList<Candy> myArrList;
ArrayList<String> editTextValues;

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

    myArrList = new ArrayList<Candy>();
    editTextValues = new ArrayList<String>();
    final ListView lisView1 = (ListView)findViewById(R.id.listView1);
    final ListView lisView2 = (ListView)findViewById(R.id.listView2);

    myArrList.add(new Candy("Butterscotch", "Rs 10"));
    myArrList.add(new Candy("Birthday Cake", "Rs 100"));
    myArrList.add(new Candy("Black Crunch", "Rs 102"));
    myArrList.add(new Candy("Industrial Chocolate", "Rs 200"));
    myArrList.add(new Candy("Coffee Molasses Chip", "Rs 500"));

    lisView1.setAdapter(new CountryAdapter(this));

    Button btnGetItem = (Button) findViewById(R.id.btnGetItem);
    btnGetItem.setOnClickListener(new OnClickListener()
    {
        public void onClick(View v)
        {
            int count = lisView1.getAdapter().getCount();

            for(int i=0;i<count;i++)
            {
            LinearLayout itemLayout = (LinearLayout)lisView1.getChildAt(i);

            EditText text = (EditText)findViewById(R.id.txtInput);
            String value = text.getText().toString();
            editTextValues.add(value);
            Toast.makeText(getApplicationContext(),"10"+value,   Toast.LENGTH_LONG).show();
            }

            lisView2.setAdapter(new CountryAdapter2(getApplicationContext()));
            }
            });
             }

    public class CountryAdapter extends BaseAdapter
    {
    private Context context;

    public CountryAdapter(Context c)
    {
    //super( c, R.layout.activity_column, R.id.rowTextView, );
    // TODO Auto-generated method stub
    context = c;
    }
    public int getCount() {
    // TODO Auto-generated method stub
    return myArrList.size();
    }
    public Object getItem(int position) {
    // TODO Auto-generated method stub
    return position;
    }
    public long getItemId(int position) {
    // TODO Auto-generated method stub
    return position;
    }
    public View getView(final int position, View convertView, ViewGroup parent) {
    // TODO Auto-generated method stub
     LayoutInflater inflater = (LayoutInflater) context
    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    if (convertView == null) {
    convertView = inflater.inflate(R.layout.views, null);
     }
    // ColID
    TextView txtID = (TextView) convertView.findViewById(R.id.nm);
    txtID.setText(myArrList.get(position).getID() +".");
    // ColCode
    TextView txtCode = (TextView) convertView.findViewById(R.id.rat);
    txtCode.setText(myArrList.get(position).getCode());
    return convertView;

    }
     }
    public class CountryAdapter2 extends BaseAdapter
    {
    private Context context;
    public CountryAdapter2(Context c)
    {
        context = c;
    }
    public int getCount() {
    // TODO Auto-generated method stub
        return myArrList.size();
    }
    public Object getItem(int position) {
    // TODO Auto-generated method stub
    return position;
    }
     public long getItemId(int position) {
    // TODO Auto-generated method stub
    return position;
    }
    public View getView(final int position, View convertView, ViewGroup parent) {
    // TODO Auto-generated method stub
     LayoutInflater inflater = (LayoutInflater) context
    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    if (convertView == null)
    {convertView = inflater.inflate(R.layout.newviews, null);
    }

    // ColID
    TextView txtID = (TextView) convertView.findViewById(R.id.nm);
    txtID.setText(myArrList.get(position).getID() +".");
    // ColCode
    TextView txtCode = (TextView) convertView.findViewById(R.id.rat);
    txtCode.setText(myArrList.get(position).getCode());
    return convertView;

    }

A: First of all, you are wasting a lot of space by creating a new HashMap<String, String> every time. Not sure why you would have an ArrayList of HashMaps. Having one or the other should be sufficient.
You can create a class called Candy like such:
class Candy {
    private String id;
    private String code;
    Candy(String id, String code) {
        this.id = id;
        this.code = code;
    }
    public String getID() { return this.id; }
    public String getCode() { return this.code; }
}

Then you can define your ArrayList and instantiate it in the beginning of onCreate():
// Don't use starting capital letters for methods, classes have first capital letter
// I renamed MyArrList to myArrList
ArrayList<Candy> myArrList;
// ...
void onCreate() {
// ...
    myArrList = new ArrayList<Candy>();
// ...
}

And populate it like:
myArrList.add(new Candy("Butterscotch", "Rs 10"));
myArrList.add(new Candy("Birthday Cake", "Rs 100"));
myArrList.add(new Candy("Black Crunch", "Rs 102"));
myArrList.add(new Candy("Industrial Chocolate", "Rs 200"));
myArrList.add(new Candy("Coffee Molasses Chip", "Rs 500"));

Now you can use the getter methods of the Candy class called getID() and getCode().
Change:
// ColID
TextView txtID = (TextView) convertView.findViewById(R.id.nm);
txtID.setText(MyArrList.get(position).get("ID") +".");
    // ColCode
TextView txtCode = (TextView) convertView.findViewById(R.id.rat);
txtCode.setText(MyArrList.get(position).get("Code"));

To:
// ColID
TextView txtID = (TextView) convertView.findViewById(R.id.nm);
txtID.setText(myArrList.get(position).getID() +".");
// ColCode
TextView txtCode = (TextView) convertView.findViewById(R.id.rat);
txtCode.setText(myArrList.get(position).getCode());

Now to answer your question, I assume you want to store the text that is within the EditText field into an ArrayList.
You can create another class ArrayList object that holds String objects and instantiate it in onCreate().
ArrayList<String> editTextValues;
// ...
void onCreate() {
// ...
    editTextValues = new ArrayList<String>();
// ...
}

Now you can just add text from EditText to this ArrayList:
EditText text = (EditText)findViewById(R.id.YOUR_ID);
String value = text.getText().toString();
editTextValues.add(value);

And then use the editTextValues where you need them.


text:
Q: Arguments Authorization in Graphql Ruby In Graphql-Ruby docs, there is way to implement the Authorization such as visibility or accessibility in the arguments field, but i didn't understand clearly to implement myself,How do i do that?

A: I think the documentation here is pretty good on this: https://graphql-ruby.org/authorization/authorization.html
This is query time authorisation, e.g. allowing point in time authorization of a given set of arguments over the API, based on some other contextual information.
You talk about visibility, I guess you mean in a schema from an introspection point of view. The Gem doesn't provide a way to apply authorization logic to alter the view of the schema for different callers. I guess it would be possible but do you want to support code which has to resolve correctly against multiple schemas or sets of arguments?


text:
Q: Codeigniter multidimensional language array, issues? I'm creating a website in CodeIgniter, I wanted to know if this way of using a multidimensional array in the language file would create any problems, like this:
$lang['profile']['name'] = 'The text to be shown';

This way I can use one file for multiple things and also I can to loop thru buttons this way:
$lang['profile_btns']['1'] = 'Text btn 1';
$lang['profile_btns']['2'] = 'Text btn 2';
//Etc...

I read the values like this:
foreach ($this->lang->line('profile_btns') as $key => $value){
    echo $value;
}

This is working fine, but I'm not sure if using this method would/could create any issue due to the non-standard CI use (this is not written in the CI manual).

A: Actually your codes right except spelling. Use profile_btns in foreach instead of profile_btn
foreach ($this->lang->line('profile_btns') as $key => $value){
    echo $value;
}


text:
Q: Laravel mongodb aggregation Is it possible to use external variables inside the raw function?
$var = 'example';
$res = DB::collection("{$var}_products")->raw(function($collection) {
        global $var;
        return $collection->aggregate([
                ['$lookup' => [
                    'from' => "{$var}_specifications",
                    'localField' => 'specifications_id',
                    'foreignField' => '_id',
                    'as' => 'specifications'
                ]]
            ]);
        });

I found only an example for an ordinary SQL (https://fideloper.com/laravel-raw-queries)
$someVariable = Input::get("some_variable");
$results = DB::select( DB::raw("SELECT * FROM some_table WHERE some_col = :somevariable"), array(
   'somevariable' => $someVariable,
 ));

A: Use the variable inside the function closure like so
$var = 'example';
$res = DB::collection("{$var}_products")->raw(function($collection) use ($var) {
        return $collection->aggregate([
                ['$lookup' => [
                    'from' => "{$var}_specifications",
                    'localField' => 'specifications_id',
                    'foreignField' => '_id',
                    'as' => 'specifications'
                ]]
            ]);
        });


text:
Q: Flask sql alchemy get child object When I declare a relationship with SQL-Alchemy, I don't found all the child's data when Marshmallow dumps the object. When Marshmallow deserialize the object, i would like to get my Member object to json not just the Ids.
My models :
class Company(db.Model):
    __table_args__ = {"schema": "public"}
    id_company = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(50), nullable=False)
    members = db.relationship('Member', back_populates="company", lazy='joined')

class Member(db.Model):
    __table_args__ = {"schema": "public"}
    id_member = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(120), nullable=False)
    age = db.Column(db.Integer)
    company_id = db.Column(db.Integer, db.ForeignKey('public.company.id_company'), nullable=False)
    company = db.relationship("Company", back_populates="members",lazy='joined')

class MemberSchema(ma.ModelSchema):
    class Meta:
        model = Member

class CompanySchema(ma.ModelSchema):
    class Meta:
        model = Company

class CompanyIdInputSchema(Schema):
    id_company = fields.Integer(required=True)

My route :
company_schema = CompanySchema()
pagination_schema = PaginationInputSchema()
company_id_schema = CompanyIdInputSchema()

class CompanyById(Resource):
    @swag_from('swag_docs/swag_company_get.yml')
    def get(self, id_company):
        company_id_args = {"id_company": id_company}
        errors = company_id_schema.validate(company_id_args)
        if errors:
            return {"error": str(errors)}, 500
        else:
            company = Company.query.filter_by(id_company=id_company)
            company = companies_schema.dump(company)
            if len(company)>=1:
                return company, 201
            else:
                return 204

The result when a call the route is :
  {
    "members": [
      1
    ],
    "id_company": 1,
    "name": "Total"
  }

What i expect :
  {
    "members": [
      {'id_member':1,'name':'Laurent','age':32,'company_id'=1}
    ],
    "id_company": 1,
    "name": "Total"
  }

A: If you want the serializer to serialize nested field as a list of serialized objects instead of ids you need to add Nested field with many=True.
class CompanySchema(ma.ModelSchema):
    members = ma.fields.Nested(MemberSchema, many=True)
    class Meta:
        model = Company


text:
Q: Sum two dataframe with multiindex I want to sum two dataframe but I lose some data in the output. All the data in the first level of the multiindex 29193 are gone.
Input ext_bal:
                          2019-10-23    2019-10-24
app_vendor_id currency
3             DASH      0.000000e+00  0.000000e+00
              ETC       0.000000e+00  0.000000e+00
              XRP       1.102733e+06  1.102733e+06
29193         BCH       0.000000e+00  0.000000e+00
              BSV       0.000000e+00  0.000000e+00
              BTC       4.991005e+00  4.991005e+00
              BTG       4.990997e+00  4.990997e+00
              DASH      0.000000e+00  0.000000e+00
              ENJ       0.000000e+00  0.000000e+00
              ETC       0.000000e+00  0.000000e+00
              ETH       3.017995e+01  3.017995e+01

Input ext_bal_ex:
created_at              2019-10-23 00:00:00  2019-10-24 00:00:00
app_vendor_id currency
 3             DASH               200.000000           200.000000
               ETC               2000.000000          2000.000000
               XRP              18900.000000         18900.000000

output:
                         2019-10-23    2019-10-24
app_vendor_id currency
 3             DASH      2.000000e+02  2.000000e+02
               ETC       2.000000e+03  2.000000e+03
               XRP       1.121633e+06  1.121633e+06
 29193         BCH       0.000000e+00  0.000000e+00
               BSV       0.000000e+00  0.000000e+00
               BTC       0.000000e+00  0.000000e+00
               BTG       0.000000e+00  0.000000e+00
               DASH      0.000000e+00  0.000000e+00
               ENJ       0.000000e+00  0.000000e+00
               ETC       0.000000e+00  0.000000e+00
               ETH       0.000000e+00  0.000000e+00

To sum the two dataframe I did:
ext_bal = (ext_bal + ext_bal_ex).fillna(0)

Any idea to solve this issue?

A: You can just do
ext_bal.add(ext_bal_ex,fill_value=0)


text:
Q: Trying to sort two columns without selecting the sheet I'm trying to sort a range from a sheet that won't always be the active one. But it always sorts the equivalent range of the active sheet.
function sortColumns() {
  var ss = SpreadsheetApp.getActiveSpreadsheet()
  var sheet = ss.getSheetByName('Sheet1');
  var range = sheet.getRange('B2:C3');
  range.sort({column: 2, ascending: true});
}

I thought this code would always sort the selected range from the sheet A1, but it's sorting the selected range of the active sheet instead.

A: I think this is what you want:
function sortColumns() {
  var ss=SpreadsheetApp.getActive()
  var sh=ss.getSheetByName('A1');
  var range = sh.getRange(ss.getActiveSheet().getDataRange().getA1Notation());
  range.sort({column: 2, ascending: true});
}

but I'm not sure.

After rereading I realize that you wanted the selected range.  The selected range only applies to the active sheet.


text:
Q: Regular Expression remove whitespace between letters I messed up my html somehow and all of my html now looks like this with a whitespace between each character
< d i v  c l a s s = " c o l - x s - 1 2   c o l - s m - 6 " >
< d i v  c l a s s = " f o r m - g r o u p   c o l - x s - 1 2 ">
< d i v  c l a s s = " r a d i o ">
< l a b e l  c l a s s = " r a d i o - l a b e l  ">

It is over 2000 lines of code. I need to go back looking like this

What regular expression can I use with notepad++ to fix this?

A: Notepad++ doesn't support very advanced regex. Your best bet is to do a find and replace to replace two consecutive spaces with a special character that doesn't appear in your page, for example ~.
< d i v~c l a s s = " c o l - x s - 1 2~ c o l - s m - 6 " >~
< d i v~c l a s s = " f o r m - g r o u p~ c o l - x s - 1 2 ">
< d i v~c l a s s = " r a d i o ">
< l a b e l~c l a s s = " r a d i o - l a b e l~">

Now, you can replace all the spaces with the empty string to remove them:

~

We have to replace the special character (~) with a space now, and we're done:

Since you mention you have Visual Studio, this is actually easier to solve with Visual Studio if you have it, since you can use a more advanced regex: Find (\S)\s or (.)\s and replace with $1.
If you have the TextFX plugin installed, you can run fairly complex regular expressions in notepad++ through TextFX -> TextFX Quick -> Find/Replace. You can run (\S)\s or (.)\s as the expression to find and use \1 for the replace.

A: How about:
Find what: (?<=\S)\s(?=\S)
Replace with: NOTHING
This will replace every space \s that is between two non spaces \S.
(?<=\S) is a positive lookbehind
(?=\S) is a positive lookahead


text:
Q: How can I change the folder that BABYLON.SceneLoader will search for textures? How can I change the folder where BABYLON.SceneLoader will search for textures when loading a babylon blender file?
For example:
    BABYLON.SceneLoader.Load("", "public/js/corredor.babylon", this.engine, function (newScene) { /*...*/ }

The code above will load corredor.babylon on public/js/ folder, but I want it to load the textures on public/js/textures/ folder.
Thanks a lot!

A: Actually Babylon.js does not support this feature so far. Textures are loaded side by side with the .babylon file.
You can suggest the feature on babylonjs.uservoice.com


text:
Q: color sides in convex Hull I'm using this code to show the convex hull.
I want to give every sides color because I'm doing some changes in convex hull and I need to see every sides alone.
  ClearAll["Global`*"]
M = x^4 + x y z + y^4 + z^4 + x^2 z^2
p = CoefficientRules[M, {x, y, z}][[All, 1]]
chull = ConvexHullMesh[p];
Show[HighlightMesh[chull, Labeled[1, "Index"]],
 Graphics3D[{Red, Sphere[p, 0.05], Black,
   Map[Text[#, # + {0., 0, 0.1}] &, p]}]
   , Axes -> True, Boxed -> True, AxesLabel -> {x, y, z}]

Another step:
Can I cut part of the convex hull (or can I just see part of convex hull)
because in my work I will just focus on the part from the view from (0,0,0)

Thank you

A: Mathematica graphics always have a corresponding Graphics or Graphics3D expression. i.e. functions like Plot and ConvexHull don't generate graphics, they generate code. We can take the code and adapt it as required. The code can usually be seen using FullForm, but in this case we also need to use Show:
(gr = chull // Show) // FullForm

Note in the output of the preceding expression the following:
Annotation[
 Polygon[List[List[1, 3, 4], List[3, 5, 4], List[4, 5, 2],
   List[5, 3, 2], List[3, 1, 2], List[1, 4, 2]]], "Geometry"]

This is clearly the polygons in the figure. (The coordinates are integers which are translated into coordinates by GraphicsComplex, which wraps this expression.) Here is how we can change this expression to color the sides:
gr /. RuleDelayed[
  Annotation[Polygon[polygons__List], "Geometry"],
  Annotation[
   MapIndexed[{ColorData[97, First[#2]], Polygon[#]} &, polygons]]
  ]

The operations that you apply to these polygons are arbitrary. You can also use it to remove planes as what you ask for.


text:
Q: gradient over image using background-image is taller than the image it is above with HTML

.backgroundimage {
    position: absolute;
    right: 25px;
    z-index: -100;
    height: 400px;

    .bgimagegradient {
        position: absolute;
        height: 100%;
        width: 100%;
        z-index: 1;
        background-image: linear-gradient(to right, white 10%, rgba(0, 53, 107, .5));
    }
    > img {
        position: relative;
        right: 0px;
        top: 0px;
        z-index: 0;
    }
}

I'm getting the following behavior (gradient is too tall):

The error is at the bottom of the image, the gradient is about 4px taller than the image its over.
When the image, in a responsive context, is large enough to hit the container max width (outside of the HTML I've shown you) it works but scaled down to smaller responsive scenarios, I get this problem.

A: You have a few things incorrect:

*

*Your HTML uses class 'outer' and your CSS uses 'backgroundimage'.

*In the CSS for the gradient you refer to the width with 100%. However, the width is not defined for the parent.

*Use of z-index is not necessary.

Below I created what I believe you require. Hope this helps.

.outer {
    position: relative;
    height: 400px;
    width: 400px;
}
.bgimagegradient  {
    position: absolute;
    height: 100%;
    width: 100%;
    top: 0;
    left: 0;
    background-image: linear-gradient(to right, white 10%, rgba(0, 53, 107, .5));
 }


text:
Q: Why is a user not a member of their private group (UPG) according to the GUI? (although CLI proves the opposite...)
*

*I downloaded the current iso file of Ubuntu MATE from the website.

*I did a completely fresh install of Ubuntu MATE 16.04 (specifically 16.04.5).

*

*the same is true for Ubuntu MATE 18.04 (specifically 18.04.1)

*and according to @mook765 also Ubuntu Studio 18.04 (Xfce) seems to be affected

*I created a default user while installing with its GUI called test (full name Test). The system thus created a UPG called test.

*after installation had finished, I restarted the system.

*Now on the completely fresh system I open System > Control Center > Users and Groups > Manage Groups.

*I look for the test group and press Properties, and here it is... user test is not member of group test!

it looks like /etc/group suggests the same: (2nd last line)
test@test ~ $ less /etc/group | grep test
adm:x:4:syslog,test
cdrom:x:24:test
sudo:x:27:test
dip:x:30:test
plugdev:x:46:test
lpadmin:x:113:test
test:x:1000:
sambashare:x:129:test

but according to how should `id` and `/etc/group` be read? the primary group of a user is only listed in /etc/passwd and not additional in /etc/group to avoid redundancy.
id <username> seems to suggest a little bit different:
test@test ~ $ id test
uid=1000(test) gid=1000(test) groups=1000(test),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),113(lpadmin),129(sambashare)

the best way to proof is groups <username>:
test@test ~ $ groups test
test : test adm cdrom sudo dip plugdev lpadmin sambashare

So is this a bug by the GUIs? - Somehow i doubt it, because of how long time it is there and also present in two well known DEs...


text:
Q: Grouped scatter plot with colorbar via pandas plotting interface When I am plotting a grouped scatter plot from pandas (as described in the documentation) where the second group needs to contain a color bar, I get an error TypeError: You must first set_array for mappable.
Following other but different questions for ungrouped scatter plots, this is because cmap is only used if c is an array of floats. But stand-alone it works perfectly and the data is not manipulated between creating the two axes-objects.
Here is the code that I am using:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

df = pd.DataFrame(np.random.rand(100, 5), columns=['A', 'B', 'C', 'D', 'E'])

# this works stand-alone
#df.plot(kind='scatter', x='A', y='B', c='C', cmap='Blues')

# why does this break?
ax = df.plot(kind='scatter', x='D', y='E', color='red', label='Other group')
df.plot(kind='scatter', x='A', y='B', c='C', cmap='Blues', ax=ax)
plt.show()

Both groups should be displayed in one plot. Note, that it is important for me to plot columns D and E before plotting A, B and C on top of them so the latter need to be in the second plot. Vice versa it works but for my requirements it breaks.
Does anyone know how to fix this and obtain the desired result?
Thanks in advance!

A: It seems pandas confuses itself about making a colorbar internally. You always have the options to create the colorbar with matplotlib though.
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

df = pd.DataFrame(np.random.rand(100, 5), columns=['A', 'B', 'C', 'D', 'E'])

ax = df.plot(kind='scatter', x='D', y='E', color='red', label='Other group')
df.plot(kind='scatter', x='A', y='B', c='C', cmap='Blues', ax=ax, colorbar=False)
ax.figure.colorbar(ax.collections[1])   # Note the index 1, which stands
                                        # for second scatter in the axes.
plt.show()

A: Reverse the order of you plotting.  I think the colorbar is getting confused which chart to apply to.   Hence, we try to do plot the first with color bar then apply the red scatter on top.
df = pd.DataFrame(np.random.rand(100, 5), columns=['A', 'B', 'C', 'D', 'E'])

# this works stand-alone
#df.plot(kind='scatter', x='A', y='B', c='C', cmap='Blues')

# why does this break?
# ax = df.plot(kind='scatter', x='D', y='E', color='red', abel='Other group')
ax = df.plot(kind='scatter', x='A', y='B', c='C', cmap='Blues', zorder=10)
df.plot(kind='scatter', x='D', y='E', color='red', label='Other group', ax=ax, zorder=1)
plt.show()

Output:

With zorder:


text:
Q: Hows this restriction an isomorphism? I'm just looking at the restriction of $\mathbb{Z}$ to $3\mathbb{Z}$. There's an isomorphism from $\mathbb{Z} / 0$ viz $n \rightarrow 3n$, but I am confused how that implies the restriction is technically surjective.

A: Let's call the isomorphism that you mentioned $f$. Then, by the 1st isomorphism theorem
$\mathop{Z} / ker f \cong f(\mathop{Z})$
Now note that $ker f =\{0\}$, because the only element that goes to 0 is 0 itself.
Also, the image is $3\mathop{Z}$, because for any $3n \in 3\mathop{Z}$, we have $f(n)=3n$.
Hence, you have
$\mathop{Z} / \{0\} \cong 3\mathop{Z}$.
But, actually $\mathop{Z} / \{0\}$ is just $\mathop{Z}$, because dividing by the trivial group doesn't affect.
So the relation that we get, is just the relation that we started with, namely
$\mathop{Z} \cong 3\mathop{Z}$.
In fact, this is the case if you start with any isomorphism relation $G\cong G'$. In other words, if you apply the 1st isomorphism theorem to an isomorphism relation then you will just go back to the point that you started with.


text:
Q: Unable to close the opened searchable dropdown on back button click I am using searchable drop-down using the below module.
https://www.npmjs.com/package/react-native-searchable-dropdown
When the drop-down is open, when I click on back button the drop-down does not close. And until I select any option it will be opened only. How to resolve this?
<View style={{ marginTop: 5 }}>
    <SearchableDropdown
        onItemSelect={(item, index) => {
            setItemname(item.value);
            setItemIndex(index);
        }}
        itemStyle={{
            padding: 10,
            marginTop: 2,
            backgroundColor: '#ddd',
            borderColor: '#bbb',
            borderWidth: 1,
            borderRadius: 5,
        }}
        itemTextStyle={{ color: '#222' }}
        itemsContainerStyle={{ maxHeight: 140 }}
        items={items}
        defaultIndex={itemindex}
        resetValue={false}
        textInputProps={
            {
                placeholder: "Select Item",
                underlineColorAndroid: "transparent",
                style: {
                    padding: 12,
                    borderWidth: 1,
                    borderColor: '#ccc',
                    borderRadius: 5,
                },
            }
        }
        listProps={{
            nestedScrollEnabled: true,
        }}
    />
</View>

A: What is happening
The SearchableDropDown component uses TextInput's onBlur prop to set its focus state to false on blur (code reference).
When the focus state is true the FlatList is rendered that contains the items (code reference).
The problem is that when you press the back button onBlur is not triggered, meaning the focus state is not set to false and the FlatList with the items is still rendered.

Possible workaround
You could conditionally hide the flatlist based on whether the keyboard is hidden or not.
import React, { Component, useState, useEffect, useRef } from "react";
import { View, TextInput, Keyboard } from "react-native";
import SearchableDropdown from "react-native-searchable-dropdown";

const App = () => {
  const [itemname, setItemname] = useState("");
  const [itemindex, setItemIndex] = useState(0);
  const [isKeyboardVisible, setKeyboardVisible] = useState(false);

  useEffect(() => {
    const keyboardDidShowListener = Keyboard.addListener(
      "keyboardDidShow",
      () => {
        setKeyboardVisible(true);
      }
    );
    const keyboardDidHideListener = Keyboard.addListener(
      "keyboardDidHide",
      () => {
        setKeyboardVisible(false);
      }
    );

    return () => {
      keyboardDidHideListener.remove();
      keyboardDidShowListener.remove();
    };
  }, []);

  return (
    <View style={{ marginTop: 5 }}>
      <SearchableDropdown
        onItemSelect={(item, index) => {
          setItemname(item.value);
          setItemIndex(index);
        }}
        itemStyle={{
          padding: 10,
          marginTop: 2,
          backgroundColor: "#ddd",
          borderColor: "#bbb",
          borderWidth: 1,
          borderRadius: 5,
        }}
        itemTextStyle={{ color: "#222" }}
        itemsContainerStyle={
          isKeyboardVisible ? { maxHeight: 140 } : { display: "none" }
        }
        items={items}
        defaultIndex={itemindex}
        resetValue={false}
        textInputProps={{
          placeholder: "Select Item",
          underlineColorAndroid: "transparent",
          style: {
            padding: 12,
            borderWidth: 1,
            borderColor: "#ccc",
            borderRadius: 5,
          },
        }}
        listProps={{
          nestedScrollEnabled: true,
        }}
      />
    </View>
  );
};

export default App;

The implementation above sets itemsContainerStyle to an object with display set to 'none' when the isKeyboardVisible state is false.

Source used for hiding/showing keyboard


text:
Q: "aborted (disconnected)" in python 3.4 I've been working on a program to track times for a game, which reads from a text file then sets up timers accordingly. I know the way I've set it up can probably be done much better, but this is how I've done it anyway. When I input the first part, it will start the timer correctly but when I input the second part it seems to immediately disconnect the program and throw this: "aborted (disconnected)".
This is my code
import threading
from threading import Thread
import time

def test():
        test = 2
        while test > 1:
                for z in range(0,-1,-1):
                        seconds1 = z % 1
                        time.sleep(1.0)
                file = open("newfile.txt","r+") #opens file with name of "test.txt"
                y = file.readline()
                x = file.readline()
                if x == "f" or x == "F":
                        if __name__ == '__main__':
                                Thread(target = test2).start()
                        print("Timer started for", y ,"Flash")
                        f = open("newfile.txt", "w+")
                        f.write(f.read().replace("f",""))
                        f.close()
                        file.close()
                        for f in range(300,-1,-1):
                                seconds = f % 301
                                print (seconds,y)
                                time.sleep(1.0)
                        print(str(y), "Flash is now up")
                if x == "heal" or x == "Heal":
                        if __name__ == '__main__':
                                Thread(target = test2).start()
                        print("Timer started for", y ,"heal")
                        f = open("newfile.txt", "w+")
                        f.write(f.read().replace("heal","").replace("Heal",""))
                        f.close()
                        file.close()
                        for h in range(240,-1,-1):
                                seconds2 = h % 241
                                print (seconds2,y)
                                time.sleep(1.0)
                        print(str(y), "heal is now up")
                if x == "exh" or x == "exhaust" or x == "Exhaust":
                        if __name__ == '__main__':
                                Thread(target = test2).start()
                        print("Timer started for", y ,"exhaust")
                        f = open("newfile.txt", "w+")
                        f.write(f.read().replace("exhaust","").replace("exh","").replace("exh",""))
                        f.close()
                        file.close()
                        for e in range(210,-1,-1):
                                seconds3 = e % 211
                                print (seconds3,y)
                                time.sleep(1.0)
                        print(str(y), "exhaust is now up")
                if x == "ignite" or x == "Ignite":
                        if __name__ == '__main__':
                                Thread(target = test2).start()
                        print("Timer started for", y ,"ignite")
                        f = open("newfile.txt", "w+")
                        f.write(f.read().replace("ignite","").replace("Ignite",""))
                        f.close()
                        file.close()
                        for i in range(5,-1,-1):
                                seconds4 = i % 5
                                print (seconds4,y)
                                time.sleep(1.0)
                        print(y, "ignite is now up")

                else:
                        file.close()

def test2():
        test = 2
        while test > 1:
                for z in range(0,-1,-1):
                        seconds1 = z % 1
                        time.sleep(1.0)
                file = open("newfile.txt","r+") #opens file with name of "test.txt"
                y = file.readline()
                x = file.readline()
                if x == "f" or x == "F":
                        if __name__ == '__main__':
                                Thread(target = test3).start()
                        print("Timer started for", y ,"Flash")
                        f = open("newfile.txt", "w+")
                        f.write(f.read().replace("f",""))
                        f.close()
                        file.close()
                        for f in range(300,-1,-1):
                                seconds = f % 301
                                print (seconds,y)
                                time.sleep(1.0)
                        print(str(y), "Flash is now up")
                if x == "heal" or x == "Heal":
                        if __name__ == '__main__':
                                Thread(target = test3).start()
                        print("Timer started for", y ,"heal")
                        f = open("newfile.txt", "w+")
                        f.write(f.read().replace("heal","").replace("Heal",""))
                        f.close()
                        file.close()
                        for h in range(240,-1,-1):
                                seconds2 = h % 241
                                print (seconds2,y)
                                time.sleep(1.0)
                        print(str(y), "heal is now up")
                if x == "exh" or x == "exhaust" or x == "Exhaust":
                        if __name__ == '__main__':
                                Thread(target = test3).start()
                        print("Timer started for", y ,"exhaust")
                        f = open("newfile.txt", "w+")
                        f.write(f.read().replace("exhaust","").replace("exh","").replace("exh",""))
                        f.close()
                        file.close()
                        for e in range(210,-1,-1):
                                seconds3 = e % 211
                                print (seconds3,y)
                                time.sleep(1.0)
                        print(str(y), "exhaust is now up")
                if x == "ignite" or x == "Ignite":
                        if __name__ == '__main__':
                                Thread(target = test3).start()
                        print("Timer started for", y ,"ignite")
                        f = open("newfile.txt", "w+")
                        f.write(f.read().replace("ignite","").replace("Ignite",""))
                        f.close()
                        file.close()
                        for i in range(5,-1,-1):
                                seconds4 = i % 5
                                print (seconds4,y)
                                time.sleep(1.0)
                        print(y, "ignite is now up")

                else:
                        file.close()
def test3():
        test = -1
        while test > 1:
                for z in range(0,-1,-1):
                        seconds1 = z % 1
                        time.sleep(1.0)
                file = open("newfile.txt","r+") #opens file with name of "test.txt"
                y = file.readline()
                x = file.readline()
                if x == "f" or x == "F":
                        if __name__ == '__main__':
                                Thread(target = test4).start()
                        print("Timer started for", y ,"Flash")
                        f = open("newfile.txt", "w+")
                        f.write(f.read().replace("f",""))
                        f.close()
                        file.close()
                        for f in range(300,-1,-1):
                                seconds = f % 301
                                print (seconds,y)
                                time.sleep(1.0)
                        print(str(y), "Flash is now up")
                if x == "heal" or x == "Heal":
                        if __name__ == '__main__':
                                Thread(target = test4).start()
                        print("Timer started for", y ,"heal")
                        f = open("newfile.txt", "w+")
                        f.write(f.read().replace("heal","").replace("Heal",""))
                        f.close()
                        file.close()
                        for h in range(240,-1,-1):
                                seconds2 = h % 241
                                print (seconds2,y)
                                time.sleep(1.0)
                        print(str(y), "heal is now up")
                if x == "exh" or x == "exhaust" or x == "Exhaust":
                        if __name__ == '__main__':
                                Thread(target = test4).start()
                        print("Timer started for", y ,"exhaust")
                        f = open("newfile.txt", "w+")
                        f.write(f.read().replace("exhaust","").replace("exh","").replace("exh",""))
                        f.close()
                        file.close()
                        for e in range(210,-1,-1):
                                seconds3 = e % 211
                                print (seconds3,y)
                                time.sleep(1.0)
                        print(str(y), "exhaust is now up")
                if x == "ignite" or x == "Ignite":
                        if __name__ == '__main__':
                                Thread(target = test4).start()
                        print("Timer started for", y ,"ignite")
                        f = open("newfile.txt", "w+")
                        f.write(f.read().replace("ignite","").replace("Ignite",""))
                        f.close()
                        file.close()
                        for i in range(5,-1,-1):
                                seconds4 = i % 5
                                print (seconds4,y)
                                time.sleep(1.0)
                        print(y, "ignite is now up")

                else:
                        file.close()
def test4():
        test = 2
        while test > 1:
                for z in range(0,-1,-1):
                        seconds1 = z % 1
                        time.sleep(1.0)
                file = open("newfile.txt","r+") #opens file with name of "test.txt"
                y = file.readline()
                x = file.readline()
                if x == "f" or x == "F":
                        if __name__ == '__main__':
                                Thread(target = test5).start()
                        print("Timer started for", y ,"Flash")
                        f = open("newfile.txt", "w+")
                        f.write(f.read().replace("f",""))
                        f.close()
                        file.close()
                        for f in range(300,-1,-1):
                                seconds = f % 301
                                print (seconds,y)
                                time.sleep(1.0)
                        print(str(y), "Flash is now up")
                if x == "heal" or x == "Heal":
                        if __name__ == '__main__':
                                Thread(target = test5).start()
                        print("Timer started for", y ,"heal")
                        f = open("newfile.txt", "w+")
                        f.write(f.read().replace("heal","").replace("Heal",""))
                        f.close()
                        file.close()
                        for h in range(240,-1,-1):
                                seconds2 = h % 241
                                print (seconds2,y)
                                time.sleep(1.0)
                        print(str(y), "heal is now up")
                if x == "exh" or x == "exhaust" or x == "Exhaust":
                        if __name__ == '__main__':
                                Thread(target = test5).start()
                        print("Timer started for", y ,"exhaust")
                        f = open("newfile.txt", "w+")
                        f.write(f.read().replace("exhaust","").replace("exh","").replace("exh",""))
                        f.close()
                        file.close()
                        for e in range(210,-1,-1):
                                seconds3 = e % 211
                                print (seconds3,y)
                                time.sleep(1.0)
                        print(str(y), "exhaust is now up")
                if x == "ignite" or x == "Ignite":
                        if __name__ == '__main__':
                                Thread(target = test5).start()
                        print("Timer started for", y ,"ignite")
                        f = open("newfile.txt", "w+")
                        f.write(f.read().replace("ignite","").replace("Ignite",""))
                        f.close()
                        file.close()
                        for i in range(5,-1,-1):
                                seconds4 = i % 5
                                print (seconds4,y)
                                time.sleep(1.0)
                        print(y, "ignite is now up")

                else:
                        file.close()
def test5():
        test = 2
        while test > 1:
                for z in range(0,-1,-1):
                        seconds1 = z % 1
                        time.sleep(1.0)
                file = open("newfile.txt","r+") #opens file with name of "test.txt"
                y = file.readline()
                x = file.readline()
                if x == "f" or x == "F":
                        print("Timer started for", y ,"Flash")
                        f = open("newfile.txt", "w+")
                        f.write(f.read().replace("f",""))
                        f.close()
                        file.close()
                        for f in range(300,-1,-1):
                                seconds = f % 301
                                print (seconds,y)
                                time.sleep(1.0)
                        print(str(y), "Flash is now up")
                if x == "heal" or x == "Heal":
                        print("Timer started for", y ,"heal")
                        f = open("newfile.txt", "w+")
                        f.write(f.read().replace("heal","").replace("Heal",""))
                        f.close()
                        file.close()
                        for h in range(240,-1,-1):
                                seconds2 = h % 241
                                print (seconds2,y)
                                time.sleep(1.0)
                        print(str(y), "heal is now up")
                if x == "exh" or x == "exhaust" or x == "Exhaust":
                        print("Timer started for", y ,"exhaust")
                        f = open("newfile.txt", "w+")
                        f.write(f.read().replace("exhaust","").replace("exh","").replace("exh",""))
                        f.close()
                        file.close()
                        for e in range(210,-1,-1):
                                seconds3 = e % 211
                                print (seconds3,y)
                                time.sleep(1.0)
                        print(str(y), "exhaust is now up")
                if x == "ignite" or x == "Ignite":
                        print("Timer started for", y ,"ignite")
                        f = open("newfile.txt", "w+")
                        f.write(f.read().replace("ignite","").replace("Ignite",""))
                        f.close()
                        file.close()
                        for i in range(5,-1,-1):
                                seconds4 = i % 5
                                print (seconds4,y)
                                time.sleep(1.0)
                        print(y, "ignite is now up")

                else:
                        file.close()


text:
Q: Sum quantities for list of items in shopping cart using Javascript I'm trying to write a small piece of Javascript that will sort through a list of items in a shopping cart and determine whether the quantities for each brand sum to a multiple of 12.
An example of the shopping cart would be:
 - Brand 1 - Oranges ---------- Qty: 10
 - Brand 2 - Oranges ---------- Qty: 4
 - Brand 1 - Oranges ---------- Qty: 2
 - Brand 3 - Oranges ---------- Qty: 6
 - Brand 2 - Oranges ---------- Qty: 20

The totals are therefore: Brand 1 = 12, Brand 2 = 24, Brand 3 = 6.
If the total of Brand 1, Brand 2 or Brand 3 is not a multiple of 12 (eg. Brand 3 above), I want the Javascript function to produce an error.
I think the best way to solve this is through an array and somehow splitting it based on brand then summing the totals but I'm not sure how to go about doing it.
Any help would be greatly appreciated.

A: You need two loops for that, the first one is to sum up all the qty's for each brand, the 2nd loop is to check if all sums are a multiple of 12.
You can find an example here: http://jsfiddle.net/5QGWG/


text:
Q: getting data for specific months from date in mysql I have a column in MySQL datatable named added_date, datatype of it is varchar(255) which is inserting date like mm/dd/yyyy. I have a lot of data in the table for dates like '5/12/2018', '4/10/2018', '3/5/2018'  etc. Now, I want to get data for may, 2018 month only.
How to have the data for may, 2018 only?
Thanks.

A: MySQL retrieves and displays dates in 'YYYY-MM-DD' format. Thus, you have to use STR_TO_DATE function to convert string to date. Then it is possible to use BETWEEN keyword in WHERE clause to set specific date range:
SELECT *
FROM MyTable
WHERE STR_TO_DATE(added_date, '%m/%d/%Y') BETWEEN '2018-05-01' AND '2018-05-31';

You could try the query online.

A: Convert varchar to date within a format that is suitable for your condition:
SELECT * FROM your_table WHERE STR_TO_DATE(added_date, '%c%Y') = '52018';

You can use the same function in the select component to return the date too:
SELECT STR_TO_DATE(added_date, '%Y-%m-%d') AS fDate FROM your_table WHERE STR_TO_DATE(added_date, '%c%Y') = '52018';


text:
Q: jpa result-set-mapping throw NPE I can't map query result to POJO.
JPA executes query ok (it trace in logs) but in mapping process throws a NPE.
What is wrong?
NPE:
java.lang.NullPointerException
at org.eclipse.persistence.queries.EntityResult.getValueFromRecord(EntityResult.java:147)
at org.eclipse.persistence.queries.ResultSetMappingQuery.buildObjectsFromRecords(ResultSetMappingQuery.java:165)
at org.eclipse.persistence.queries.ResultSetMappingQuery.executeDatabaseQuery(ResultSetMappingQuery.java:215)
at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:675)
at org.eclipse.persistence.queries.DatabaseQuery.executeInUnitOfWork(DatabaseQuery.java:589)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2857)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1225)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1207)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1181)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.executeReadQuery(EJBQueryImpl.java:453)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.getResultList(EJBQueryImpl.java:681)
at com.silyan.meyem.view.visor.tienda.TiendaResources.delusuario(TiendaResources.java:284)

execution code:
List<TiendaTO> tiendas = entityManager.createNamedQuery("TiendaResources.tiendas_del_usuario", TiendaTO.class).setParameter(1, user.getId()).getResultList();

metadata:
    <named-native-query name="TiendaResources.tiendas_del_usuario" result-set-mapping="TiendaTOMapping">
<query>
select
    tienda.id as id,
    tienda.nombre as nombre,
    tienda.idporcliente as idporcliente,
    tienda.cliente_id as clienteid,
    ST_X(direccion.geolocalizacion) as x,
    ST_Y(direccion.geolocalizacion) as y
from
    user_tienda,
    tienda,
    direccion
where
    user_tienda.user_id = ? and
    tienda.id = user_tienda.tienda_id and
    direccion.id = tienda.direccion_id
</query>
</named-native-query>

<sql-result-set-mapping name="TiendaTOMapping">
    <entity-result entity-class="com.silyan.meyem.view.visor.tienda.TiendaTO" >
        <field-result name="id" column="id"/>
        <field-result name="idPorCliente" column="idporcliente"/>
        <field-result name="nombre" column="nombre"/>
        <field-result name="x" column="x"/>
        <field-result name="y" column="y"/>
    </entity-result>
</sql-result-set-mapping>

Plataform:
Glassfish 3.0.1 - eclipselink 2.0.1.v20100213-r6600
Thanks!

A: Is com.silyan.meyem.view.visor.tienda.TiendaTO mapped class? If not, then you are facing this problem: https://bugs.eclipse.org/bugs/show_bug.cgi?id=288957
But on the other hand "entity-result entity-class", it kind of makes sense that entity is expected, of course some implementations can support also other classes.


text:
Q: Android share pdf from a url I have a url with a pdf file and i would like to show a share via intent on button click
SO i have the following
 string pdfurl = "http://www.africau.edu/images/default/sample.pdf";

SO in my code i have
public function showShareIntent(String url){
   Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
    sharingIntent.setType("application/pdf");

     //attach pdf here
    sendIntent.putExtra(Intent.EXTRA_STREAM, pdfurl);
    startActivity(Intent.createChooser(sharingIntent, "Share sample item via"));

 }

But the above doesnt attach the pdf file
What am i missing out
I have checked on This link but it expains loading this when file is located on local device.
How do i attach a url pdf file when showing share.

A: Step #1: Download the PDF.
Step #2: Share it using FileProvider via EXTRA_STREAM.
That way, you follow the documentation and use a content: Uri.
Alternatively, include the URL in some message in EXTRA_TEXT.


text:
Q: Invalid check digit for identifier : While create a new patient? I have override the existing Patient Registration form and render the Xform Patient Registration from successfully[Reference].
When I create a new Patient I'm getting following error
"Patient#null failed to validate with reason :Invalid check digit for identifier:10005G".
I given following information for patient creation

*

*Family Name: Patient

*Given Name:One

*DOB:30/12/2000

*Identifier :10005C

*Gender:M

*Location:Unknow Location

*Identifier Type:Old Identification Number Other

Other Identifiers

*

*Identifiers Identifier :10005G

*Identifier Type:OpenMrs ID Identifer

*Location:Unknow Location

Some please help how to fix the issue.

A: OpenMRS uses a modified Luhn Algorithm to calculate check digits, where the last character in an identifier is calculated from the preceding characters. Check digits allow for self-validation of identifiers that are manually entered (an approach also used by the credit card industry). The default algorithm used for new identifier types is a Luhn Mod-30 Check Digit Validator. This Mod-30 algorithm uses the character set "0123456789ACDEFGHJKLMNPRTUVWXY" for characters within identifiers and check digits (avoiding letters that may be confused with numbers or other letters: B, I, O, Q, S, and Z).
Presumably, this algorithm is being applied to your supplied identifier(s). The correct Mod-30 check digit for "10005" is "K" (not "C" or "G"). This is probably why you are getting the error. The algorithm used, if any, to validate identifiers depends on the Patient Identifier Type, so you can figure out which algorithm(s) are being used on your system by looking at the patient identifier types defined in your system.


text:
Q: extract a class from beatiful soup I Have a HTML script that after extraction looks something like this:
class="a-toaster Toaster_toaster__bTabZ">
    </div>
   </div>
  </div>
  <script id="__NEXT_DATA__" type="application/json">
   {"props":{"pageProps": {"type":"Job","sid":"a84cacbbcb07ec55cdbfd5fbe3d9f252d7f9cdd0","loggedIn":false,"userId":null,"avatar":null,"rating":{"count":"743","value":6.6},"metadata":{"title":"Medior/Senior Tester0"}

I am interested in extracting certain key value pairs of this script into a dataframe. I would for example like a column named "title" with the value "Medior/Senior Tester0" and a column "customer" filled with null.
soup.find('a-toaster Toaster_toaster__bTabZ') results in a nonetype nonetype error. What would be a good way to extract for example the  title of this html (medior/senior tester) ?

A: Try:
import json
from bs4 import BeautifulSoup

html_doc = """\
<div class="a-toaster Toaster_toaster__bTabZ">
    </div>
   </div>
  </div>
  <script id="__NEXT_DATA__" type="application/json">
   {"props":{"pageProps": {"type":"Job","sid":"a84cacbbcb07ec55cdbfd5fbe3d9f252d7f9cdd0","loggedIn":false,"userId":null,"avatar":null,"rating":{"count":"743","value":6.6},"metadata":{"title":"Medior/Senior Tester0"} } } }
  </script>
</div>"""

soup = BeautifulSoup(html_doc, "html.parser")

# locate the script tag:
script = soup.select_one("#__NEXT_DATA__")

# decode the json:
data = json.loads(script.text)

# print all data:
print(data)

Prints:
{
    "props": {
        "pageProps": {
            "type": "Job",
            "sid": "a84cacbbcb07ec55cdbfd5fbe3d9f252d7f9cdd0",
            "loggedIn": False,
            "userId": None,
            "avatar": None,
            "rating": {"count": "743", "value": 6.6},
            "metadata": {"title": "Medior/Senior Tester0"},
        }
    }
}

To print the title:
print(data["props"]["pageProps"]["metadata"]["title"])

Prints:
Medior/Senior Tester0


text:
Q: change inputText via ref I'm going to change the textinput via ref, but nothing happens
My code in the render is as follows
<TextInput
       onChangeText={(value) => this.setState({replyTicketText: value})} />
       ref={"replyInput"+this.state.ticketID}
       />

When I call the function:
let replyInput;
          replyInput = "replyInput"+this.state.ticketID;
          this.refs[replyInput].setNativeProps({ text: ' ' });

platfrom: ios

A: I'm probably misunderstanding, but would it not be easier to hook the input to state, the field will update when state is changed?
value={this.state.replyTicketText}


text:
Q: Core-Data: Print contents of an entity How would I print the contents of an entity e.g. customer?
I want the data to be table like, e.g. the entity data should print like so:
First Name | Last Name | Telephone Number | Email | DOB
I also need to apply a search predicate before printing the data, e.g. print members born after 1984
Could anybody tell me how I should do this?
Thanks!

A: I found this link which helped me alot using core data:
http://iphoneinaction.manning.com/iphone_in_action/2009/09/core-data-part-3-retrieving-data.html
Cast the entity to an array, loop the array and NSLog the data for each result. E.g.:
NSEntityDescription *entity = [NSEntityDescription entityForName:@"news"
                                          inManagedObjectContext:self.managedObjectContext];
[fetchRequest setEntity:entity];
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"url=%@",theUrl];
[fetchRequest setPredicate:predicate];

NSError *error;
NSArray *items = [self.managedObjectContext
                   executeFetchRequest:fetchRequest error:&error];

for (news *theNews in items) {
    NSLog(@"Title: %@, Date: %@, News: %@", [theNews title], [theNews date], [theNews news]);
}

[fetchRequest release];


text:
Q: How to use varying quantiles to highlight the tails of the corresponding distributions in R with ggridges? Take the data "diamond" for example,
library(ggplot2)
library(ggridges)
ggplot(diamonds, aes(x = price, y = cut,fill = factor(stat(quantile)))) +
    stat_density_ridges(
        geom = "density_ridges_gradient",
        calc_ecdf = TRUE,
        quantiles = 0.25) +
    theme_ridges() +
    scale_fill_manual(
        name = "Probability", values = c("#FF0000A0", "#A0A0A0A0"),
        labels = c("(0, 0.25]", "(0.25, 0.75]")
    )

This will plot 5 different densities overlap given categorical variable "cut" is mapped onto the y axis, the tail of quantile 25% in all 5 density ridges will be filled with red color "#FF0000A0",  or "quantiles= 2" parameter will result in colored tail of 50% quantile.
But what I want is different quantile tail for each group in the "cut" variable, e.g. 10% tail for "Ideal", 20% for "Premium" ,30%for "Good ", 40%for"Very Good" ,and 50% for "Fair" .
HOW to do this plot?


text:
Q: SQL - Calculate Incentive using Frequency (Mode)
I'd like a SQL query to calculate the incentive column and based on the number of times a student was tutored in a month.
If the student was tutored in AP Math twice in a month then, the Tutor gets $20, else $0.
I don't want group the date into month summary so, I'd like to leave the dates as is hence why I assigned $10 for each record where the students that were tutored twice in month.

A: initializing the data
declare @StudentTable as table
(
    StudentVisitDate  date,
    StudentId int,
    StudentName varchar(100),
    [Subject] varchar (30),
    Tutor varchar(100),
    Incentive int
)

insert into @StudentTable
values
('2018-August-03',123,'Terry Brooks','AP Math','Shawn Green',10)
,('2018-August-04',123,'Terry Brooks','AP Science','Ted Berry',10)
,('2018-August-07',123,'Terry Brooks','Music','Shawn Green',10)
,('2018-September-03',123,'Terry Brooks','AP Math','Shawn Green',10)
,('2018-September-04',123,'Terry Brooks','AP Science','Ted Berry',10)
,('2018-September-07',123,'Terry Brooks','AP Math','Shawn Green',10)

getting the count of visits per month, grouping the data
;with temp as
(
select
StudentId,  Subject,    Tutor,Month(StudentVisitDate) [month]
,max(StudentVisitDate) maxdate -- the date on which the incentive will be calculated
,Count(StudentVisitDate) [count]
from @StudentTable
Group by
StudentId,  Subject,    Tutor,Month(StudentVisitDate)
)

getting the effective incentives for each month using the information from above table
select
s.StudentVisitDate  ,
s.StudentId ,
s.StudentName ,
s.[Subject] ,
s.Tutor ,
Case
when t.maxdate = s.StudentVisitDate -- the incentive will be applied on the maximum date
then
 s.Incentive*t.count
 else
 0
 end Incentive
from @StudentTable s
inner join temp t
on s.StudentId=t.StudentId
and s.Subject =t.Subject
and s.Tutor=t.Tutor
and Month(s.StudentVisitDate)=t.month
order by StudentVisitDate

Final output -
StudentVisitDate    StudentId   StudentName Subject Tutor   Incentive
2018-08-03  123 Terry Brooks    AP Math Shawn Green 10
2018-08-04  123 Terry Brooks    AP Science  Ted Berry   10
2018-08-07  123 Terry Brooks    Music   Shawn Green 10
2018-09-03  123 Terry Brooks    AP Math Shawn Green 0
2018-09-04  123 Terry Brooks    AP Science  Ted Berry   10
2018-09-07  123 Terry Brooks    AP Math Shawn Green 20

A: I think you just need window functions:
select t.*,
       (case when cnt = 2 then 10 else 0 end) as incentive
from (select t.*,
             count(*) over (partition by studentid, subject, tutor, year(studentvisitdate), month(studentvisitdate) as cnt
      from t
     ) t


text:
Q: How to prove this greedy algorithm as optimal? The problem sounds like this: we get n-cubes. Each cube has a length (the edge's length) and a colour. The edges' lengths are distinct, but the culours are not, for instance: any two cubes can never have the same length, but it is possible to have the same colour. The colours are from 1 to p (p is given).
We have to build a cube-tower that has a maximum height, following these rules:
1) a cube cannot be placed upon a cube if they have the same colour;
2) a cube cannot pe placed upon a cube whose edge's length is smaller.
e.g: cube c1 has a length of 3, cube c2 has a length of 5. cube c1 can be placed on the top of c2, but cube c2 cannot be placed on the top of c1.
Alright, so the algorithm I came up with in order to solve this problem is this:

*

*we sort the cubes by edge length, in descending order and we put them in an array;

*we add the first cube in the array to the Tower;

*we save the length of the last inserted cube( in this case, the first cube's length ) in variable l;

*we save the colour of the last inserted cube( in this case, the first cube's colour ) in variable c;

*we go through the rest of the array, inserting the first cube whose length is smaller than l and colour different than c and then we repeat 3-4-5;

Now what I'm having difficulties with is, how do I prove this greedy algorithm to be the optimal one? I guess that the proof has to somehow look like the ones here: http://www.cs.princeton.edu/~wayne/kleinberg-tardos/pdf/04GreedyAlgorithmsI-2x2.pdf

A: The question is:

*

*Is there a case where picking the max-length cube is not optimal?
At each decision-node we have to decide if we pick a or b, given a>b:
Assume picking b is strictly optimal (implies max-height):

*

*Case 1: col(a) == col(b)

*b optimal => final tower: b, x0, x1, ...

*but also valid by construction with equal height: a, x0, x1, ...

*valid because: col(a) == col(b), (a > b) & (b > x0) => (a > x0) (transitivity)

*contradiction!

*Case 2 col(a) != col(b)

*b optimal -> final tower: b, x0, x1, ...

*but also valid construction with more height: a, b, x0, x1, ...

*valid because: (a > b) & (col(a) != col(b)) => a before b

*contradiction!

We assumed picking b is strictly optimal and showed contradictions. Picking b can only be equally good or worse than picking a (the max-length cube of the remaining ones).


text:
Q: Python - Paste document to each folder in directory I have an annual file located on our netwrok that contains sub-folders based on each week of the year.  I am trying to write a script that will copy a "Template" document saved on my desktop, then iterate through the annual file, and paste the Template into each weekly sub-folder.
I have a script that is generating a "PermissionError: [Errno 13] Permission denied:" though I am not sure why, and therefore not sure what to do about it.
import os
import shutil

myPath = r"""K:\PROCESS\YEAR"""
myDocument = r"""C:\Users\me.domain\OneDrive - Co Name\Desktop\Template.xlsx"""

for filename in os.listdir(myPath):
    with open(os.path.join(myPath,filename)) as myFile:
        copyfile(myDocument, myFile)

Error is,
PermissionError: [Errno 13] Permission denied: 'K:\PROCESS\YEAR\WEEK 1'

@ line 'with open(os.path.join(myPath,filename)) as myFile:'
I tried moving the target document to the program root and modified the script based on some sugestions as seen below.
import os
from shutil import copy2

my_doc_path = "Template.xlsx"
myPath = "K:\PROCESS\YEAR"

for directory in os.listdir(myPath):
    copy2(my_doc_path, directory)

I am no longer receiving any errors; however, the target document is not being coppied to the target directory. Instead, a nondescript "file" with the target directory name is being created in the program root as seen in the image below.

What ended up working:
import os
from shutil import copy

my_doc_path = "Template.xlsx"
myPath = "K:\PROCESS\YEAR"

for directory in os.listdir(myPath):

    target_directory = myPath + '\\' + directory
    check_file = target_directory + '\\' + my_doc_path

    if not os.path.exists(check_file):
        copy(my_doc_path, target_directory)

A: Instead of opening a file, try to copy your file in the target folders.
from shutil import copy

my_doc_path = "/here/is/my/doc/path.xlsx"
myPath = "K:\PROCESS\YEAR"

for directory in os.listdir(myPath):
    copy(my_doc_path, directory)

Or if you need also the metadata:
from shutil import copy2

my_doc_path = "/here/is/my/doc/path.xlsx"
myPath = "K:\PROCESS\YEAR"

for directory in os.listdir(myPath):
    copy2(my_doc_path, directory)

Why copy/copy2 instead of copyfile? take a look at this comment

A: The document name needed to be appended to myPath variable.  I incorrectly assumed the copy2() function was looking for the path to save the document to, I didnt realize it required the full destination path including the document itself.
Thanks for the feedback everyone, it got me pointed in the right direction.