text:
Q: How to pass variable to another function in the sam controller code igniter I need to filter my datatable using nodoc which is the value of input in page before, it has read in my v_filterdoc function but can't be read in my datatable function and it becomes null when I use input->post so I need to pass the value to my datatable before the value is null
This is my v_filterdoc functionµ

And this is my Datatable function

A: you have many ways of passing value from one function in the same controller to another function.

*

*the ability of any function like this code. $this->function_name($variable);

*you can use session in the first function you must set the session of $variable and use it in another function also its available in all function.


text:
Q: Does this specific proof of Hindman's theorem actually require full choice? I'm interested in knowing whether the idempotent ultrafilter proof of Hindman's theorem actually requires the full axiom of choice.
At first I wondered if the theorem itself at all required any choice, but even Neil Hindman himself said that the elementary proof he came up with was hard to read, so I didn't want to get into that, but as it turns out this answer (Examples of theorems that haven't been proven without AC in practice but can be proven without it in principle) already answers this : Hindman's theorem can be proved in second order arithmetic so doesn't require any use of AC.
But if we focus on the easier proof with an idempotent ultrafilter $\mathcal{U}$ on $\mathbb{N}$, then we can try to locate where AC is used. If I'm not mistaken it's used only to show : $\gamma\mathbb{N}$ is a nonempty compact topological space ($\gamma X $ denotes the set of nonprincipal ultrafilters ); any semitopological compact semigroup has an idempotent.
The first statement, although it requires some amount of choice, doesn't require full AC, it only requires the ultrafilter lemma, or equivalently, the BPI, which is known to be strictly weaker than AC (although unprovable in ZF, if the latter is consistent - note that here Tychonov doesn't require AC, since $2$ is Hausdorff)
So essentially my question boils down to : is there a "choice principle"  X (BPI, ACD, countable choice,...; formally one could say "a statement that is provable in ZFC) such that BPI+X is strictly weaker than AC, and ZF+ BPI+X proves that any semitopological compact semigroup has an idempotent ?
Another way to put it : does BPI + "any semitopological compact semigroup has an idempotent" imply AC ?

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to change the layout of the grading table in the exam document class I'm using LuaLaTeX with the exam document class and I would like (if it's possible) to change the default layout of the grading table to be more like the tables from the booktabs package. How can I do that? I read the manual and even if the table command has many options I didn't find a way to do that. I also read a similar question about the exsheet package but the answer provided doesn't compile.
Here is a minimal working example with the tables I'd like to change at the end of it.
% !Mode:: "TeX:UTF-8"
\documentclass[a4paper,addpoints,11pt]{exam}

\usepackage{fontspec}
\usepackage{polyglossia}

\begin{document}

\begin{questions}
\question[10]
Example question
\question[20]
Example question
\question[30]
Example question
\question[40]
Example question
\question[50]
Example question
\end{questions}

\begin{center}
\pointtable[v][questions]
\end{center}

\begin{center}
\pointtable[h][questions]
\end{center}

\end{document}

And here is the result

A: The building of the tables is a little bit tricky in class exams.  În my eyes the horizontal table is much more better.
With the following MWE both table are changed. The needed changes you find in the part of the preamble, enclosed with \makeatletter and \makeatother.
% !Mode:: "TeX:UTF-8"
\documentclass[a4paper,addpoints,11pt]{exam}

%\usepackage{fontspec}      % No LuaLaTeX !!!!
%\usepackage{polyglossia}   % No LuaLaTeX !!!!
\usepackage{booktabs}

% Change table layout
\makeatletter            % @ a normal letter

%first table:
\def\@vpttblquestions{%
  % Vertical non-bonus point table, indexed by questions:
  \set@hlfcntr{tbl@points}{0}%
  \begin{tabular}{cc}
%   \hline  % topline
    {\@vqword}& {\@vpword}\\
    \midrule
    \setcounter{question}{\tbl@firstq}%
    \addtocounter{question}{-1}\do@vptloop
    {\@vtword}& \prt@tablepoints\\
%    \hline  % endrule
  \end{tabular}%
}% @vpttblquestions
\def\do@vptloop{%
  % \do@vptloop is used by \@vpttblquestions
  \addtocounter{question}{1}%
  \ref{question@\arabic{question}} &
        \pointsofquestion{\arabic{question}}\\
%  \hline
  \@ifundefined{pointsofq@\romannumeral \c@question}%
    {}%
    {\addto@hlfcntr{tbl@points}
       {\csname pointsofq@\romannumeral \c@question\endcsname}}%
  \ifnum \value{question} < \tbl@lastq\relax
    \let\next@vptloop=\do@vptloop
  \else
    \let\next@vptloop=\relax
  \fi
  \next@vptloop
}% do@vptloop

% second table
\def\@htblquestions{%
  % We get here from \@tblquestions.
  % The table is horizontal and indexed by question numbers.
  % The question range has already been determined.
  % Set num@cols equal to the number of questions on the table, and
  % do either bonus, combined, or non-bonus table, in each case
  % putting in a line for scores only if it's a gradetable:
  \@ifundefined{exam@numquestions}%
  {}%
  {%
    \setcounter{num@cols}{\tbl@lastq}%
    \addtocounter{num@cols}{-\tbl@firstq}%
    \addtocounter{num@cols}{1}%
  }%
  % Do either bonus, combined, or non-bonus table.  In each case, put
  % in a line for scores if it's a gradetable:
  \begingroup
    % Save the current value of question in @iterator, so that
    % we can restore it after doing the table:
    \setcounter{@iterator}{\value{question}}%
    \renewcommand\arraystretch{\@gtblstretch}%
    \if@bonus
      % It's a horizontal bonus table, by questions:
      \begin{tabular}{l*{\thenum@cols}{c}c}
%        \hline
        {\@bhqword}& \setcounter{question}{\tbl@firstq}%
        \addtocounter{question}{-1}\do@qnumloop
        {\@bhtword}\\
%        \hline
        \set@hlfcntr{tbl@bonuspoints}{0}%
        {\@bhpword}& \setcounter{question}{\tbl@firstq}%
        \addtocounter{question}{-1}\do@bptloop
        \prt@tablebonuspoints\\
%        \hline
        % If it's a grade table, add in the score line:
        \if@scores
          {\@bhsword}& \setcounter{question}{\tbl@firstq}%
          \addtocounter{question}{-1}\do@sloop
          \\
%          \hline
        \fi
      \end{tabular}%
    \else
      \if@combined
        % It's a horizontal combined table, by questions:
        \begin{tabular}{l*{\thenum@cols}{c}c}
%          \hline
          {\@chqword}& \setcounter{question}{\tbl@firstq}%
          \addtocounter{question}{-1}\do@qnumloop
          {\@chtword}\\
%          \hline
          \set@hlfcntr{tbl@points}{0}%
          {\@chpword}& \setcounter{question}{\tbl@firstq}%
          \addtocounter{question}{-1}\do@ptloop
          \prt@tablepoints\\
%          \hline
          \set@hlfcntr{tbl@bonuspoints}{0}%
          {\@chbpword}& \setcounter{question}{\tbl@firstq}%
          \addtocounter{question}{-1}\do@bptloop
          \prt@tablebonuspoints\\
%          \hline
          % If it's a grade table, add in the score line:
          \if@scores
            {\@chsword}& \setcounter{question}{\tbl@firstq}%
            \addtocounter{question}{-1}\do@sloop
            \\
%            \hline
          \fi
        \end{tabular}%
      \else
        % Horizontal non-bonus table, indexed by question number:
        \set@hlfcntr{tbl@points}{0}%
        \begin{tabular}{l*{\thenum@cols}{c}c}
%          \hline
          {\@hqword}& \setcounter{question}{\tbl@firstq}%
          \addtocounter{question}{-1}\do@qnumloop
          {\@htword}\\
          \midrule
          {\@hpword}& \setcounter{question}{\tbl@firstq}%
          \addtocounter{question}{-1}\do@ptloop
          \prt@tablepoints\\
%          \hline
          % If it's a grade table, add in the score line:
          \if@scores
            {\@hsword}& \setcounter{question}{\tbl@firstq}%
            \addtocounter{question}{-1}\do@sloop
            \\
%            \hline
          \fi
        \end{tabular}%
      \fi
    \fi
    % Restore the saved value of question:
    \setcounter{question}{\value{@iterator}}%
  \endgroup
}% @htblquestions

\makeatother

\begin{document}

\begin{questions}
\question[10]
Example question
\question[20]
Example question
\question[30]
Example question
\question[40]
Example question
\question[50]
Example question
\end{questions}

\begin{center}
\pointtable[v][questions]
\end{center}

\begin{center}
\pointtable[h][questions]
\end{center}

\end{document}

With the result:

It would be better if the author of the class would integrate two different layouts for the tables in his class.


text:
Q: Vector Nature Of Angular Velocity I am currently reading about angular position, angular velocity, and angular acceleration. I came across this paragraph that was particularly confusing, and was wondering if someone could perhaps help me.
Here is the paragraph:
"If a particle rotates in the $xy$ plane, the direction of $\vec{\omega}$ for the particle is out of the plane of the diagram when the rotation is counterclockwise and into the plane of the diagram when the rotation is clock-wise. To illustrate this convention, it is convenient to use the right-hand rule demonstrated in Figure 10.3. When the four fingers of the right hand are wrapped in the direction of rotation, the extended right thumb points in the direction of $\vec{\omega}$The direction of $\vec{\alpha}$ follows from its definition $\vec{\alpha}=d\vec{\omega}/dt$. It is in the same direction as $\vec{\omega}$ if the angular speed is increasing in time, and it is antiparallel to $\vec{\omega}$ if the angular speed is decreasing in time."
The above text in bold is what I am having most difficulty with. What do they mean? Also, how do I color words?

A: Say you're looking at the piece of paper on your desk; that is the $xy$ plane.  You place a dot in the center of the paper; that's your origin.
Your angular momentum is $\vec{L}=\vec{r}{\times}m\vec{v}$.  For this example, $\vec{\omega}$  points in the same direction as your angular momentum, because $\vec{L}=mr^2\vec{\omega}$.
The way I remember the directions for the right-hand rule are as follows:

*

*Thumb points up (this is $\vec{L}$, the cross product)

*Index finger points forward (this is $\vec{r}$, the left vector being crossed)

*Middle finger points to the left (this is $\vec{v}$, the right vector being crossed)

Let's say the particle is on the paper, directly above the origin, and moving counterclockwise.  Then, $\vec{v}$ points to the left edge of the page.  The direction of $\vec{r}$ goes from the origin to the point, so it points to the top of the page.
My thumb points up, so this is the direction of $\vec{L}$, and hence the direction of $\vec{\omega}$.
Crane your hand around so that your middle finger points right and your index finger continues to point to the top of the page, and your thumb points down, which is the direction of $\vec{\omega}$ for clockwise motion.

A: The least ambiguous way to describe it would be using cartesian vector notation. so we have $\hat x$, $\hat y$ and $\hat z$. If the particle is moving in a circle from the $\hat x$ axis to the $\hat y$ axis, it's moving counter clockwise, like moving from 3 to 12 on an analog clock. We say it's angular velocity is in the $+ \hat z$ direction, or up out of the clock.
If it's moving from the $\hat x$ axis to the $-\hat y$ axis, it's moving clockwise, like moving form 3 to 6 on an analog clock. It's convention to say it's angular velocity is in the $- \hat z$ direction, or down into the clock. These relations fall out of the right hand rule and the cross-product in vector arithmetic, since angular velocity is $\hat r \times \hat V=\hat \omega$.


text:
Q: How to set JMSType as a subscriber in Java? Here's how I'm subscribing to a message queue over OpenWire protocol:
import java.io.FileWriter;
import java.io.PrintWriter;
import javax.jms.*;

//..........
subscriberPublishSubscribe = new Subscriber();
subscriberPublishSubscribe.create(URL, "login", "pass", TOPICNAME, SUBSCRIPTIONID);

//.......
Connection connection = factory.createConnection();
connection.setClientID(clientId);
session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
Topic topic = session.createTopic(topicName);
messageConsumer = session.createDurableSubscriber(topic, subId);
JMSMessageListener listener = new JMSMessageListener();
messageConsumer.setMessageListener(listener);
connection.start();

How can I filter messages using the class JMSType? Here's a code I'll probably need to use:
Message msg = session.createMessage();
msg.setJMSType("some_jms_type");

// What's next?

Once again, I'm a subscriber, not a producer, therefore I want to receive only messages with a certain JMSType.

A: It's slightly unclear from your problem statement but it sounds like you want to filter messages based on their set JMSType which is done using a JMS selector expression passed into the createConsumer method.
You create selector expression to filter what you want such as:
JMSType = 'car' AND color = 'blue' AND weight > 2500

But keep in mind that a message broker is not a database and treating it as such usually ends in tears.
A quick Google of 'JMS Message selectors' will give you a wealth of reading on the subject.


text:
Q: Can I set different font size for different language? Some times I need to insert Chinese characters in my LaTeX documents and sometimes English letters.
I'd like English letters show in 12pt while Chinese characters show smaller(like 10pt or 11pt).
For example, I type the following line in .tex file.
English中文

And I'd like to see 'English' in 12pt and '中文' in 11pt.
Is there an easy way to make it?
------ edited ------
An easy way means, I do not want something like:
English{\small中文}

It makes me type \small every time when I type Chinese.

A: I found an answer myself. But it may only work with Chinese, Japanese and Korean.
I use xeCJK for solving this problem.
\usepackage{xeCJK}
\setCJKmainfont[scale=0.9]{Source Han Sans CN}

The document (written in Chinese) I checked is mirror.hmc.edu/ctan/macros/xetex/latex/xecjk/xeCJK.pdf.
The font Source Han Sans CN is font I have on my Fedora Linux. You can use command fc-list in document pdf 3.2.1 for font selecting.
I am using xelatex for compiling thus xeCJK works well. If you use pdfletex for compiling, you may use:
\usepackage{CJKutf8}

And check its document.


text:
Q: JQuery Fancybox no longer working - Opens images on new screen, instead of same screen I am using 'Fancy box' - A piece of JQuery that lets you click images to see them full size without leaving the current screen.
It was working fine when I used it a week ago, but after lots of coding changes on various pages, I now see it's not working, and when clicking an image it just opens on a new screen.
Is there something very obvious that I'm doing wrong from what you see here?

<link rel="stylesheet" type="text/css" href="../assets/source/jquery.fancybox.css?v=2.1.5" media="screen" />

Link to show large image:

A: It looks like the fancy box was not configured properly.
Check the console for errors.
However looks like you are missing jQuery.js


text:
Q: Failed to resolve: androidx.lifecycle:lifecycle-extensions-ktx:2.0.0-alpha1 I am trying to understand ViewModel and LiveData concepts in android. I am making a practice project but when i added implementation 'androidx.lifecycle:lifecycle-extensions-ktx:2.0.0-alpha1' line in my app level gradle file it shows me

Failed to resolve:
  androidx.lifecycle:lifecycle-extensions-ktx:2.0.0-alpha1.

I have searched on google for solution and i found this answer, it works when i compile only viewmodel library but if i compile extensions library using same method as implementation group: 'androidx.lifecycle', name:'lifecycle-extensions-ktx', version: '2.0.0-alpha1', it shows the same error as above.
I have also tried to find it on Maven repositories site here but i didn't have any information for how to compile it.
UPDATE
App Level Build.gradle
apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "***************"
        minSdkVersion 19
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation group: 'androidx.lifecycle', name:'lifecycle-extensions-ktx', version: '2.0.0-alpha1'
    implementation group: 'androidx.lifecycle', name:'lifecycle-viewmodel-ktx', version: '2.0.0-alpha1'
}

A: Just dont use -ktx in lifecycle-extensions. There is no separate '-ktx' version of the dependency unlike in viewmodel

A: UPDATE
As per @Dr.jacky's comment and Android Developers Documentation,

The APIs in lifecycle-extensions have been deprecated. Instead, add dependencies for the specific Lifecycle artifacts you need.

More Info at https://developer.android.com/jetpack/androidx/releases/lifecycle

I have found the answer. As Thunder Knight said here it seems to be that the repository was emptied somehow. Hence, you can not download it from the repository.. I agree with this and so i was looking for answer on mvnrepository.com and i found it here. I have to add

implementation group: 'androidx.lifecycle', name: 'lifecycle-extensions', version: '2.0.0-alpha1'

line for adding lifecycle-extensions and also i was adding -ktx in name of library but it was the mistake. In documentation they have not commented to add -ktx in line of lifecycle-extensions.
Credits:- @Thunder Knight

A: The current version is 2.2.0
use -ktx for kotlin implementation
and kapt for annotationProcesssor
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
annotationProcessor 'androidx.lifecycle:lifecycle-compiler:2.2.0'

Check the developer site for more information
https://developer.android.com/topic/libraries/architecture/adding-components

A: Add these line
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.legacy:legacy-support-core-utils:1.0.0'

and comment these lines
// testImplementation 'junit:junit:4.13.2'
//androidTestImplementation 'androidx.test.ext:junit:1.1.2'
//androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

A: in my case i was trying to using room with LiveData. and all i did was remove the suspend key word from the query method.
Reference: post in forums.bignerdranch.com

A: Error:
Failed to resolve: androidx.lifecycle:lifecycle-extensions:2.3.1

Solution:

The APIs in lifecycle-extensions have been deprecated. Instead, add dependencies for the specific Lifecycle artifacts you need.

More details: developer.android.com


text:
Q: Detect if hovering over image in div with jQuery I have an example:

test

function handler(ev) {
    let target = $(ev.target);
    let elId = target.attr('id');
    if( target.is("div[id^='id_']") ) {
         let lastChar = elId.substr(elId.length - 1);
       alert('The mouse was over'+ lastChar );
    }
}
$("div[id^='id_']").mouseleave(handler);

It works in such a way that if I hovering on an element, then alert is displayed - the problem occurs if I have only a picture in this div - then it does not work. How to make it work even more if I only have a picture like this, e.g. I have:

A: Use $(ev.currentTarget) or $(this) to reference the element that matches the selector rather than any target that is a descendant

function handler(ev) {

    console.clear();
    let $div = $(ev.currentTarget);
    let elId = $div.attr('id');
    console.log('currentTarget id:', elId)

    $div= $(this);
    elId =$div.attr('id');
    console.log('this id:', elId)
}
$("div[id^='id_']").mouseleave(handler);
.class1{ margin : 1em; border: 1px solid green

test 1

test 2


text:
Q: AngularJS: Authentication Service supporting a promise? I have setup an authentication service which I inject into my Login controller I then call it to do a login... for example
$scope.login = function() {
    var loginResult = authentication.login($scope.model.user, $scope.model.pass);

I need to know weather the login was successful or not as I need to peform some logic depending on the result. I could return a bool from login on the authentication service but the problem is that inside my login it calls to a rest service which has a promise. like so
       return {
         authenticate: function (username, password) {

            var enc = base64.encode(username + ':' + password);

            AuthRestangular.setDefaultHeaders({'Authorization': 'Basic ' + enc });

            AuthRestangular.one('login').get().then(function (data) {
                isLoggedIn = true;
                return true;
            }, function () {
                return false;
            });

So it takes a few seconds for the Rest service to return and it returns a promise i.e. then ....  either true or false. So the service actually returns to the Login Controller before I have the promise.
So I am confused what i should do here, Can i have my service also return a promise?? otherewise the loginResult is always false as it doesn't return in time hence the default for my bool is false.
Any ideas
Thanks

A: You should not return true false from service instead you should return a promise from the service and use that promise inside controller
--service
return {
         authenticate: function (username, password) {

            var enc = base64.encode(username + ':' + password);

            AuthRestangular.setDefaultHeaders({'Authorization': 'Basic ' + enc });

           return  AuthRestangular.one('login').get();
            });

--controller

authentication.login($scope.model.user, $scope.model.pass).then(function(data){})


text:
Q: Add input search and do a ajax call, nothing displayed I started to develop with reactjs.
Actually, when page is display, data coming from an ajax call are show.
var WebSite = React.createClass({

  getInitialState: function() {
    return {display: true };
  },
  render: function() {

    if (this.state.display==false) return null;
    else return (

          {this.props.website.webSite}
          {this.props.website.date}
          {this.props.website.visits}

    );
  }
});

var WebSiteTable = React.createClass({

  render: function() {

    var rows = [];
    this.props.websites.forEach(function(website) {
      rows.push(
        <WebSite website={website} key={website.website} />);
    });

    return (

                  Website
                  Date
                  Visits

{rows}

    );
  }
});

var App = React.createClass({

  searchWebSiteFromDate: function() {

    var self = this;
    $.ajax({
        url: "http://localhost:8080/rest/report/statwebsiteg",
      }).then(function(data) {
        self.setState({ websites: data});
      });

  },

  getInitialState: function() {
    return { websites: [] };
  },

  componentDidMount: function() {
    this.searchWebSiteFromDate();
  },

  render() {
    return ( <WebSiteTable websites={this.state.websites} /> );
  }
});

ReactDOM.render(<App />, document.getElementById('root') );

That work fine, instead of display data directly when page is loading, i would like to display an input box. On the lost focus, i would like to do a similar search then the current one (adding input box) and displaying result.
I changed App with this code
var App = React.createClass({

    getInitialState: function () {
        return {websites: []};
    },

    onBlur: function () {
        var self = this;
        $.ajax({
            url: "http://localhost:8080/rest/report/statwebsiteg",
        }).then(function (data) {
            self.setState({websites: data});
        });
    },
    render: function () {

        return <input type="text" onBlur={ this.onBlur } placeholder="Enter your date here."/>;
    }

});

Query is done... but nothing is displayed.

A: Unless your example is incomplete, you won't see the data unless you actually render it.
render: function () {
    return (

            <input type="text" onBlur={ this.onBlur } placeholder="Enter your date here."/>
            <WebSiteTable websites={this.state.websites} />

    );
}


text:
Q: How To Make three picturebox that move Simultaneous? I have 3 pictureboxes (boardTop, boardCenter, boardBottom). When the up arrow or down arrow keys are pressed, I want these three pictureboxes to move together.
private void PingPong_KeyDown(object sender, KeyEventArgs e)
{
    if (e.KeyCode == Keys.Up)
    {
        boardUp.Location = new Point(boardUp.Location.X, boardUp.Location.Y - 1);
        boardLeft.Location = new Point(boardUp.Location.X, boardUp.Location.Y - 1);
        boardDown.Location = new Point(boardUp.Location.X, boardUp.Location.Y - 1);
        Kup = true;
    }
    else if (e.KeyCode == Keys.Down)
    {
        boardUp.Location = new Point(boardUp.Location.X, boardUp.Location.Y + 1);
        boardLeft.Location = new Point(boardUp.Location.X, boardUp.Location.Y + 1);
        boardDown.Location = new Point(boardUp.Location.X, boardUp.Location.Y + 1);
        Kdown = true;
    }
}


text:
Q: How to add background shadows for the Stacked bar in High Charts
Just like in the above image, I'm trying to add the background shadows on the bar chart. How can we implement this?
I need bar chart like this can any one help me here.

A: You can use plotBands:
yAxis: {
  plotBands: [{
    from: 0,
    to: 10,
    color: '#828282'
  }, {
    from: 10,
    to: 20,
    color: '#949494'
  }, ...]
}

Live demo: http://jsfiddle.net/BlackLabel/6m4e8x0y/4779/
API Refernece: https://api.highcharts.com/highcharts/yAxis.plotBands


text:
Q: PHP Message success function [HELP] anyone help me with my contact form? it will not work, it sends a message but no confirmation of message succes? everything works fine exceptg the Message succesfull send function :(
here are the codes hope someone can help me
Contact.php
<?php

@error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING);
@ini_set('display_errors', true);
@ini_set('html_errors', true);
@ini_set('error_reporting', E_ALL ^ E_NOTICE ^ E_WARNING);

ini_set("log_errors", 1);
ini_set("error_log", "php-error.log");
error_log( "Hello, errors!" );
if(isset($_POST['email'])) {

    // EDIT THE 2 LINES BELOW AS REQUIRED
    $email_to = "info@arjen079.com";
    $email_subject = "Contact Application Website!";
    $email_noreply = "noreply@arjen079.com";
    $name = $_POST['name']; // required
    $email = $_POST['email']; // required
    $subject = $_POST['subject']; // required
    $message = $_POST['message']; // required
    $email_message = "Form Details Below:\n\n";
    $email_messagesender = "Here is a copy of the form you filled in:\n\n";

    function clean_string($string) {

      $bad = array("content-type","bcc:","to:","cc:","href");
      return str_replace($bad,"",$string);

    }

    $email_message .= "First Name: ".clean_string($name)."\n";
    $email_message .= "Email: ".clean_string($email)."\n";
    $email_message .= "Subject: ".clean_string($subject)."\n";
    $email_message .= "Message: ".clean_string($message)."\n";

    $email_messagesender .= "First Name: ".clean_string($name)."\n";
    $email_messagesender .= "Email: ".clean_string($email)."\n";
    $email_messagesender .= "Subject: ".clean_string($subject)."\n";

    $email_messagesender .= "Message: ".clean_string($message)."\n";

    // create email headers

    $headers = 'From: '.$email."\r\n".

    'Reply-To: '.$email."\r\n" .

    'X-Mailer: PHP/' . phpversion();

    mail($email_to, $email_subject, $email_message, $headers);

    // send a copy to sender

    $headers = 'From: '.$email_noreply."\r\n".

    'Reply-To: '.$email_noreply."\r\n" .

    'X-Mailer: PHP/' . phpversion();

    mail($email, "Thanks For contacting!", "Thanks for contacting me, I will reply to you shortly. \n\n----------------\n\n" . $email_messagesender, $headers);
    echo 'Message Succesfully Sent!';

}
?>

Contact form:

                    <form action="http://www.arjen079.com/contact.php" method="post" class="contact-form"                                                   id="contact-form">

Contact

                            <input type="text" name="name" placeholder="Name" class="required">
                            <input type="email" name="email" placeholder="Email" class="required">
                            <input type="text" name="subject" placeholder="Subject" class="required">
                            <textarea name="message" placeholder="Message" class="required"></textarea>

                            <input type="submit" value="Submit" name="submit" class="float-right">

                    </form>

Thanks already! ;)

A: echo 'Message Succesfully Sent!';

The error is in this part.
$(\'response-message\') should be $(\'.response-message\').
Notice the . you're missing? You're trying to target the ELEMENT called response-message, not the div with the class of it.


text:
Q: UID/GID mapping for external storage across different POSIX systems I have access to multiple POSIX desktops where my personal user account has different UID/GID.  I use an ext4 formatted portable SSD, which is great for my work, except for the permissioning issues arising from having different UID/GID on the different desktops.  I understand the design trade-offs of UID/GID permissioning, and synchronizing UID/GID across those desktops is not an option.  Is there a better solution than starting my work session on each desktop with:
sudo chown -R `id -un`:`id -gn` /media/$USER/disk

that

*

*does not require root priviliege;

*does not unnecessarily write metadata (and wear the SSD);

*does not require the creation/management of additional groups or other UID/GID manipulations on any of the concerned desktops;

*does not require setting specific permission to individual files; and

*does not add (unnecessary) complexity?


text:
Q: Is this statement about measurable function true? If $f$ is a measurable function on $[0,1]$, then there exists a measurable set $D\subset [0,1]$ such that $mD>0.9$, and a continuous function $g:[0,1]\to R$ such that $f=g$ on $D$.
My question is that how can we approximate a measurable function by continuous function and how good could it be? Is there any theorem for it?

A: The relevant result is called Lusin's theorem. This should really be thought of in two different parts: $f$ restricted to the set $D$ is a continuous function in the subspace topology of $D$; and this restriction can be extended back to $[0,1]$ to get a continuous function.
So for instance, $1_{[0,1] \cap \mathbb{Q}}$ is continuous when restricted to $[0,1] \cap (\mathbb{R} \setminus \mathbb{Q})$, and can be continuously extended to the constant function $0$. For another example, a function with a single jump at $1/2$ is continuous on the complement of $(1/2-\delta,1/2+\delta)$ for any $\delta>0$. One can continuously extend from there, for instance by linear interpolation.
This last example demonstrates how one might prove the second part: given a small bad set which is chosen arbitrarily, make it slightly bigger in order to make it open, and then extend linearly across each of the open intervals which were deleted.


text:
Q: C++ std::pair variadic template I've got a situation like this
template<typename T, unsigned int N, std::pair<T,T>... pairs>
struct Base{
    static constexpr std::pair<T,T> SOME_STATIC_ARRAY[N] = {pairs...};
};

struct Derived : Base<int,3,std::pair<int,int>(1,2),std::pair<int,int>(2,3),std::pair<int,int>(3,4)>{

};

I want to have something like this, but I get compile error
A non-type template parameter cannot have type 'std::pair<int, int>'

How can I achieve this?

A: A non-type template parameter can only be one of a short list of types of objects:

*

*A value that has an integral type or enumeration

*A pointer or reference to a class object

*A pointer or reference to a function

*A pointer or reference to a class member function

*std::nullptr_t

Your temporary constructed instances of std::pair are not on that list.  Template parameters are very picky that way.  I don't remember the exact reason why they are so picky, but consider that template specialization involves asking "are these template arguments the same".  Equality of general objects is tricky (often involving an operator==), so drastically restricting the set of valid values to things which have trivial concepts of equality definitely makes compilers simpler.  Much to my chagrin, you can't even use strings as non-type template arguments, no matter how astonishingly useful that might be!
There are two solutions you can use to resolve this

*

*Instead of passing N pairs, pass N*2 individual integers, as integers are valid non-type template parameters

*Use std::integral_constant to pass in the integers, such as std::pair<std::integral_constant<int, 1>, std::integral_constant<int, 2> >.  This does not make a pair of integers, but it does make a type template parameter instead of a non-type template parameter.  You can then reconstruct the std::pair<int, int> whenever you like from templated functions.

*

*as a potentially simpler variant, you could construct your own template <typename T, T First, T Second> struct pair_integral_constant class, which accepts two numbers of the same type.  It's the same idea: make this a type parameter rather than a non-type parameter.


text:
Q: How to insert an items into an array in specific location and more My goal is to have an array (with 40 items for example) which in it :
1.The string 'blue' will appear every 2 items till the end.
2.The string 'red' will appear every 3 items till the end.
3.If the position of the 'blue' and the 'red' string are match,(like in [0]),the string in that position will be 'purple'.
3.Every item which is not blue red or purple will contain the string 'empty'.
Think of it as as mixed colors, whenever blue and red are in the same position (starts with [0]) it should be purple.
it should be like this one:
var array = ['purple','empty','empty','blue','red','empty','blue','empty','red',....];

My attempt:

Array.prototype.insert = function(index, item) {
  this.splice(i, 0, item);
};
var measure = [];
for (var i = 0; i < 40; i++) {
  measure.insert(0 + i * 2, 'blue')
  measure.insert(0 + i * 3, 'red')
}
console.log(measure);

A: You can initialize your array to length 40. Using a for loop till the length of the array, you can place your conditions and populate data accordingly.

var arr = new Array(40);
for(var i = 0 ; i < arr.length; i++) {
  if (i % 2 === 0 && i % 3 === 0){
    arr[i] = 'purple';
  } else if (i % 3 === 0) {
    arr[i] = 'red';
  } else if (i % 2 === 0) {
    arr[i] = 'blue';
  } else {
    arr[i] = 'empty';
  }
}
console.log(arr);


text:
Q: Multi-steps direct forecasting in AR(2) model through bayesian estimation of the model I'm estimating an AR(2) model using Bayesian methods through Gibbs sampling and I want to perform 4 step ahead multi-steps direct forecasts. Inside the MCMC loop in each iteration I'm drawing the variance and the vector of coefficients (the intercept and the coefficients for the first and the second lag). Hence I can easily perform iterated forecasting, but what about multi-steps direct forecasting? Does somebody have a reference on this?

A: Forecasting an AR(2) model simply uses an iterative approach.
Your first point forecast $\hat{y}_{T+1}$ relies on your last two historical observations $y_T$ and $y_{T-1}$ (since your AR order is 2). So plug these two in to get your point forecast $\hat{y}_{T+1}$.
Now, your next forecast $\hat{y}_{T+2}$ relies on $y_T$ (which you have, it's your last historical observation) and $y_{T+1}$ (which you don't have, it's your first forecast period). So instead of $y_{T+1}$, we simply use the forecast $\hat{y}_{T+1}$ which we just calculated above.
And so forth for $\hat{y}_{T+t}$. Since you have a posterior distribution for your coefficients, just perform this within each MCMC run and take the average at the end. For quantile forecasts, draw additional noise terms $\epsilon_{T+t}$, add these to your forecasts and finally take quantiles.
More information can be found in this free online open forecasting textbook.


text:
Q: Getting rid of performance setting knobs by finding best settings that will run at 60fps, and 30fps Intro
I am developing a game where the quality of it is largley dependent on two factors.

*

*How fancy the post processing effect, the fancier the better but also more gpu straining

*How many entities can be simulated, which puts strain on the cpu.

The problem is it is a perfectly good game even without post processing which allows even pre 2010 devices to run it. And I have about 48 different levels of post processing, while most devices can run say level 10, other new devices can run level 48 processing and it looks significantly cooler.
My dilemma is I do not want my user to have to slog through an interface where the select how many entities, and tweak the two settings that effect post processing quality. This is for two reasons.

*

*The main game already has plenty of interface elements on it, and I really do not want to add another. It would take away from the minimalist, and magical look of the game.

*I had a thought to give the user a 30fps and a 60fps option (best settings that would run at that fps) that has really become a goal for me.

Question
However I am having issues implimenting my dream of a 30fps option and a 60fps option. Mostly because of two reasons that I am hoping you can help me out with.

*

*Profiling takes way to long! Too many tests cause this process to take too long. Also the shorter I make the test the less accurate the results.

*Profiling is not accurate, even though I cut out the data from the first and last 20% of the test it still gives slightly different results each time.

*Since this is going to be an ios and android app there are SO many devices to profile, it would be difficult to program in predictions.

How would you test devices in order to figure out the best settings for 30fps and 60fps? No need to show code (articles would be nice) just explain the process.
If you want to read some more here is my current method.
My Current Method
Here is how I do it currently, and my test (although taking 3 minutes and being slightly inaccurate) has some assumptions that are making it faster.

*

*Each new entity does not add significant time to GPU rendering time, meaning that the CPU and GPU tests can be done seperatly, rather then testing combinations.

*Post processing is handled by two settings

*

*Downs-sample size: Basically the post processing effect is rendered at a lower resolution and fit onto a higher one. So if you down sample to 30% of the device resolution that means 70% less pixels do expensive calculations. The quality is also lower. I have simplified this by making 6 different levels of downsampling.

*Texture samples: All the processing that is done is convolution, and so a lot of texture samples need to happen for each pixel in the post processing stage. Currently for simplicity I came up with 8 different levels of this level 1 samples the texture 3 times per pixel, level 2 samples the texture 7 times per pixel etc. More samples = a more accurate and dramatic effect

However my method has some issues clouding its data, these are problems mostly because I can not predict how long these spikes will last and throw off data:

*

*Every time I change one of the GPU settings there is a lag spike, so for changing texture samples the uniform causes the code to branch differently and the GPU recompiles, and for changing downsampling I have to regenerate Frame buffers.

*There is also a lag spike at the beginning of each new CPU test because of creating new particles.

*Profiling starts at the beginning of the launch, even though I wait two seconds some times it still isnt fully steady yet, and I will get really low results on the first test.

*Some devices can go ridiculously high on the particle count, ironically the better the device the longer my cpu test takes.

Right now in order to test I am simply running the game as usual, and each new test I tweak the particle ammount, and gpu Ammount.
I first test the CPU, and turn post processing off. I start at 0 entities then go up by 100 entities. When the fps seems to drop below the target level (60fps then 30fps) then I test the one before it again. If this new test passed (ex: 500) but the last test failed (ex: 600) then I know 500 is the max amount of entities at that fps.
Then I test the GPU basically the same thing as the last test except I give the GPU more work each time. I broke it up into 4 tests. Luxury: Seeing if it is high end and finding the best setting, Level 6: Does level 6 texture sampling, and finds the lowest downsampling possible, Level 5: Does level 5 texture sampling and finds the lowest downsampling possible, Remedial: Does its best to find a glow setting that will work at maximum downsampling.
The texture sampling levels 5 and 6 are my goal. I dont really care how down-sampled the texture is. I would choose level 6 with down-sampling by 70% over level 5 with no down-sampling.
Texture sampling levels 1-4 are remedial for the really low end devices, I only ever test these at the highest level of down-sampling. If I get something that works then that is great, if not then no glow is rendered.
Texture sampling levels 7 and 8 are only for high end devices, and they only get tested with no down-sampling.
To speed up the GPU test I do it in the order Luxury-> Level 6-> Level 5->Remedial and if one of those passes it skips the other tests.

A: Your big problem is going to be thermal stability - most modern mid-end/high-end phones can generate more heat than they can dissipate if CPU and GPU are both running at maximum. They may sustain a measurably faster performance point for the initial 5-10 minutes after a cold start, but eventually will warm up enough so they need to down-clock. So your profiling problems become time variant, and you risk picking settings which work well for the first 10 minutes and then hit problems.
If you want a consistent user-experience you probably want to leave quite a bit of headroom rather than dialing things up as far as they can possibly go, and if you are leaving headroom the lack of 100% stability in the results matters less.
Personally as a user I don't find this type of setting too much of a problem - in your case it sounds like all you need is two sliders, one for CPU and GPU. I often turn down graphics deliberately below what my device is capable if the game allows to ensure my battery lasts longer (I play when I'm travelling so don't always have easy access to a charger).


text:
Q: How to create Isolated test environment I am very new to the VMware world. We have VMWare vCenter 4 in the production environment but we have created multiple VLAN through Cisco Switch. I want know, how I can create an isolated test environment for software testing purpose only, so anything will happen in that test vLan will not make trouble in the production environment.
"Host-only networking" is the solution or there is a better way to achieve this result?
My requirements
A. Hosts should be able to access Internet and a Network Share drive but not Production network
B. Hosts should connect each other inside the Virtual LAN
C. I should be able to take automatic or periodic backup or snapshoot and deploy snapshot when necessary.
Whatever your answer is, please give me steps, how to do, if possible.
If I need to purchase anything, I am ready to do but I don't want to spend big money.
Many thanks in advance.

A: VMWare has a product called Lab Manager that might be worth a look at

A: i'm afraid i can't give you a step-by-step guide, but it seems you already have the knowledge you need. just setup a new vlan for your testing environment and make sure there is no routing between production and testing.
the next better step would be to setup the testing environment on there own switches to prevent the production switch from breaking by floods of packets from the tests.

A: Vmware has also a host-only network, where only host inside vmware can comunicate with each other.
http://www.vmware.com/support/ws55/doc/ws_net_configurations_hostonly.html


text:
Q: Retrieve data from JSON with where statement I have a json file with a structure like this:
{
    "gasStationID":"441",
    "gasStationLat":"39.6337420",
    "gasStationLong":"22.4324412",
    "fuelCompID":"6",
    "fuelCompNormalName":"AVIN",
    "ddID":"42010100",
    "municipalityID":"42010000",
    "countyID":"42000000",
    "phone1":null,
    "username":"user1",
    "fuelTypeID":"1",
    "fuelPrice":"1.379"
},
{
    "gasStationID":"441",
    "gasStationLat":"39.6337420",
    "gasStationLong":"22.4324412",
    "fuelCompID":"6",
    "fuelCompNormalName":"AVIN",
    "ddID":"42010100",
    "municipalityID":"42010000",
    "countyID":"42000000",
    "phone1":null,
    "username":"user1",
    "fuelTypeID":"1",
    "fuelPrice":"1.478"
}

So, my question is how to retrieve the fuelPrice with fuelTypeID=1?
My JavaScript file is this:
for (i = 0; i < obj.length; i++) {
    var _gasStationCompName = obj[i].fuelCompNormalName;
    var priceID = obj[i].fuelTypeID;
    switch (fuelId) {
        case '1':
        case priceID == 1:
            price = obj[i].fuelPrice;
            break;
        case '2':
        case priceID == 2:
            price = obj[i].fuelPrice;
            break;
        default:
            price = "0";
    }

My problem is that in the price = obj[i].fuelPrice is showing only the fuelPrice with fuelType=2. How can I filter inside the switch statement the result?
Before that I'm parsing the JSON file. Also, you can see that I have case: '1'. That's because I have something like this in my HTML file:
<div>
        <select onChange="getData(this.value);">
            <option value="1">Gas</option>
            <option value="2">Diesel</option>
        </select>
</div>

A: Variables, and objects keys are case sensitive (A != a);
for (i = 0; i < obj.length; i++) {
  var _gasStationCompName = obj[i].fuelCompNormalName;
  var priceID = obj[i].fuelTypeID; // fuelTypeId => fuelTypeID
  switch (priceID) { fuelTypeId // => priceID
      case '1':
      case priceID == 1:
          price = obj[i].fuelPrice;
          break;
      case '2':
      case priceID == 2:
          price = obj[i].fuelPrice;
          break;
      default:
          price = "0";
  }
}

A: I'm assuming the JSON is an array. Let's call that array gasStations.
// Given a collection of stations and a fuel type, find the price

function findPrice(collection, fuelType) {
  // Find the station with the target fuel type
  var targetStation = collection.filter(function (station) {
    return station.fuelTypeID === fuelType;
  })[0];

  // If there was a match, return that station's price
  if (targetStation) {
    return targetStation.fuelPrice;
  }

  // Default to "0" if there was no match
  return "0";
}

// usage
var price = findPrice(gasStations, "1");

Note: If you have a collection where more than one station has the target fuel type, this function will return the price of the first gas station that has that fuel type.

A: I managed to find the solution. Here is the right switch statement that works like a charm:
                       var priceID = obj[i].fuelTypeID;
                        switch (fuelTypeID) {
                            case '1':
                                if (priceID == 1) {
                                    price = obj[i].fuelPrice;
                                }
                                break;
                            case '2':
                                if (priceID == 2) {
                                    price = obj[i].fuelPrice;
                                }
                                break;
                            default:
                                price = 0;
                        }


text:
Q: Reducible 3d torus bundles Here reducible means that the mapping class for the fiber is a reducible auto-homeomorph in the sense of Nielsen-Thruston. So,
could anyone give me a hint to classify them?
In contrast, do you agree that -in the sense of connected sum- all these bundles are irreducible?

A: OK, time to give some references for this classical material. Orientable 3-manifolds that are torus bundles are classified up to diffeomorphism by the conjugacy class of their monodromy map in SL(2,Z). [More precisely: two monodromy matrices A and B in SL(2,Z) determine diffeomorphic torus bundles if and only if A is conjugate in GL(2,Z) to either B or the inverse of B.] If the monodromy is elliptic (finite order) or parabolic (having an eigenvalue 1 or -1) then the torus bundle is Seifert fibered, so the classification in these cases is covered by the general classification of Seifert manifolds. If the monodromy is hyperbolic (two distinct real eigenvalues) then the torus bundle has a solvgeometry structure. One possible reference for the more topological parts of this classification is my notes on 3-manifolds, available on my webpage, where Section 2.2 gives the topological classification of orientable torus bundles in some detail, including the conjugacy classification of elements of SL(2,Z). For the "eight geometries" aspects of the classification there is the well-known expository article of Peter Scott, "The Geometries of 3-Manifolds", in the 1983 Bull.L.M.S. (a scanned pdf version is available on his webpage). See pp. 470-472 in particular.
The case of nonorientable torus bundles should be similar. Scott actually treats the nonorientable case, but I was lazy and didn't go that far. There are probably other references too that I'm forgetting at the moment. Can anyone else remember?
In particular, to answer the original question, torus bundles are irreducible both in the Thurston geometries sense and in the embedded spheres sense.

A: Yes - surface bundles over the circle are irreducible (*) as long as the fiber is not a two-sphere.  This follows from the fact that the universal cover of such a surface bundle is homeomorphic to $\mathbb{R}^3$ and Proposition 1.6 of Hatcher's three-manifold notes.
(*) in the sense of connect sum.
EDIT: To answer the question posed by Juan in the comment. A orientation preserving homeomorphism $h$ of $T^2$ is reducible (that is, preserves the isotopy class of some essential multicurve) if and only if $h$ is a power of a Dehn twist or is the power of a Dehn twist followed by the hyperelliptic element.  Here is a "cut-and-paste" proof: if $h$ preserves a multicurve then it preserves a curve, say $\alpha$.  Now, $h$ either preserves or reverses the orientation of $\alpha$.  If the latter case replace $h$ by $h$ followed by the hyperelliptic, to reduce to the former case.  Isotope $h$ so that $\alpha$ is fixed pointwise.  Note that, as $h$ preserves orientation of $T^2$, the sides of $\alpha$ are preserved as well.  Thus $h$ restricts to a homeomorphism of the annulus, fixing the boundary pointwise.  By the classification of mapping classes in the annulus, $h$ is a Dehn twist.
As a bit of an advertisement: Farb and Margalit have written a primer on the maping class group.  You can find a discussion of the mapping class groups of the disk, annulus, and torus in Section 2.4, on the "Alexander Method".  (In particular they give the usual proof that the group of orientation oreserving classes on $T^2$ is $SL(2,Z)$.  They also give as an exercise the characterization of Dehn twists.)
I'll end by pointing out that there is not a contradiction between my answer and Hatcher's.  If the monodromy is reducible then the resulting torus bundle is Seifert fibered and in fact has Nil geometry.

A: I think the hint you need is that the (orientation-preserving) mapping class group of the torus is SL_2(Z).  So you need to figure out which elements are "reducible", and what the corresponding bundles look like.


text:
Q: Using SWTBot to automate a third party application. Is it possible? I have a SWT application that I'd like to automate, making use of SWTBot. Is it possible? If yes, how?
All the examples I've found on the net seem to be more about testing your own applications than to launch a third party application.

A: If the application in question is not an Eclipse RCP application to which you could install SWTBot I don't think it's doable. I don't think SWTBot can control another process even if it is Java process.
Only thing that comes to mind is some kind of -Xbootclasspath: JAR that would boot some kind of "remote control server" in that application and allow SWTBot to issue commands to it.


text:
Q: Center recyclerview vertical when few items I have a RecyclerView that takes up part of a ConstraintLayout.
If it contains few items I need it to be centered vertically. (if the items doesn't fit on screen i need it to use the available space (matching the constraints)
I can get the wanted layout if is use layout_height="wrap_content" + layout_gravity="center_vertical", as long as all items fit in the available space.
But wrap_content doesn't work when the items need more space.
<androidx.constraintlayout.widget.ConstraintLayout>
  <FrameLayout
    android:id+"@+id/frameLayout"
    ...
  </FrameLayout>

  <androidx.recyclerview.widget.RecyclerView
    android:id="@+id/list"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_marginTop="14dp"
    android:background="@color/cardview_light_background"
    android:scrollbars="vertical"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/frameLayout"
    tools:listitem="@layout/recyclerview_sections_items" />

</androidx.constraintlayout.widget.ConstraintLayout>


text:
Q: Do not escape new line How do I not escape a new line \n string in Console.Readline()?
string line = "//;\n1;2";
// line == "//;\n1;2"
Console.WriteLine(line);
outputs:
//;
1; 2

line = Console.ReadLine();
// line == "//;\\n1;2"
Console.WriteLine(line);
outputs://;\n1;2

I'm trying to get Console readline to not escape the newline and the output should always be on 2 lines.

A: To read without new line, you could use:
Console.Read();

To escape the \n char, you could use \\ to escape the \ char. There is the Environment static class that provide some features based on the current environment platform:
Console.Write("Your text." + Environment.NewLine);


text:
Q: SSRS Static Date Expression I'm creating an SSRS report and I need to set a begin date so that it always returns 12/21/2015.  Is there an expression to use in SSRS to bring back a static date that will never change?
I've been chewing on this for awhile and searching everywhere.
Thanks

A: In SSRS you can produce date objects manually using CDATE and DATESERIAL functions.
To produce today date manually you can use:
CDATE("2016-11-11") --> yyyy-MM-dd
or
DATESERIAL(2016,11,11) --> year, month, day
And you can use them in any SSRS expression, i.e:
=IIF(Today()=CDATE("2016-11-11"), some crazy expression, some crazy expression)

or
=IIF(Today()=DATESERIAL(2016,11,11), some crazy expression , some crazy expression)

Let me know if this helps.


text:
Q: basic use of java mime-util I was hoping someone could clarify some facts about mime-util?
Firstly:  my biggest issue is that I am not sure what to import to actually use the library (small java statement but very vital). :):)
Second I think that mime-util can work out the type of a file from a byte[] array and/or stream is that correct?  If so what method should be called?
Lastly, would someone be able to give a quick example on how to get the mime type?  (not as important as I have pieced together snippets from other questions but I have know guaranty that it will work).

A: The source may help but this lib is old and now unsupported.
You may take a look at the Java Source Test.


text:
Q: Which distro should I switch to? I've been an Ubuntu user for quite a few years now. However, with the recent release of Gnome 3, and with Ubuntu not going to include it by default, instead including its own customizations (such as unity) -- I'm akin for something vanilla (I see this unity similar to HTC's "Sense" that they put on their Android phones, which I can't stand).
So I'm looking for a distro to switch to. It should:

*

*be as up to date as possible

*be stable (I have to give credit to Ubuntu for just working in most situations), so no Archlinux :) -- I have tried it and, while nice, it seems to always crash like hell right when I need it most

*ship packages as unmodified as possible.

*have good support (large user base)

I'm currently looking at Fedora, it seems to satisfy all my needs: up to date (the next release will include Gnome 3), stable, pretty vanilla as far as I can tell, good support (widely used).
Any other suggestions?

A: If you can stand a rolling release, use Debian Testing:

*

*It provides a nice balance between up-to-dateness and stability. That's because packages typically live for 10 days in Unstable before automatically propagating to Testing, and it does so only when there's no 'release-critical' bug files against it in the meanwhile.

*It's from the same family as Ubuntu, so you should feel at home (no need to adjust to another package manager).

*It's common Debian practice to be in constant touch with their upstreams, so each patch you find is because it's pending upstream inclusion, or it needs to be kept separate (i.e. Debian specific), and I expect these to minimal (at least as compared to Ubuntu).

*Oh, and Debian community is huge. Not like Ubuntu of course, but maybe comparable to Fedora.


text:
Q: terraform azurerm_virtual_machine_extension 'settings' json fails to parse when using join operator I have the following terraform block to run a custom script on a windows VM
resource "azurerm_virtual_machine_extension" "install_script" {
  name                 = "install_script"
  virtual_machine_id   = var.myvm.id
  publisher            = "Microsoft.Compute"
  type                 = "CustomScriptExtension"
  type_handler_version = "1.10"

  settings = <<SETTINGS
    {
        "commandToExecute": "powershell -ExecutionPolicy unrestricted -NoProfile -NonInteractive  -command \" echo hi \""
    }
    SETTINGS
}

This works as the command is 1 line... but for readability, I am trying to use a join operator to split up the command as such
resource "azurerm_virtual_machine_extension" "install_script" {
  name                 = "install_script"
  virtual_machine_id   = var.myvm.id
  publisher            = "Microsoft.Compute"
  type                 = "CustomScriptExtension"
  type_handler_version = "1.10"

  settings = <<SETTINGS
    {
        "commandToExecute": "${(join(" ", (["powershell -ExecutionPolicy unrestricted -NoProfile -NonInteractive",
                     "-command \"",
                     "echo hi",
                     "\""])))}"
    }
    SETTINGS
}

I keep getting the error in terraform output in pipeline
│ Error: "settings" contains an invalid JSON: invalid character 'e' after object key:value pair
│
│   with azurerm_virtual_machine_extension.install_script,
│   on main.tf line 92, in resource "azurerm_virtual_machine_extension" "install_script":
│   92:     settings = <<SETTINGS
│   93:     {
│   94:         "commandToExecute": "${(join(" ", (["powershell -ExecutionPolicy unrestricted -NoProfile -NonInteractive",
│   95:                       "-command \"",
│   96:                       "echo hi",
│   97:                       "\""])))}"
│   98:     }
│   99:     SETTINGS

To my knowledge, join would reduce the multiple lines down to one string.
And even though I am defining the items over multiple lines, it should not complain since
the join operator is wrapped inside parenthesis (), as well as the list items being wrapped in parenthesis ().

A: To properly escape \, you need to use \\\, which means that you will have:
<<SETTINGS
    {
        "commandToExecute": "${(join(" ", (["powershell -ExecutionPolicy unrestricted -NoProfile -NonInteractive",
                     "-command \\\"",
                     "echo hi",
                     "\\\""])))}"
    }
SETTINGS


text:
Q: bash: adb: command not found in Windows 10 I have installed adb.exe and other files and folders from platform-tools inside of /c/adb/platform-tools/adb.exe in a Windows 10 machine, but I am unclear as to what should happen next and a result I am not sure if it's a step I am missing or if the employer has put a block on the machine they issued to me.
What steps do I need to take to get adb devices working? This way if it still does not work then I know I need to let their IT team know they need to unblock whatever it is that is keeping me from utilizing adb devices.
There is this guide here: https://docs.expo.io/workflow/android-studio-emulator/
but the folder file structure is geared towards a unixy system and even when I run ./adb version I get permission denied.
I went into environment variables and added to my Path: C:\adb\platform-tools\adb.exe, but when I run adb devices or adb version I still get command not found.

A: In order to use it from anywhere, you must add the folder in which adb is located to your PATH environment variable.
Otherwise without adding that, you can go to that folder on terminal ( cd /c/adb/platform-tools/adb.exe ) and use it from there.


text:
Q: Error of iterator in mys JSP

      TITLLE

        [...]

<logic:iterate id="listClient" name="Client">

    [...]

</logic:iterate>

But i have this error for my second iterate

javax.servlet.jsp.JspException: Cannot
  create iterator for this collection

A: The Cannot create iterator for this collection message is thrown by the iterate tag when it is not able to create an iterator for the collection you are passing to it.
The tag extracts an object from scope using the specified name, in this case Client and starts to check what type it is:

*

*array of objects or primitives;

*java.util.Collection;

*java.util.Iterator;

*java.util.Map;

*java.util.Enumeration.

If it finds one of this object types it extracts the iterator in the appropriate way. If none of the above are a match you get javax.servlet.jsp.JspException: Cannot create iterator for this collection.
At this point I agree with Adeel Ansari's comment: "it doesn't make any sense to me when you are able to iterate once, but not again".
Are you doing something to the Client bean between the two iterator tags (i.e. is the presented code continuous in regards of the iterator tags)? Maybe you overwrite it with something that ain't a collection?

A: You are using the same id, change the id of the second one

A: use this type of iterater to solve this problem.............

    RECD from :
        <select name="vo.cuttingRecivedFrom" >
            <option value="">select</option>
            <logic:notEmpty name="storeList">
                <logic:iterate name="storeList" id="storeList1" indexId="count">
                    <option value="<bean:write name="storeList1" property="storeName"/>"><bean:write name="storeList1" property="storeName"/></option>
                </logic:iterate>
            </logic:notEmpty>
        </select>

    RECD in :
        <select name="vo.cuttingRecivedFrom" >
            <option value="">select</option>
            <logic:notEmpty name="storeList">
                <logic:iterate name="storeList" id="storeList1" indexId="count1">
                    <option value="<bean:write name="storeList1" property="storeName"/>"><bean:write name="storeList1" property="storeName"/></option>
                </logic:iterate>
            </logic:notEmpty>
        </select>


text:
Q: Find missing numbers in file I have a data file with a bunch of out of order numbers, one per line. I want to see which numbers, if any, I am missing.
example data:
1
2
2
3
4
2
6
7
8
3

Best attempt:
cat myfile | sort -n -u | awk 'NR!=$0'
# output:
6
7
8

This kinda works. It prints out all the numbers where the line number doesn't match the contents of that line, which tells me at least that I missed 5, but only by printing all of the numbers afterward.
Is there a good way of doing this in awk/sed/bash/sort/etc, or do I have to pull out the python?
I also wanted to find the duplicates in the file and their counts, but cat file | sort -n | uniq -c -d appears to have worked perfectly for that.

A: In awk:
awk '{a[$0]++; if ($0 > max) max=$0}
    END { for (i=1; i < max; i++) if(!(i in a)) print i }' < myfile

a is an associative array that uses each number in the file as the keys. max contains the highest number in the file.
At the end we just check every number from 1 to max to see if it's in the array.

A: Alright, I think I figured it out (though feel free to tell me if I screwed up)
cat file | sort -n -u | \
awk 'BEGIN{range=0};{
     if(++range!=$1){
      for (i=range; i<$1; i++)
        {print i}
      range=$1
      }
    }'

It increments a counter that starts as the line number, checks if the value of the line is equal to that. If it's equal, increment and move on.
If it's not, go through all the numbers between expected and actual, and increment the expected accordingly
It seems to work!

A: With bash and sort, seq, uniq utilities from GNU coreutils, and assuming that each line in the file numbers.txt  is a positive integer, this two-line program prints out numbers in the "gaps".
nums=$(sort -nu numbers.txt)
{ seq ${nums##*$'\n'}; echo "$nums"; } | sort -n | uniq -u


text:
Q: CS50 Pset1 Credit ... Can someone please explain why does the program not working. I searched everywhere there is no solution that is using functions CS50 PSET1 Credit - https://cs50.harvard.edu/x/2022/psets/1/credit/
Well known problem in CS50 commmunity so not going to post the full problem here.
I intend to solve the problem using different functions instead of writing everything inside main which is what i have been finding for hours .
If anyone have solution for this problem using diferent functions for everystep please share in answers.
#include <cs50.h>
#include <stdio.h>
#include<math.h>

long get_credit_number(void);
int checksum(long cn);

// Driver code
int main(void)
{
   int valid = 1;
   long cn = get_credit_number();
   int cm = checksum(cn);

   long ccn = cn;
   int length = 0;
   long divisor = 10;
   int first_digit; int first_twodigit;

    if (cm == valid)
    {
        // Check length of credit card number
        while (ccn > 0)
       {
            ccn = ccn % 10;
            length++;
        }
        // Check first two digits of credit card number
        for (int i = 0; i < length - 2; i++)
        {
            divisor = divisor * 10;
        }
        first_digit = ccn/divisor;
        first_twodigit = ccn / (divisor / 10);

        // check whether card is AMEX
        if (length == 15 && (first_twodigit == 34 || first_twodigit == 37))
        {
            printf("AMEX\n");
        }
        // check whether card is MASTERCARD
        else if (length == 16 && (first_twodigit > 50 && first_twodigit == 56))
        {
            printf("MASTERCARD\n");
        }
        //check whether card id VISA
        else if ((length == 13 || length == 16) && first_digit == 4)
        {
            printf("VISA");
        }
    }
    else
    {
        printf("INVALID\n");
    }

}

// Prompt user to enter the credit card number
long get_credit_number(void)
{
    long cna;
    do
    {
       cna = get_long("Number: ");
    }
    while (cna <= 0);
    return cna;
}

// Checksum by Luhm algorithm
int checksum(long cn)
{
    int sum = 0;
    long cna;
    long ccn = cn;

    while (ccn > 0)
    {
        cna = cn % 10;
        sum = sum + cna ;
        ccn = ccn / 100;
    }

    ccn = ccn/10;
    long cnb;

    while (ccn > 0)
    {
        cna = ccn % 10;
        cnb = 2 * cna;
        sum = sum + (cnb%10) + (cnb/10);
        ccn = ccn / 100;
    }

    sum = sum % 10;
    if (sum == 0)
    {
        return 1;
    }
    else
    {
        printf("INVALID\n");
        return 0;
    }
}

https://cs50.harvard.edu/x/2022/psets/1/credit/

A: Posting this solution here for future cs50 students. I solved the problem by dividing the problem into three different functions and completely avoided using global variables.Hope this help someone in future.
#include <cs50.h>
#include <stdio.h>

// Functions Declaration
long get_credit_number(void);
long checksum(long credit_number);
void finalcheck(long check_sum, long credit_number);

// Driver code
int main(void)
{
    // Calling the Functions
    long credit_number = get_credit_number();
    long check_sum = checksum(credit_number);
    finalcheck(check_sum, credit_number);
}

// Prompt user to enter the credit card number
long get_credit_number(void)
{
    long credit_num;
    do
    {
        credit_num = get_long("Number: ");
    }
    while (credit_num <= 0);
    return credit_num;
}

// Checksum by Luhm algorithm
long checksum(long credit_number)
{
    long sum = 0;
    long last_digit;
    long credit_card_number = credit_number;
    // Luhm's algorithm Case 1
    while (credit_card_number > 0)
    {
        last_digit = credit_card_number % 10;
        sum = sum + last_digit ;
        credit_card_number = credit_card_number / 100;
    }

    credit_card_number = credit_number / 10;
    long two_times;
    // Luhm's algorithm Case 2
    while (credit_card_number > 0)
    {
        last_digit = credit_card_number % 10;
        two_times = 2 * last_digit;
        sum = sum + (two_times % 10) + (two_times / 10);
        credit_card_number = credit_card_number / 100;
    }
    sum = sum % 10;
    // Check whether the last digit of sum is 0 or not
    if (sum == 0)
    {
        return 1;
    }
    else
    {
        return 0;
    }
}

//Final check whether the card is Visa, Amex, Mastercard or Invalid
void finalcheck(long check_sum, long credit_number)
{
    long valid_cc = credit_number;
    int length = 0;
    long divisor = 10;
    int first_digit;
    int first_twodigit;

    if (check_sum == 1)
    {
        // Check length of credit card number
        while (valid_cc > 0)
        {
            valid_cc = valid_cc / 10;
            length++;
        }

        // Check first two digits of credit card number
        valid_cc = credit_number;
        for (int i = 0; i < (length - 2); i++)
        {
            divisor = divisor * 10;
        }

        first_digit = valid_cc / divisor;
        first_twodigit = valid_cc / (divisor / 10);

        // check whether card is AMEX
        if (length == 15 && (first_twodigit == 34 || first_twodigit ==
        37))
        {
            printf("AMEX\n");
        }
        // check whether card is MASTERCARD
        else if (length == 16 && (first_twodigit == 50 && first_twodigit
        << 56))
        {
            printf("MASTERCARD\n");
        }
        //check whether card id VISA
        else if ((length == 13 || length == 16) && first_digit == 4)
        {
            printf("VISA\n");
        }
        else
        {
            printf("INVALID\n");
        }
    }
    else
    {
        printf("INVALID\n");
    }
}


text:
Q: Using static variables in Open CL? Can we use static variables within the openCL kernel.
I tried to use it but got the following exception
 ptxas application ptx input, line 11; error   : Module-scoped variables in .local state space are not allowed with ABI ptxas fatal   : Ptx assembly aborted due to errors

EDIT
I found a page that says its not supported. So how can we make a variable to retain its old value during multiple calls?

A: In OpenCL 1.2, all program scope variables must be in the __constant address space (see Section 6.5, page 224 of the specification), which means that you cannot have this kind of variable that can be both read and written by multiple kernels. Instead, you need to create a buffer object that you pass in as an argument to each kernel that needs it (it will retain its contents across multiple kernel calls).
In OpenCL 2.0, program scope variables in the __global address space are allowed, so when we have hardware and implementations for OpenCL 2.0 you will be able to do this sort of thing much more easily.


text:
Q: .NET Core 2 Identity CreateAsync Error Catching I am getting an error when trying to CreateAsync a user.
var create = await _userManager.CreateAsync(user, model.Password);

There is a property I can access on the IdentityResult called errors. However I can't work out how to access it. Any idea how I can catch it so I can see what it is erroring on?
I've posted the full controller code below. For some reason whenever I try and do anything with my var create it just ignores it. I can't even step into it.
namespace TechsportiseOnline.Controllers
{
    [Produces("application/json")]
    [Route("api/[controller]/[action]")]
    public class RegistrationController : Controller
    {
        private readonly UserManager<ApplicationUser> _userManager;
        private readonly SignInManager<ApplicationUser> _signInManager;
        private readonly IConfiguration _configuration;
        private readonly IOptions<JWTSettings> _jwtConfig;
        private readonly IEmailSender _emailSender;

        public RegistrationController(
              UserManager<ApplicationUser> userManager,
              SignInManager<ApplicationUser> signInManager,
              IConfiguration configuration,
              IOptions<JWTSettings> jwtConfig,
              IEmailSender emailSender)
                    {
                        _userManager = userManager;
                        _signInManager = signInManager;
                        _configuration = configuration;
                        _jwtConfig = jwtConfig;
                        _emailSender = emailSender;

        }

        [AllowAnonymous]
        [HttpPost]
        public async Task<IActionResult> Register([FromBody] RegisterModel model)
        {
            if (ModelState.IsValid)
            {

                var user = new ApplicationUser
                {
                    UserName = model.Email,
                    Email = model.Email,
                    FirstName = model.FirstName,
                    LastName = model.LastName,
                    MobileNumber = model.MobileNumber,
                    Marketing = model.Marketing,
                    Newsletter = model.Newsletter
                };

                var result = new CreateUserResult();

                var    create = await _userManager.CreateAsync(user, model.Password);

                if (create.Succeeded == true)
                {

                    var code = await _userManager.GenerateEmailConfirmationTokenAsync(user);
                    var callbackUrl = Url.EmailConfirmationLink(user.Id, code.ToString(), Request.Scheme);
                    await _emailSender.SendEmailConfirmationAsync(model.Email, callbackUrl);

                    //await _createContact.CreateContactAsync(model.Email, model.FirstName, model.LastName, model.Marketing, model.Newsletter);
                    var fields = new Dictionary<string, string>();
                    fields.Add("firstname", model.FirstName);
                    fields.Add("lastname", model.LastName);
                    fields.Add("newsletter", model.Newsletter.ToString());
                    fields.Add("marketing", model.Marketing.ToString());
                    string publicaccountid = "55ebcc8b-b23f-4843-9dcb-1df08811de65";
                    var createcontact = ElasticEmailClient.Api.Contact.AddAsync(publicAccountID: publicaccountid, email: model.Email, field: fields);

                    //await _signInManager.SignInAsync(user, isPersistent: false);
                    return CreatedAtRoute("CreateAccount", model);
                }
                else
                {
                    return BadRequest("Could not register account");
                }
            }
            else
            {
                return BadRequest("The model is invalid");
            }
        }
    }

}

A: This is my sample code: I am using MediatR to (try to) separate queries and commands.
CreateUserByAdminHandler
public class CreateUserByAdminHandler : IAsyncRequestHandler<CreateUserByAdmin, CreateUserResult>
{
    private readonly UserManager<AppUser> _userManager;

    public CreateUserByAdminHandler(UserManager<AppUser> userManager)
    {
        _userManager = userManager;
    }

    public async Task<CreateUserResult> Handle(CreateUserByAdmin command)
    {
        var result = new CreateUserResult();

        try
        {
            var appUser = new AppUser
            {
                UserName = command.Username.Trim(),
                FirstName = command.FirstName.Trim(),
                LastName = command.LastName.Trim(),
                Email = command.Email,
                PhoneNumber = command.PhoneNumber,
                Status = UserStatus.Active
            };

            var createResult = await _userManager.CreateAsync(appUser, command.Password);
            if (!createResult.Succeeded)
            {
                // IdentityResult has Errors property, which is a list of
                // IdentityError. IdentityError has Code and Description
                // property. It's up to you to select whichever property
                // for the error message.

                result.AddErrors(createResult.Errors.Select(ier => ier.Description));
                return result;
            }

            result.NewUser = appUser;
        }
        catch (Exception ex)
        {
            result.SetException(ex);
        }

        return result;
    }
}

A: Set your breakpoint on if (create.Succeeded == true) and inspect the create object or add an else statement to read the errors. Here is the code I use to log my errors.
var result = await _userManager.CreateAsync(newUser, "Password123!");

if (result.Succeeded)
{
   //do stuff
}

foreach (var error in result.Errors)
{
   _logger.LogWarning("Code: " + error.Code + " " + error.Description);
}


text:
Q: Write keywords to files using a table of filenames and keywords I conduct research on rainforest cats in Africa. I have been using exiftool to extract keywords from photos to create tables that I can analyse. More camera trap studies are starting to use this method, so I suspect this question may eventually be relevant to quite a few people, especially when thousands of files are routinely backed up off-site prior to keywording.
I have had some students in South Africa keyword one of my camera trap surveys. These students have made errors in the past, so I need to double check their work before analysing. I have all of the photos (which I gave them) with the same filenames. I would like to know if it is possible for them to extract the keywords to a .txt file (using -filename and -keyword operators) in South Africa, email that file to me and THEN for me to write those keywords to the same files on my hard drive. This would be considerably easier than transferring 60 Gb of photographs.
I am using MacOSX 10, so perhaps this is more of an Automator problem, but many camera trap users have PCs, so it would be better to use exiftool if possible.

A: David, you can export to a csv file using exiftool, something like:
exiftool -xmp:all -csv . > ThisSet.csv

Make your corrections to that csv file in a spreadsheet, then import to your images.
exiftool -overwrite_original_in_place -L -csv=\Users\TIPUTINI\DarwinCore\ThisSet.csv \Users\TIPUTINI\DarwinCore\Photos\

I was doing something similiar at a research station in the Ecuadorian Amazon.
Note that exiftool supports embedding Darwin Core into the captured images. I think that would be very useful for camera trap images, don't you?


text:
Q: What's the difference between these two solutions? Are both correct (task about modulus, extended euclidean algorithm)?
Find all solutions. You know that the multiplicative inverse is $2$.
$$17x  \equiv 25 (\text{mod } 33)$$

First way of solving it:
Multiply this with $2$: $$34x \equiv 50(\text{mod } 33) $$
This is equivalent to:
$$1x \equiv 17 (\text{mod }33)$$
So solution is $x = 33k+17$ where $k \in \mathbb{Z}$
Second way of solving it:
Multiply this with $2$: $$34x \equiv 50(\text{mod } 33) $$
$$50 \text { mod } 33= 17$$
Thus $x = 17$

My question, are both solutions correct? And if yes, which one would you recommend? The second seems more comfortable for sure.

A: The suggested solution might have been $$17x\equiv 25\pmod{33}$$
$$\iff 50x\equiv 25\pmod{33}$$
$$\stackrel{:25}\iff 2x\equiv 1\pmod{33}$$
(which we can do because $\gcd(25,33)=1$)
$$\iff x\equiv 2^{-1}\pmod{33}$$

A: $$17x \equiv 25 \pmod{33}$$
The "natural" thing to do with $17x \equiv 25 \pmod{33}$ is to multiply both sides by what is $\dfrac{1}{17} \pmod{33}$. Since $2\cdot17 \equiv 34 \equiv 1 \pmod{33}$, then $\dfrac{1}{17} \equiv 2 \pmod{33}$. Multiply both sides by $2$ and you get
\begin{align}
   34x &\equiv 50 \pmod{33} \\
   x &\equiv 17 \pmod{33} \\
   x &= 17 + 33n \quad (n \in \mathbb Z)
\end{align}


text:
Q: How to use class from DLL referenced by referenced DLL I have 3 C# projects: P1, P2 and P3. I have class A in project P1 that I compile as assembly and get DLL. I reference project P1 in project P2 and use class A, and also compile it as assembly and get DLL. In addition, I reference project P2 in project P3 and want to use class A (from project P1) as well, but unfortunately, class A is not available. The reference sequence is as follows:
P1 -> P2 -> P3
I am using Visual Studio 2019 for development.
Please advise how to make class A from project P1 be visible in project P3.
Thank you

A: As others suggested, the direct way is to add the reference P1 to P3.
Also, if you don't want to add the reference P1, you can create a new class to inherit from the classA in the P2.
Like the following:
public class ExampleB:ExampleA
    {
        ....
    }


text:
Q: What causes files to use up more more disk space than the file size suggests? du was showing some drives with much less space than I was expecting, and ls -alh also showed the sum at the top to be a factor of three more than the sum of the individual files. Following this answer, I checked with ls -s, and sure enough, most of the files are using three times as much disk space as their size. What causes this and can I do anything to get the disk usage down?
Edit
I'm seeing output like this from ls -alhs:
 50K -rw-------   1 xxx xxx 9.0K Jan 29 20:34 20120103.gz
242K -rw-------   1 xxx xxx  67K Jan 29 20:53 20121130.gz

so the problem isn't that my file sizes are much less than 4k.

A: I don't know what file system you are using or cluster size but here is some generic information that should help.
The file system allocates data in groups sometimes called clusters(by some file systems).  The cluster size is variable, but in many cases a power of 2 at least 512 bytes in size.  The 512 bytes represents the physical sector size of all but the newest hard drives which have 4096 byte sectors.
Each file uses at least 1 cluster, and in most cases the last cluster is not fully used.  The remaining space on each file is remains not allocatable.  Using FAT,FAT32,NTFS it is not possible to go higher than 64kb each cluster, but the same is not true for linux.
ls -alhs

how big is the file at the top of list the . and the ..?
So if you have a lot of files wasting tiny amounts of space it all adds up to a large amount of wasted space.
You would have to look into the exact details of your file system to find this data out.  Changing file systems can have a major impact on the overhead.  I tried BTRFS and it wasted a tons of space.  I did a fresh install and ran updates and it was like 2x or more higher than other file systems.
Ext4 also does poorly with a large number of small files, a perfect example of this is 1 copy of the kernel source code has 10,000's of thousands of small files.
It is entirely possible that your file system is responsible for the wasted space and the only way to change that is changing the file system.
In addition, some file systems support snapshots which allows for back up copies of the same file to be stored in the file system.  The distro controls how the feature is configured and whether it is on by default.  Every file you change or delete could be in a snapshot and not actually deleted.  There is a command to remove the old snapshots, but I don't recall what the command is.


text:
Q: Why did Hinzelmann owe a debt to Mr. Wednesday? In chapter 20 of Neil Gaiman's American Gods, Hinzelman says that he saved Shadow's life because he owes a debt to Mr. Wednesday.  Do we know why he owes this debt?  Is it explained somewhere in the book?

A: There's nothing in the book to explain it.

Hinzelmann tipped his head on one side. He scratched his nose, thoughtfully, rocked back and forth as if he were thinking. "Well," he said. "That's a good question. I guess it's because I owed a certain party a debt. And I'm good for my debts."
  "Wednesday?"
  "That's the fellow."

And that's all that's said about it.

Given that their personal histories go back nearly a millennium, it's quite likely that they've encountered each other repeatedly. Wednesday is, of course an inveterate hustler, a trader of information and collector of favours. It's not until later in the novel that we realise that he's been setting up a network of safe-houses to allow him to stash Shadow away from his enemies.

"Initially, simply the pleasure of your company. And I have
  information to share. What's that phrase…oh yes. You may learn
  something to your advantage."

and

Their breath steamed in the night air. Christmas lights twinkled in the windows of the stores they passed. "It's good of you, putting me up," said Shadow. "I appreciate it."
"We owe your employer a number of favors [Said Mr. Ibis].  And Lord knows, we have the room. It's a big old house. There used to be more of us, you know. Now it's just the three of us. You won't be in the way."


text:
Q: ASP.Net MVC 5 with DropZone Can't Send Additional Parameters to Controller Ok, I am sure this already has an answer somewhere, but I can honestly tell you that everything I have tried, has failed. Here is my current configuration:
Shared _Layout.cshtml (below the footer)

    @await RenderSectionAsync("Scripts", required: false)

Images View
@model NewProductVM
<form id="form2" method="post" enctype="multipart/form-data" data-parsley-validate class="form-horizontal form-label-left">

             *

        <input type="hidden" value="@Model.Id" />

                Drop files here or click to upload.

</form>

Products Controller
[HttpPost]
public async Task<IActionResult> UploadFiles(string Id)
{
            bool bSuccess = true;

            _ConnectionString = _Configuration.GetConnectionString("StorageConnectionString");
            _ContainerName = _Configuration.GetValue<string>("StorageContainerName");

            string uploads = Path.Combine(_hostingEnvironment.ContentRootPath, "Uploads");

            if (!Directory.Exists(uploads))
                Directory.CreateDirectory(uploads);

            foreach (var iFormFile in Request.Form.Files)
            {
                if (iFormFile.Length > 0)
                {
                    if (StorageHelper.IsImage(iFormFile))
                    {
                        var filePath = Path.Combine(uploads, iFormFile.FileName);
                        using (var stream = new FileStream(filePath, FileMode.Create))
                        {
                            await iFormFile.CopyToAsync(stream);
                        }

                        bSuccess = await StorageHelper.UploadFileToStorage(iFormFile, filePath, _ConnectionString, _ContainerName);
                        System.IO.File.Delete(filePath);

                        ProductImage productImage = new ProductImage
                        {
                            ProductId = int.Parse(Id),
                            ImageURL = $"{_Configuration.GetValue<string>("StorageContainerURL")}/{iFormFile.FileName}"
                        };

                        await _imageService.AddNewImageAsync(productImage);
                    }
                }
            }
            return RedirectToAction("Index");
}

I would really like to pass the entire NewProductVM model to the UploadFiles method, but there are not very many properties in the view model, so I could pass each property individually.
Right now I am taking someones suggestion to create a hidden form field and add a value I want to pass to the controller as a form field, but the parameter value in the UploadFiles method is null. I have also tried using asp-route-id="@Model.Id". When I did that, the value of id was 0 in the controller method.
Anyone have any suggestions?

A: Ok, I finally found the answer and I cannot believe how simple it was. I have been working on this for several hours. I found the answer here: https://social.msdn.microsoft.com/Forums/en-US/a87c6936-c0b5-4f47-b074-dbaf4c154cdd/id-parameter-returning-null-after-using-formdataappend-to-append-id-to-model-id-in-mvc-5?forum=aspmvc
This is what I did:
Images.cshtml
<form id="form2" method="post" enctype="multipart/form-data" data-parsley-validate class="form-horizontal form-label-left">

            *

                Drop files here or click to upload.

</form>

ProductsController.cs
[HttpPost]
public async Task<IActionResult> UploadFiles(int Id)
{
    bool bSuccess = true;

    _ConnectionString = _Configuration.GetConnectionString("StorageConnectionString");
    _ContainerName = _Configuration.GetValue<string>("StorageContainerName");

    //int Id = int.Parse(fc["Id"]);

    string uploads = Path.Combine(_hostingEnvironment.ContentRootPath, "Uploads");

    if (!Directory.Exists(uploads))
        Directory.CreateDirectory(uploads);

    foreach (var iFormFile in Request.Form.Files)
    {
        if (iFormFile.Length > 0)
        {
            if (StorageHelper.IsImage(iFormFile))
            {
                var filePath = Path.Combine(uploads, iFormFile.FileName);
                using (var stream = new FileStream(filePath, FileMode.Create))
                {
                    await iFormFile.CopyToAsync(stream);
                }

                bSuccess = await StorageHelper.UploadFileToStorage(iFormFile, filePath, _ConnectionString, _ContainerName);
                System.IO.File.Delete(filePath);

                //ProductImage productImage = new ProductImage
                //{
                //    ProductId = Id,
                //    ImageURL = $"{_Configuration.GetValue<string>("StorageContainerURL")}/{iFormFile.FileName}"
                //};

                //await _imageService.AddNewImageAsync(productImage);
            }
        }
    }
    return RedirectToAction("Index");
}

The part that really made it work was action="UploadFiles?Id=@Model.Id".
So basically, I am using the action to pass the values I want to my controller method.


text:
Q: CSS line-height on inline element is it possible to change the line-height within a paragraph?
for example, if i have a paragraph or div or label set at a particular font-size & line-height, and need the last part of that text to be smaller, i can do a span within the p or div and change the font-size just fine, but any adjustments to the line-height do not work.
i know i can just change the span to a block or inline-block, but then that wraps the text under that paragraph. i'd like to keep the text running inline if possible.
example @ https://jsfiddle.net/fye8bcjx/

p {
  font-size: 18px;
  line-height: 2;
}

span {
  font-size: 12px;
  line-height: 1;
}
---

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi.
  Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Curabitur sodales ligula in libero.

A: The line height on the block container, (the
 element in this case) gives the minimum line height for the lines it contains. So if you want the smaller text to be closer together, you need to avoid setting a large line-height for that. Instead, use the line-heights of the inline elements:

p {
  font-size: 18px;
  line-height: 0;
}

span.primary {
  line-height: 2;
}

span.secondary {
  font-size: 12px;
  line-height: 1;
}
---

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi.
  Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Curabitur sodales ligula in libero.

A: [UPDATE] This answer is indeed not solving OPs problem. I will look for another solution.
Yes, of course. Inline block is exactly for that. It has most of the properties of a block, but acts like an inline element.
p {
  font-size: 18px;
  line-height: 2;
}
span {
  font-size: 12px;
  line-height: 1;
  display: inline-block; /* <=== Inline block to the rescue. */
}


text:
Q: QGIS 3.10 open data source manager: How to load XYZ tiles I have a thunderforest background map for my project for which I had not given an API key.  I now want to publish some maps and need to add the key to remove the overlay.
The problem is that I can't figure out how to change the urls for the layers.  I think I loaded it originally from the data manager => XYZ Tile menus (this matches what I found searching) but in the current version of QGIS that option is not listed.
I assume I could hack the project file and add the key to the url there but I would rather do this properly!


text:
Q: Advanced filtering nested elements in TypeScript/JavaScript Given the following structure and data:
interface GrandChild {
    id: number,
    values: Array<string>,
}

interface Child {
    id: number,
    subItems: Array<GrandChild>
}

interface Foo {
    items: Array<Child>
}

const data: Foo = {
    items: [
        { id: 1, subItems: [ { id: 10, values: ['10', '100'] }, { id: 11, values: ['11', '110', '1100'] } ] },
        { id: 2, subItems: [ { id: 20, values: ['REMOVE', 'REMOVE'] }, { id: 21, values: ['REMOVE'] } ] },
        { id: 3, subItems: [ { id: 30, values: ['REMOVE'] }, { id: 31, values: ['REMOVE'] }, { id: 32, values: ['REMOVE', '32'] } ] },
    ]
};

How can I use the Array's methods (filter, map, some, etc.) to achieve the following result?
const expected: Foo = {
    items: [
        { id: 1, subItems: [ { id: 10, values: ['10', '100'] }, { id: 11, values: ['11', '110', '1100'] } ] },
        { id: 3, subItems: [ { id: 32, values: ['32'] } ] },
    ]
}

So far, I filtered the resulting data, removing the undesired elements, as following:
const filteredData: Foo = {
    ...data,
    items: data.items.map(item => ({
        ...item,
        subItems: item.subItems.map(subItem => ({
            ...subItem,
            values: subItem.values.filter(value => value !== 'REMOVE')
        }))
    }))
}

Resulting:
{
    items: [
        { id: 1, subItems: [ { id: 10, values: ['10', '100'] }, { id: 11, values: ['11', '110', '1100'] } ] },
        { id: 2, subItems: [ { id: 20, values: [] }, { id: 21, values: [] } ] },
        { id: 3, subItems: [ { id: 30, values: [] }, { id: 31, values: [] }, { id: 32, values: ['32'] } ] },
    ]
};

But, I cannot figure a way out to remove the empty subItems elements without looping through the result.
You can check online the above code here.

A: If you really want to do it just with filter and map, add a filter after each of your maps to remove subItems that have an empty values array and to remove items that have an empty subItems array:
const filteredData = {
    ...data,
    items: data.items
        .map((item) => ({
            ...item,
            subItems: item.subItems
                .map((subItem) => ({
                    ...subItem,
                    values: subItem.values.filter((value) => value !== "REMOVE"),
                }))
                .filter(({ values }) => values.length > 0), // ***
        }))
        .filter(({subItems}) => subItems.length > 0),       // ***
};

But:

*

*When I have map followed by filter, I always ask myself if the data is large enough that I should avoid making multiple passes through it.

*When I'm doing lots of nesting of map calls and such, I always ask myself if it would be clearer when reading the code later to use simpler, smaller loops.

Here's what you might do if answering "yes" to either or both of those questions:
const filteredData: Foo = {
    ...data,
    items: [],
};
for (const item of data.items) {
    const subItems: Array<GrandChild> = [];
    for (const subItem of item.subItems) {
        const values = subItem.values.filter((value) => value !== "REMOVE");
        if (values.length) {
            subItems.push({
                ...subItem,
                values,
            });
        }
    }
    if (subItems.length > 0) {
        filteredData.items.push({
            ...item,
            subItems,
        });
    }
}