text:
Q: Google Analytics UTM Parameters and other Parameters Suppose I have a URL like the following
www.example.com/page?utm_source=Facebook&utm_campaign=affiliate&NID=999999
What I am finding in GA is that when I have custom querystring parameters like the NID above, the utm_source is registering as direct traffic in real time analytics in GA.
I would expect this to read facebook.
Can you I have other custom querystring parameters and utm's still register

A: utm_source and utm_medium are required parameters:
https://support.google.com/analytics/answer/1033863?hl=en
That said, the documentation is a little unclear:
"When adding parameters to a URL, you should always use utm_source, utm_medium, and utm_campaign. utm_term and utm_content are optional and can be used for tracking additional information"
Here's how it should be written:
When adding parameters to a URL, you must always use utm_source and  utm_medium.  The other three parameters are optional: utm_campaign, utm_term and utm_content.


text:
Q: sizeof dynamic array is not correct In array there are four element so it size should be 4bit*4 = 16. (An int data type take 4 bit in my system to store the value.) But when i ran this code i only got 8 bit as the size of dynamicArray.
#include <stdio.h>
#include <stdlib.h>

int main(void) {

    //Dynamic arrays save memory by creating a pointer that stores
    //the beginning of the array
    int *dynamicArray = malloc(20 * sizeof(int));
    *dynamicArray = 10;
    printf("Address %x stores value %d\n", dynamicArray, *dynamicArray);

    dynamicArray[1] = 20;
    printf("dynamicArray[1] stores value %d\n", dynamicArray[1]);
    dynamicArray[2] = 45;
    printf("dynamicArray[2] stores value %d\n", dynamicArray[2]);
    dynamicArray[3] = 34;
    printf("dynamicArray[3] stores value %d\n", dynamicArray[3]);
    printf("The size of dynamicArray is %d\n", sizeof(dynamicArray));

    // Release unused memory:
    free(dynamicArray);

    return EXIT_SUCCESS;
}

Here is the image of output.

Also suggest me website for C to check the in-built function properties or to know about them more.
Thank you.

A: *

*You don't have an array; you have a pointer.

*The size of the pointer is measured in bytes, not bits.

*sizeof is evaluated at compile time and is constant for any given expression or type. It does not depend on the number of "filled" elements in an array (or pointer to some space that holds those elements, for that matter).
Your expression is equivalent to sizeof(int*), and pointers are 8 bytes in your environment.

A: I ran your code on my 32-bit computer and the value of sizeof(dynamicArray) does report 4. I bet your computer is 64-bits which is why the value is 8 instead.
Take a look at: http://www.viva64.com/en/a/0004/ and look for the table titled "Table N2. 32-bit and 64-bit data models.". That would help explain why some systems report 4 and some report 8 for the value for sizeof(dynamicArray).

redpajama_set_name: RedPajamaStackExchange


text:
Q: Angular test using $httpBackend fails with "400 thrown" error For hours I've been trying to test my NewPostController with $httpBackend. The problem is whenever I set non-2xx status code in the response, the test fails.
NewPostController has the following method:
$scope.submit = function () {
  var newPost = $scope.newPost;
    PostService.insertPost(newPost).then(function (post) {
      $location.path("/my-posts");
    }, function (status) {
        $scope.form.$setPristine();
        $scope.error = status;
    });
};

I have a problem testing the failure path:
it(...) {
  ...
  $scope.post.text = "";
  $httpBackend.expectPOST("/create-post", {"post":$scope.post}).respond(400);
  $scope.submit();
  $httpBackend.flush();
  expect($scope.error).toBeDefined();

  $scope.post.text = "This is a valid text.";
  $httpBackend.expectPOST("/create-post", {"post": $scope.post}).respond(200);
  $scope.submit();
  $httpBackend.flush();
  expect($location.path()).toBe("/my-posts");
});

The test fails with a message "400 thrown" (no callstack). I tried to change the order of subtests, use whenPOST instead of expectPOST and combine the methods as they do in Angular docs (https://docs.angularjs.org/api/ngMock/service/$httpBackend) but without success.
Please help.
EDIT:
Now when I look at PostService, it makes sense where the "400 thrown" comes from but I expected the error to be handled by angular. I threw it because of the section "Handling problems in nested service calls" of this article. It is supposed to be a shorter version of deferred.resolve/reject mechanism.
this.insertPost = function (newPost) {
  return $http({
    method: "post",
    url: "/create-post",
    data: {
      post: newPost
    }
  }).then(function (res) {
      return (res.data);
  }, function (res) {
      throw res.status;
  });
};

A: This is indeed strange, and is perhaps something the angular team didn't consider.
When a promise is rejected by throwing (as you're doing), the angular $exceptionHandler service is called with the thrown exception. By default, this service just logs the exception in the browser console.
But when using ngMocks, this service is replaced by a mock implementation that can either log or rethrow the exception. The default mode is to rethrow, in order to make a test fail when an exception is thrown.
My advice would be to avoid using throw to simply reject a promise, and thus replace
function (res) {
  throw res.status;
}

by
function (res) {
  return $q.reject(res.status);
}

But if you really want to keep using throw, you can also configure the mock exceptionHandler to log instead of rethrowing:
beforeEach(module(function($exceptionHandlerProvider) {
  $exceptionHandlerProvider.mode('log');
}));


text:
Q: deserialize issue json xamarin Why on gods earth will the APFile.Id not deserialize correct ???
I have a simple class APFile - which I try to deserialize - for some reason it will not deserialize the Id - and I cannot see where its going wrong :(
using System;
using Newtonsoft.Json;

namespace ActionShared
{
[Serializable]
public class APFile
{
    public APFile()
    {
    }

    /// <summary>
    /// File id
    /// </summary>
    [JsonProperty("id")]
    public int Id { get; set; }

    /// <summary>
    /// The id of entity that the file is attached to.
    /// </summary>
//  [JsonProperty("type")]
    [JsonIgnore]
    public int Type { get; set; }

    /// <summary>
    /// The file name including the extension.
    /// </summary>
    [JsonProperty("filename")]
    public string Filename { get; set; }

    /// <summary>
    /// The mime type of the file.
    /// </summary>
    [JsonIgnore]
    public string Mimetype { get; set; }

    /// <summary>
    /// The size of the file in bytes.
    /// </summary>
    //[JsonProperty("size")]
    [JsonIgnore]
    public int Size { get; set; }

    /// <summary>
    /// The unique id of the file creator's profile.
    /// </summary>
    //[JsonProperty("creator_id")]
    [JsonIgnore]
    public int Creator { get; set; }

    /// <summary>
    /// The unique id of the file creator's profile.
    /// </summary>
    //[JsonProperty("creator_name")]
    [JsonIgnore]
    public string CreatorName { get; set; }

    /// <summary>
    /// The date and time when the file was uploaded.
    /// </summary>
//  [JsonProperty("created_at")]
    [JsonIgnore]
    public DateTime CreatedAt { get; set; }

    /// <summary>
    /// The date and time when the file was last updated.
    /// </summary>
//  [JsonProperty("updated_at")]
    [JsonIgnore]
    public DateTime UpdatedAt { get; set; }

    /// <summary>
    /// A link to download the file.
    /// </summary>
    //[JsonProperty("url")]
    [JsonIgnore]
    public string Url { get; set; }
}
}

public void Do()
{
    string a = "{\"id\":910,\"filename\":\"image.jpg\"}";
    var b = JsonConvert.DeserializeObject<APFile>(a);
    // b.Id = 0 and b.Filename = "image.jpg"
}

A: plz copy your json responce and convert into C# class file to http://json2csharp.com/
public home()
        {
            InitializeComponent();
            NavigationPage.SetHasNavigationBar(this, false);

            PostRequest(this, "http://propertyworld.in/app/property.php?");
        }

public async static void PostRequest(home instance, string URL)
        {
            var formContent = new FormUrlEncodedContent(new[]
             {
                new KeyValuePair<string, string>("action", "property_list"),
            });
            var myHttpClient = new HttpClient();
            var response = await myHttpClient.PostAsync(URL, formContent);
           //json variable is over responce
            var json = await response.Content.ReadAsStringAsync();

            MyJsonConvertedclass record = JsonConvert.DeserializeObject<MyJsonConvertedclass>(json);

            ObservableCollection<ModelClass.infoClass> ls = new ObservableCollection<ModelClass.infoClass> { };
            foreach (var point in record.records)
            {
                ls.Add(new ModelClass.infoClass
                {
                    info1 = Stringclass.rs + " " + point.property.price,
                    info2 = point.property.title.ToUpper(),
                    url = record.image_url + point.property.image
                });
            }

            instance.newProp.ItemsSource = ls;
//instance.yourControllname which is declares in your xaml like

        }


text:
Q: How to draw SPL curve for a parametric equalizer? I want to show (graphically) the Gain/Attenuation vs frequency of a parametric equalizer.
This is my circuit:
https://sound-au.com/project28.htm
The same schematicas as a screenshot:

I want to show the effect of VR1 thru VR7 in the same way as it's shown in the Winamp:

I have tried to decipher this page: https://www.andyc.diy-audio-engineering.org/parametric-eq-parameters-1.html
I don't know how to interpret the formulas to derive the Gain/Attenuation, given the frequency, Q and center frequency of each equalizer band. Can anybody please explain in simple terms?


text:
Q: Change Wordpress colors based on logo main color I'm trying to make a demo website where a user upload his logo and a title for his website and the website is automatically generated using what he entered.
I already figured how to make a demo website but i'm not sure on where to start to change colors (header, footer and menu) based on the logo main color.
Feel free to give me tips/ideas on where to start :)

A: First of all, you need colors from the image, you can use vibrant.js or any other js lib or you can write custom js code to extract colors from an image using JS, there are many articles on this topic.
the second thing you'll do that you will change your site styling system and will use css variables var(--varname) in every possible place that you want to be changed after image upload.
so once it's done, you'll grab the color from the image and then will change the values of css variables and the new color will be applied in your desired sections.


text:
Q: Error in `[.data.frame`(t, 1) : undefined columns selected I got this R code to make visualization using ggplot. However, I am getting the problem with syntax. Can anyone see where it went wrong? Thanks!
t <- ggplot_build(p)$data[[3]]
s[i,1] <- as.character(a[i])
s[i,2] <- t[1,2] - t[(length(t[,1])),2]

The error is related to t in this three lines of code.


text:
Q: Akka HTTP, Spray Json and Option Fields Failing as Required I have a case class:
case class OpcTagPlaybook(name: String, tags: Seq[OpcTagAtTime], looped: Boolean, enabled: Option[String])

With an optional enabled field that will contain a date.
Spray Json describes encoding/decoding:
implicit val opcTagPlaybookFormat = jsonFormat4(OpcTagPlaybook)

And a route in akka http:
post {
  entity(as[OpcTagPlaybook]) { playbook =>
    val playbookCreated: Future[_] =
      (opcTagPlaybookActor ? UpsertPlaybook(playbook))
    onSuccess(playbookCreated) { _ =>
      log.info("Created playbook [{}]", playbook.name)
      complete((StatusCodes.Created, "ok"))
    }
  }
})

For some reason posting without the createdAt field fails:
Posting:
{"name": "test1",
"tags":[{"offset": 100, "tag": "hello", "value": "yo"}],
"looped": true
}

Fails:
The request content was malformed:
Object is missing required member 'enabled'

And if I post created it gives me another error:
 {"name": "test1",
 "tags":[{"offset": 100, "tag": "hello", "value": "yo"}],
 "looped": true,
 "enabled": "2018-08-08"
 }

gives
The request content was malformed:
spray.json.JsString cannot be cast to scala.Option

I'm assuming this is some interplay between akka http and so I'm going to just deal with the input more manually but I'd just like to understand what I'm doing wrong here.


text:
Q: Which version of debian distro shall I install to my server? This is my first time installing debian, aswell as my first experience touching a server machine. I want to install debian to my server, what version of debian shall I install ?
Between [alpha][amd64][arm][armel][hppa][i386][ia64][mips][mipsel][powerpc][sparc] choices.
Thanks

A: Use amd64 or i386.
amd64 is better, as it is 64-bit so can address more RAM. It works on Intel 64-bit CPUs as well (specifically, those that have the Intel 64 or EM64T extension).

A: Depends on your hardware. Most likely your CPU is x86 architecture and supports 64bit, you should use amd64, otherwise i386 is your distro of choice.
If you have an intel CPU, use this http://processorfinder.intel.com/ to see if it supports 64bit.

A: On a Quad-Core Intel Xeon with more than 4GB RAM always install debian/lenny amd64.

ia64 (itanium) is not compatible with your Processor.

A: If you plan on experimenting heavily on server setup and configuration, might I recommend doing it with a virtual server? You can install an i386 or AMD64 version of Debian Lenny and then install either OpenVZ or VirtualServer on it. Lenny has default packages for them. It will certainly help you when you wish to experiment.


text:
Q: Athena query does not return any results newer than table creation Following the formal instructions for querying CloudFront access logs using Athena, I created a table in Athena called default.cloudfront_logs that points to my path in S3 where my CloudFront distribution's access logs are being written:
CREATE EXTERNAL TABLE `cloudfront_logs`( <fields here> )
ROW FORMAT SERDE
  'org.apache.hadoop.hive.serde2.RegexSerDe'
WITH SERDEPROPERTIES (
  'input.regex'='^(?!#)([^ \\t]+)\\s+([^ \\t]+)\\s+([^ \\t]+)\\s+([^ \\t]+)\\s+([^ \\t]+)\\s+([^ \\t]+)\\s+([^ \\t]+)\\s+([^ \\t]+)\\s+([^ \\t]+)\\s+([^ \\t]+)\\s+([^ \\t]+)\\s+([^ \\t]+)\\s+([^ \\t]+)\\s+([^ \\t]+)\\s+([^ \\t]+)\\s+([^ \\t]+)\\s+([^ \\t]+)\\s+([^ \\t]+)\\s+([^ \\t]+)\\s+([^ \\t]+)\\s+([^ \\t]+)\\s+([^ \\t]+)\\s+([^ \\t]+)\\s+([^ \\t]+)$')
STORED AS INPUTFORMAT
  'org.apache.hadoop.mapred.TextInputFormat'
OUTPUTFORMAT
  'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'
LOCATION
  's3://mybucket/examplecom'
TBLPROPERTIES (
  'transient_lastDdlTime'='1520796451')

I then verified that a query returns data:
SELECT date, count(*)
FROM cloudfront_logs
order by date
group by date;

However, in the days following the table creation no newer data is appearing in my query despite more access log files appearing in my S3 buckets (for subsequent dates).
I have tried dropping and recreating the table, however the query still returns the same results (without newer access logs data after the original Athena table creation).
Why does newer data that has appeared in S3 not show up in my Athena query results?

A: If your data is partitioned into sub-directories, then Athena might not be aware of the newly created directories.
Use the MSCK REPAIR TABLE to scan the partitions:
MSCK REPAIR TABLE cloudfront_logs;

Then, run your query again.
This will be necessary whenever the folder structure has changed.


text:
Q: Why are these two integrals equal? $$\int_0^T\int_{-x}^{T-x} f(y) dy dx = \int_{-T}^T (T-|y|)f(y) dy$$
I'm so confused, but I can't reach from one side of equality to the other, please help me.

A: Hint: Draw the set and use Fubini
EDIT: Here is the picture of the set.


text:
Q: Spacy lemma different results from 'English' class and en_core_web_sm I am wondering why I get different lemmatization results from these two language models: spacy.lang.en.English and en_core_web_sm.
According to the documentation, when loading the en_core_web_sm model this should tell spacy to use the language "en" and initialize spacy.lang.en.English so I don't understand why the lemmatization rules change. How can I get the lemmas from the English model but the tag and POS from en_core_web_sm?
from spacy.lang.en import English
nlp = English()
doc = nlp('nonlinearities')
print('English nlp: ', [(token.lemma_, token.lemma, token.tag_, token.pos_) for token in doc])

nlp = spacy.load('en_core_web_sm', disable = ['ner'])
doc = nlp('nonlinearities')
print('loaded model nlp: ', [(token.lemma_, token.lemma, token.tag_, token.pos_) for token in doc])

Here is the output:
English nlp:  [('nonlinearity', 3011504801575762058, '', '')]
loaded model nlp:  [('nonlinearitie', 2964900603636025371, 'NNS', 'NOUN')]

A: As you correctly pointed out spacy.lang.en.English and en_core_web_sm are two different models. These two models might POS tag a word differently.  And since the lemma of a word also depends on its POS tag, two models might return different lemmatizations.
To use lemma from English and POS from en_core_web_sm
nlp = English()
sentence = 'nonlinearities is none'
doc1 = nlp(sentence)
print('English nlp: ', [(token.lemma_, token.lemma, token.tag_, token.pos_) for token in doc1])

nlp = spacy.load('en_core_web_sm', disable = ['ner'])
doc2 = nlp(sentence)
print('loaded model nlp: ', [(token.lemma_, token.lemma, token.tag_, token.pos_) for token in doc2])

print('Mixed nlp: ', [(doc1[i].lemma_, doc1[i].lemma, token.tag_, token.pos_) for i, token in enumerate(doc2)])
doc2 = nlp('nonlinearities is none')
print('loaded model nlp: ', [(token.lemma_, token.lemma, token.tag_, token.pos_) for token in doc2])

print('Mixed nlp: ', [(doc1[i].lemma_, doc1[i].lemma, token.tag_, token.pos_) for i, token in enumerate(doc2)])


text:
Q: Getting the nearest positioned ancestor of an Element According to https://www.w3schools.com/css/css_positioning.asp,

An element with position: absolute; is positioned relative to the nearest positioned ancestor (instead of positioned relative to the viewport, like fixed).

How can I get the nearest positioned ancestor of an Element, in either vanilla Javascript or JQuery?

What about offsetParent()? https://api.jquery.com/offsetParent/

Description: Get the closest ancestor element that is positioned.

A: You can test if the position is static of the parent, if not you continue until your reach the first ancestor with position different from static.
Here is a simplified code that you can adjust:

$('.box').each(function() {
  var p = $(this).parent();
  while (p && p.css('position') === 'static') {
    p = p.parent();
  }
  console.log(p.attr('class'));
})
.box {
  position: absolute;
}

.f2 {
  position: relative;
}

A: Edit : I was assuming you were looking for distance bewteen two elements. @TemaniAfif has the right answer

You could navigate the tree of ancestors using parentNode and compare the offsetTop of each to the offsetTop of the element at hand. if all you are interested in is the Y distance.
On the other hand if you need the full distance while accounting for X and Y, you could use the method described here
Measure distance between two HTML elements' centers


text:
Q: ios15 app with a List now has a gap showing on ios16 phone So I have an app, built for iOS15, it contains a List in plainstyle which looks fine. However, running the app on an iOS 16 device (or simulator) there is now a gap that shows between sections as illusrated in the image below

Here's the code I've used
var body: some View {
        VStack{
            List{
                Section{
                    HStack(spacing:0){
                        Text("Some Content 1")
                            .padding(.vertical, 10)
                        Spacer()
                    }
                    .padding(.horizontal,10)
                    .listRowInsets(EdgeInsets())
                    .padding(.bottom,10)
                    .background(Color.init(Color.RGBColorSpace.sRGB, red:0.949, green:0.949, blue:0.949, opacity:1.0))
                    .listRowSeparator(.hidden)
                } header:{
                    HStack(spacing:0){
                        Text("Header 1")
                            .font(.custom("Avenir-Heavy", size: 14))
                            .foregroundColor(Color.init(.sRGB, red: 0.11, green: 0.125, blue: 0.15, opacity: 1.0))
                            .textCase(nil)
                        Spacer()
                    }
                    .padding(10)
                    .listRowInsets(EdgeInsets())
                    .background(Color.init(Color.RGBColorSpace.sRGB, red:0.949, green:0.949, blue:0.949, opacity:1.0))
                }

                Section{
                    HStack(spacing:0){
                        Text("Some content 2")
                            .padding(.vertical, 10)
                        Spacer()
                    }
                    .padding(.horizontal,10)
                    .listRowInsets(EdgeInsets())
                    .padding(.bottom,10)
                    .background(Color.init(Color.RGBColorSpace.sRGB, red:0.949, green:0.949, blue:0.949, opacity:1.0))
                    .listRowSeparator(.hidden)

                } header:{
                    HStack(spacing:0){
                        Text("Header 2")
                            .font(.custom("Avenir-Heavy", size: 14))
                            .foregroundColor(Color.init(.sRGB, red: 0.11, green: 0.125, blue: 0.15, opacity: 1.0))
                            .textCase(nil)
                        Spacer()
                    }
                    .padding(10)
                    .listRowInsets(EdgeInsets())
                    .background(Color.init(Color.RGBColorSpace.sRGB, red:0.949, green:0.949, blue:0.949, opacity:1.0))
                }
            }
            .listStyle(.plain)
            .background(Color.init(Color.RGBColorSpace.sRGB, red:0.949, green:0.949, blue:0.949, opacity:1.0))

        }
        .background(Color.init(Color.RGBColorSpace.sRGB, red:0.949, green:0.949, blue:0.949, opacity:1.0))
    }

Found a solution here -
How to remove section header top padding in SwiftUI Plain List with iOS16


text:
Q: HttpsURLConnection returns --> java.io.IOException: unexpected end of stream on com.android.okhttp.Address I useing HttpsURLConnection to do a POST request, sometimes I get the following error back java.io.IOException: unexpected end of stream on com.android.okhttp.Address
but sometimes it works fine, any idea on how to prevent this.
HttpsURLConnection myConnection = (HttpsURLConnection) new URL( tURL ).openConnection();
myConnection.setRequestMethod( "POST" );

myConnection.setRequestProperty("info", "ok");
myConnection.setRequestProperty("type", "car");
myConnection.setRequestProperty("type", tRequestString);
myConnection.setDoOutput(true);

//Adding Post Data
OutputStream outputStream = myConnection.getOutputStream();
outputStream.write(post_data.getBytes());
outputStream.flush();
outputStream.close();

myConnection.setConnectTimeout( 100000 );
myConnection.setReadTimeout( 100000 );
myConnection.connect();

tURL
https://my.url.com/folder/folder2/fileee.cgi


text:
Q: Alinhar div no rodapé dentro de outra div Tenho um DIV content que engloba outra chamada Images, gostaria que a a div images ficasse no fundo da div content com um certo espaço que eu poderia definir, ex: 400px, porém isso que acontece:

Gostaria que ficasse assim:

Estrutura do código:

TEXTO TEXTO

A: É necessário basicamente definir a div principal com a position: relative e a div filha position: absolute, o resto é editar da forma que você necessitar. Segue o exemplo:

  texto texto texto

  #content {
    position: relative;
    min-height: 150px;
    width: 100px;
    background: black;
    color: white;
  }
  #images {
    position: absolute;
    background: red;
    width: 80%;
    height: 20%;
    bottom: 0;
    margin-left: 10px;
    margin-bottom: 5px;
  }

  texto texto texto


text:
Q: Strange behavior of log on after restart application pool I am building a simple asp.net mvc3 application using Form authentication. After publishing it to IIS 7.5, I find that even after I restart the application pool for my web site(stop it and then start). A logined user doesn't need to re-login. That's not what I expect and I don't remember I had configured the cookie to be persistent.
I use the simple asp.net mvc3 web application template and haven't done much thing to config authentication. Below is some codes related to authentication:
in web.config:
<authentication mode="Forms">
  <forms loginUrl="~/Account/LogOn" timeout="2880" />
</authentication>

in LogOn action:
        FormsAuthentication.SetAuthCookie(userName, false);

A: I think I have got your answer, cookie is set at client side and resetting server IIS will not destroy the cookie as it is not available on server. You can set cookie expiration time and it will get destroy at client side.I hope this clears the situation.


text:
Q: GitHub: accept part of pull request by changed files This may be stupid question, I know, but I wonder, is there any way I can approve part of pull request changes by changed files?
I mean when I see all changed files in pull request, I want to approve only couple of them, add them to repo, and rest of changes mark as 'to improve'.
Thans in advance!

A: Pull request are atomic, you cannot accept few files in request. Either its all or nothing.
If your pull request has multiple commits and you want few commits out it then it can be achieved by making a new branch out of PR and then cherry-picking to master.


text:
Q: General error: 1005 Can't create table 'magento2.easylife_table' in magento I have creating a table through my package(Ics->easylife->sql->install-0.0.1.php) file, but it's returning error.
can anyone tell me where I went wrong?
my code is
<?php

$installer = $this;

$installer->startSetup();

$table = $installer->getConnection()

->newTable($installer->getTable('easylife/easylife_table'))

->addColumn('easylife_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
        'identity'  => true,
        'unsigned'  => true,
        'nullable'  => false,
        'primary'   => true,
    ), 'EasyLife ID')

->addColumn('nom', Varien_Db_Ddl_Table::TYPE_TEXT, '64k', array( ), 'Number')

->addColumn('prenom', Varien_Db_Ddl_Table::TYPE_TEXT, '64k', array( ), 'Pre Number')

->addColumn('telephone', Varien_Db_Ddl_Table::TYPE_TEXT, '64k', array( ), 'Telephone Number')

->addForeignKey($installer->getFkName('easylife/easylife_table', 'easylife_id', 'easylife/easylife_table', 'easylife_id'),
        'easylife_id', $installer->getTable('easylife/easylife_table'), 'easylife_id',
        Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE)

->setComment('Easy Life Table');

$installer->getConnection()->createTable($table);

$installer->endSetup();

thanks in advance.

A: Most probably it's the foreign key you are trying to add.
From what I see, you try to add a foreign key to the same field in the same table. That won'y work.
Either drop the addForeignKey or reference an other table.


text:
Q: REST API backed by H2 DB behaves differently to IBM DB2 for inserting rows with XML strings I'm a bit befuddled : I've got some table with one CLOB column that is supposed to contain an XML String. In my test suites I use an in-memory database, H2. In production I use IBM DB2. My test kept failing at some point, and I noticed that the reason is that when I add a row to my table in my test suites, the XML String contains a header (<?xml ...>). In my production database there is no such header.
The calls I do in production and in my test suite are identical : I make a REST call to insert some row with the same JSON input (mapped to a DTO that gets converted to XML with JAXB).
From some cursory reading online I have not been able to figure out what the cause of this is. Does IBM DB2 do something with XML Strings in the background, something I must have missed?


text:
Q: A monotone increasing function on [0,1] with f(0)=0 and f(1)=1, with measure of f[0,1] is 1, is continuous Let f be a monotone increasing function on [0,1] with f(0)=0 and f(1)=1. Let E = f([0,1]) and the Lebesgue measure mE = 1. Prove f is continuous on [0,1].
I've been attempting this problem at several angles, but cannot seem to work with it. Is it wise to work with discontinuities and their measure?

A: Any discontinuity of a monotone function is a jump discontinuity, meaning that $f(a-)\lt f(a)$ or $f(a)\lt f(a+)$. Either way, a whole interval is missing from the range of $f$, and so $m(E)$ falls short of $1$ by at least the length of that interval.

A: The only type of discontinuity a monotone function can have are jumps. First note that $\displaystyle f[0,1]\subset [0,1]$. Now pick a point $y\in [0,1]$. Then $\displaystyle 1=m(f[0,1])\le 1-\lim_{x\to y^+}|f(x)-f(y)|\le 1$, so that $\lim_{x\to y+}|f(x)-f(y)|=0$, and similarly $\lim_{x\to y^-}|f(x)-f(y)|=0$, so that $f$ is continuous.


text:
Q: TinyMCE shows error in the editor I have used tinyMCE for my project. but now I am getting a below error
This domain is not registered with TinyMCE Cloud. Start a free trial to discover our premium cloud services and pro support
Can anyone know how to get rid of this error message? without using paid service from tinyMCE?

A: I have solved my problem with the use
<script src="//cdn.tinymce.com/4/tinymce.min.js"></script>

A: If you're using a JS framework like VueJS, you can use the tinymce-script-src attribute to use a non-cloud version of tinymce.min.js to avoid the error message but still have the framework functionality.
Example using a locally stored non-cloud file:
<editor tinymce-script-src="tinymce/tinymce.min.js" ... />

You can see why this works in the Vue implementation here:
https://github.com/tinymce/tinymce-vue/blob/9ef5d30ff68c5428940ff4722bdb257e6079bc7e/src/main/ts/components/Editor.ts#L94

A: It seems that you're using TinyMCE getting the file from their domain (cloud.tinymce.com), you should get a free key and update the URL e.g.:
<script src="http://cloud.tinymce.com/stable/tinymce.min.js?apiKey=[YOUR_API_KEY]"></script>

A: This will remove only the first "free trial" warning notification (and leave other notifications like deprecated plugins, errors, etc).
tinymce.init({
  selector: 'textarea',
  init_instance_callback : function(editor) {
      var freeTiny = document.querySelector('.mce-notification');
      freeTiny.style.display = 'none';
  }
});

A: Thank you @Ignacio Ara. A free API key is valid only for 30 days.
I have used CSS property display none for the class .mce-notification.mce-in
that resolved my problem.

A: I solved my problem used this function.
_tinymce.init({
  selector: 'textarea',
  init_instance_callback : function(editor) {
    var freeTiny = document.querySelector('.tox .tox-notification--in');
   freeTiny.style.display = 'none';
  }
 });

A: The correct way of avoiding the warning is to host the library yourself, as pointed out in Nathan Goings' answer (which IMO should be the accepted one).
If you are integrating TinyMCE in an Angular project using the @tinymce/tinymce-angular package, you can override the library source path by defining a provider:
import { Component } from '@angular/core';
import { TINYMCE_SCRIPT_SRC } from '@tinymce/tinymce-angular';
import { RawEditorOptions } from 'tinymce';

@Component({
  selector: 'tiny-editor',
  template: '<editor [init]="editorOptions"></editor>',
  providers: [
    { provide: TINYMCE_SCRIPT_SRC, useValue: 'assets/tinymce.min.js' }
  ]
})
export class TinyEditorComponent   {

  editorOptions: RawEditorOptions = {
    base_url: '/assets',
    height: 500,
    menubar: false,
    plugins: [
      'advlist autolink lists link image charmap print preview anchor',
      'searchreplace visualblocks code fullscreen',
      'insertdatetime media table paste code help wordcount'
    ].join(' '),
    toolbar:
      `undo redo | formatselect | bold italic backcolor |
      alignleft aligncenter alignright alignjustify |
      bullist numlist outdent indent | removeformat | help`
  }
}

Don't forget to update the architect build step in your angular.json file, to include the tinymce files into your public assets folder:
{
...
    "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "assets": [
              ...
              {
                "glob": "**/*",
                "input": "./node_modules/tinymce/",
                "output": "./assets/"
              }
              ...
           ]
        }
        ...
     }
     ...
}

For more information, check this guide on how to integrate a self-hosted TinyMCE instance in an Angular app.

A: While  CCS does the job in most cases, you may have to use !important. You could also try hiding it on DOMContentLoaded with vanilla javascript:
<style>
/* one way */
  .tox-notifications-container{
      visibility: hidden;
    }
/* another way */
  .tox-notifications-container{
      display: none;
    }
</style>

/* javascript way */

window.addEventListener('DOMContentLoaded', () => {
document.querySelector('.tox-notifications-container').style.visibility = "hidden";
}); // Assuming that you have only one element with this class.


text:
Q: How to Thunderbird mail client change status of inbox mail unread to read? I am using Thunderbird mail client for gmail accounts.  Its works fine, enjoying functionality too. I have problem with this mail client. In client inbox it has a list of unread mails and once viewed it becomes read mail. That's not happening on the gmail servers. If I login to gmail I'm still finding unread mails which I read in Thunderbird.
Please help me how to solve this problem. Is there any option or settings or add-ons which change status of mail when I read it?

A: Sounds like you setup Thunderbird to use POP to get your email instead of using IMAP. If you go into Gmail and go Settings -> Forwarding and POP/IMAP there is instructions on how to setup an external mail client, like Thunderbird, to use IMAP to get your emails. Just enable IMAP access, and click the link for configuration instructions. There is a section explaining how to setup IMAP access in Thunderbird. In using IMAP, as you read email in Thunderbird, it will be marked as read in Gmail.
Most email services these days allow IMAP access through external clients. POP is good for just getting messages quickly, but IMAP allows the client to pass data back, as well (at least in the case of Gmail) as pull over folders, calendars and notes to your client.


text:
Q: What is the difference between Ethernet and Serial communication? All the mouse movements, USB connections and other PC peripherals such as printers etc. are what is called serial communication. One bit per time.
So far so good. But when it comes to TCP protocol, Ethernet and internet it is not called serial communication anymore. But this is also bit per second stuff.
Why is that so? What is the main difference? I couldn't understand why it is not serial communication.

A: Ethernet can be transmitted serially and generally was until the days of  1000BASE-T.
But it's packetized,  you literally can not send a single valid byte as there is a pile of addressing, crc, etc. overhead.  Ethernet also does not insure ordering between packets, so you might send packets A B and C but the receiver could get them in the order C A B.  There is also collision detection and re-transmission baked in.
Overall it's a whole lot more complicated that a serial connection.

A: The answer is: the ISO-OSI stack.
OSI stands for Open Systems Interconnection (ISO is the International Standardization Organization), and it's a model which defines the structure used to transmit data between every kind of devices. Each level is a different abstraction layer, and adds rules or details that define the communication protocol.
While Internet (excluding things that are commonly associated with it, like HTTP) belongs to the upper layers (the Network layer), serial communication is just a way to define the Physical layer.

This is the OSI model stack, compared with the TCP/IP model used for Internet: you can see that Internet is defined at the network level, while the serial protocol (in strict sense, not the implementation) is defined by the physical layer, at the base of the stack.
From Wiki about the Internet protocol suite:

The Internet protocol suite is the set of communications protocols used for the Internet and similar networks, and generally the most popular protocol stack for wide area networks. It is commonly known as TCP/IP, because of its most important protocols: Transmission Control Protocol (TCP) and Internet Protocol (IP)
It has four abstraction layers, each with its own protocols. From lowest to highest, the layers are:

*

*The link layer (commonly Ethernet) contains communication technologies for a local network.

*The internet layer (IP) connects local networks, thus establishing internetworking.

*The transport layer (TCP) handles host-to-host communication.

*The application layer (for example HTTP) contains all protocols for specific data communications services on a process-to-process level (for example how a web browser communicates with a web server).

Ethernet and WiFi are examples of protocols that can work as Network Access Layer, providing the physical medium and the basic transmission rules (like the encoding of symbols) for the Internet connection.
Other protocols used at different layers of the stack are, as mentioned, TCP, UDP, HTTP and many others.

A: Several people have given you good answers to your question.
But there's another distinction nobody has mentioned yet.
When we talk about serial and parallel peripherals for a PC, historically we talked about a point-to-point link. One computer talks to one printer or one modem (per cable). In general there is a master device that controls all communications over these links and slave devices that just do what they're told.
When we talk about Ethernet, we're talking about networking. Multiple computers are connected a network, and none of them is necessarily master or slave. In the early Ethernet protocols, multiple computers would actually be hooked up to the same coaxial cable. Nowadays generally Ethernet means point-to-point links but Ethernet includes protocols that enable communicating with multiple other devices in a peer-to-peer network.
Of course USB somewhat changes the picture for PC peripherals because its a multi-point network, but its still a peripheral interconnect with defined masters and slaves, rather than a peer-to-peer network.
So, I'd say that discussions of serial and parallel interfaces don't mention networking don't mention TCP or Ethernet because those things live in a completely different world from peripheral interconnects. Like when you talk about all the kinds of apples (Red Delicious, Braeburn, etc.) you never mention Gros Michel and Cavendish.

A: At least three reasons, probably:

*
*In the era when RS-232 ports were common, it so by far the most common means of bit-at-a-time communication, so much so that the term "serial port" became synonymous with "RS-232 port"; using the term "serial" in connection with anything else would add confusion.  Note that USB avoids such confusion mainly because it seldom referred to as "Universal Serial Bus", so the existence of the word "serial" in its long-form name is a non-issue.

*In nearly all cases, RS-232 ports their logic-level equivalents transmit individual bytes as they are received from software, and individual incoming bytes available to software as they are received.  By contrast, most Ethernet devices will wait until software has supplied an entire packet (between 64 and 1536 bytes) before they begin transmission, and will wait until they have received and validated an entire packet before they make any of it available to software.  Although bits and bytes might be sent over the wire serially, software neither knows nor cares.  It just knows that some short time after one controller is fed a packet and told to send it, another controller will report that a packet is available, and allow software to read it.

*A "serial port" is guaranteed to transmit bytes of data in the chronological sequence that software supplies them, and make them available to software in the chronological sequence they are received; it would be rather useless if it did not.  All Ethernet and Internet systems guarantee that when a packet is sent from one node to another the arrangement of bytes made available to the recipient will match the arrangement of bytes supplied by the sender, but there is no common specification requiring that the chronological order in which data are transmitted have any relation to their arrangement within a packet.  Further, there only guarantees that can be made with regard to chronological sequencing of packets relative to each other are highly vague.  If packet X is delivered Sunday at 11:47am and packet Y is delivered the next day at 3:28pm, one can safely assume that Y was sent after X.  On the other hand, if X is delivered at 1:47:12 and Y is delivered at 1:47:15, it's entirely possible that Y was sent first but X took longer to arrive.

Incidentally, a 10-base-T Ethernet connection sends individual bits in sequence, but higher-speed cabling often uses various signalling methods to send multiple bits at once.

A: One byte at a time is also called serial communication, except by hardware people. Nobody cares how the signaling is done. Think about a modem. Although the RS-323 interface driven by a UART chip may be banging out the bits one at a time, the actual encoding done by the modem may use parallel encodings whereby multiple bits are transmitted at the same time.
Ethernet also used to be strictly serial (baseband pulses at a rate of 10 Mhz). Modern Ethernet protocols are not serial.
The word "serialize" is often used to mean "pack some data in memory into a byte-by-byte format" (where issues of bit order and such are taken care of way down in some datalink and physical communication layers).

A: In my work as a control system engineer for power plant design, we have hardwired IO (input/output) point lists and a separate "serial" points list.  My preference is to call these "soft" point lists a "communicated point list" instead since they are typically Ethernet based (Modbus TCP, DNP3, Profinet etc.).  Many colleagues still insist on using the historical "serial point list" title.  I'm interested in hearing from others on the proper nomenclature for such lists.


text:
Q: Opening tab in Firefox using a url on a file I have a file.txt with some urls and the name of the web. Something like:
WEB1: www.url.com
WEB2: www.url2.com

(No space in the name, and there is a space after the colon) I want to be able to open a tab in Firefox for an specific web in that file. I have tried something like this:
xargs -a file.txt firefox -new-tab "$line"

This opens every word in the document as a new tab. I want to be able to select which url to open using the Web's name. I would open a single url at a time. The file would be around 100 lines long or so. Is there any simple way of doing this? Thanks!
As suggested from Bodo here is some details:

*

*There is a file urls.txt in your HOME directory that contains lines as shown in the question.

*The key and the URL are separated by a colon and a space (: ).

*You want to run a command openurl foo bar baz where foo, bar, baz are keys in the file like WEB1, WEB2 without the trailing colon (:).

A: You can use awk and xargs:
awk -F ': ' '$1 == "WEB2" {print $2}' file.txt | xargs -I{} firefox -new-tab {}

-F ': ' lets awk separate the fields by colon followed by a space. This sequence should not appear in the urls.

A: The answer is based on the requirements defined in the question.
You can create a shell script named openurl:
#! /bin/sh

for i in "$@"
do
    grep "^$i": "$HOME"/urls.txt
done | sed 's/.*: //' | while read url
do
    firefox -new-tab "$url"
done

When you run openurl WEB1 it should open www.url.com, When you run openurl WEB1 WEB2 it should open both URLs from the example.
Keys that don't exist in the file, will be ignored. That means e.g. openurl WEB1 WEB3 will open www.url.com and do nothing about WEB3.
Of course you can also create a function openurl instead of a shell script.
If the file that contains the table of URLs would be very big (much more than 1000 lines) or if you want to specify many URL keys (much more than 10) the simple approach might get slow. In this case it might be better to use a different approach to extract all matching lines from the file in a single pass instead of running grep multiple times for every command line argument.

The part how to open the URLs as tabs is copied from Artem S. Tashkinov's answer.

A: awk '{print $2}' file.txt | grep -v ": " | while read url; do firefox -new-tab "$url"; done

Adding | grep -v ": " because the OP indicated " are keys in the file like WEB1, WEB2 without the trailing colon (:)."


text:
Q: Itunes Keeps deleting my podcasts I like to download podcasts to my ipod to listen to them at work or at the gym. However, after I have listened to them, once I sync my ipod with my computer, it deletes the podcasts that I have played from both my computer and my ipod, despite the fact i have the settings set to not delete them automatically after they have been played. I like to keep old podcasts of some shows (such as This American Life) because once they add the new episode to itunes, the old one is only accessible through purchase and I want to save them in case i want to listen to them again. Any idea what's going on?

A: I was having the same issue. For me I found a "refresh" button in the title of the podcast, then the episodes were visible again and I could right-click/highlight and select 'mark as unplayed' It seems to be working for me :)


text:
Q: Why Isn't Cross Entropy Used in SVM? Modern neural networks use cross entropy as a loss function, because of shortcomings of MSE. So, why is MSE still being used in SVM (and maybe other learners) and not replaced by cross entropy?

A: Neural nets are a broad class of models, and many different loss functions can be used. In fact, SVMs can be thought of as a particular kind of shallow neural net. SVMs are much narrower in scope than neural nets. You can't just pop in any arbitrary loss function, or you'd no longer have an SVM. Furthermore, cross entropy is defined on probability distributions, so it can only be used as a loss function when the classifier gives a probability distribution over classes. SVMs don't do this, so cross entropy won't work. SVMs don't use MSE, they use the hinge loss, which gives them their maximum margin properties.


text:
Q: Why does std::make_shared cause linker errors when using non-inline static const members? I'm using C++17 and stumbled on a linker error with this kind of code
#include <memory>

struct SomeType
{
    static const int MIN = 0;
    static const int MAX = 0;
};

struct Range
{
    Range(int min=0, int max=0) : min(min), max(max) {}

    int min, max;
};

int main()
{
    auto range = std::make_shared<Range>(
        SomeType::MIN,
        SomeType::MAX
    );
    return 0;
}

On linux using gcc 11.2 this causes linker errors but MSVC builds it without problems (Visual Studio 2019 Version 16.9.2).
undefined reference to `SomeType::MIN'
undefined reference to `SomeType::MAX'

but if I add inline before static const int MIN = 0; and static const int MAX = 0; then it works just fine.
Why does adding the inline fix the linking issue? Why is it a link time issue and not a compile time issue?


text:
Q: How to remove row from excel using Python/PySimpleGUI Dears,
How to remove row from excel using Python/PySimpleGUI.
Knowing that I'm using the reverse process of adding rows to excel file using PySimple :
Add Row :
import PySimpleGUI as sg
import pandas as pd

..........
[sg.Button('Submit', size=(6, 1), button_color=('White','Dark'))]

if event == 'Submit':
    new_record = pd.DataFrame(values, index=[0])
    df = pd.concat([df, new_record], ignore_index=True)
    df.to_excel(EXCEL_FILE, index=False)
    sg.popup('Data Saved!', font=("Helvetica", 11),text_color='Yellow', no_titlebar=True, button_type=5)
    clear_input()

And for deleting row with a given key , i'm using the following code and didn't help :
   if event == 'Delete':
    df = pd.read_excel(EXCEL_FILE)
    df = df[df.Column1!= 'ENTRY']
    df.to_excel(EXCEL_FILE, index=False)
    sg.popup('Entry Deleted!')

Could you please advice ? Thanks

A: Could you drop the column from the df and then rewrite to excel if needed?
df = df.drop(['rowToDelete'])


text:
Q: Sticky footer messes up the height of sections I'm trying to create a sticky footer in a webpage that has section with fixed heights. When I tried this trick, I got my sticky footer but the sections weren't showing their fixed height. How do I fix this?
Ps: when I change min-height to height, it fixes the issues for sections height but I get no sticky footer.

html,body {
width:100%;
height:100%;
position:relative;
}

.wrapper {
position:relative;
width:100%;
min-height:100%;
margin-bottom:200px;
}

.section1{
width:100%;
height:100%;
background-color:grey;
}

.section2{
width:100%;
height:50%;
background-color:orange;
}

.wrapper:after {
  content: "";
  display: block;
}
.site-footer, .wrapper:after {
height:200px ;
}

.site-footer {
    background-color:red ;
}

header1

header2

footer

A: Instead of percent values, you can use "vh"  values for the sections (1vh = 1% of the viewport height):

html,body {
width:100%;
height:100%;
position:relative;
}

.wrapper {
position:relative;
width:100%;
min-height:100%;
margin-bottom:200px;
}

.section1{
width:100%;
height:100vh;
background-color:grey;
}

.section2{
width:100%;
height:50vh;
background-color:orange;
}

.wrapper:after {
  content: "";
  display: block;
}
.site-footer, .wrapper:after {
height:200px ;
}

.site-footer {
    background-color:red ;
}

header1

header2

footer


text:
Q: How can I make sure my Linux sees one file, but the data is stored on multiple drives? I'm currently making my server (on Ubuntu, non server variant) that is going to act as a home theater server that i am sharing with my friends. Now, it is going to start very small, I only have a 60gb SSD. This is for start up fine, but will fill up pretty quick (Thinking about 10/15 movies in 1080p quality). Now I use emby, this is mostly like PLEX, but not relevant in my eyes.
The current way I have it setup to upload files is an FTP server. My friends can only see one folder where they upload their movies. But here is where I get stuck.
This folder will only exist on the first SSD, but not the HDDS that will later follow. But I want to use this folder to let me and my friends upload the data, but then when I upload it, it distributes it on different HDDs. But when I open the folder, I can see all the data of the HDDS that are behind it. (Some kind of a tree storage system?)
I have not tried anything myself that is remotely close to what I want to achieve. Simple said, I am just stuck.
So my question here, does anyone have tips on how I should accomplish this idea, or do others have better ways to accomplish this?
Thanks in advance!

A: LVM is a great tool to accomplish this. If you configure the folder to be on a partition on an LVM "logical volume", you can later add disks to the "volume group" and migrate the "logical volume" to whatever combination of disks you want, inside the volume group.


text:
Q: Need Individual Arrays from ArrayList of ArrayLists Could someone show me how to get arrays from my ArrayList of ArrayLists? All the information regarding converting to an array using ".toArray()" seems to only apply to an ArrayList, not an ArrayList of ArrayLists.
To give a quick background: I am reading values from an excel table of variable dimensions (meaning it could be 1x1, 100x100 table, or anywhere in between) hence the need for ArrayLists. The number of columns and rows are calculated by the excel sheet for easy access in the java program itself (as shown below).
public static void main(String args[]){

    int columns;
    int rows;
    XSSFWorkbook workbook = new XSSFWorkbook(new FileInputStream("c:\\KalmanInputFile.xlsx"));
    XSSFSheet sheet = workbook.getSheetAt(0);
    XSSFRow row1 = sheet.getRow(1);

    columns = (int) row1.getCell(7).getNumericCellValue();
    rows = (int) row1.getCell(6).getNumericCellValue();

    ArrayList <Double> innerlist = new ArrayList<Double>();

    ArrayList <ArrayList <Double>> list = new ArrayList<ArrayList <Double>>();

    int i;
    int j;

    for (j = 1; j < (rows+1); j++)
    {
        XSSFRow row = sheet.getRow((j-1));

        for (i = 1; i < (columns+1); i++)

        {
            innerlist.add((i-1), row.getCell(i).getNumericCellValue());

        }

        list.add((j-1), new ArrayList<>(innerlist));
        innerlist.clear();
    }

If I were to print "list" I would get the following:
[[1.0, 1.0, 9.0, 11.0], [0.0, 1.0, 10.0, 12.0], [2.0, 3.0, 4.0, 5.0]]

Each element in "list" is a row of the 3x4 table in the Excel file. I need all three of those elements turned into separate arrays for later use in a matrix algebra program that is already written.
Any help at all would be appreciated!

A: Double array1[] = new Double[list.get(0).size()];
array1 = list.get(0).toArray(array1);

Double array2[] = new Double[list.get(1).size()];
array2 = list.get(1).toArray(array2);

Double array3[] = new Double[list.get(2).size()];
array3 = list.get(2).toArray(array3);


text:
Q: Startup job/task not working on windows I've registered a new startup job as follows
$trigger = New-JobTrigger -AtStartup -RandomDelay 00:00:30

$option =  New-ScheduledJobOption -RunElevated –ContinueIfGoingOnBattery

Register-ScheduledJob -Name startup_test -FilePath C:\startup.ps1 -Trigger $trigger -ScheduledJobOption $option

My startup.ps1 script is as follows
New-Item c:\test_startup_success.txt -type file

When I restart the windows server 2012 R2 core, it doesn't create the file. Have restarted using
shutdown /r

But if I use test it using, it created the file
Start-Job -DefinitionName startup_test

Is there anything that I'm missing which needs to be done specifically for startup jobs?
Update:
I executed the following command to see if the job failed, but the output was empty.
Get-WinEvent -LogName Microsoft-Windows-TaskScheduler/Operational | Where {$_.Message -like "*fail*"}

My wild guess is that the job itself is not getting executed. Some condition is probably not getting satisfied. Even the Job trigger is enabled
PS C:\Windows\System32\WindowsPowerShell\v1.0> Get-ScheduledJob | Get-JobTrigger
Id         Frequency       Time                   DaysOfWeek              Enabled
--         ---------       ----                   ----------              -------
1          AtStartup                                                      True


text:
Q: Informix window function range clause behaves like rows clause Consider this statement in Informix:
SELECT
  a,
  b,
  sum(a) over (order by b) "no frame",
  sum(a) over (order by b range between unbounded preceding and current row) "range",
  sum(a) over (order by b rows between unbounded preceding and current row) "rows"
FROM TABLE(SET{row(1, 1), row(2, 1), row(3, 2), row(4, 2)}) AS t(a, b);

Surprisingly, it produces the same result for range and rows:
a |b |no frame |range |rows |
--|--|---------|------|-----|
1 |1 |3        |1     |1    |
2 |1 |3        |3     |3    |
3 |2 |10       |6     |6    |
4 |2 |10       |10    |10   |

This works quite differently from any RDBMS I'm used to, including PostgreSQL:
SELECT
  a,
  b,
  sum(a) over (order by b) "no frame",
  sum(a) over (order by b range between unbounded preceding and current row) "range",
  sum(a) over (order by b rows between unbounded preceding and current row) "rows"
FROM (values(1, 1), (2, 1), (3, 2), (4, 2)) AS t(a, b);

... which produces the expected
a |b |no frame |range |rows |
--|--|---------|------|-----|
1 |1 |3        |3     |1    |
2 |1 |3        |3     |3    |
3 |2 |10       |10    |6    |
4 |2 |10       |10    |10   |

Is there a subtle difference between Informix and standard SQL that I'm missing, or is it a bug? I'm using the official docker image, which corresponds to Informix 12.10 as of now.

A: This is documented behavior:

If you specify an ORDER clause but no window frame clause for a window aggregation function, then by default, all rows that precede the current row and the current row are returned, which is equivalent to the following window frame specification:
ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW

I believe the standard is RANGE when no windowing clause is present.  I'm pretty sure that is the default in most other databases.

A: As a workaround, I can use 0 PRECEDING (which shouldn't be allowed, but oh well) instead of CURRENT ROW. This produces the result I would have expected:
SELECT
  a,
  b,
  sum(a) over (order by b) "no frame",
  sum(a) over (order by b range between unbounded preceding and 0 preceding) "range",
  sum(a) over (order by b rows between unbounded preceding and current row) "rows"
FROM (values(1, 1), (2, 1), (3, 2), (4, 2)) AS t(a, b);

I now get:
a |b |no frame |range |rows |
--|--|---------|------|-----|
1 |1 |3        |3     |1    |
2 |1 |3        |3     |3    |
3 |2 |10       |10    |6    |
4 |2 |10       |10    |10   |


text:
Q: CustomTextField doesn't work when added in Fxml I have TextField with cross to clear input. When I'm adding it like this:
public class Controller implements Initializable {
    @FXML
    private TextField autoCompleteTextField = TextFields.createClearableTextField();
    ...

and then:
@Override
public void initialize(URL location, ResourceBundle resources){

    autoComplete1 = TextFields.bindAutoCompletion(autoCompleteTextField,callback, converter);
    autoCompletePane.getChildren().add(autoCompleteTextField);

Everything works great. But when i want to add this item in SceneBuilder or manualy in Fxml:
<Pane fx:id="autoCompletePane" prefHeight="30.0" prefWidth="444.0">
    <children>
        <CustomTextField fx:id="autoCompleteTextField" layoutX="25.0" layoutY="3.0" />
        // or TextField instead of CustomTextField
    </children>
</Pane>

normal TextField is inserted, without cross to clear input.
What can i do?

A: You can specify a static method not taking parameters to create the textfield using the fx:factory attribute:
<Pane fx:id="autoCompletePane" prefHeight="30.0" prefWidth="444.0">
    <children>
        <TextFields fx:id="autoCompleteTextField" fx:factory="createClearableTextField" layoutX="25.0" layoutY="3.0" />
    </children>
</Pane>

(This requires an import processing instruction for the TextFields class of course.)


text:
Q: How do you design a text-based view using Ember.js or some other MVC javascript framework? I have an homemade javascript which, among other things, do some kind of text-formatting work in order to emulate a retro text-based game:
When developing it, i tried to stick close to an MVC model, and this is what i did:
The data model basically consists of a list of objects mapping strings to very specific locations in the display, like this
[{
 "value":"Hello!",
 "color":"blue",
 "row":1,
 "column":13
},
{
 "value":"What is your quest ?",
 "color":"red",
 "row":5,
 "column":10
},

/* ... some other data */]

Then my view consists of a simple
 tag. When my controller draws the model on the view, it iterates through each string-location pair and create a  for each one that is appended to the
 tag. To keep the formatting consistent, it also adds "blanck" span each time it is needed.

               Hello!

It's pretty simple, but it worked great until i had to dynamically change a span text value, without redrawing the whole scene each time.
So i took a look on the internet and realized that Ember.js existed, it really seems to be exactly what i could use to improve my whole code.
Now, i tried to redesign it using Ember.js, but as i don't fully understand yet its features i ran into a problem:
How do you represent a 'text-based' view into an Ember.js handlebar template ?
What am i missing here?
My data model contains both the value and the position in the display, so i don't exactly see how handlebars template could fit my needs. Or perhaps dynamically generating the template is an option ?
What do you think ?
Am I choosing the wrong framework or misunderstanding its use? is it my original MVC design that is wrong ? Changing the data model for something completely different is not an option i can easily consider as it would impact everything.
Do you have any ideas on how this could be implemented using Ember or some other framework?
Any advice will be appreciated :)

A: I made a rudimentary example on jsfiddle on how you could use ember for this.
Each row is an object and we have an ArrayProxy holding such objects. Thus if we have 10 rows, we have 10 row objects.
The view is binding one output line per row object.
Enjoy the flying bird:
http://jsfiddle.net/algesten/YMrW3/2/
Edit: Better to {{#if}} away empty rows as pointed out by ud3323:
http://jsfiddle.net/ud3323/92b24/


text:
Q: Pyinstaller with pywinauto huge file size I have a script that I want to compile into an executable. I'm using Pyinstaller for this task and the exe file generated is too large.
There are several imports, one of them is pywinauto. If I comment pywinauto imports I get an executable with 20mb. With pywinauto I get an executable with 232mb!
Note: I'm running pyinstaller from a virtual environment in which I have just installed the necessary python dependencies that I'm using in the script.
Here is a list of the imports I'm using:
import os,subprocess,datetime, argparse, math, win32con
import boto3
from botocore.exceptions import NoCredentialsError
from botocore.client import Config
import wx,wx.adv
from pubsub import pub
from win32api import GetSystemMetrics

from pywinauto.application import Application
from pywinauto.keyboard import SendKeys
from pywinauto.findwindows import find_window

from base64 import b64decode
from zlib import decompress
from io import BytesIO

Pyinstaller command that I'm running:
pyinstaller --noconsole --onefile --i=rec.ico --clean script.py
pip list in my virtal environment:
Package         Version
--------------- --------
boto3           1.9.246
botocore        1.12.246
comtypes        1.1.7
docutils        0.15.2
jmespath        0.9.4
Pillow          6.2.0
pip             19.2.3
pubsub          0.1.2
pypiwin32       223
python-dateutil 2.8.0
pywin32         225
pywinauto       0.6.7
s3transfer      0.2.1
setuptools      40.8.0
six             1.12.0
urllib3         1.25.6
wheel           0.33.6
wxPython        4.0.6

Is there any way to reduce the executable size?
I'm using pywinauto basically to send a keyboard shortcut command to another application from my script. If there's an alternative library to do this that would make my executable smaller I would certainly try it.
Thanks!
====================
EDIT:
I tried to compile with:
pyinstaller --noconsole --onedir --i=rec.ico --clean script.py
Now I get a folder with 660mb!!! And the application loads WAY faster (it was taking about 15s to load before, now it's almost instantly).
The folder of the application has a LOT of dll files, the 19 largest of them  summing up to 537 Mb.

Any suggestions on how to trim that?

A: I did a fresh install of python 3.7, since I was using Anaconda's Python distribution before, installed just the packages I needed and compiled it with pyinstaller again. Now I have a 35Mb file with --onefile or a 120Mb folder with --onedir. I'll probably be using onedir because the application loads faster that way. I don't think it's the ideal file size but it's certaily way better than before (open to suggestions in case anyone has an idea on how to further reduce the size of the application). Thanks Vasily for the help!


text:
Q: Targeting a sortable thats being dragged So I'm convinced this is a simple thing to work out if you know your way around jQuery/Javascript, obviously I don't as I can't figure out how to do it!
I have some code that used the 'this' selector to get the current thing being dragged 'div.block'
which can be found here: http://jsfiddle.net/tktGA/4/
However I now need to change the implementation over to a jQuery UI sortable, instead of draggable, and now 'this' targets the wrong thing, anyone any ideas on how I can target the item being dragged again ?
The new sortables converted code (so far) is here > http://jsfiddle.net/WqZ9m/11/
NOTE: It targets something else because with sortables I have to target the container's (#areaOne, #areaTwo) instead of what it used to target (.block), the block's themselves.
What should happen in the new sortables version is that when you drag a block over to the edge (the right), it scroll's to the next area, like it currently does on the draggable code, but because it's not targeting the .block, it does not scroll over :/
Anyone got any ideas as to how I can target the correct block being dragged?
Any help is very much appreciated!

A: Just for any future reference I used ui.helper to target the element being dragged.


text:
Q: DLL ativa Delphi Tenho uma DLL e a mesma é ativada assim:
Rundll32 MinhaDll.dll

Inicia após o comando, faz o processo e é encerrada.
Eu preciso que ela continue na memória fazendo o monitoramento de determinados processos.
A unica forma de manter ela ativa que encontrei foi fazendo:
repeat application.processmessage until false;

Porém o processamento fica sempre em 100%.
Existe outra forma de manter ela ativa fazendo um monitoramento a cada 1 segundo?
Em um resumo, eu preciso carregar uma DLL ao iniciar o Windows e descarregar quando ele for desligado.

A: DLLs são bibliotecas de link dinâmico, isto é, elas são carregadas no momento em que um programa ou outra DLL faz referência a ela durante a execução.
Pelo que entendi do problema acima, você precisa de um programa que executa um procedimento a cada 1 segundo. A melhor forma que conheço de fazer isso no Windows é criando um serviço e registrá-lo no Service Control Manager.
Existe este tutorial http://www.devmedia.com.br/criando-um-windows-service/7867
Serviços são programas sem interface gráfica (pois rodam em background) e são gerenciados pelo Windows.
Acredito que você esteja usando o Delphi, neste caso é muito simples criar serviços com o Delphi. Vá até o menu de assistente de um novo projeto e indique que você quer criar um projeto service do Windows.
Pela natureza de um serviço do Windows, você vai precisar implementar 3 métodos na sua classe de inicialização - Start e Stop - Eles serão chamados pelo Windows para, respectivamente, iniciar e parar o serviço. Cabe a você implementar o que o seu serviço irá fazer ao iniciar.
Como ele requer um monitoramento a cada 1 segundo, eu faria algo assim:
procedure TsrvPrincipal.ServiceExecute(Sender: TService);
begin
  while not self.Terminated do begin
    Sleep(1000); // Aguarda 1 segundo
    executeMonitoring();  // Realiza o monitoramento
  end;
end;

Ao compilar o seu serviço, o Delphi criará um arquivo executável. Para executar o serviço é necessário que você antes registre ele no Service Control Manager. Para tal, chame o seu programa com o parâmetro /INSTALL.
A partir daí, ele ficará disponível no Service Control Manager, e você poderá iniciar ou interromper ele através do Painel de Controle -> Serviços.
Espero ter ajudado.


text:
Q: Vue.js 2 + Bootstrap-Vue.js: Make column follow user I've been building a small test App using Vue.js and Bootstrap-Vue, lets say my App is like this:

                // Page content...

                <cart></cart>

How can I make it so the b-col around cart or cart itself will follow the user if he scrolls? In a similar fashion to what was available in bootstrap 3 Affix plugin?
The ideia is to have a long left/first b-col to show products and a right/second b-col with a shopping cart that follows the user around.
Thank you.

A: I've a solution, considering this is the template for the cart:
<template>

Items

        <li v-for=...

</template>

Just add this to the CSS:
div.cart {
    position: -webkit-sticky;
    position: sticky;
    top: 40px;
    height: calc(100vh - 40px);
    overflow-y: auto
}

Done.


text:
Q: alternative proof : Borel $\sigma$-field on $\mathbb R^d$ is the smallest $\sigma$-field making all continuous functions measurable This question is related to Prove that Borel sigma field on R(d) is the smallest sigma-field that makes all continuous functions f:R(d)->R measurable.  I'm trying to prove this exercise in Durrett's book myself, and wonder if the following elementary arguments are valid:
First of all, for every continuous $f:\mathbb R^d\to \mathbb R$, $f^{-1}(E)$ is open, for any open set $E\in \mathbb R$.  So clearly the Borel $\sigma$-field $\mathcal B^d$ makes all continuous function measurable.
To show the $\mathcal B^d$ is the smallest such $\sigma$-field $\mathcal F$, let $d=2$ for simplicity of arguments.  Consider two continuous functions: $g(x,y)=x$ and $h(x,y)=y$.  Note that $g^{-1}((a_1, b_1))=(a_1, b_1)\times(-\infty, \infty)$, and $h^{-1}((a_2, b_2))=(-\infty, \infty)\times(a_2, b_2)$.  So $\mathcal F$ must contain $\{(a_1, b_1)\times(-\infty, \infty):a_1, b_1\in \mathbb R\}$ and $\{(-\infty, \infty)\times(a_2, b_2):a_2, b_2\in \mathbb R\}$, and hence $\{(a_1, b_1)\times(a_2, b_2):a_1, b_1, a_2, b_2\in \mathbb R\}$.  This implies $\mathcal F\supset \mathcal B^2$ and hence $\mathcal F = \mathcal B^2$.  Extension to $d>2$ or $d=1$ is obvious.
Is this proof correct?  If there're flaws, I'd appreciate it if someone can point them out.  Thanks a lot!


text:
Q: Development machine url does not reflect "dev" part in the url I have two machines, and they are served by a master machine. The master machine defines the first machine 10.10.0.59
server {
        listen 80;
        client_max_body_size 200M;
        server_name localhost 127.0.0.1;
        server_name_in_redirect off;

location / {
        proxy_pass http://10.10.0.59;
        proxy_redirect default;
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

location ^~ /dev/ {

        proxy_pass http://10.10.0.56;
        proxy_redirect default;
        proxy_set_header Host $http_host;
        rewrite /dev/(.*) /$1 break;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

The dev machine is 10.19.9.56 and I need to add (most likely) /dev/ to the url path, so that I can browse it by http://public_domain/dev/.....
Each of these machines has several apps running.
With this new rule, I can go on by http://public_domain/dev/app1/ but all the links on that page will point to, for example, http://public_domain/app1/login which is server#1.
What else is wrong? Thanks.
Should I setup a new server clause? If I do, do I need to open a different port because the these two location blocks are inside the same server clause and listening on 80.
Thanks.

A: The issue is the trailing / on your proxy_pass directives.  That tells proxy_pass to replace the part of the url that matched the location (/dev) with the provided path (/).  It doesn't make a difference in your location / because it's replacing / with /.  If you just replace your current line with
proxy_pass http://10.10.0.59;

Then it will not process the url before passing it to the backend.

A: Update: My answer is wrong. But, I'm leaving it here so that whoever sees this wouldn't make my mistake!
location / block should probably be the last block of any server. In your configuration, it comes first. That's probably the reason for the issue you described. So, please try the following...

server {
        server_name localhost 127.0.0.1;
        server_name_in_redirect off;

        location /dev {
                proxy_pass http://10.10.0.59/;
                    .........
        }

        location / {
                proxy_pass http://10.10.0.56/;
                     ........


text:
Q: How to avoid "RuntimeWarning: invalid value encountered in true_divide dx = np.abs(FY)/np.sqrt(FX**2+FY**2)" I_pad=np.pad(img0,1,'edge') #array padding

FY=np.gradient(I_pad,axis=0)
FX=np.gradient(I_pad,axis=1)

dx = np.abs(FY)/np.sqrt(FX**2+FY**2)
dy = np.abs(FX)/np.sqrt(FX**2+FY**2)

I am trying to avoid the RuntimeWarning: invalid value encountered in true_divide in NumPy.
and unable to find a solution


text:
Q: curl not downloading all pdf files PHP im trying to download multiple pdfs with php. i get an array of urls and each url redirects to a website that contains a pdf file if something is wrong with that url it just redirects to a html page, so i've been googling and found this to download all pdfs to the server:
public function download ($data, $simultaneous = 1, $save_to)
    {
        $loops = array_chunk($data, $simultaneous, true);

        foreach ($loops as $key => $value)
        {
            foreach ($value as $urlkey => $urlvalue)
            {
                $ch[$urlkey] = curl_init($urlvalue["url"]);
                curl_setopt($ch[$urlkey], CURLOPT_RETURNTRANSFER, true);
                curl_setopt($ch[$urlkey], CURLOPT_FOLLOWLOCATION, 1);
                curl_setopt($ch[$urlkey], CURLOPT_SSL_VERIFYHOST, false);
            }

            $mh = curl_multi_init();

            foreach ($value as $urlkey => $urlvalue)
            {
                curl_multi_add_handle($mh, $ch[$urlkey]);
            }

            $running = null;
            do {
                curl_multi_exec($mh, $running);
            } while ($running);

            foreach ($value as $urlkey => $urlvalue)
            {
                $response = curl_multi_getcontent($ch[$urlkey]);
                file_put_contents($save_to.$urlvalue["saveas"], $response);
                curl_multi_remove_handle($mh,$ch[$urlkey]);
                curl_close($ch[$urlkey]);
            }

        }
    }

for some reason this downloads only some of the files

anyone has any idea why this is not working?
any help would be appreciated


text:
Q: Use PooledRedisClientManager() to connect to remote Redis Instance on Ubuntu virtual box I want some suggestions on using PooledRedisClientManager() to connect to remote Redis Instance on Ubuntu virtual box.
I tried
PooledRedisClientManager pCm = new PooledRedisClientManager(new[] {"xxx.xxx.x.x:6379"});
but getting exception "could not connect to redis Instance at xxx.xxx.x.x:6379"

A: Connection Exception:
First ensure that your Redis server is configured to run on a network reachable IP. Ensure you have changed redis.conf bind line from:

bind 127.0.0.1

to

bind 192.168.0.1

Where 192.168.0.1 is the hostname/IP of your Redis server.
Or you will only be able to access the Redis server locally. You should avoid using 0.0.0.0 in place of your local IP, to prevent Redis binding to any public interfaces, thus exposing it to the Internet. (Unless protected by your firewall)
If you have the Redis client installed on your application server, you can check that the Redis server is accessible by running this command from the terminal:
redis-cli -h 192.168.0.1 ping

This answer here steps through the process of diagnosing the connection issues.
If you are still getting exceptions while connecting ensure that your firewall on your application machine allows the outgoing connection to be established, and on your Redis service your firewall allows incoming connections on that port from your application server. Ubuntu uses IPTables for firewalling.

Using ServiceStack.Redis without the ServiceStack Platform:
You shouldn't have any issues using it the way you are doing it already, other than configuration problems of your actual Redis Server.
// Where 192.168.0.1 is the hostname/IP of your Redis server
var pcm = new PooledRedisClientManager(new[] {"192.168.0.1:6379"});
var client = pcm.GetCacheClient();

Using ServiceStack.Redis with the ServiceStack platform:
Configure the PooledRedisClientManager to be injected:
Assuming you are using ServiceStack's standard approach of dependancy injection, you will want to wire up your App Configuration to inject the client manager into your Service base class. This makes Redis available to each request. So in your AppHost Configuration:
// Where 192.168.0.1 is the hostname/IP of your Redis server
container.Register<IRedisClientsManager>(c => new PooledRedisClientManager("192.168.0.1:6379"));
// Register Redis cache client to be injected as ICacheClient, using pooled manager, registered above
container.Register<ICacheClient>(c => c.Resolve<IRedisClientsManager>().GetCacheClient());

Using Redis:
Once you have injected the pool, the standard ICacheClient and IRedisClient will be automatically wired up when you call base.Cache or base.Redis, respectively, within your Service. So there is no further configuration required to use Redis.


text:
Q: configure sidebar to be able to scroll horizontally visual studio code How can I make sidebar scrollable horizontally? Otherwise long file names can't be seen if I don't increase the sidebar width manually every time I need. Check the screenshot below:

A: v1.22 released in April, 2018 has just added the ability to add horizontal scrolling to various tree elements, like the explorer pane.  Horizontal scrolling support.

// Controls whether trees support horizontal scrolling in the
workbench.

  "workbench.tree.horizontalScrolling": true, (deprecated, don't use)

False is the default so you will need to change the setting.  A restart is required.

UPDATE: vscode v1.32 just changed the setting to:
"workbench.list.horizontalScrolling": true,

Workbench > List: Horizontal Scrolling in the settings UI.


text:
Q: How to profile R6 class functions? R6 class functions are anonymous so profiling information is lost. For example:
library(R6)
library(proftools)

Test <- R6Class("Test",
  public = list(
    fn = function() pause(0.3)
  )
)
obj <- Test$new()

#
# Profile
Rprof(line.profiling=TRUE)
replicate(10, obj$fn())
Rprof(NULL)
png('profile-self.png')
plotProfileCallGraph(readProfileData(), score='self')
dev.off()

gives the following profile information:

How can I profile these functions effectively?

A: If you're using a recent version of R-devel (since this commit), it will output obj$fn instead of <Anonymous> in the profiling data. This should be in the next release of R (3.3.0?).


text:
Q: Errors when numerically solving differential equations for global vortex profiles I am currently to numerically solve the following differential equation for the profile of global vortices with a simple complex scalar field:
y''[x] + y'[x]/x  - y[x]/x^2 + (1 - y[x]^2) y[x] == 0,
y[0] == 0, y[Infinity] == 1.

This is my following code in Mathematica to try and obtain the solution.
inf = 100;
eqn = y''[x] + y'[x]/x  - y[x]/x^2 + (1 - y[x]^2) y[x] == 0;
NDSolve[{eqn, y[0] == 0, y[inf] == 1}, y, {x, 0, 10}]

Unfortunately, Mathematica's NDSolve function gives the following errors due to infinities being obtained:
Power::infy: Infinite expression 1/0.^2 encountered.

Infinity::indet: Indeterminate expression 0. ComplexInfinity encountered.

Power::infy: Infinite expression 1/0. encountered.

Infinity::indet: Indeterminate expression 0. ComplexInfinity encountered.

Power::infy: Infinite expression 1/0.^2 encountered.

General::stop: Further output of Power::infy will be suppressed during this calculation.

Infinity::indet: Indeterminate expression 0. ComplexInfinity encountered.

General::stop: Further output of Infinity::indet will be suppressed during this calculation.

NDSolve::ndnum: Encountered non-numerical value for a derivative at x == 0.`.

I have tried to specify the method of NDSolve to the "Shooting" method but this yields similar problems.  I know this form of differential equation can be solved numerically to give profiles such as the ones given in the figure below.

In this plot y[x] is simply labelled f and x is equivalent to r, k is the co-efficient of the third term, -y[x]/x^2, which I have taken to be equal to 1 for convenience.  The singularity at x = 0 can be avoided by an appropriate solution y[x].
I am therefore wondering how Mathematica can be used to obtain similar results.  Any help on this matter would be greatly appreciated.

A: A step backward i.e. make use of finite difference method (FDM) seems not to be a bad idea in this case. I'll use pdetoae for the generation of difference equation:
Clear@k;
inf = 100;
eqn = y''[x] + y'[x]/x - k^2 y[x]/x^2 + (1 - y[x]^2) y[x] == 0;
bc = {y[0] == 0, y[inf] == 1};

points = 100;
domain = {0, inf};
grid = Array[# &, points, domain];
difforder = 4;
(* Definition of pdetoae isn't included in this post,
   please find it in the link above. *)
ptoafunc = pdetoae[y[x], grid, difforder];

ae = ptoafunc[x^2 # & /@ eqn // Simplify][[2 ;; -2]];

sollst = Table[
  ListInterpolation[
   With[{initial = 1}, FindRoot[{ae, bc}, {y@#, initial} & /@ grid]][[All, -1]],
   grid], {k, 10}]

(* Alternatively: *)
(*
lSSolve[obj_List, constr___, x_, opt : OptionsPattern[FindMinimum]] :=
 FindMinimum[{1/2 obj^2 // Total, constr}, x, opt]
lSSolve[obj_, rest__] := lSSolve[{obj}, rest]

fullae = ptoafunc[x^2 # & /@ eqn // Simplify];
sollst = Table[
  ListInterpolation[
   With[{initial = 1},
     lSSolve[Subtract @@@ Flatten@{fullae, bc}, {y@#, initial} & /@ grid]][[2, All, -1]],
    grid], {k, 10}]
 *)
Plot[sollst[x] // Through // Evaluate, {x, 0, 50}, PlotRange -> All,
 PlotStyle -> Table[Blend[{Blue, Magenta}, x], {x, 0, 1, 1/9}], GridLines -> Automatic,
 AxesLabel -> {r, f}]


text:
Q: XPath expression to get a string after a  tag I'm trying to get the content in article/div/p but only the date after the
 tag. How is that done?

Man rescued after falling into Crater Lake

        Man rescued after falling 800 feet into Crater Lake in Oregon

by Joe Sutton

            June 11, 2019

$expression = "article/div/p";

A: This XPath,
//br/following-sibling::text()

will select all following sibling text nodes after br.


text:
Q: Trying to get div text to be at the same spot in javascript First message on this site.
Anyway, my problem is this:

                le texte 1

                le texte 2

                le texte 3

                le texte 4

                le texte 5


text:
Q: How to remove LiveCD after installing OS on VirtualBox? After going through the process of installation of a Unix OS (in this case Mageia) on VirtualBox 4.08, the next step is to remove the LiveCD.
Since the LiveCD is virtual, how should one proceed to remove it? Deleting the ISO does not seem like a clean way to do this.
Should the setting be changed in the storage section?

A: On the screenshot you provided, with the Live CD selected, click the little CD icons on the right. That should provide you with a dropdown box from which you can select Remove Disc from Virtual Drive


text:
Q: How does sklean LinearSVC classify the test cases which are on the boundary? I just did an experiment. I provided only two training cases [0, 1] and [1, 0]. They belong to two different categories. The test cases is [0, 0], which is on the decision boundary. The classifier assigns it to class 0. Is it because class 0 is the first class? Does it really make sense?
>>> X=numpy.array([[0,1],[1,0]])
>>> y=numpy.array([0,1])
>>> clf.fit_transform(X,y)
array([[0, 1],
       [1, 0]])

>>> clf.predict(numpy.array([[0,0]]))
array([0])
>>> clf.decision_function(numpy.array([[0,0]]))
array([ 0.])
>>> clf.coef_
array([[ 0.66666667, -0.66666667]])
>>> clf.predict(numpy.array([[0,1]]))
array([0])
>>> clf.decision_function(numpy.array([[0,1]]))
array([-0.66666667])
>>> clf.intercept_
array([ 0.])
>>> clf.intercept_ > 0
array([False], dtype=bool)

A: Personally, I would take your experiment as the answer to the question.
Points sitting on the decision boundary are ambiguous. What should the behavior be? Should it predict one of the two classes? Error out? Predict NaN?
By your experiment, scikit-learn predicts 0. I would take that to mean that in the general case, it chooses the first (in lexicographical order) for the boundary cases.
If the boundary case matters for your application, you will have to write special code that checks the decision function for exact 0, and does something different. Like this:
scores = clf.decision_function( X )
predictions = scores > 0
preidctions[ scores==0 ] = np.nan


text:
Q: Creating sparse matrix from a data frame in R Given a dataframe that has multiple objects mapped to the same person:
mike toy
mike golf
mike swim
mike call
tom eat
tom sleep
nate eat

how can i generate a matrix that has the counts of each of the elements and NA in the rest?:
     toy    golf   swim  call  eat  sleep
mike 1      1        1     1    NA     NA
tom  NA     NA       NA    NA   1      1
nate NA     NA       NA    NA   1      NA

A: > df
    V1    V2
1 mike   toy
2 mike  golf
3 mike  swim
4 mike  call
5  tom   eat
6  tom sleep
7 nate   eat
> table(df)
      V2
V1     call eat golf sleep swim toy
  mike    1   0    1     0    1   1
  nate    0   1    0     0    0   0
  tom     0   1    0     1    0   0


text:
Q: How to find MS SQL Port without admin access? Im setting up a Ubuntu server in my office which is going to be used for automatic reporting. Ive set it up with the LAMP stack. Ubuntu 16.04 server edition.
Im getting an error when Im trying to connect to one of my companies MsSQL servers through PHP on my new server:

Failed to get DB handle: SQLSTATE[HY000] Unable to connect: Adaptive Server is unavailable or does not exist (severity 9)

Ive set up my connection with the default port for MsSQL which is 1433. However its not working.
I have READ rights to this SQL Database.
Are there any ways to find out what PORT the SQL server is listening on? Without contacting the IT Dept. (they are on vacation)?

A: nmap is a great port scanner.
sudo at-get install nmap

nmap -p- 192.168.1.1

If your target is not 192.168.1.1 you should change the IP.
Read this.

A: Looks like it is because of misconfiguration of SQL Server. Following steps are required to gain remote access to SQL Server:

*

*Enable TCP/IP access for SQL Server: Start -> All programs -> Microsoft SQL Server YourVersion -> Configuration Tools -> SQL Server YourVersion Configuration Manager -> SQL Native Client Configuration -> TCP/IP -> right click -> enable.

*Add Inbound rule for Windows Firewall allowing access for 1433 port from required network (or hosts).

*Enable authentication for both SQL Server and Windows modes. In SSMS, right click on connected instance -> Security -> Server authentication -> SQL Server and Windows authentication.

*Make sure your login (Security -> Logins -> YourLogin) have all required rights.

With all this information, you have to contact your SQL Server DBA and ask him to check out configuration.


text:
Q: Apache home server connects to domain inside network and not out Hello i have an old windows xp pc im trying to turn into a server for hobbyist purposes. I downloaded and installed the apache xampp 1.8 distribution. Once installed and tested that the localhost worked, I connected my domain to my servers ip. So my problem is when i tried to connect to my site on my pc on the same network, they all were able to load the domain/site inside the network successfully but when i have a pc thats outside the network try it fails. Any ideas?. thanks.

A: You have used a private IP instead of public IP so it does not get resolved to your server. You have to use a public IP (if you have a static IP from your provider you have to setup port forwarding on your router.) If you get the IP from DHCPD server you will need to use dynamic DNS and port forwarding.
More info on private networks: http://en.wikipedia.org/wiki/Private_network


text:
Q: Recursive Query to calculate Folder Size I have the following scenario which I am trying to execute in my SQL Server:
     Root Folder (dataID - 001)
                 Folder A (dataid-123)
                       child folder 1
                             doc1 (size-6 mbs)
                             doc2  (size- 10 mbs)
                       child folder 2
                             doc3  (size - 1 mbs)
                             doc4  (size- 50 mbs)
                 Folder B (dataId- 456)
                       child folder 1
                             doc1 (size-4 mbs)
                             doc2  (size- 8 mbs)
                       child folder 2
                             doc3  (size - 8 mbs)
                             doc4  (size- 3 mbs)
                       child folder 3
                             doc5  (size - 3 mbs)
                             doc6  (size- 7 mbs)
                                   SubChild folder 1 for child folder 3
                                             doc 7 (size - 9 mbs)
                                                   SubSubChild Folder1 for SubChild folder1
                                                         doc 8 (size 5 mbs)

The output format that I am trying to get is below :
              Name       Count of Docs   Total Folder Size:
              FolderA        4               67Mbs
              FolderB        8               47Mbs

The query that I have formed allows me to only get the size and count of all the docs if i give the Root Folder ID:
              WITH n(DataID, Name,ParentID,SubType,versionnum) AS

             (SELECT DataID, Name ,ParentID,SubType,versionnum
              FROM DTreeCore
              WHERE DataID = 001
              UNION ALL
              SELECT nplus1.DataID, nplus1.Name ,nplus1.ParentID,nplus1.SubType,nplus1.versionnum
              FROM DTreeCore as nplus1, n
              WHERE n.DataID = nplus1.ParentID)

              SELECT COUNT(d3.docid) AS "Number of Docs",SUM(d3.datasize) /(1024 *1024) "Megabytes"
              FROM
              n,dversdata d3
              WHERE
              n.dataid = d3.docid AND
               n.versionnum = d3.version

Please advise on how can I achieve the required output. Thanks !


text:
Q: Why not use "casualties" in "Small shops have been a casualty of the recession."? From the Oxford Advanced Learner's Dictionary:

Small shops have been a casualty of the recession.

"Shops" is plural here while "casualty" is singular. Any reason for that?
Can I have the sentence stick to one form?

Small shop has been a casualty of the recession.
Small shops have been casualties of the recession.

Thanks in advance.

A: The first sentence is grammatically correct, as small shops is talking about the singular collection of small shops, not any small shop in particular.
In other words, Small shops is one noun referencing one collection, so it is singular.
As Andrew pointed out, there is an important distinction between the two sentences that I forget to address. When someone says Small shops have been casualties of the recession, you are saying that many individual shops have caused separate casualties rather than small shops as a whole. Both are valid, but the Small shops have been a casualty of the recession makes more sense

A: The reason for the use of the singular casualty is to imply that small shops (collectively) are one casualty among many other groups of entities.  Another example:

Private equity funds are a significant factor in the rapid increase in housing prices, in certain markets.

It may be grammatical to say "the funds are significant factors", but this changes the meaning to suggest that the funds each have a separate effect, rather than that, together, they have a collective effect among other (unmentioned) groups that also have an effect  (e.g. foreign investors, families with rising incomes, etc.)
Of course if we were talking about one specific fund, then we would use the singular:

The Donald Trump 'Best Fund in the World' Fund is a significant factor in ...

A: When you refer to a group of things and the nature of the group is more important than the identity of the individual members, you will likely use a collective noun.
Some collective nouns are distinct from their individual forms, e.g., "The herd fled when a lioness approached." Herd is the collective noun, and the individual members might be gazelles or antelopes.
Other nouns, such as "shops" do not have different words for plural vs collective usage. In this case, the collective usage is determined by the grammar of the sentence.
The use of "small shops" as a collective noun indicates (1) that all small shops were hurt by the recession in some manner, and (2) that being a member of the "small shops" class is sufficient to receive that harm.


text:
Q: Tensor product of linear codes and generators Suppose I have a $[n_1,k_1,d_1]$-linear code $C_1$ and a $[n_2,k_2,d_2]$-linear code $C_2$. I want to show that $C_1 \otimes C_2$ is a $[n_1 n_2, k_1 k_2, d_1 d_2]$-linear code. Suppose they have generator matrices $G_1$ and $G_2$. Is it true that $G_1\otimes G_2$ (as vector space elements) generates $C_1 \otimes C_2$? If not, how do I show this?

A: Yes, the direct product code is denoted in this way and has this generator matrix (see MacWilliams, Sloane p.569). Some authors define $C_1 \otimes C_2$ to be the code with parity check matrix $H_1 \otimes H_2$. To see that the generator matrix definition is equivalent,
$$(G_1 \otimes G_2)(H_1 \otimes H_2)^T = (G_1 \otimes G_2)(H_1^T \otimes H_2^T) = G_1 H_1^T \otimes G_2 H_2^T = 0 \otimes 0 = 0.$$
Likewise, $(H_1 \otimes H_2)(G_1 \otimes G_2)^T = 0$.


text:
Q: I want to merge contents of columns based on same student_id I have a table in SQL Server 2008 like this:
st_id   st_rollno  st_name  subject  Theory      Total   Lab      Total
--------------------------------------------------------------------------------
086001  IT001      PRANAV   mat        21           22       11       14
086002  IT002      DEEP     mat        21           22       11       14
086001  IT001      PRANAV   sci        20           24       09       12
086002  IT002      DEEP     sci        21           24       08       12

I want my output as below, using SQL Server 2008 features, if any 1 could help me..?
st_id   st_rollno   st_name   subject   Theory   Total            Lab      Total
---------------------------------------------------------------------------------------
086001  IT001      PRANAV   mat,sci 21,20       22,24          11,09       14,12
086002  IT002       DEEP    mat,sci 21,21       22 ,24         11,08       14,12

A: SQL Fiddle
MS SQL Server 2008 Schema Setup:
create table YourTable
(
  st_id varchar(6),
  st_rollno varchar(5),
  st_name varchar(6),
  subject varchar(3),
  Theory int,
  Total1 int,
  Lab int,
  Total2 int
)

insert into YourTable values
('086001',  'IT001',      'PRANAV',   'mat',        21,           22,       11,       14),
('086002',  'IT002',      'DEEP  ',   'mat',        21,           22,       11,       14),
('086001',  'IT001',      'PRANAV',   'sci',        20,           24,       09,       12),
('086002',  'IT002',      'DEEP  ',   'sci',        21,           24,       08,       12)

Query 1:
select T1.st_id,
       T1.st_rollno,
       T1.st_name,
       stuff(T3.X.query('subject').value('.', 'varchar(max)'), 1, 1, '') as subject,
       stuff(T3.X.query('Theory').value('.', 'varchar(max)'), 1, 1, '') as theory,
       stuff(T3.X.query('Total1').value('.', 'varchar(max)'), 1, 1, '') as Total1,
       stuff(T3.X.query('Lab').value('.', 'varchar(max)'), 1, 1, '') as Lab,
       stuff(T3.X.query('Total2').value('.', 'varchar(max)'), 1, 1, '') as Total2
from (
     select st_id, st_rollno, st_name
     from YourTable
     group by st_id, st_rollno, st_name
     ) as T1
cross apply
     (
     select  ','+T2.subject                     as subject,
             ','+cast(T2.Theory as varchar(10)) as Theory,
             ','+cast(T2.Total1 as varchar(10)) as Total1,
             ','+cast(T2.Lab    as varchar(10)) as Lab,
             ','+cast(T2.Total2 as varchar(10)) as Total2
     from YourTable as T2
     where T1.st_id = T2.st_id and
           T1.st_name = T2.st_name and
           T1.st_rollno = T2.st_rollno
     for xml path(''), type
     ) as T3(X)

Results:
|  ST_ID | ST_ROLLNO | ST_NAME | SUBJECT | THEORY | TOTAL1 |  LAB | TOTAL2 |
----------------------------------------------------------------------------
| 086001 |     IT001 |  PRANAV | mat,sci |  21,20 |  22,24 | 11,9 |  14,12 |
| 086002 |     IT002 |  DEEP   | mat,sci |  21,21 |  22,24 | 11,8 |  14,12 |

A: Adapted from here: SQL Server Concatenate GROUP BY you are looking for something like this:
SELECT
 st_id, st_rollno, st_name,
 STUFF
 (
    (
        SELECT
            ',' +subject
        FROM
            yourtable
        WHERE
            yourtable.st_id=st_id
        FOR XML PATH('')
    )
,1,1,'') AS subject,

...

FROM yourtable

The core concepts to understand here are stuff and for xml I don't have the syntax quite right, but this should get you on the right path if no one else posts. I will update this when I get near SSMS and can test. Definitely this is doable. I find it easier in MySQL with Group_Concat.


text:
Q: ORC hive table which is already performed the ACID transactions(DELETE/UPDATE) is not able to read from Presto? I am having problems trying to read from Pesto:
presto> select * from DEFAULT.MYDIM;
Error: Query 20190722_165050_00066_7g652 failed: Hive table 'default.mydim' is corrupt. Found sub-directory in bucket directory for partition: <UNPARTITIONED>

presto> SELECT * FROM DEFAULT.hello_acid;
Query 20190722_171313_00080_7g652, FAILED, 11 nodes
Splits: 16 total, 0 done (0.00%)
0:01 [0 rows, 0B] [0 rows/s, 0B/s]

Query 20190722_171313_00080_7g652 failed: Hive table 'default.hello_acid' is corrupt. Found sub-directory in bucket directory for partition: load_date=2016-03-02

How could I solve this?

A: Presto currently does not support ACID/Transactional tables, unless they're fully VACUUM-ed. You can track this feature request at https://github.com/prestosql/presto/issues/576
Currently you can read such tables using Starburst Presto 323e.