text:
Q: Rails web app authenticated with windows Is it possible for a rails web application to make use of the windows authentication features in its code. I am looking at being able to obtain the user's login name and domain in the application. But there is a catch.
This particular web application runs off an apache web server hosted on a linux machine which is kind of networked to other windows machines.
Is all of this possible?

A: You can use mod_auth_sspi with Apache to enable NTLM authentication (have a look at this post).
Another way to do it with Basic authentication is with the mod_authnz_ldap to enable LDAP authentication (Basic authentication) in Apache which will allow it to talk to Active Directory for authentication.

A: If you are using Apache, then, yes, you should be able to achieve that. First, portect the directory your Rails app lives with Apache, using LDAP/Kerberos (aka Active Directory) - this link describes what you've got to do.
After you are done with that, in your Rails app, the name of the Kerberos principal that logged in should be available in the environment vairable REMOTE_USER.


text:
Q: How to get foreign key table values using foreign key in the view public class SubCategory
{
    public int SubCategoryId { get; set; }
    [StringLength(25)]
    public string SubCategoryName { get; set; }
    [ForeignKey("Category")]
    public int CategoryId { get; set; }
    public Category Category { get; set; }
}
public class Category
{
    [Key]
    public int CategoryId { get; set; }
    [StringLength(25)]
    public string CategoryName { get; set; }
}

These are my domain models, I created a view using this SubCategory model. I need to show a table in the view which consist of headings (CategoryName, SubCategoryName).
How can I access CategoryName values respect to the each rows in the SubCategory Table?

redpajama_set_name: RedPajamaStackExchange


text:
Q: Display column result  as row result  php I am sure the title is not even right on this one.
Here is the issue , I have 3 columns and 6 results
that are displayed like this
Column1           Column2             Column3
result1           result3             result5
result2           result4             result6

but need them like this
Column1           Column2             Column3
result1           result2             result3
result4           result5             result6

my array holds all 6 results and so far I see I need to pick  every 0 and 2nd to be displayed in column1 and continue( array starts at 0).
the code is pretty large but the main part for switching results is here
$count = count($result);
for ($result = 0; $result < $count; $result++) {
                    $getorder= "";
                    if ($count != 1) {
                        if ($result == 0) $getorder= "first";
                        if ($result == $count - 1) $getorder= "last";
                    }

    echo '
'.$mycolumn[$result].'
';
}

so this here should have some kind of division. Here is just dumb example
$mycolumn[$result % X == X]

i hope I did not confuse you and you get the idea.  If you ask yourself why i don't just do rows instead columns , answer is complete css reconstructions. whit this here figured out I can target the results and keep columns and css as they are

A: Don't use ($result / 3) since you can have seriuous rounding problem.
Since to me it's not very clear the name of your vars I post you a php generic code and it is:
echo '
';
for($i = 0; $i < $columnNum; $i++)
{
   echo '
';
   for($j = $i; $j < $resultNum; $j += $columnNum)
      echo '' . array[j] . "";
   echo '
';
}
echo '
';

Just change the vars name with your needs and this is the solution to your problem.

A: $mycolumn[intval($result / 3) + intval(($result % 3) * $count / 3)]

Demo http://codepad.viper-7.com/hdSi6b
Working flawlessly.
You can change whole code as AurelioDeRosa said.


text:
Q: How can I rearrange form fields for customer address attributes in the admin? I am developing a Magento extension that adds several custom attributes to the customer address. My goal is to rearrange the address input fields in the admin order form. When I change the sort order of the attributes, the arrangement changes, but only for the custom attributes. I.e. I cannot place input field for custom attribute before input field for a system attribute.
I've read the source code in Mage_Adminhtml_Block_Sales_Order_Create_Form_Address and  Mage_Customer_Model_Form but still cannot figure out how to do it.
Is this possible at all? If so, how do I achieve it?
Edit
In my mysql4-install-0.1.0.php script, I use:
$this->addAttribute('customer_address', 'carrier_office_name', array(
    'type' => 'int',
    'input' => 'text',
    'label' => 'Carrier office name',
    'global' => 1,
    'visible' => 1,
    'sort_order' => 247, // example
    'required' => 0,
    'user_defined' => 1,
    'visible_on_front' => 1
));

A: If somebody else is trying to achieve this:
$someFieldName = $this->_form->getElement('some_field_name');

//Remove the element from its default position
$fieldset->removeField($someFieldName->getId());

//Add new field
$someNewField = $fieldset->addField($someFieldName->getId(),
                'text',
                $someFieldName->getData(),
                **$this->_form->getElement('lastname')->getId()**);

The key piece of info: $this->_form->getElement('lastname')->getId() is the element AFTER which the custom input field has to be positioned.

A: Take a look at the code found in Mage_Adminhtml_Block_Sales_Order_Create_Form_Address::_prepareForm. After it calls _addAttributesToForm to add all the attributes, it does extra processing on a handful of the default attributes. When it does this, it is removing them from the form, then adding them back in after '^' which will put them at the top of the form regardless of their original position.
It is certainly possible to alter the positioning of all the attributes in the form, but to do so you will need to extend the block in order to control the final positioning of the form elements.

A: The solution that I used was to define my custom attribute as a system attribute. The only thing required for that was to set the parameter 'user_defined' with the value 0.
$this->addAttribute('customer_address', 'mobile', array(
'type' => 'varchar',
'input' => 'text',
'label' => 'Mobile',
'global' => 1,
'visible' => 1,
'required' => 0,
'user_defined' => 0,
'visible_on_front' => 1,
'position' => 130 ));

Dont know if the difference between a system or user defined attribute matters.
NB (magento 1.9.2.1) : I had to use the parameter 'position' instead of 'sort_order' for the method addAttribute()


text:
Q: how to store data with indexing foreign key java im working at a java project and i want to store data in db
in phpmyamin i set in my table publication id_createur as a foreign key that reference to membre table

    public class PublicationService  implements IPublicationService{

private Connection connection;

public PublicationService() {
      connection = DataSource.getInstance().getConnection();
}

@Override
public void add(Publication pub) {
    try {
        String req = "insert into publication(description,id_createur) values (?,?)";
        PreparedStatement ps = connection.prepareStatement(req);
        ps.setString(1,pub.getDescription());
        ps.setInt(2,pub.getCreateur().getId());
        ps.executeUpdate();

    } catch (SQLException ex) {
        ex.printStackTrace();
    }
}

@Override
public void update(Publication t) {

}

@Override
public void delete(Integer id) {
}

@Override
public List<Publication> getAll() {
            List<Publication> pubs = new ArrayList<>();
            return pubs;

}

  }

this is my interface IpublicationService that extends IService
 public interface IPublicationService extends IService<Publication, Integer>
{

 }

and this is my Iservice interface
   public interface IService <T,R> {

void add(T t);
void update(T t);
void delete(R id);
List<T> getAll();

  }

and finally this is my model publication
  public class Publication {
private int id ;
private String description;
private int nb_jaime;
private Date date_publication;
private Membre createur;

public Publication(String description, Date date_publication) {
    this.description = description;
    this.date_publication = date_publication;
}

public Publication(String description, Date date_publication, Membre createur) {
    this.description = description;
    this.date_publication = date_publication;
    this.createur = createur;
}

public Publication(String description, Membre createur) {
    this.description = description;
    this.createur = createur;
}

public int getId() {
    return id;
}

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

public String getDescription() {
    return description;
}

public void setDescription(String description) {
    this.description = description;
}

public int getNb_jaime() {
    return nb_jaime;
}

public void setNb_jaime(int nb_jaime) {
    this.nb_jaime = nb_jaime;
}

public Date getDate_publication() {
    return date_publication;
}

public void setDate_publication(Date date_publication) {
    this.date_publication = date_publication;
}

public Membre getCreateur() {
    return createur;
}

public void setCreateur(Membre createur) {
    this.createur = createur;
}

@Override
public int hashCode() {
    int hash = 7;
    hash = 97 * hash + this.id;
    return hash;
}

@Override
public boolean equals(Object obj) {
    if (this == obj) {
        return true;
    }
    if (obj == null) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final Publication other = (Publication) obj;
    if (this.id != other.id) {
        return false;
    }
    return true;
}

@Override
public String toString() {
    return "Publication{" + "id=" + id + ", description=" + description + ", nb_jaime=" + nb_jaime + ", date_publication=" + date_publication + ", createur=" + createur + '}';
}

}

this is my test main method
   public class TestPublicationService {
public static void main(String[] args) {
    Publication p = new Publication("testjava",new Membre(1));
    IService ps = new PublicationService();
    ps.add(p);

}

 }

but i got error  cannot add foreign key constraint

A: i make clean and build in the properties of my projects and everything is working fine


text:
Q: Как исправить отображение border-bottom в таблице с overflow-x: auto? Делаю таблицу на flexbox, столкнулся с проблемой отображения бордера.

Vue.config.devtools = false
Vue.config.productionTip = false
const vm = new Vue({
  el: "#table"
})
.table {
  display: flex;
  flex-flow: column nowrap;
  overflow-x: auto;
}

.row {
  width: 100%;
  display: flex;
  flex-flow: row nowrap;
  align-items: flex-start;
  border-bottom: 1px solid #d0d0d0;
}

.column {
  flex: 1 0 150px;
  max-width: 150px;
}

.cell {
  padding: 20px;
}

        Row: {{ row }}

        Column {{ column }}

Как исправить эту багулину ?

A: Заменяем flex на inline-flex и вуаля:

Vue.config.devtools = false
Vue.config.productionTip = false
const vm = new Vue({
  el: "#table"
})
.table {
  /* display: flex;
  Использование inline-flex предотвращает выход
  дочерних элементов за рамки родителя */
  display: inline-flex;
  flex-flow: column nowrap;
  overflow-x: auto;
}

.row {
  width: 100%;
  /* display: flex;
  И снова спасает inline-flex */
  display: inline-flex;
  flex-flow: row nowrap;
  align-items: flex-start;
  border-bottom: 1px solid #d0d0d0;
}

.column {
  /* flex: 1 0 150px;
  max-width: 150px;
  Используем конкретную ширину для корректного
  расчета ширины родительского контейнера
  можно комбинировать max-width и min-width */
  width: 150px;
}

.cell {
  padding: 20px;
}

        Row: {{ row }}

        Column {{ column }}


text:
Q: Regex to catch similar matching word until it hits a number I have this df:
data1 <- structure(list(attr = c("kind1", "kind2", "kind3", "price1",
"price2", "packing1", "weight1", "weight2", "calorie1"), coef = c(-1.08908045977012,
-0.732758620689656, -0.922413793103449, -0.570881226053641, 0.118773946360153,
-0.0287356321839081, -0.168582375478927, 0.173371647509578, -0.646551724137931
), pval = c(0.0000000461586619475345, 0.000225855110699109, 0.00000354973103147522,
0.000189625500287816, 0.506777189443937, 0.801713589134903, 0.269271977099465,
0.33257496253009, 0.0000000192904668116847)), row.names = c(NA,
-9L), class = "data.frame")

#      attr        coef             pval
#1    kind1 -1.08908046 0.00000004615866
#2    kind2 -0.73275862 0.00022585511070
#3    kind3 -0.92241379 0.00000354973103
#4   price1 -0.57088123 0.00018962550029
#5   price2  0.11877395 0.50677718944394
#6 packing1 -0.02873563 0.80171358913490
#7  weight1 -0.16858238 0.26927197709946
#8  weight2  0.17337165 0.33257496253009
#9 calorie1 -0.64655172 0.00000001929047

I'm trying to add by groups according to a regex that identifies similar words up to a certain point, in this case, until a number appears.
For example, in the case of my variables, there would be 5 groups:
kind
Total = kind sum
price
Total = price sum
packing
Total= packing sum
weight
Total = weight sum
calorie
Total = calorie sum

I made this code, but I don't know how to position this regex or how to create it. I tried using stringr but I couldn't do what I want:
data1 %>%
  dplyr::arrange(attr) %>%
  split(f = .[,"attr"]) %>%
  purrr::map_df(., janitor::adorn_totals)

#     attr        coef             pval
# calorie1 -0.64655172 0.00000001929047
#    Total -0.64655172 0.00000001929047
#    kind1 -1.08908046 0.00000004615866
#    Total -1.08908046 0.00000004615866
#    kind2 -0.73275862 0.00022585511070
#    Total -0.73275862 0.00022585511070
#    kind3 -0.92241379 0.00000354973103
#    Total -0.92241379 0.00000354973103
# packing1 -0.02873563 0.80171358913490
#    Total -0.02873563 0.80171358913490
#   price1 -0.57088123 0.00018962550029
#    Total -0.57088123 0.00018962550029
#   price2  0.11877395 0.50677718944394
#    Total  0.11877395 0.50677718944394
#  weight1 -0.16858238 0.26927197709946
#    Total -0.16858238 0.26927197709946
#  weight2  0.17337165 0.33257496253009
#    Total  0.17337165 0.33257496253009

It sums individual rows as groups differ by number. I need a regex that captures this:
kind
price
packing
weight
calorie

That is, to capture the letters until a number appears there.

A: You can create a grouping variable by removing the digits from the attr variable, and then use group_modify:
data1 %>%
  group_by(grp = str_remove_all(attr, "[0-9]")) %>%
  group_modify(janitor::adorn_totals, where = "row") %>%
  ungroup() %>%
  select(-grp)

#  # A tibble: 14 × 3
#  attr         coef           pval
#  <chr>       <dbl>          <dbl>
#  1 calorie1 -0.647   0.0000000193
#  2 Total    -0.647   0.0000000193
#  3 kind1    -1.09    0.0000000462
#  4 kind2    -0.733   0.000226
#  5 kind3    -0.922   0.00000355
#  6 Total    -2.74    0.000229
#  7 packing1 -0.0287  0.802
#  8 Total    -0.0287  0.802
#  9 price1   -0.571   0.000190
# 10 price2    0.119   0.507
# 11 Total    -0.452   0.507
# 12 weight1  -0.169   0.269
# 13 weight2   0.173   0.333
# 14 Total     0.00479 0.602

A: Something like this:
We could use group_split() after extract the words to identify. Then we get a list. Here we now can iterate with map_df the function adorn_totals:
library(tidyverse)
library(janitor)

data1 %>%
  group_split(id=str_extract(attr, '[A-Za-z]+')) %>%
  map_dfr(., adorn_totals) %>%
  select(-id) %>%
  as_tibble()

  attr         coef         pval
   <chr>       <dbl>        <dbl>
 1 calorie1 -0.647   0.0000000193
 2 Total    -0.647   0.0000000193
 3 kind1    -1.09    0.0000000462
 4 kind2    -0.733   0.000226
 5 kind3    -0.922   0.00000355
 6 Total    -2.74    0.000229
 7 packing1 -0.0287  0.802
 8 Total    -0.0287  0.802
 9 price1   -0.571   0.000190
10 price2    0.119   0.507
11 Total    -0.452   0.507
12 weight1  -0.169   0.269
13 weight2   0.173   0.333
14 Total     0.00479 0.602


text:
Q: Can't connect to neo4j via Browser, bolt port changed in neo4j browser I have used neo4j until now with a previous database. I now created a new database and I try to open neo4j browser and suddenly, I find:

BoltConnectionError: No connection found, did you connect to Neo4j?

Seeing logs of my database, I see :

018-12-20 12:56:17.381+0000 WARN  Server thread metrics not available
  (missing neo4j.server.threads.jetty.all) 2018-12-20 12:56:17.385+0000
  WARN  Server thread metrics not available (missing
  neo4j.server.threads.jetty.idle)

I also noticed that the bolt port of my neo4j browser changed from (localhost) 7687 to 11004. I can however open my database on my internet browser with 7687 port. But, I cannot access my favourited cypher scripts. Hence, I would prefer to connect to my graph db through neo4j browser. Any idea on how this issue can be solved? Thanks in advance :)

A: Bolt port is changed whenever the current port(7687) is used by another process(another instance of neo4j).
You can open the database in your internet browser on port 7687 because there are multiple instances, and you're accessing another instance not the current one.
To access the correct database instance use the current port(11004 in this case). Looks like a port in changed but Neo4j is not running, you need to start/restart the neo4j.
You can check if the neo4j is running or not from cmd(admin mode)
using these commands:

neo4j status
netstat -ano | findstr :11004

Replace 11004 if the port is different.


text:
Q: Using the same table for entities that are almost alike when it breaks foreign key integrity? I'm designing a website with a database that should support events that a user can sign up for, fx. a concert. Users can sign up using our internal registration system, or using an external website (which we just redirect to).
So events can be internal or external. Both types of events have the same type of metadata such as date, title and place etc. If the event is internal then some can tables refer to the event ID using a foreign key, fx. the many-to-many table users_events, there's also some tables that handle billing-data related to internal events.
My current setup is a single event table that has the columns I mentioned before, date, title, place etc. It also has an external_signup_url column, which is NULL when an event is internal, and contains an URL for when an event is external. The problem with this design is that the tables that references an event ID by a foreign key can potentially reference an external event, which makes no sense at the application level.
So my question is, even though the two types of events are so similar (attribute-wise), does the small difference, and the potential non-sensical foreign key reference, really warrant separate tables, fx. external_event and internal_event?

A: Typically you would design the database such that someone coming into the database alone could get a handle on how the application worked. Had they seen such a foreign key they may not be aware of it's implications.
You could approach this in two ways:
First, you could do as you mentioned. Create two separate tables and handle them there.
Second, and the way I would recommend, you would create a table to handle all the common fields between the two, and then two other tables, one for internal-specific data, and one for external-specific data. Each of those tables would have a primary-foreign key to the common table. I.e. a Guid or ID.
The downfall of the second method is the application would be required to be aware of the two different tables, and depending on the method you are using to implement it (.NET, PHP, Python, etc) you may find one method easier than the other.
I personally use .NET and C# or VB, depending on the project, and in this situation I would go with the three-table design, as I would create an abstract class ("Event") and then two classes to inherit it and all the common properties ("ExternalEvent", "InternalEvent"). The Event class would handle the interaction of the shared properties, and the InternalEvent and ExternalEvent would handle the logic specific to them.
The upside to this approach is the polymorphism of it. If you add a common field to the two in the future (for whatever unprecedented reason) you only have to add/change it in one location.


text:
Q: BIRT: Gradient Across Chart instead of Bars I want to style my chart in BIRT Designer Pro such that I have a color gradient moving across the bars. I know this can be accomplished using the format chart editor and adjusting the series palette to have a color gradient, but this doesn't achieve quite what I want to accomplish. My chart looks like this currently: You can see that the gradient moves across all the bars from start to finish no matter how long the bars are. In reality, what I want to accomplish can be seen in this Photoshop render:
In this image you can see how the gradient depends on how long the bar is and does not extend all the way between both colors of the gradient. Is it possible to do something like this in BIRT via scripting?

A: This turned out to be very simple to fix in the BIRT Designer. All that was needed was a custom theme with the following Highcharts.js needed to style it:
color: {
     linearGradient: [0, 0, 0, '100%'],
         stops: [
             [0, '#FCB314'],
             [1, '#EF6F00']
         ]
 }
The crucial piece of this was the addition of the 100% when specifying the gradient in the first place.


text:
Q: Find gradient of a equi-angular spiral (log spiral) I encountered a problem in determining the gradient in cartesian coordinates (x,y) of a logarithmic spiral (or equi-angular spiral) profile. The log-spiral definintion is as shown below (similar to a previous question of mine):

I have also generated several points in accordance to the profile using the equation `r=a*e^(θtan m):
Point x y
0 9.9999997 2.700000258
1 9.805274245   2.030963458
2 9.452271678   1.338905277
3 8.921115486   0.654692774
4 8.196483978   0.016283107
5 7.269524783   -0.531552828
6 6.139893897   -0.937932945
7 4.817842108   -1.147059284
8 3.326250384   -1.099962912
9 1.702494595   -0.736840057
10 0 0
with (xc,yc) = (7.699656589, 4.680792423); a = 2.013727242; and m = 30 degrees
The plot of the points:

Using cartesian equation from the book: https://books.google.com.sg/books?id=YlLpO8Sv8RMC&pg=PA69&lpg=PA69&dq=log+spiral+cartesian+equation&source=bl&ots=FsW4lA8Y_K&sig=KRAOE42VVGMeTLHiCRlVNhnK6dY&hl=en&sa=X&ei=rjErVdWWLYaKuASO6oCYBw&ved=0CC8Q6AEwAzgK#v=onepage&q=log%20spiral%20cartesian%20equation&f=false
The cartesian equation of a log spiral is (excerpt of the book):

What I then did next was to bring the term y/x to the left hand side of the equation so that the cartesian equation equates to zero.
I substituted the points into the equation but they did not yield zero for any case:
Point Equation_value
0 -1.423441983
1 -1.421707215
2 -1.449201544
3 -1.52278722
4 -1.677072486
5 -1.997427817
6 -2.770942087
7 -5.989331442
8 10.18165028
9 1.961047581
10 -27.63998102
This didnt make sense to me and I'm not sure what I did wrong. Formula in Excel appears to be correct though.
Also, does anyone has an approach/equation describing the gradient of a logspiral curve, given (x,y) coordinates?
Thank you.
Regards
Corse

A: Hope the graph and given spiral equation would clarify. Else, meet in chat.
$$ r = a e^{ \cot m . \theta }$$

A: As shown in your book excerpt, some problems are just not served very well by Cartesian coordinates. Let's consider this problem in complex coordinates. The generic form for a logarithmic spiral with flair coefficient $b$ and its gradient are given by
$$z=e^{(b+i)\theta}\\
\dot z=(b+i)e^{(b+i)\theta}$$
If you want the gradient expressed as the tangent angle, then
$$\Theta=\text{tan}^{-1}\frac{\mathfrak{Im}(\dot z)}{\mathfrak{Re}(\dot z)}$$
Of course this can expressed in term of $x$ and $y$, but it's very messy, indeed.


text:
Q: How do I add multiple sections to an MvxTableView? I'm trying to create an MVVMCross-based UITableView with multiple sections. The recommended way of binding data in the ViewModel to items in the table is to create a binding with an MvxTableViewSource's ItemsSource property like so:
var source = new MyCustomMvxTableViewSource(MyTableView);

this.AddBindings(new Dictionary<object, string>
{
    {source, "ItemsSource MyObservableCollection"}
});

MyTableView.Source = source;

This works fine if I don't need to have multiple sections, but I do. There's a super-complicated example of achieving this here, but I'm very much hoping that there's a much simpler way of doing this with MVVMCross. There's nothing in their documentation that helps with this, even though a table with sections is a common iOS feature.
I'm hoping someone, somewhere can point me in the direction of some code examples to help me achieve this?

A: I think you can find a lot of answers after searching online.
We just need to implement NumberOfSections and GetViewForHeader delegate method in MyCustomMvxTableViewSource.
And don't forget to change your model struct if you want to show different sections.
Refer to Modern approach for UITableView grouping with Mvvmcross


text:
Q: Do I need to declare $_REQUEST['From'] and $_REQUEST['To'[ ahead of time I am trying to follow this API tutorial, but I get errors with the $_REQUEST['From'] and $_REQUEST['To'] array variables
I am expecting to see a response like what I got for this Tutorial so I can hook it to my Twilio number.
Instead I see this Error.
Here is the code referenced
if(!$name = $people[$_REQUEST['From']]){
      $name = "Caller";
    }


text:
Q: 10 bit values in a 16 bit image I am using C# to call a camera API in C++ which returns an image where each pixel is interpreted as a 2 byte value. However, the camera operates at 10 bits, so the image range is between 0 and 1023 inclusive.
For the usual 8 bit images, I was doing:
Bitmap bmp = new Bitmap(width, height, PixelFormat.Format8bppIndexed);
ColorPalette ncp = bmp.Palette;
for (int i = 0; i < 256; i++)
    ncp.Entries[i] = Color.FromArgb(255, i, i, i);
bmp.Palette = ncp;

Now, I want to similarly create the palette entries for my 10 bit images. My question is whether I should use 1024 entries or the full 16 bit 65536 entries even though my range will always be 0-1023.


text:
Q: s3api put-object with spaces included in the name of the file I am trying to upload files to S3 in order to get some redirects working.
Unfortunately I notice some anomalies when the file names have spaces.
My bash script is very simple:
#!/usr/bin/env bash
declare -A redirects
redirects["foo/bar/index.html"]="/foo/"
redirects["foo/bar/test.pdf"]="/foo/test.pdf"
redirects["assets/docs/NEW-TEST WELCOME TO MYTEST.pdf"]="/"

for i in "${!redirects[@]}"
do
    echo "Executing command: aws s3api put-object --bucket $BUCKET_NAME --key" '"'${i}'"' "--website-redirect-location" "${redirects[$i]}"
    aws s3api put-object --bucket $BUCKET_NAME --key '"'${i}'"' --website-redirect-location "${redirects[$i]}"
done

From the output what I can see is:
Executing command: aws s3api put-object --bucket myamazingbucket --key "assets/docs/NEW-TEST WELCOME TO MYTEST.pdf" --website-redirect-location /
usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:

  aws help
  aws <command> help
  aws <command> <subcommand> help

Unknown options: TO, MYTEST.pdf", WELCOME

Do you have suggestions on how to make these put-objects on S3?

A: By specifying '"'${i}'"' you are forcing a literal quote at the beginning and end of the string, which internally results in an aws command like:
aws s3api put-object --bucket BUCKET_NAME --key '"assets/docs/NEW-TEST' WELCOME TO 'MYTEST.pdf"' --website-redirect-location /

Instead, you should properly quote your string, changing your aws command line to:
aws s3api put-object --bucket $BUCKET_NAME --key "${i}" --website-redirect-location "${redirects[$i]}"

... which internally results in an aws command like below.
aws s3api put-object --bucket BUCKET_NAME --key 'assets/docs/NEW-TEST WELCOME TO MYTEST.pdf' --website-redirect-location /

Btw. your echo command behaves differently because you're passing the quoted command line to echo as a quoted string.


text:
Q: How to: Allow a ViewPager to function normally whilst passing touch events to a view the ViewPager is overlapping I have a TabLayout and a ViewPager which contains the tabs.
The ViewPager is positioned above the TabLayout so that the ViewPager overlaps the TabLayout, and as a result, the TabLayout buttons which navigate between the different tabs do not work because the ViewPager is intercepting the touch events.
I've tried to fix the issue by calling requestDisallowInterceptTouchEvent(true) on the ViewPager and it didn't fix the issue.
I also created a custom ViewPager and overrode the onTouchEvent() method like this:
 @Override
    public boolean onTouchEvent(MotionEvent ev) {
        if (ev.getActionMasked() != MotionEvent.ACTION_MOVE) {
            return false;
        }
        else {
            return super.onTouchEvent(ev);
        }
    }

This allows the TabLayout tab buttons to receive the touch events but the ViewPager doesn't scroll automatically to the different fragments when the ViewPager is scrolled a sufficient amount.
The problem in a nutshell: How do I allow the TabLayout which the ViewPager is overlapping to receive the touch events that the ViewPager is intercepting before the TabLayout, whilst allowing the ViewPager to function properly?
Thanks in advance
Edit:
Here is a basic XML representation of the Activity:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".Activity"

    >

    <include
        android:id="@+id/toolbar"
        layout="@layout/toolbar_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:elevation="50dp"
        />

    <android.support.design.widget.TabLayout
        android:layout_marginTop="?actionBarSize"
        android:id="@+id/tabLayout"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:minHeight="?attr/actionBarSize"
        android:layout_gravity="bottom"
        app:tabMode="fixed"
        android:background="@color/purple_light"
        app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
        app:tabMaxWidth="0dp"
        app:tabGravity="fill"
        android:clickable="true"
        />

    <CustomViewPager
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/viewPager"
        android:layout_below="@+id/toolbar_layout"
        android:clickable="false"
        />

    </RelativeLayout>

Note: I made it seem like the ViewPager pages are below the TabLayout by setting the top margin of the TabLayout fragments enough for them to display below the TabLayout
Here is a basic diagram of the Activity before the views (which function to reveal other fullscreen views onClick) inside the ViewPager are expanded

And here is a basic diagram of my Activity after a clicked view in the pager has revealed the other content:

You can see in the second diagram the TabLayout is covered by the ViewPager content


text:
Q: Having a data upload get "picked up" by SQL Server? I need to transfer some data over to another location so that it can get "refreshed" in their database system (SQL Server).
I'm a little unfamiliar with this, is SQL server able to refresh its own internal tables based on anything? For instance is it able to recreate/refresh tables based on the contents of .CSV files? Or would I need to move the data over in the form of a small Access database with tables or something similar?
What is the "correct" way to do something like this where you need to refresh the data of another server based on the content you have somewhere else?

A: Best way would be to use SSIS as Brad suggested.
But if you are not familiar with SSIS packages then you can opt for simple sql server job to upload data from csv files periodically. Please have a look in below links:
Schedule import csv to SQL Server 2014 Express edition
https://answers.laserfiche.com/questions/74591/Auto-Import-csv-into-SQL-Table


text:
Q: How do I safely remove a path string from a compiled library without corrupting the library? My RPM build process is complaining about the buildroot path string appearing inside several .so files. I've tried using both sed and perl to do a regex replacement of that string with '', but while that silences check-buildroot, it corrupts the .so file and causes anything that uses it to segfault.
This string is apparently not part of an rpath, as chrpath --delete doesn't silence the error message from check-buildroot. I have no idea why the buildroot path is appearing within these .so files.
So what's the "right" way to prevent that buildroot path from appearing in the .so files?
EDIT: Here's my specfile:
%{!?tgrelease: %define tgrelease() %2}
%if 0%{?amzn}

# Prevent /usr/lib/rpm/check-buildroot from running, because the only remedy we've found to silence its error messages
# also corrupts the .so files it complains about.
%define __arch_install_post /usr/lib/rpm/check-rpaths

%define __python python
%define __python_ver python2.6
%define __python_prefix python
%else
%define __python python2.6
%define __python_ver python2.6
%define __python_prefix python26
%endif
%define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")

%define __package directory
%define __package_safe %(echo %{__package} | sed 's/[-. ]/_/g')
%define __pip_package %(echo %{__package} | sed 's/_/-/g' | tr '[A-Z]' '[a-z]')

%define __configdir etc/prod
%define __django_root REDACTED
%define __requirements REDACTED

Name:           %{__package}
Version:        %{__version}
Release:        %tgrelease 0 1
Summary:        REDACTED
Group:          Development/Languages
License:        Restricted
Source0:        %{rname}/%{name}-%{version}.tar.gz
BuildRoot:      %{_tmppath}/%{name}-%(%{__id_u} -n)

BuildRequires:  %{__python_prefix}
BuildRequires:  %{__python_prefix}-setuptools
BuildRequires:  %{__python_prefix}-virtualenv
# Uncomment this when we get git as an RPM on RH6
BuildRequires:  git
BuildRequires:  openldap-devel
BuildRequires:  libxml2-devel
BuildRequires:  libxslt-devel
BuildRequires:  chrpath

Requires:  %{__python_prefix}
Requires:  %{__python_prefix}-virtualenv
Requires:  openldap
Requires:  mysql

%description
REDACTED

%prep
%setup -q -n %{name}-%{version}

%install
rm -rf $RPM_BUILD_ROOT

%{__install} -d %{buildroot}%{__django_root}/conf.d
%{__install} -d %{buildroot}%{__django_root}/cron/daily
%{__install} -d %{buildroot}%{__django_root}/cron/hourly
%{__install} -d %{buildroot}%{__django_root}/%{name}/ve
%{__install} -d %{buildroot}%{__django_root}/%{name}/current_settings
%{__install} -d %{buildroot}%{__django_root}/html/static

#virtualenv
virtualenv-2.6 --no-site-packages %{buildroot}%{__django_root}/%{name}/ve
source  %{buildroot}%{__django_root}/%{name}/ve/bin/activate
pip install -r %{__requirements}
virtualenv-2.6 --relocatable %{buildroot}%{__django_root}/%{name}/ve
deactivate

# Put the settings file into current_settings and add the symlink we will want when installed.
%{__install} -m 664 %{buildroot}%{__django_root}/%{name}/ve/src/%{__pip_package}/%{__configdir}/settings/settings.py %{buildroot}%{__django_root}/%{name}/current_settings/settings.py
rm -f %{__django_root}/%{name}/current_settings/settings.py
ln -sf %{__django_root}/%{name}/current_settings/settings.py %{buildroot}%{__django_root}/%{name}/ve/src/%{__pip_package}/directory/settings/settings.py

#fix the wrong paths in easy_install.pth
perl -p -i -e "s#$RPM_BUILD_ROOT##g" %{buildroot}%{__django_root}/%{name}/ve/lib/%{__python_ver}/site-packages/easy-install.pth
#fix the wrong paths in activate
perl -p -i -e "s#$RPM_BUILD_ROOT##g" %{buildroot}%{__django_root}/%{name}/ve/bin/activate*

# The Linux build hosts we use have recently become persnickety about references to the build root in deployed files.
# egg-links and *.so files in our site-packages folder have this problem:
# THIS IS COMMENTED OUT BECAUSE IT CORRUPTS THE *.so FILES.
#find %{buildroot} -name "*.egg-link" -o -name "*.so" -o -name "*.txt" | xargs perl -p -i -e "s{\Q$RPM_BUILD_ROOT\E}{}g"

# The Linux build slaves we use are persnickety about rpaths in libraries pointing to directories that don't exist.
# So we use chrpath to purge them.
chrpath --delete %{buildroot}REDACTED/ve/lib/python2.6/site-packages/_ldap.so

# Un prelink everything
# http://www.alexhudson.com/2013/05/24/packaging-a-virtualenv-really-not-relocatable/
find %{buildroot}%{__django_root}/%{name}/ve -type f -perm /u+x,g+x -exec /usr/sbin/prelink -u {} \;
# re-point the lib64 symlink - not needed on newer virtualenv
if test -d %{buildroot}%{__django_root}/%{name}/ve/lib64; then
  rm %{buildroot}%{__django_root}/%{name}/ve/lib64
  ln -sf %{__django_root}/%{name}/ve/lib %{buildroot}%{__django_root}/%{name}/ve/lib64
fi

%clean
rm -rf $RPM_BUILD_ROOT

%preun
if [ $1 -eq 0 ]; then
    rm -rf %{__django_root}/%{name}/html
    rm -rf %{__django_root}/whoosh
fi

%files
%defattr(-,root,root,-)
# Prevent RPM from deleting our manually edited settings files during upgrade.
%config(noreplace) %attr(660,apache,apache) %{__django_root}/conf.d/%{name}_apache.conf
%config(noreplace) %attr(660,apache,apache) %{__django_root}/%{name}/current_settings/settings.py
%attr(775,apache,apache) %{__django_root}/%{name}/html/static
%{__django_root}/%{name}/ve
%{__django_root}/%{name}/current_settings

A:
While I can't give an authoritative answer on how exactly to fix your problem, as I too am new to this packaging thing, I do want to drop off a lead that helped me with such a problem of mine, for future readers.

During the build configuration phase, I thougt it best to use the tool's PREFIX to set the install directory to /path/to/buildroot/
This caused the exact issue with check-buildroot finding the path inside the built files.
What helped me was doing setup with PREFIX=/ instead, so that files passed the check, and then a DESTDIR=/path/to/buildroot make install, which had make drop the files in the appropriate location.
That's probably what you might want to look into. Build the project/library as if you were going to install it normally, and only perform the relocation to your rpm buildroot at a later phase, using whatever means your respective building/installing system provides.


text:
Q: How to extract only String part from a column containing alphanumeric String in mysql I have a alphaNumeric column in my mysql Database like this INV0001 and many values like INVI000040  where alphabets can be of variable length and integers can be of variable length. I want to extract only the alphabetic string from this column . I have searched on google I found about PATINDEX but that is not available in mysql . Please give some hint related to this problem . I am not able to understand how to do this.

A: MySQL does have any native regex replacement support, at least not of the time this answer was written.  However, if you just want the letter components, you may try just removing all digits:
SELECT
    col,
    REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(
        REPLACE(col, '9', ''), '8', ''), '7', ''), '6', ''), '5', ''), '4', ''),
         '3', ''), '2', ''), '1', ''), '0', '') AS alpha_only
FROM yourTable;

Demo


text:
Q: Flutter how to check if pdf print data has been delivered I made an app that converts images to datr-pdf and prints them. my app prints in Wi-Fi Direct format and uses the printing package. there is no problem in printing using the default print service in both android and IOS. select a printer from the default print service and press the print button after connecting, data is sent to the printer and the app returns to the previous app screen from the default print service screen.
After sending data to the printer, I want to receive a return about success or failure with a bool variable in the process of returning to the previous screen.
My end goal is to pass data from the app to the printer and when I return to the screen of the app, if return is `true', I want the app to close while printing. I'm looking at the source via 'GitHub' but haven't found it yet. Do you know of a method or class that sends data and returns to the app's screen??
My PrintSource
_generatedPdf(PdfPageFormat format, BuildContext context) async {
    final pdf = pdfWidget.Document(version: PdfVersion.pdf_1_5, compress: true);

  //Page Num
    for(int nCount=0; nCount<context.read<ScoreImageProvider>().scoreImageList.length; nCount++){
      final image = await imageFromAssetBundle(context.read<ScoreImageProvider>().scoreImageList[nCount]);

      pdf.addPage(
          pdfWidget.Page(
              pageFormat: format,
              build: (pdfWidget.Context context){
                return pdfWidget.Center(
                    child: pdfWidget.Padding(
                        padding: pdfWidget.EdgeInsets.zero,
                        child: pdfWidget.Image(image, fit: pdfWidget.BoxFit.fill)
                    )
                );
              }
          )
      );
    }

    bool bRes = await Printing.layoutPdf(onLayout: (format) async => pdf.save());
  }

printing package verseion is printing: ^5.6.6 thank you.
Solved
Check if printing is complete in void onCompleted in PrintingHandler.java file.


text:
Q: Using Two Different Versions of the Same Library I am developing a small library that will be used across multiple applications.  I would like to use some third-party libraries within my own library (e.g. log4Net, Entity Framework, etc.).  I would imagine I can either deploy the DLLs alongside my own library, or use ILMerge to create a single DLL (I know little about ILMerge having never tried it).
I'm concerned about what will happen if the applications that consume my library also use the same third party libraries that I will be using.  For example, if I use log4Net version 1.2, and a consuming app uses log4Net version 1.0, will I get a conflict of some sort, or will only one version of the assembly not load?
Does ILMerge prevent this?  How is this typically resolved when developing a library with 3rd party dependencies?

A: You may use the extern alias:

You might have to reference two versions of assemblies that have the
  same fully-qualified type names. For example, you might have to use
  two or more versions of an assembly in the same application. By using
  an external assembly alias, the namespaces from each assembly can be
  wrapped inside root-level namespaces named by the alias, which enables
  them to be used in the same file.

Here's a Extern alias walkthrough.

A: The best way would be to deploy alongside your app. NuGet manages these sort of dependencies very well. Unless you have some specific reason to use ILMerge, it'll just make your life harder - perhaps you want to upgrade, for example.


text:
Q: AngularJS ng-repeat and filter I'm using scope.$first and scope.$index to apply accordion to my content when ng-repeat finishes populating it. At first I was using just scope.$last but faced this problem - when try to search for some info (using filter) and then turn back to the whole list, accordion doesn't apply.
How to apply accordion when ng-repeat finishes and save it further while filtering?

A: I suggest wrapping the "apply accordion" functionality into a directive.  Define a template for the ng-repeat stuff, then $watch() the model data for changes.  When the $watch triggers, apply the accordion stuff.
See also https://groups.google.com/d/topic/angular/lACrEA-TIto/discussion and
http://angular-ui.github.com/bootstrap/


text:
Q: Python остановка функции Как остановить функцию с помощью другой не вложенной функции? Я пытаюсь остановить функцию с помощью return но это не выходит. Функция vopr2var1btnfunc вызывается с помощью кнопки.
Хочу остановить update_time1 с помощью vopr2var1btnfunc

def vopr1var1btnfunc():
    variant1btn.pack_forget()
    vopr1var1lbl.pack()
    vopr1var1ent.pack()
    vopr1var1btn.pack()
    global currentvariant
    currentvariant = 'Задания для 5-6 классов'
    vopr1timerlbl.pack(anchor=CENTER)
    format1 = '%H:%M:%S'
    target1 = datetime.now() + timedelta(minutes=2)
    global update_time1
    def update_time1():
        now = datetime.now()
        if now < target1:
            remains = round((target1 - now).total_seconds())
            text = time(second=remains % 60, minute=remains // 60).strftime(format1)
            vopr1timerlbl.config(text=text)
            vopr1timerlbl.after(1000, update_time1)
        else:
            vopr2var1()
    update_time1()

def vopr2var1btnfunc():
    if update_time1():
        return
    global vopr1var1answer
    vopr1var1answer = vopr1var1ent.get()
    vopr1var1lbl.pack_forget()
    vopr1var1ent.pack_forget()
    vopr1var1btn.pack_forget()
    vopr1timerlbl.pack_forget()
    vopr2var1lbl.pack()
    vopr2var1ent.pack()
    vopr2var1btn.pack()
    vopr2timerlbl.pack(anchor=CENTER)
    format2 = '%H:%M:%S'
    target2 = datetime.now() + timedelta(minutes=2)
    global update_time2
    def update_time2():
        now = datetime.now()
        if now < target2:
            remains = round((target2 - now).total_seconds())
            text = time(second=remains % 60, minute=remains // 60).strftime(format2)
            vopr2timerlbl.config(text=text)
            vopr2timerlbl.after(1000, update_time2)
        else:
            vopr3var1()
    update_time2()

A: Чтобы остановить функцию надо просто написать return
def foo():
    if True:
        return
    print("Hi")!
foo()

A: Я решил проблему созданием доп переменной. Когда происходит нажатие на кнопку то переменная а увеличивается до нужного значения и функция останавливается. В полном коде после каждого объявления переменной а глобальной а = а + 1.
def vopr1var1btnfunc():
    variant1btn.pack_forget()
    vopr1var1lbl.pack()
    vopr1var1ent.pack()
    vopr1var1btn.pack()
    global currentvariant
    currentvariant = 'Задания для 5-6 классов'
    vopr1timerlbl.pack(anchor=CENTER)
    format1 = '%H:%M:%S'
    target1 = datetime.now() + timedelta(minutes=2)
    global update_time1
    def update_time1():
        now = datetime.now()
        if a == 1: #на каждом вопросе переменная а возрастает на 1
            return
        if now < target1:
            remains = round((target1 - now).total_seconds())
            text = time(second=remains % 60, minute=remains // 60).strftime(format1)
            vopr1timerlbl.config(text=text)
            vopr1timerlbl.after(1000, update_time1)
        else:
            vopr2var1()
    update_time1()

def vopr2var1btnfunc():
    global a #чтобы связать работу переменных а, я каждый раз объявлял глобальными
    a = 1
    global vopr1var1answer
    vopr1var1answer = vopr1var1ent.get()
    vopr1var1lbl.pack_forget()
    vopr1var1ent.pack_forget()
    vopr1var1btn.pack_forget()
    vopr1timerlbl.pack_forget()
    vopr2var1lbl.pack()
    vopr2var1ent.pack()
    vopr2var1btn.pack()
    vopr2timerlbl.pack(anchor=CENTER)
    format2 = '%H:%M:%S'
    target2 = datetime.now() + timedelta(minutes=2)
    global update_time2
    def update_time2():
        now = datetime.now()
        if a == 2:
            return
        if now < target2:
            remains = round((target2 - now).total_seconds())
            text = time(second=remains % 60, minute=remains // 60).strftime(format2)
            vopr2timerlbl.config(text=text)
            vopr2timerlbl.after(1000, update_time2)
        else:
            vopr3var1()
    update_time2()


text:
Q: Rewrite file url to different file using htaccess? I am trying to hide a stylesheet so that when a user visits it directly from the browser, it would show a 404, but show correctly on my site. Is this possible? I am currently trying this with:
RewriteEngine On
Options +FollowSymLinks
RewriteRule ^/?wp-content/themes/mysteam/style.css$ /wp-content/themes/steam/stylesheet.css [L,NC]

Is there any way I can achieve this?
Thanks.

A: You cannot securely hide a css file from the client if you want to use it on at least 1 page.
You can use the referer header to redirect to a 404-page if it is not set, but:

*

*this header can be spoofed

*in some cases it is set anyways

*using developer tools, it would still be visible when viewing the request there

You could set up a very smart system that would generate an unique id for every request, and would only show the css file if that id matches an id that is currently authorized to see that page, but:

*

*using developer tools, it would still be visible when viewing the request there

Your stylesheet is requested from the browser to apply style to your text, and therefore it will always be possible to forge a request with that browser to see the contents of the file (or the output a file generates) or, more simple, by viewing the output when the browser needs it.

The syntax you are using is invalid. See the documentation for more information. The pattern cannot start with a / and it will not include the query string. Your rewriterule would look like:
RewriteCond %{QUERY_STRING} ^wp-content/themes/mysteam/style\.css$
RewriteRule ^$ /wp-content/themes/steam/stylesheet.css? [L,NC]

The first line will match the query string. The second line has a trailing ? in the rewritten part to clear the original query string.


text:
Q: ASP.NET MVC3, Html.TextAreaFor without encoding? How can I use the Html.TextAreaForwithout encoding it?
I know it's a security risk but I have a separate class that sanitizes any text.
Example:
@Html.TextAreaFor(model =>model.PostBodyText, 10, 100, 1)
I'm planning to use it with TinyMCE.
Regards
RaVen
UPDATE
I'm using the new Razor View Engine.

A: You will need to roll your own:
<textarea cols="100" id="PostBodyText" name="PostBodyText" rows="10">
    @MvcHtmlString.Create(Model.PostBodyText)
</textarea>

Of course in terms of security this could be very dangerous as your site is now vulnerable to XSS attacks. So the question is why having a separate class that sanitizes all the text when you can simply rely on the HTML helpers to do the job for you?

A: As an alternative option you might wanna use ValidateInput as described here. An example in MVC style would be:
[ValidateInput(false)]
public ActionResult Method(){
     return View()
}

[ValidateInput(false)]
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Method(){
    // your stuff here
    RedirectToAction("index"); // or something
}

I think that is more the MVC way to go. Now your controller tells you there is a security issue in that controller method. Your view can be any normal view using html helpers etc. Note that this enables all sorts of input, not filtered. It will work with TinyMCE though.
//edit
woops I see you need to add
<httpRuntime requestValidationMode="2.0"/>

to webconfig as well in new versions of MVC. Guess it might not be the way to go.

A: Use [AllowHtml] on the model property. As I learned in In ASP.NET MVC 3, how do I get at the model using Razor Syntax in a Create() View?.


text:
Q: Software to track application profile I am developing a software for number theory investigation, and I am suspicious that is leaking memory.
It would be very nice to log the CPU, and RAM usage of this program through some application. Is there any?
Grateful for the attention,
Yuri S VB.

A: Valgrind is what's usually used to look at memory leaks and related problems.


text:
Q: Node.js write to child process I'm trying to make a mp3 webradio in node.js using the child_process module and the mpg123 player on a raspberry pi.
Here's the problem:
When I try to write to a stream, I always get an Error:
Error: write EPIPE
at exports._errnoException (util.js:1026:11)
at WriteWrap.afterWrite (net.js:795:14)

Here's what I tried to test it:
//create a subprocess
var test = childProcess.exec('ls /home/pi/music');

//pipe all the output to the process output
test.stdout.pipe(process.stdout);
test.stderr.pipe(process.stderr);

test.stdin.setEncoding('utf-8');

//here I just want to write a key to the subprocess
test.stdin.write('q');
test.stdin.end()

Anyone know, what to do, that the created write stream will not be closed until everything is done?
And of course I still searched on google for this:
Child_process throw an Error: write EPIPE
https://github.com/nodejs/node/issues/2985
https://nodejs.org/api/child_process.html#child_process_subprocess_stdin
https://nodejs.org/api/stream.html#stream_writable_write_chunk_encoding_callback
Please help!

A: The EPIPE write error means someone is writing into a pipe that no one will ever read from.
Additionally, because this error is being raised in a context where no one handles it, the error is fatal for your process.  Sadly, node doesn't do a good job of identifying which stream, but we can guess that its in your code, and there is only one stream being written to by this code ...
You can verify that the error is coming from the "stdin" stream if you add an error handler:

test.stdin.on('error', (...args) => { console.log('stdin err', args); });

Now the error will be "handled" (poorly), and the process will continue, so you at least know where its coming from.
Specifically this test.stdin.write('q') is writing a q to the stdin of your process.  But your child process is ls.  It doesn't accept anything on stdin, so it closes stdin.  So the OS sends an EPIPE error back when the parent tries to write to the now-closed pipe.  So, stop doing that.
You probably expect ls to behave the same as when you type ls interactively, but it probably does not (I suspect your interactive ls is going through a pager, and you're expecting that you need to quit that pager?)  This child process is more equivalent to running /bin/ls interactively.


text:
Q: Error put my var in string parameter with ${} reactjs Error: paths must be non-empty strings and can't contain . # $ or
but my code is :
const rootRef = firebase.database().ref();
const emailRef = rootRef.child(`${email}`).set({
  firstName,
  lastName
}).catch(err => {
  setErrors(prev => ([...prev, err.message]))
})

Help please :)

A: What happened if you change?
const emailRef = rootRef.child(`${email}`).set({

to
const emailRef = rootRef.child(email).set({


text:
Q: replacing content in a page with varnish + regex If I want my varnish cache server to replace content inside a page (ie: change the class on a div) from the backend before serving or storing the page (vcl_fetch?), how can this be done?
I would like to use simple regex to perform the replacement as I imagine it is supported natively in varnish.

A: Modifying response body is not natively supported by Varnish. You need a Varnish module (vmod) for this.
Aivars Kalvans has libvmod-rewrite, which does exactly what you are looking for. However the vmod is a proof of concept and according to Aivars it is not ready for production use. You can use it as a starting point in any case.
If you are using Apache, you can use mod_ext_filter to modify response body. Here's an example from mod_ext_filters documentation. Since you can pass the response body to any external command, it is very easy to do the necessary modifications to the content.
# mod_ext_filter directive to define a filter which
# replaces text in the response
#
ExtFilterDefine fixtext mode=output intype=text/html cmd="/bin/sed s/verdana/arial/g"

<Location />
# core directive to cause the fixtext filter to
# be run on output
SetOutputFilter fixtext
</Location>


text:
Q: I need to compare files in 2 directories and be able to tell how long each set of files has been the same in Bash Basically, I have 2 copies of a set of .csv files in separate directories. 1 copy is today's data, and the other copy is yesterday's data. The script I have that makes the backup only runs once per day, so that's how often I need this to run. What I want to do is compare them to see if the files are the same, and if a set of files has been the same for 14 days, then have an email notification get sent out notifying myself and my coworkers that a particular file hasn't changed.
So, I've already got the comparison part down:
diff -sq DIR_1 DIR_2 | sort > comparison_results.txt
However, now I want to read the file and have a counter for each line, so that I know for how many days each set of files has been the same, with the output in separate columns.
Ideally, the 3 columns would be $name_of_file | are the files the same? | how many days have they been the same?
I've got a while loop started for reading each line, but I'm not sure how to progress:
while read line; do
    counter=0
    if [[ $line == *"not identical"* ]]
    then
        $something
    else
       (( counter += 1 ))
        $something_else
    done < comparison_results.txt

If necessary, I can write all this output to a file, and then read that file, and if the counter column has any 14s or higher, then send out an email notification.
Essentially my question is how to read each line and send that to a file with 3 columns, followed by an email notification if any of the files have been the same for 14 days or more?

A: Here's a rough draft of what a function for this purpose could look like. Note that I'm only writing names (in eval-safe quoted form) of files that have been identical for longer than minAge seconds -- sending email is an exercise for the reader.
findConsistentlyIdenticalFiles() {
  local dirA=$1 dirB=$2 storeLoc=$3 minAge=$4
  local fnA fnB fnStore fn currentTime storedTime

  mkdir -p -- "$storeLoc" || return

  # in very new bash, faster alternative is: printf -v currentTime '%(%s)T' -1
  # ...the following command using date is the older/slower/compatible alternative:
  currentTime=$(date +%s)

  # for each file in dirA...
  while IFS= read -r -d '' fnA; do

    # strip the directory name...
    fn="${fnA#$dirA}"; fn="${fn#/}"

    # and calculate the name of a corresponding file in dirB
    fnB=${dirB}/${fn}

    # if a file in dirA doesn't exist in dirB, or the dirB copy differs, clear our flag
    if [[ ! -e $fnB ]] || ! cmp -s "$fnA" "$fnB"; then
      rm -f -- "$storeLoc/$fn"
      continue
    fi

    fnStore=$storeLoc/$fn
    if [[ -e $fnStore ]]; then
      # if we already have a marker, check whether it's over minAge seconds old
      storedTime=$(<"$fnStore")
      if (( storedTime < currentTime - minAge )); then
        printf '%q\n' "$fn"
      fi
    else
      # whereas if we don't have a marker, populate it with the current time
      mkdir -p -- "${fnStore%/*}"
      printf '%s\n' "$currentTime" >"$storeLoc/$fn"
    fi
  done < <(find "$dirA" -type f -print0)

  # ...also, prune any store contents that don't have corresponding dirA contents
  while IFS= read -r -d '' fnStore; do
    fn="${fnStore#$storeLoc}"; fn="${fn#/}"
    [[ -e $dirA/$fn ]] || rm -f -- "$fnStore"
  done < <(find "$storeLoc" -type f -print0)
}

Used as:
findConsistentlyIdenticalFiles dirA dirB .cmptimes "$(( 3600 * 14 ))"

Obviously, you can easily test the logic by using much smaller number of seconds (60 to find identical files not modified for the last minute, 5 for the last 5 seconds, etc).

Some notes:

*

*Using find -print0 emits a NUL-delimited list of filenames, and IFS= read -r -d '' filename reads a single name from such a NUL-delimited list. This format is guaranteed to parse correctly even with very unusual or even malicious names -- names with newlines, names containing strings that look like diff -sq output, etc. See BashFAQ #1, and UsingFind.

*The < <(find ...) syntax avoids the issue described in BashFAQ #24, wherein piping from find into a loop creates a subshell from which changes to shell-local state can't escape.

*Format is one metadata file per content file. This makes it much easier to read, write, or update specific content rather than needing to read and write the entire file at a time.

*The syntax used to strip components from directory names (ie. ${fn#$dirA}, ${fn#/}) is parameter expansion.

*The quoting on the right-hand-side of assignments is present to make StackOverflow's syntax highlighting happy, and is not related to correctness.


text:
Q: How to round off both angles of CollectionViewCell equally? Now, when i round off, i get one rounded and one sharp angle
My code:
override func awakeFromNib() {
    self.layer.cornerRadius = 50
}

How can i round all angles equally?


text:
Q: Python in Big Data? Can python be efficiently implemented in big data field? To be precise I am building an web app that analyses really big data in medical health care field consisting of medical history and huge personal information. I need some advice on how to handle very big data in python efficiently and with high performance. Also are their some open source packages in python available which have high performance and efficiency in big data handling?
About users and data:
Each user has about 3gb of data. Users are grouped based on their family and friend circles and the data is then analysed to predict important information and co-relations out of that. Currently I am talking about 10,000 users and will be rapidly increasing number of users.

A: That is a very vague question, there is no canon definition for what constitutes big data. From a development point of view the only thing that truly changes how you need to handle data is if you have so much that you can't fit it all in memory at once.
How much of a problem that is depend greatly on what you need to do with the data, for most jobs you can do a single pass scheme where you load a block of data, do whatever needs to done with it, unload it, and go on to the next.
Sometimes issues can be solved by doing an organization pass, first going through data organizing it into chunks of data that need to be handled together, then going through each chunk.
If that strategy doesn't fit your task you can still get a long way with OS handled disk swapping, handle the data in blocks as far as possible, but if you need a little arbitrary access here and there it is still going to work.
And of course an always excellent strategy when dealing with a lot of data is to dwarf it by hardware. You can get 64 GB of memory in 16 GB blocks for $500, if you are working with that much data it is an easily justified investment. Some good SSDs is a nobrainer.
Specific case:
A big part of this job is definitely to reduce those 3GB data per person. It is often a bit of an art in its own right to find out what can be thrown away, but given the amount I must presume that you have got a fair amount of bulk measurements, in general you should first find patterns and aggregations for those data, and then use those results for comparing persons to one another. The majority of your raw data is either noise, repetition or irrelevant, you have got to cut that away.
This reduction process is easily suitable for a cluster as you can just give each process its own pile of persons.
The processing thereafter is a bit more tricky, what is optimal depend on a lot of factors, and you will probably have to do some trial and error. If you can make it fit the job try to load select pieces of data from all persons on the same computer and compare those, do the same with other pieces of data on other computers. Use those results as new data sets etc.

A: It depends on what you want from your handling of big data.  This concept is relatively vague.  For example, if you're talking about MapReduce jobs across disparate data sources, then you may be interested in using Hadoop Streaming with the Dumbo library.  If you're talking about statistical analysis, then NumPy and SciPy (as mentioned by Akira71) are interesting, as well as pandas (a data analysis toolkit).  If you want graphing, look into matplotlib.
However, if you're talking about the storage and querying of big data, Python is not your best bet.  You will want something like the Hadoop ecosystem to make this perform well, perhaps with layers on top for querying and building intermediate data sets.  One project that really interests me is Spark; you may want to look at it as well.  Unfortunately, this type of application framework does not play to Python's strengths.

A: Python is used extensively in the big data field. There are a couple of packages that tend to get used quite a bit and they are probably the main reason Python has made inroads so deeply into big data:

*

*NumPy - The Fundamental package for scientific computing in Python

*SciPy - Mathematics, Scientific and Engineering package

Given that they are both open source and the popularity and ease of learning Python has pretty much catapulted it's use in Academia. This in turn has caused it to be used more and more outside academia and in larger companies or when students move into work roles they bring these packages with them.
These are very good packages and I had dabbled with them in a few projects. I have not used Python enough in Big Data projects to answer your ancillary question on how to handle Big Data efficiently with Python.


text:
Q: Coefficient calculation on Fourier series !? in a Fourier series for function
$$f(x)=\begin{cases}-1&\text{for }-\pi<x<0\\\sin x&\text{for }0<x<\pi\end{cases}$$
with $f(x)=f(x+ 2 \pi)$, is $f(x)= \dfrac{a_0}{2}+ \sum\limits_{n=1}^{ \infty}(a_n \cos nx+b_n \sin nx)  $. we have:

$a_n=0, n=2k+1; b_n=0, n=2k$

I get stuck in this problem. How this coefficient was calculated? a bit more explanation was highly appreciated.

A: The function is defined on the interval $(- \pi, 0) \cup (0,\pi)$, which means that the length of the interval (which happens to be the period) is $\boxed{L = 2\pi}$.
We know that:
$$\displaystyle a_n= \dfrac 2L \cdot \int_{-\pi}^{\pi} f(x)\cdot \cos\left(\dfrac{2n\pi x} L\right) \,dx.$$

However,
$$\displaystyle \int_{-\pi}^0 -1\cdot  \cos (nx)\,dx = -\dfrac{\sin(n\pi)}\pi=0, \quad \text{since $n$ is an integer}.$$
How to compute
$$\displaystyle \int_0^\pi \sin x \cdot  \cos (nx)\, dx.$$
Integrals of the form $$\displaystyle \int \sin (\alpha x)\cdot \cos (\beta x)\,dx$$ are evaluated using the formula:
$$\boxed{2 \sin\alpha \cos \beta = \sin(\alpha+\beta) +\sin(\alpha - \beta)}.$$
Thus, we have:
$\displaystyle \int_0^\pi \sin x \cos(nx)\,dx =
\dfrac 12 \int_0^\pi 2 \sin x \cos (nx)\,dx
=\displaystyle\dfrac 12 \int_0^\pi \sin(x+nx) + \sin(x-nx) \, dx\\
=\displaystyle\dfrac 12 \int_0^\pi \sin[(n+1) x]\, dx + \dfrac 12 \int_0^\pi \sin[(1-n)x]\, dx\\
=-\displaystyle\dfrac 12 \cdot \left[\dfrac {\cos[(n+1)x]}{n+1}\right]_0^\pi -\dfrac 12 \cdot \left[\dfrac{\cos[(1-n)x]}{1-n}\right]_0^\pi\\
= \cdots\\
= \dfrac 12 \cdot \left(\dfrac{n-1}{n^2 -1} - \dfrac{(n-1) \cos[(n+1) \pi]}{n^2-1} - \dfrac{(n+1)\cos[(1-n)\pi]}{1-n^2} + \dfrac{n+1}{1-n^2}\right)\\
= \dfrac 12 \cdot \dfrac{2 + (n-1) \cos[(n+1)\pi] - (n+1) \cos[(n-1)\pi]}{1-n^2}\\
=\dfrac 12 \cdot \dfrac {2 - 2\cos[(n+1)\pi]}{1-n^2}, \quad\text{because $\cos[(n+1)\pi] = \cos[(n-1)\pi]$, for $n\geqslant 1$}\\
= \dfrac 12 \cdot \dfrac{1 - \cos[(n+1) \pi]} {1-n^2}\\
= \dfrac {1+\cos(n\pi)}{1-n^2}, \quad \text{because $\cos[(n+1)\pi] = -\cos(n\pi)$}.
$
Also, I used the fact that $\cos[(n-1) \pi ] =  \cos [(1-n)\pi]$.
Thus, $$a_n = \dfrac 2 {2\pi} \cdot \dfrac{1+\cos(n\pi)}{1-n^2}.$$
For $b_n$ you will need to  evaluate  $\displaystyle \int \sin x \sin(nx)\, dx$.
Thus, you will need to use the identity
$$\boxed{2 \sin\alpha \sin \beta = \cos(\alpha - \beta) - \cos(\alpha +\beta)}.$$
P.S. I cannot do all the math, since the answer is going to be too long!

A: Here's my attempt: I'm not sure I get those answers either - are you sure they are right?
The formula for $a_{n}, b_{n}$ are:
$$a_{n} = \frac{1}{L} \int\limits_{-L}^L f(x)cos(\frac{n\pi x}{L})dx $$
$$b_{n} = \frac{1}{L} \int\limits_{-L}^L f(x)sin(\frac{n\pi x}{L})dx $$
Since L is half the period, L = $\pi$ in this example.
$$
 f(x) =
  \begin{cases}
   -1 & \text{if } -\pi< x < 0 \\
   sin(x)      & \text{if } 0 < x < pi
  \end{cases}
$$
Then
$$a_{n} = \frac{1}{\pi} (\int\limits_{-\pi}^{0}-1cos(nx)dx + \int\limits_{0}^{\pi}sin(x)cos(nx) dx) = \frac{1}{\pi} \int\limits_{0}^{\pi}sin(x)cos(nx) dx = \frac{1}{\pi} \frac{cos(n\pi)+1}{1-n^2}$$
$$b_{n} = \frac{1}{\pi} (\int\limits_{-\pi}^{0}-1sin(nx)dx + \int\limits_{0}^{\pi}sin(x)sin(nx) dx)=\frac{1}{\pi} (\frac{cos(nx)}{n}|_{-\pi}^{0} + \frac{\pi}{2}) = \frac{1}{\pi} (\frac{1-(-1)^n}{n}+\frac{\pi}{2}) $$


text:
Q: Deploying WCF Services I have a WCF visual studio project, which contains many SVC files.
Can I compile each SVC file into its own dll file?
my target is to be able to deploy each svc file separately without touching other services, but maybe keep them on the same website
what options I have?

A: No, you cannot compile the svc files.
You can however compile your actual service code into an assembly (if you haven't stuck it into YourFile.svc.cs  codebehind file), and then deploy that compiled assembly into the bin directory below the virtual directory where you svc files exist.
If you want to have an assembly for each service, you will need to create a class library project for each service, put the service implementation inside that, compile it, and then deploy that resulting assembly into the bin directory.
The svc files must be deployed as is, and they must be copied into a virtual directory (or a subdirectory thereof) in IIS.


text:
Q: How to deal with punctuation in an ElasticSearch field I have a field in a document stored in Elastic Search, which I want to be analyzed as a full text field.  In one case, it contains a value for the name field like this:
A&B Corp

I want to be able to search the documents for an auto-complete widget, using a query like this (suppose the user typed A&B into the autocomplete field).  The intention is to match documents that contain the any terms with the typed prefix.
{   "query": {
    "filtered": {
      "query": {
        "query_string": {
          "query": "A&B*",
          "fields": [
            "firstName",
            "lastName",
            "name",
            "key",
            "email"
          ]
        }
      },
      "filter": {
        "terms": {
          "environmentId": [
            "foo"
          ]
        }
      }
    }
  }
}

```
My mapping for the name field looks like this:
"name": {
    "type": "string"
},

But, I get no results.  The query structure works for documents that don't have & in the field, so I'm pretty sure that is part of the problem.
But, I'm not sure how to deal with this.  I am pretty sure I still want to analyze the field for full text search.
In addition, if I add a space before the * in the query (ie, "query": "A&B *",) then I get results including A&B, so I don't think it is just discarding the ampersand and treating the A and B as separate terms.
Should I change my mapping? The query?

A: The Query_string query has a set of reserved characters that needs to be escaped.
query_string : Read the reserved characters section
So to search for

'A&B'  (or)  'A&B Corp' (or) 'A&B....'
Your query must be "A&B\\*" such that the query_string parser treats
  it as a * wildcard operator.

*

*While currently your query is searching for exact match of
"A&B*" it expects asterik to be part of your data.

*And when you search "A&B *" the whitespace is a reserved
character so its
    now searching for "A&B" (or) "*" and hence you get a match in this
    case.


text:
Q: how to bypass googletagmanager while scraping When site added script googletagmanadger i cant get what I need. With this code I was scraping links from
now Im getting "www.googletagmanager.com" in every row... So I dont know how to handle with that.Thank you
[HTML][1]
[HOW CSV FILE NOW LOOK][2]
from bs4 import BeautifulSoup
import csv
import pandas as pd
from csv import writer

data_list = ["LINKI", "GOWNO", "JAJCO"]

with open('innovators.csv', 'w', newline='') as file:
    writer = csv.writer(file, delimiter=',')
    writer.writerow(data_list)
    for i in range(0,50):
        #df = pd.read_csv("C:\\Users\\Lukasz\\Desktop\\PROJEKTY PYTHON\\W TRAKCIE\\bf3_strona2.csv")
        #url = "https://bf3.space/" + df['LINKS'][i]
        url='https://bf3.space/a-Byu6am3P'
        response = requests.get(url)
        data = response.text
        soup = BeautifulSoup(data, 'lxml')
        rows = soup.find('iframe')
        q = (rows.get('src'))
        writer.writerow([q])

[1]: https://i.stack.imgur.com/Ogq0N.png
[2]: https://i.stack.imgur.com/3JYqc.png

A: You can use soup.find() with lambda.
For example:
import requests
from bs4 import BeautifulSoup

url = 'https://bf3.space/a-Byu6am3P'
soup = BeautifulSoup(requests.get(url).content, 'html.parser')

print( soup.find('iframe', src=lambda s: 'googletagmanager.com' not in s) )

Prints first non-googletagmanager <iframe> tag:
<iframe align="center" frameborder="0" height="1500" src="https://ven-way.x.yupoo.com/albums/83591895?uid=1" style="margin: 10px 0;padding: 0px 0px; border:none" width="100%"></iframe>


text:
Q: Spring Boot & OAuth2.0: At least one redirect_uri must be registered with the client So I login to an app and go to an external feature, which demands another login (all within the app). Now it has become impossible to log into that external feature as it throws error (code 400):
OAuth Error. error="invalid_request", error_description="At least one redirect_uri must be registered with the client."

This error is thrown whenever I'm using the app or try to login to the external feature directly.
I had upgraded Spring Boot in a project to 1.5.22 from 1.4.1, which may have caused this. After downgrading back Spring Boot to 1.4.1 the problem was gone.
Then I tried updating Spring Boot to 1.5.22 again and additionally included this in application.configuration:
security.oauth2.client.pre-established-redirect-uri=https://page.com
security.oauth2.client.registered-redirect-uri=https://page.com
security.oauth2.client.use-current-uri=false

It didn't help. Then in browser's Network tab I noticed redirect_url parameter in Query String Parameters, which differed from the one I specified. It was something like:
https://page.com/oauth-authorized/app

I updated application.configuration as above. However, nothing has changed.
How to proceed?
Some code:

public class AuthorizationServerConfiguration extends AuthorizationServerConfigurerAdapter {

  @Autowired
  @Qualifier("authenticationManagerBean")
  private AuthenticationManager authenticationManager;

  @Autowired
  private TokenStore tokenStore;

  @Autowired
  @Qualifier("clientDetailsServiceImpl")
  private ClientDetailsService clientDetailsService;

  @Autowired
  private DefaultTokenServices tokenServices;

  @Autowired
  private TokenEnhancer tokenEnhancer;

  @Override
  public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {
    endpoints.setClientDetailsService(clientDetailsService);
    endpoints
        .tokenStore(tokenStore)
        .authenticationManager(authenticationManager)
        .tokenServices(tokenServices)
        .tokenEnhancer(tokenEnhancer)
        .pathMapping("/oauth/token", "/api/oauth/token")
        .pathMapping("/oauth/check_token", "/api/oauth/check_token")
        .pathMapping("/oauth/authorize", "/api/oauth/authorize")
        .pathMapping("/oauth/error", "/api/oauth/error");
  }

  @Override
  public void configure(AuthorizationServerSecurityConfigurer oauthServer) throws Exception {
    oauthServer.checkTokenAccess("permitAll()");
  }

  @Override
  public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
    clients.withClientDetails(clientDetailsService);
  }
}
=================================================================================================

@Service
@Primary
public class ClientDetailsServiceImpl implements ClientDetailsService {

  @Autowired
  private ClientRepository clientRepository;

  @Override
  public ClientDetails loadClientByClientId(String clientId) throws ClientRegistrationException {
    Client client = clientRepository.findOneByClientId(clientId)
        .orElseThrow(() -> new NoSuchClientException(
            String.format("Client with clientId=%s was not found", clientId)));

    return new com.app.auth.domain.ClientDetails(client);
  }

}

Edit: After downgrading Spring Boot once again the problem seems gone but it's not much of a fix.

A: After authentication, you may need to contact the resource owner and ask for support and then redirect to your client application or you may redirect to client application directly.
for that, add redirectUris in your Authorization server config
@Configuration
@EnableAuthorizationServer
public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdapter{

    @Override
    public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
        clients.inMemory().withClient("client_id").secret("client_secret").authorizedGrantTypes("authorization_code")
            .scopes("read").authorities("CLIENT").redirectUris("http://localhost:8090/your_redirect_URL");
    }
}


text:
Q: Xaringan slides advance with odd latency in presentation I am presenting my slides (same problem in in RStudio as in browser) and the transitions have weird latency. New text comes in, but old text doesn't go away for more than 0.5 sec.
I have a video on YouTube that illustrates the problem.
Not really sure where the problem stems from. Any suggestions?

A: The issue arises from a mismatch between R's color names and HTML/CSS color names. Here is the source code chunk used in the slides to create the xaringanthemer CSS:
```{r xaringan-themer, include=FALSE, warning=FALSE}
library(xaringanthemer)
style_xaringan(title_slide_background_image = "https://wallpapercave.com/wp/wp2567196.jpg",
               background_color = "grey14",
               title_slide_text_color = "white"
               )
```

Unfortunately "grey14" is an R color, but it's not recognized by HTML, so the slide background becomes transparent. A warning is emitted that hexadecimal colors are expected if used by theme_xaringan(), so I understand why the warning was ignored.
In some cases, the color names are the same — e.g. "white" is both an R and HTML color — so it made sense to me to warn rather than throw an error in cases like these.
You can use col2rgb() to lookup the rgb or hex representation of the color:
col2rgb("grey14")
#>       [,1]
#> red     36
#> green   36
#> blue    36
rgb(36, 36, 36, maxColorValue = 255)
#> [1] "#242424"

So either background_color="#242424" or background_color = "rgb(36,36,36)" would create slides with a solid background.

A: OK, so I was able to chase down the problem.  It is that when you change slides that class temporarily changes from remark-visible to remark-fading which keeps the existing slide active for 1 second.  I'm not sure why this particular thing happened (I don't recall it happening when I've made xaringan slides in the past).  In any event, you can stop it by putting the following block in your first slide after the background image.  Then, everything seemed to work fine for me.
htmltools::tags$style("
.remark-fading{
  display:none
}
")

I also changed it in the RStudio.cloud project and it worked there.  I added it right after the background-image() line of the first slide.


text:
Q: Deploying to Azure linux webapp shows container error on port 8080 I'm trying to deploy a simple .netcore webapp on azure linux app service and I'm getting the below error:
ERROR - Container  for site  has exited, failing site start
ERROR - Container  didn't respond to HTTP pings on port: 8080, failing site start. See container logs for debugging.
This is a v5.0 .net and deploying the app through azure devops yaml pipeline.
resource "azurerm_linux_web_app" "webapp" {
  name                       = "appname"
  resource_group_name        = data.azurerm_resource_group.rg.name
  location                   = data.azurerm_resource_group.rg.location
  service_plan_id            = data.azurerm_service_plan.appserviceplan.id
  https_only                 = true

  identity {
    type = "SystemAssigned"
  }
 site_config {
    always_on          = true

    #container_registry_use_managed_identity = true

    application_stack {
      dotnet_version   = "5.0"
    }

    use_32_bit_worker       = false
    vnet_route_all_enabled  = true
    tags                    = local.all_tags
    app_settings = {
     "APPINSIGHTS_INSTRUMENTATIONKEY"   = azurerm_application_insights.appinsights.instrumentation_key

 }
}

A: *

*I was able to deploy the Azure Linux Web App without any issues

ERROR - Container for site has exited, failing site start ERROR - Container didn't respond to HTTP pings on port: 8080,failing site start

Thank you  @Jayendran for the comment,

*

*The ports supported by Azure Web App service are 80 and 443 , if we want to run on any other port we need to add the WEBSITES_PORT   in Application Settings in Configuration  Section

*Add the value of the port number as whatever your application is listening. As per the error you need to add 8080
Even the same is suggested by @SnehaAgrawal-MSFT

*

*Also we can set/change  the port in server.js file

const myport= process.env.port || 8080;


text:
Q: VPN to office without routing all internet traffic I'm using the Gnome Network manager to connect to my office VPN.  It's using StrongSwan IPSec.
It connects fine, but all my internet traffic is routed through the office.  I don't want this, I only want to see the IP addresses of my office without all my internet traffic going through the office.  Also, if possible, to use the office DNS to resolve the office server names (but this is less important).
The following settings are set:

*

*Gateway Address: IP address of the office

*Certificates: All working, I'm using "Certificate/private key".

*Options: All options are enabled.

*IPv4: I tried a view settings here, but currently only "Automatic (DHCP)" is selected.

*IPv6: Disabled.

UPDATE: My ip -r output is:
default via 192.168.188.1 dev enp3s0 proto dhcp metric 100
169.254.0.0/16 dev enp3s0 scope link metric 1000
192.168.2.103 dev enp3s0 proto kernel scope link src 192.168.2.103 metric 50
192.168.2.103 dev enp3s0 proto kernel scope link src 192.168.2.103 metric 100
192.168.188.0/24 dev enp3s0 proto kernel scope link src 192.168.188.21 metric 100

A: The general idea is to modify the routing table so only known office subnets (address blocks) get routed through your VPN interface (e.g. ppp0) and all other subnets get routed through your normal network interface (e.g. en0). When you connect to VPN Gnome network manager adds so-called default route to the VPN interface (ppp0). You need to remove this route but add new routing entries for known office subnets.
Firstly, you need to find what private subnets are used by your office network. The easiest way is just to ask your office network administrators. If this not an option, you can figure it yourself by resolving your office host names after you connected to VPN. For example:
$ nslookup service.company.office
Server:     127.0.0.53
Address:    127.0.0.53#53

Non-authoritative answer:
Name:   service.company.office
Address: 192.168.1.22

In this case the subnet you need to route through your VPN is 192.168.1.0/24 which means all addresses from 192.168.1.0 to 192.168.1.255. Your office may have more than one subnet you need to route.
Secondly, you need to modify routing table by using ip command. Print out the table by typing ip r and look for an entry that points to VPN device:
$ ip r
default dev ppp0 proto static scope link metric 50
default via 192.168.20.1 dev eno1 proto dhcp metric 100
...
192.168.20.0/24 dev eno1 proto kernel scope link src 192.168.20.126 metric 100
192.168.100.1 dev ppp0 proto kernel scope link src 192.168.100.89 metric 50

So now you know that ppp0 is your VPN device. In my example there are two default routes but ppp0 has smaller metric so all traffic goes there. Now, add a separate route to your office network:
$ ip route add 192.168.1.0/24 dev ppp0 proto static scope link

Now you just need to remove the default route to ppp0 and you are good to go:
$ ip route delete default dev ppp0

You can automate this by the following script:
#!/bin/bash

# List your office networks
networks=(
                192.168.1.0/24
                192.168.2.0/24
)

# Execute it with sudo
if [ $(id -u) != "0" ]; then
        echo "You must be root to execute this script. Use sudo?"
        exit -1
fi

# Check if VPN is active. You can use ipsec status command
# if your VPN is not L2TP
tunnel=$(ip l2tp show tunnel 2>&1)
if [ -z "$tunnel" ]; then
        echo "VPN is not active."
        exit -2
fi

# Add office private network routes
for net in ${networks[*]}; do
        ret=$(ip route add $net dev ppp0 proto static scope link 2>&1)
        if [[ $ret =~ "File exists" ]]; then
                echo "routes have been already added."
                exit -3
        fi
done

# Delete default routes so Internet is routed via local ISP
ip route delete default dev ppp0


text:
Q: İnstalling ubuntu to C: I have created a Bootable Usb stick, I will create Ubuntu to C: but I have some saved documents like picture at d: If I install Ubuntu to c: , backup files from d: will erase ?

A: Ubuntu does not use letters (c: or d:) to identify hard drives or partitions.
The first drive is /dev/sda
The second drive is /dev/sdb
Partitions are then numbered, so first partition on the first hard drive is /dev/sda1
As long as you understand partitioning and the target of your installation, your data on the d: drive / partition should be find, BUT ...
Overwriting your data is a mouse click away on the installer and if you do not understand Linux partitioning you can easily loose data.
I suggest you first back up your data off the hard drive, then read the partitioning and installation documentation.
How to partition my hard drive for Ubuntu use?
https://help.ubuntu.com/lts/installation-guide/

A: If your disk is partitioned in both C: and D: directories, then installing Ubuntu on C: will not erase the document in D:
But the Operating system installed in C: will be erased.
However you should NEVER install an OS without a backup of all your documents, because you never know you might make a mistake.
Here's a great guide

A: since your talking about C: & D: drives--thats for M.S. O.S.,,,use wubi installer then install ubuntu alongside with windows,,that would install your ubuntu to window's c: drive without loosing evrything except for the space used for your ubuntu,,ubuntu and all files under it will be deleted if you reinstall your windows so its better to install ubuntu on a separate partion..
hope that helps.......

A: you won't lose anything if u use wubi installer for windows cause it will be installed under your C: drive as a windows application and you can select which O.S. to boot from evrytym u start your machine


text:
Q: Refactoring TestCategory properties using Roslyn Recently I had to re-factor a large number of tests so that they all were tagged with specific a specific TestCategory property based on the results of a report. If the test was listed on the report it should be tagged with the "good category" otherwise it should be in the "bad category". The categories were going to be used to filter which tests would be run as part of our gated build.
Here are some examples of how it was done.

A: The first step in the process is to load up the solution
var wkps = MSBuildWorkspace.Create();
var sln = wkps.OpenSolutionAsync(slnPath).Result;

Now that we have a Solution reference, we can iterate through each Project and get its SyntaxTrees. We can then call GetRoot on each SyntaxTree and cast it as a CompilationUnitSyntax. From this point we search all DecsendantNodes that match our criteria of being a Method with a TestMethod property defined.
Here is what it looks like all together
foreach (var proj in sln.Projects)
{
    var comp = proj.GetCompilationAsync().Result;
    foreach (var method in root.DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => HasAttribute(m, TEST_METHOD)))
    {
        //do something with this test method
    }
}

There is a helper method above called HasAttribute which just looks for any Attribute on the method with the name "TestMethod". Here is what that looks like
bool HasAttribute(MethodDeclarationSyntax method, string attributeName)
{
    return method.AttributeLists
        .Any(al => al.Attributes
            .Any(a => a.Name is IdentifierNameSyntax && (((IdentifierNameSyntax)a.Name).Identifier.Text == attributeName)));
}

Now that we've got a way to iterate through all the TestMethod methods, we need to assign our TestCategory properties to them. This is the "do something" part of the loop above.
There are two steps to the process here. First is to edit our SyntaxTree such that we've added and/or removed the categories that we want. Second is to write that SyntaxTree back out to the source file.
The first thing we'll need to do is check the name of the method against our input list. Assuming we have a Dictionary of method names, it might look something like this
var methodName = method.Identifier.ValueText;
var testIsOnList = testDictionary.ContainsKey(methodFullName);

However, this test assumes that accross your whole solution, test names are globally unique.. Unfortinately in my case, this was not true. To work around this, we made the input list the "Fully Qualified Test Name" as it would appear in the MSTest test runner. This would be:

*

*namespace

*

*class hierarchy

*

*method name

ex. My.Long.NameSpace.ParentClass.ChildClass.Method
Here is a litte helper method that will create the FQTN given the MethodDeclarationSyntax
string BuildFullTestName(MethodDeclarationSyntax method)
{
    StringBuilder sb = new StringBuilder();
    sb.Append(method.Identifier.ValueText);
    SyntaxNode node = method;
    while(node.Parent is ClassDeclarationSyntax)
    {
        node = node.Parent;
        sb.Insert(0, ".");
        sb.Insert(0, ((ClassDeclarationSyntax)node).Identifier.ValueText);
    }
    if(node.Parent is NamespaceDeclarationSyntax)
    {
        node = node.Parent;
        sb.Insert(0, ".");
        sb.Insert(0, ((NamespaceDeclarationSyntax)node).Name.ToString());
    }
    else
    {
        throw new Exception("method \{method.Identifier.ValueText} has wierd parents.");
    }

    return sb.ToString();
}

So we've done our comparison and we'd like to mark a test with our good or bad TestCategory property. Here is another helper method that will take in the MethodDeclarationSyntax, property name (TestCateogry in our case), and the argument to the property (name of the cateogry in our case). It will return the new MethodDeclarationSyntax which includes our changes.
MethodDeclarationSyntax AddMethodProperty(MethodDeclarationSyntax method, string propertyName, string argumentName)
{
    return method.AddAttributeLists(
            SyntaxFactory.AttributeList(
                SyntaxFactory.SingletonSeparatedList(
                    SyntaxFactory.Attribute(
                        SyntaxFactory.IdentifierName(propertyName),
                        SyntaxFactory.AttributeArgumentList(
                            SyntaxFactory.SingletonSeparatedList(
                                SyntaxFactory.AttributeArgument(
                                    SyntaxFactory.LiteralExpression(
                                        SyntaxKind.StringLiteralExpression,
                                        SyntaxFactory.Token(
                                            default(SyntaxTriviaList),
                                            SyntaxKind.StringLiteralToken,
                                            argumentName,
                                            argumentName,
                                            default(SyntaxTriviaList))
                                        ))))))));
}

Because all SyntaxNodes are immutable, we can't update the method in place. So now that we've got our new MethodDeclarationSyntax we'll need to create a new SyntaxTree in which we've replaced the old method with the new one.
SyntaxTree newTree = SyntaxFactory.SyntaxTree(
    Formatter.Format(syntaxRoot.ReplaceNode(method, newMethod), wkps))
        .WithFilePath(method.SyntaxTree.FilePath);

Note: .WithFilePath is needed so that the new SyntaxTree retains its context about which source file it maps to.
Now we can write our new SyntaxTree out to disk. Standard stuff here.
using (StreamWriter file = File.CreateText(method.SyntaxTree.FilePath))
{
    file.Write(newTree.ToString());
    file.Flush();
}

There is one major gotcha to remember while looping through your methods. Each time you create a new SyntaxTree, its root CompilationUnitSyntax must be passed to future iterations of the loop. In addition, our call to syntaxRoot.ReplaceNode above will only work if the method being replaced is actually from that SyntaxTree. In other words, the MethodDeclarationSyntax reference in your next iteration of our big nested foreach will not be found in your newly created SyntaxTree. To handle this, I created another helper method that will find the MethodDeclarationSyntax in the new SyntaxTree given the old one.
MethodDeclarationSyntax GetMethodFromSyntaxRoot(CompilationUnitSyntax root, string nameSpaceName, string className, MethodDeclarationSyntax method)
{
    var result = root.Members.OfType<NamespaceDeclarationSyntax>().Single(ns => ns.Name.ToString() == nameSpaceName)
       .DescendantNodes(d => true).OfType<ClassDeclarationSyntax>().Single(c => c.Identifier.ValueText == className)
           .Members.OfType<MethodDeclarationSyntax>().SingleOrDefault(m => m.Identifier.ValueText == method.Identifier.ValueText && m.ParameterList.ToString() == method.ParameterList.ToString());
}


text:
Q: express.bodyParser not parsing? I've stripped everything down to the absolute bare bones to try and fine out whats wrong, and still can't get bodyParser to do anything. It won't even work for .txt files.
server.js
var     cfg     = require(__dirname + '/config'),
    express     = require('express');

var app = express();

app.set('view engine', 'ejs');
app.set('views', __dirname + '/views');
app.use(express.logger(cfg.LOGGER));
app.use(require('connect').bodyParser());
app.use(express.static(__dirname + '/public'));
app.use(express.favicon(__dirname + '/public/favicon.ico'));

app.get('/', function(req, res) {
    res.render('index');
    res.end();
});

app.post('/upload', function(req,res) {
    console.log(req.body.file);
    res.end();
});

app.listen(2017);

index.ejs
<form enctype="multipart/form-data" action="/upload" method="POST">
    <input id="multipart/form-data" type="file" name="foo" />
    <button>Upload</button>
</form>

the result is that req.body.file is undefined

A: You can access the file using req.files.<yourFileInputFieldName>:
console.log(req.files.foo);

More info in this section of the docs.

A: Change this
  app.use(require('connect').bodyParser());
            as
  app.use(express.bodyParser());

  app.post('/upload', function(req,res) {
     console.log(req.body.foo);//in req.body u have to mention the name of the file..
     res.end();
  });


text:
Q: Windows file's default action to open with a vbs script? Don't laugh.
I'm in a corporate environment with a locked down desktop.  Installing third party apps is not an option.
Notepad is mostly okay, the biggest pain though is that it doesn't detect if a file is already open.  I wind up with edits to files in two places.
So, I thought I would write a little vbs to check to see if the file might be open and instead of opening it twice, just raise the suspect window.
Dim Arg, var1
Set Arg = WScript.Arguments

'Parameter1, begin with index0
var1 = Arg(0)

set fso = CreateObject("Scripting.FileSystemObject")

Set oShell = CreateObject("WScript.Shell")
If Not oShell.AppActivate( fso.GetFileName(var1) + " - Notepad") Then
   Dim objShell
   Set objShell = WScript.CreateObject( "WScript.Shell" )
   objShell.Exec("notepad.exe " + var1 )
   Set objShell = Nothing
End If

it works great.  But...
I can't set a vbs to the target of an "Open With..." menu.  It looks like I can do a .bat, .cmd, .exe, .pif.   Manually selecting ".vbs" doesn't work.  It will say that the .txt file "is not a valid win32 application"
How can I get a file's default action to open with a vbs script?

A: Call the vbscript from a batch file (.cmd) with a single line 'wscript.exe %1'.  Put the cmd file in the send to list.

A: Solution
Windows file association can be either system-wide or per-user, and the latter takes precedence. You can therefore override the default behavior for .txt files by creating a specific registry key:

*

*Open a command prompt.

*Type or paste the following command, and press Enter after replacing X:\Path\to\myscript.vbs with the actual path:
reg add "HKCU\Software\Classes\txtfile\shell\open\command" /ve /t REG_SZ /d "\"%windir%\System32\wscript.exe\" \"X:\Path\to\myscript.vbs\" \"%1\"" /f

Changes are applied immediately.
Further reading

*

*File Types

*Command-Line Reference

A: create file 1.cmd at user temp directory).
1.cmd:
cmd

open file and do what you want)