Mathematical Induction Involving The Floor Function

Question: I need to prove the identity $\lfloor \sqrt{n}+\sqrt{n+1}\rfloor=\lfloor\sqrt{4n+2}\rfloor$ for all natural numbers $n$.
I wanted to use mathematical induction. The identity is true for $n=1$. Then, I assume $$\lfloor \sqrt{k}+\sqrt{k+1}\rfloor=\lfloor\sqrt{4k+2}\rfloor$$
and need to show that it is also true for $n=k+1$
$$\lfloor \sqrt{k+1}+\sqrt{k+2}\rfloor=\lfloor\sqrt{4k+6}\rfloor.$$
I thought about the inequality $m\leq\sqrt{4k+6}<m+1$ for some integer $m$, and the same for the LHS, but this doesn't seem to help and I don't have other ideas.
Comment: I wouldn't use induction for this. Hint: $$\sqrt{4n+2} = \sqrt{4\left(n+\frac{1}{2}\right)} =2\sqrt{n+\frac{1}{2}}$$
Comment: @ZubinMukerjee is it related to the fact that $\sqrt{n}+\sqrt{n+1}=\sqrt{n+1/2-1/2}+\sqrt{n+1/2+1/2}$ ?
Comment: Possibly related to [$\lfloor \sqrt n+\sqrt {n+1}+\sqrt{n+2}+\sqrt{n+3}+\sqrt{n+4}\rfloor=\lfloor\sqrt {25n+49}\rfloor$ is true?](https://math.stackexchange.com/questions/477108/lfloor-sqrt-n-sqrt-n1-sqrtn2-sqrtn3-sqrtn4-rfloor-lfloor-sqr)
Comment: Consider cases: $k^2\leq n<n+1<(k+1)^2$ and $k^2<n<n+1\leq(k+1)^2$.
Answer: The identity is true for $n = 0$, so consider $n \ge 1$. Also, let
$$m = \sqrt{n} + \sqrt{n + 1} \tag{1}\label{eq1A}$$
With $m \gt 0 \; \to \; m = \sqrt{m^2}$, we get
$$\begin{equation}\begin{aligned}
m & = \sqrt{\left(\sqrt{n} + \sqrt{n + 1}\right)^2} \\
& = \sqrt{n + 2\sqrt{n(n+1)} + n + 1} \\
& = \sqrt{2n + 1 + 2\sqrt{n(n+1)}}
\end{aligned}\end{equation}\tag{2}\label{eq2A}$$
We also have
$$\color{blue}{n} \lt \color{red}{\sqrt{n(n+1)}} \lt \color{green}{n + 1} \tag{3}\label{eq3A}$$
Thus, using this with \eqref{eq2A} results in
$$\begin{equation}\begin{aligned}
\sqrt{2n + 1 + 2(\color{blue}{n})} & \lt \sqrt{2n + 1 + 2\color{red}{\sqrt{n(n+1)}}} \lt \sqrt{2n + 1 + 2(\color{green}{n + 1})} \\
\sqrt{4n + 1} & \lt m \lt \sqrt{4n + 3}
\end{aligned}\end{equation}\tag{4}\label{eq4A}$$
Since natural numbers squared are congruent to $0$ modulo $4$ for even values and to $1$ modulo $4$ for odd values, neither $4n + 2$ or $4n + 3$ can be a perfect square. Thus, the largest perfect square less than or equal to values in \eqref{eq4A}, say it's $k^2$, must be less than or equal to $4n + 1$. This therefore gives
$$k \le \sqrt{4n + 1} \lt m \lt \sqrt{4n + 3} \lt k + 1 \tag{5}\label{eq5A}$$
Finally, we get that
$$k = \lfloor m \rfloor = \lfloor \sqrt{n} + \sqrt{n + 1} \rfloor = \lfloor \sqrt{4n + 2} \rfloor \tag{6}\label{eq6A}$$
Answer: Here is an (maybe) easier approach.
To prove $\lfloor\sqrt n+\sqrt {n+1}\rfloor=\lfloor\sqrt{4n+2}\rfloor$, and it's easy to notice that $\lfloor\sqrt{4n+2}\rfloor>\lfloor\sqrt n+\sqrt {n+1}\rfloor$ and that $\lfloor\sqrt{4n+2}\rfloor-\lfloor\sqrt n+\sqrt {n+1}\rfloor<1$, it suffices to prove that there's no integer between  $\sqrt n+\sqrt {n+1}$ and $\sqrt{4n+2}$.

We suppose that there is an integer $k$ between $\sqrt n+\sqrt {n+1}$ and $\sqrt{4n+2}$. Then
\begin{equation*}
\sqrt n+\sqrt {n+1}\leq k\leq\sqrt{4n+2}\\
n+n+1+2\sqrt{n(n+1)}\leq k^2\leq 4n+2
\end{equation*}
Since $\sqrt{n(n+1)}>n$, we have
\begin{equation*}
4n+1<k^2\leq4n+2
\end{equation*}
So the only possibility is $k^2=4n+2$. So $k=\sqrt{4n+2}=2\sqrt{n+1/2}=2\sqrt{(2n+1)/2}$. So
\begin{equation}
\sqrt{\frac{2n+1}{2}}=x\quad (1),\quad or\\
\sqrt{\frac{2n+1}{2}}=y+\frac{1}{2}\quad(2)
\end{equation}
for integers $x$ and $y$. Since $2n+1$ is an odd number, $(2n+1)/2$ cannot be an integer, so $(1)$ cannot be the case. For $(2)$, we notice that $(y+1/2)^2=(2y+1)^2/4$, which is an odd number over $4$. But $(2n+1)/2$ is an odd number over $2$, namely an even number over $4$, thus they can not be equal. We have the desired contradiction.


After Migration from MYSQL to Maria DB, query returns different cases for a result sets column names

Question: Were attempting to migrate mysql servers to MariaDB on a new AWS (amazon-linux-2) instance.
After creating a new instance and installing mariadb we've dumped the old database via
mysqldump ... --add-drop-database --triggers --routines --events
and imported into the new system using
mysql -u ... < dump.sql
The database has a table defined with mixture of uppercase and lower case columns e.g COLUMN1,COLUMN2,column3,etc
The original database, via mysqld -V, is mysqld  Ver 14.14 Distrib 5.5.62, for Linux (x86_64)
The new database is, via mysqld -V, is mysqld  Ver 15.1 Distrib 5.5.64-MariaDB, for Linux (x86_64)
installed with yum install mariadb-server
I've verified the schema's columns match for the table in question.
Querying the table with a select statement requesting the columns as lowercase.
(I've connected a local application and tested executing the same query against both database)
e.g. SELECT column1,column2,column3,etc from TABLE1 where ..
The results from the query from the original database respect the casing in the "select" statement, however in the new mariadb database, the query results match the column casing as defined in the table.
Is there a setting that can be applied that will cause the result column names to respect the casing in the "SELECT" statement, and therefore cause the result column names returned by the same select statement in both databases to match?
A testcase under MariaDB and Mysql
select cname from (select s.CName from (select 'A' as CNAME) s) t;

Under MariaDB the result set column casing matches the column from the intermediary temp table.

With the same query using the source mysql database,

The result set column name's casing matches the casing in the select statement
Answer: (Thanks for the complete test case.)
Different Optimizers:
mysql> explain
    -> select cname from (select s.CName from (select 'A' as CNAME) s) t;
+----+-------------+------------+--------+---------------+------+---------+------+------+----------------+
| id | select_type | table      | type   | possible_keys | key  | key_len | ref  | rows | Extra          |
+----+-------------+------------+--------+---------------+------+---------+------+------+----------------+
|  1 | PRIMARY     | <derived2> | system | NULL          | NULL | NULL    | NULL |    1 | NULL           |
|  2 | DERIVED     | <derived3> | system | NULL          | NULL | NULL    | NULL |    1 | NULL           |
|  3 | DERIVED     | NULL       | NULL   | NULL          | NULL | NULL    | NULL | NULL | No tables used |
+----+-------------+------------+--------+---------------+------+---------+------+------+----------------+
3 rows in set (0.01 sec)

mysql> select @@version;
+-----------------+
| @@version       |
+-----------------+
| 5.6.22-71.0-log |
+-----------------+

versus
mysql> explain
    -> select cname from (select s.CName from (select 'A' as CNAME) s) t;
+------+-------------+------------+--------+---------------+------+---------+------+------+----------------+
| id   | select_type | table      | type   | possible_keys | key  | key_len | ref  | rows | Extra          |
+------+-------------+------------+--------+---------------+------+---------+------+------+----------------+
|    1 | PRIMARY     | <derived3> | system | NULL          | NULL | NULL    | NULL |    1 |                |
|    3 | DERIVED     | NULL       | NULL   | NULL          | NULL | NULL    | NULL | NULL | No tables used |
+------+-------------+------------+--------+---------------+------+---------+------+------+----------------+
2 rows in set (0.00 sec)

mysql> select @@version;
+--------------------------------------+
| @@version                            |
+--------------------------------------+
| 10.4.1-MariaDB-1:10.4.1+maria~bionic |
+--------------------------------------+

Notice how MariaDB was smart enough to throw away one layer of your query.
(MySQL/MariaDB questions are better handled on stackoverflow.com or dba.stackexchange.com .)
But Oracle did catch up at some point:
mysql> select cname from (select s.CName from (select 'A' as CNAME) s) t;
+-------+
| CName |
+-------+
| A     |
+-------+
1 row in set (0.00 sec)

mysql> explain
    -> select cname from (select s.CName from (select 'A' as CNAME) s) t;
+----+-------------+------------+------------+--------+---------------+------+---------+------+------+----------+----------------+
| id | select_type | table      | partitions | type   | possible_keys | key  | key_len | ref  | rows | filtered | Extra          |
+----+-------------+------------+------------+--------+---------------+------+---------+------+------+----------+----------------+
|  1 | PRIMARY     | <derived3> | NULL       | system | NULL          | NULL | NULL    | NULL |    1 |   100.00 | NULL           |
|  3 | DERIVED     | NULL       | NULL       | NULL   | NULL          | NULL | NULL    | NULL | NULL |     NULL | No tables used |
+----+-------------+------------+------------+--------+---------------+------+---------+------+------+----------+----------------+
2 rows in set, 1 warning (0.00 sec)

mysql> select @@version;
+-----------+
| @@version |
+-----------+
| 8.0.17    |
+-----------+
1 row in set (0.00 sec)


New site appearing in folder structure after first hit on homepage?

Question: This one has me scratching my head.  I'm new to Drupal and am trying to restore a backup of a Drupal 7 site to a 3rd party hosting provider (hostgator as it happens.)
I purchased a business account and domain name to experiment with, and via their interface installed Drupal 7 in the public_html/myaccount subfolder.
I then restored the backup to that same folder.  Beneath myaccount is the typical drupal file structure-- includes, scripts, sites etc.
Beneath the sites folder were subfolders all and default, exactly as restored from the backup and a typical Drupal structure.  But that has changed.
When I browse to www.myhostedsite.com/myaccount I get an unstyled version of my site along with messages on the page that say things like:
Undefined index: highlighted in include() (line 126 of /home4/xyz/public_html/myaccount/modules/system/page.tpl.php).
...and to my surprise, under the sites folder there's now a new folder with the name of the old site, with js and css subfolders beneath it.
How did that appear, and would anyone know what I may be doing wrong?  I've noodled with .htaccess and settings.php values but am not sure I know what to look for in either location (though I did set the database connection correctly in settings.php, I'm pretty sure.)
Comment: Instead of `public_html/myaccount`, try putting the site in `public_html` only.
Comment: Thanks for the tip.  I did that, and unfortunately I have the exact same problem, even though my site is now directly under `public_html`
Answer: It would be good if you ask HostGator support guys to assist you through your problem. Got to Support and create a support ticket.
Comment: They're the next step, sure, but was wondering if anyone had seen this type of problem after restoring an existing site?


What is 1/3 of the width using Bootstrap system?

Question: If I define the code bellow, can I say that it is taking up 1/3 of the width of the whole container ?

   ...

Note: I did some research and taking 8 from 12 columns it should be 2/3 of the whole container
Answer: 12/3 = 4 so for a col that will take up 1/3 of the screen you need to use the
col-sm-04 class
Comment: To take up 1/3 of the width i need to use col-sm-4 and for 2/3 i need to use col-sm-8. isn't it ?


Using Jasmine.js Warning:boot is not defined

Question: I'm using Jasmine 1.3 with RequireJS and Grunt. I have a grunt task that does this:
jasmine: {
        app: {
            options: {
                outfile: "<%= config.testPath() %>/jasmine_runner/_SpecRunner.html",
                specs: ["<%= config.testPath() %>/specs/*Spec.js"],
                template: require('grunt-template-jasmine-requirejs'),
                templateOptions:{
                    requireConfigFile: ['<%= config.appPath() %>/js/config.js','<%= config.testPath() %>/specs/testConfig.js']
                }
            }
        }
    }

From the command line, I execute grunt jasmine which gives this error:
Running "jasmine:app" (jasmine) task
Warning: boot is not defined Use --force to continue.

Aborted due to warnings.

PhantomJS is set up to run it in the background. I have done extensive search on what the boot error means but haven't found anything.
Comment: see https://github.com/gruntjs/grunt-contrib-jasmine/pull/112
Comment: I am having the same problem. Been searching for two days to get it fixed.
Comment: @pelachile did you ever figure it out?
Answer: Try updating your version of grunt-contrib-jasmine.
Upgrading from 0.5.1 to 0.7.0 fixed this issue for me.
Here's my package.json for reference:
{
  "name": "...",
  "version": "0.1.0",
  "description": "...",
  "devDependencies": {
    "grunt": "^0.4.5",
    "matchdep": "^0.3.0",
    "grunt-contrib-concat": "^0.4.0",
    "grunt-contrib-uglify": "^0.5.0",
    "grunt-contrib-watch": "^0.6.1",
    "grunt-contrib-compass": "^0.9.0",
    "grunt-contrib-requirejs": "~0.4.4",
    "grunt-contrib-jasmine": "~0.7.0",
    "grunt-template-jasmine-requirejs": "~0.2.0"
  },
  ...
}


Gaussian primes when $p \equiv 1\pmod {4}$ and $x^2 +1$ factors

Question: In watching a video from Prof. Gross's algebra course, there were some remarks for which I would appreciate explanations.
They were in a discussion of Gaussian primes, and in the case where $p \equiv 1\pmod {4}$, and $(x^2 +1)$ factors into $(x - a)(x + a)$ where $a^2\equiv - 1\pmod {p}$.
The lecture went on to say that these two factors are related to two roots whose related ideals are $(p, i - a)$ and $(p, i + a)$.
He then went on to point out that these are not principal.
But here (at last) is my first question: he then said that these are both prime in $Z[i]$. How, please, can a non-principal ideal be considered prime? (I probably should know this, did try to look it up.)
Then he went on to show that there are only two elements of order $2$, $+1$ and $-1 \pmod {p}$ by the argument that $p\mid(a^2 - 1)$, and since $p$ is prime, $p\mid(a -1)$ or $p\mid(a + 1)$; thus $a = 1$ or $a = -1$.
My second question is where does $a^2 - 1$ come from, since, we are assuming $a^2 \equiv - 1\pmod {p}$.
Lastly, I was wondering how this leads to Fermat's Theorem where $p = a^2 + b^2$. I can see that since there are two roots above which are complex conjugates and there is the constraint on $p$, $p \equiv 1\pmod {4}$. But I would appreciate help pulling it together.
Thanks. These lectures were produced eight years ago, so although I would prefer it, there is no mechanism for me to go up after class, etc.
Comment: For the record, $(p, i-a)$ *is* a principal ideal of the Gaussian integers. Arturo's answer proves this, although he didn't explicitly state the fact. In fact, *every* ideal of the Gaussian integers is principal.
Answer: If $R$ is a ring, an ideal $P$ is a prime ideal if and only if:

$P\neq R$; and
If $A$ and $B$ are ideals of $R$, and $AB\subseteq P$, then $A\subseteq P$ or $B\subseteq P$.

In commutative rings, this definition is equivalent to:

Let $R$ be a commutative ring. An ideal $P$ or $R$ is a prime ideal if and only if

$P\neq R$; and
If $a,b\in R$ are such that $ab\in P$, then either $a\in P$ or $b\in P$.

The definition does not require the ideal $P$ to be principal.
To your second question: you are confusing the $a$ from the first part of the problem (which was a solution to $x^2\equiv -1\pmod{p}$), with a new variable $a$. Perhaps this will clarify it: if $r$ is an element that is of order $2$ modulo $p$, then $r^2\equiv 1\pmod{p}$, which means that $r^2-1\equiv 0\pmod{p}$, which means that $p|r^2-1 = (r-1)(r+1)$. He's just using $a$ to denote the putative element of order $2$.
So that means that if $r$ is of exponent 2 (that is, $r^2\equiv 1\pmod{p}$), then either $p|r-1$ or $p|r+1$. If $p|r-1$, then $r\equiv 1\pmod{p}$; if $p|r+1$, then $r\equiv -1\pmod{p}$. Thus, the only two elements of exponent $2$ modulo $p$ are $1$ and $-1$, as stated.
As far as the connection to the so-called "Fermat's Christmas Theorem", or "Fermat's Theorem on the Sums of Two Squares", which says that an odd prime $p$ can be written as a sum of two squares if and only if $p\equiv 1\pmod{4}$, we have the following:
If $p= a^2+b^2$, then since $a^2,b^2\equiv 0,1\pmod{4}$ and $p$ is an odd prime, we must have $p\equiv 1\pmod{4}$.
Conversely, if $p\equiv 1\pmod{4}$, then in $\mathbb{Z}[i]$ we have that $p$ is not prime; therefore, $p$ can be written as $(a+bi)(a-bi)$ for some Gaussian integers $a+bi, a-bi$, and therefore $a^2+b^2=p$.
Comment: @Andrew: If you "still didn't get it", then don't accept the answer! What are you still having trouble with? Again: suppose $b$ is an element of order two modulo $p$. "Order two" means that $b$ is not $1$ modulo $p$, but $b^2$ is $1$ modulo $p$. That is, $b^2\equiv1 \pmod{p}$. This is equivalent to $p|b^2-1=(b-1)(b+1)$. Since $p$ is prime, $p|(b-1)(b+1)$ implies $p|b-1$ or $p|b+1$. Since $b$ is not $1$ modulo $p$, $p$ does not divide $b-1$, so we conclude that $p|b+1$, so $b\equiv -1\pmod{p}$. So the only element of order $2$ modulo $p$ is $-1$, and the only elements of *exponent* $p$ are 1,-1
Comment: @ArturoMagidinFixed the Fermat. Also I was thinking what you said about the usage of the "a"s and actually changed it to a "b" in my notes, but still didn't get it. Thanks for answering.
Comment: @ArturoMagidinSorry, I was referring to the fact that even though I thought "a" was different from the "a" earlier in the lecture, I still - at that time - did not get the point. From your answer I did. My apologies for you to have to write further.


Spring Security CSRF 405 Method POST not supported inspite of sending CSRF token in form

Question: I am using Spring framework version 4.3.5.RELEASE.
Spring security version is 4.2.2.RELEASE.
I am facing a strange issue related to CSRF. Whenever I submit a form (from a JSP file), Sometimes it works fine, the form gets submitted without error but sometimes after submitting the form, it shows Http Status 405 ? Method not supported. I have included csrf token too, both in hidden field as well as appended it as query string in form's action's tag.
Here is an example POST form from my project:
<code> <form:form class="form-horizontal" method="POST" modelAttribute="dealerVisit" enctype="multipart/form-data"
        action="http://localhost:8080/update/edit.html?${_csrf.parameterName}=${_csrf.token}">

        <input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}">
</form:form>
</code>
Here is the controller where I am submitting the above form:
<code>@RequestMapping(value = "/update/edit.html", method = RequestMethod.POST)
    public String saveEdit(ModelMap map, @Valid @ModelAttribute(MODEL_KEY) DealerVisitVO dealerVisitVO, BindingResult result,
            @RequestParam(required = false, name="followup") Boolean followup) {
//my codes here
}
</code>
The problem is coming random. It works sometimes and sometimes it doesnt. With no change in code or form.  Disabling the CSRF is not a possible solution as this is 1 requirement of my client.
Please help if anyone was able to solve.
Comment: Can you provide a better explanation of why you think this has something to do with CSRF.  A response of HTTP 405 does not imply a CSRF problem.  405 simply means that the HTTP method (POST, GET, etc) is not supported by the server for this resource. See https://tools.ietf.org/html/rfc7231#section-6.5.5.
Comment: If you could see my form's `method` attribute, it is set to `POST`.
And the same `POST` type is specified over my controller's `RequestMapping`.

Also, when I disable CSRF, the issue never comes up. Hence, its related to CSRF. Also, before posting the question, I have searched much about this problem and everything points to CSRF issue with Spring security.
Comment: Am facing the same issue..Hope for a permanent solution except disabling CSRF
Comment: May be csrf token is expired if client did not make the call on time. Debug it. :-)
Answer: In spring security, CSRF token get generated per session basis and remains the same until your session is not expired. This is one case you are getting 405 method not allowed because your session is expiring on some interval (you may check that). Secondly, if you're using spring's form then there is no need to put token in hidden field explicitly, spring does it by default also no need to put it into the query string. Your code should be like this...
<code><form:form class="form-horizontal" method="POST" modelAttribute="dealerVisit" enctype="multipart/form-data" action="http://localhost:8080/update/edit.html">

     <!-- Spring will add by default -->
    <!-- <input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"> -->
</code>
Comment: How do you handle situations where the token expires ans show custom error page?


make errors when compiling PHP 5.2.6 from source (Fedora 12)

Question: I have already installed Apache 2.2.14, PHP 5.3.1 (using mod_fastcgi) and MySQL 5.1.41 - this is working great, but I am now trying to install PHP 5.2.6 (also using mod_fastcgi) so I can use it for testing on other virtualhosts as my host uses this version.
I followed the same procedure in CentOS 5, and earlier versions of Fedora, and it worked fine. I have installed all the dependencies I need. "configure" worked fine, here is my configure command...
./configure \
--prefix=/usr/local/php-5.2.6 \
--enable-bcmath \
--with-bz2 \
--enable-calendar \
--with-curl \
--with-curlwrappers \
--enable-exif \
--enable-ftp \
--with-gd \
--enable-gd-native-ttf \
--enable-gd-jis-conv \
--with-gettext \
--with-gmp \
--with-imagick \
--with-imap \
--with-imap-ssl \
--with-kerberos \
--with-ldap \
--enable-libxml \
--enable-mbstring \
--with-mcrypt \
--with-mhash \
--with-mysql \
--with-mysqli \
--with-openssl \
--enable-pdo \
--with-pdo-mysql \
--enable-soap \
--enable-sockets \
--with-tidy \
--with-xmlrpc \
--with-xsl \
--enable-zip \
--with-zlib

But I seem to be getting errors when running "make"... there are alot of errors so I have shown the first and last bit (had to log it to a text file it was so long). I assume I need some compile flags/options to get this to work.
/bin/sh /home/luke/Downloads/php-5.2.6/libtool --silent --preserve-dup-deps --mode=compile gcc  -Iext/libxml/ -I/home/luke/Downloads/php-5.2.6/ext/libxml/ -DPHP_ATOM_INC -I/home/luke/Downloads/php-5.2.6/include -I/home/luke/Downloads/php-5.2.6/main -I/home/luke/Downloads/php-5.2.6 -I/usr/include/libxml2 -I/home/luke/Downloads/php-5.2.6/ext/date/lib -I/usr/include/ImageMagick -I/usr/include/imap -I/home/luke/Downloads/php-5.2.6/ext/mbstring/oniguruma -I/home/luke/Downloads/php-5.2.6/ext/mbstring/libmbfl -I/home/luke/Downloads/php-5.2.6/ext/mbstring/libmbfl/mbfl -I/usr/include/mysql -I/home/luke/Downloads/php-5.2.6/TSRM -I/home/luke/Downloads/php-5.2.6/Zend    -I/usr/include -g -O2  -c /home/luke/Downloads/php-5.2.6/ext/libxml/libxml.c -o ext/libxml/libxml.lo
In file included from /home/luke/Downloads/php-5.2.6/Zend/zend.h:236,
from /home/luke/Downloads/php-5.2.6/main/php.h:34,
from /home/luke/Downloads/php-5.2.6/ext/libxml/libxml.c:28:
/home/luke/Downloads/php-5.2.6/Zend/zend_alloc.h:34: error: expected specifier-qualifier-list before 'uint'
/home/luke/Downloads/php-5.2.6/Zend/zend_alloc.h:41: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'char'
/home/luke/Downloads/php-5.2.6/Zend/zend_alloc.h:43: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'void'
/home/luke/Downloads/php-5.2.6/Zend/zend_alloc.h:44: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'void'[/code]

...
/home/luke/Downloads/php-5.2.6/Zend/zend_hash.h:339: note: previous implicit declaration of 'strtol' was here
In file included from /home/luke/Downloads/php-5.2.6/main/php.h:234,
from /home/luke/Downloads/php-5.2.6/ext/libxml/libxml.c:28:
/home/luke/Downloads/php-5.2.6/main/snprintf.h:82: error: expected declaration specifiers or '...' before 'va_list'
/home/luke/Downloads/php-5.2.6/main/snprintf.h:84: error: expected declaration specifiers or '...' before 'va_list'
In file included from /home/luke/Downloads/php-5.2.6/main/php.h:236,
from /home/luke/Downloads/php-5.2.6/ext/libxml/libxml.c:28:
/home/luke/Downloads/php-5.2.6/main/spprintf.h:42: error: expected declaration specifiers or '...' before 'va_list'
In file included from /home/luke/Downloads/php-5.2.6/ext/libxml/libxml.c:28:
/home/luke/Downloads/php-5.2.6/main/php.h:293: error: expected declaration specifiers or '...' before 'va_list'
In file included from /home/luke/Downloads/php-5.2.6/main/php.h:383,
from /home/luke/Downloads/php-5.2.6/ext/libxml/libxml.c:28:
/home/luke/Downloads/php-5.2.6/main/php_output.h:100: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'extern'
In file included from /home/luke/Downloads/php-5.2.6/main/fopen_wrappers.h:25,
from /home/luke/Downloads/php-5.2.6/main/php.h:401,
from /home/luke/Downloads/php-5.2.6/ext/libxml/libxml.c:28:
/home/luke/Downloads/php-5.2.6/main/php_globals.h:33: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'struct'
In file included from /home/luke/Downloads/php-5.2.6/main/php.h:405,
from /home/luke/Downloads/php-5.2.6/ext/libxml/libxml.c:28:
/home/luke/Downloads/php-5.2.6/TSRM/tsrm_virtual_cwd.h:162: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
In file included from /home/luke/Downloads/php-5.2.6/main/php.h:407,
from /home/luke/Downloads/php-5.2.6/ext/libxml/libxml.c:28:
/home/luke/Downloads/php-5.2.6/Zend/zend_constants.h:58: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'int'
/home/luke/Downloads/php-5.2.6/Zend/zend_constants.h:59: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'int'
/home/luke/Downloads/php-5.2.6/Zend/zend_constants.h:60: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'void'
/home/luke/Downloads/php-5.2.6/Zend/zend_constants.h:61: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'void'
/home/luke/Downloads/php-5.2.6/Zend/zend_constants.h:62: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'void'
/home/luke/Downloads/php-5.2.6/Zend/zend_constants.h:63: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'void'
/home/luke/Downloads/php-5.2.6/Zend/zend_constants.h:64: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'int'
In file included from /home/luke/Downloads/php-5.2.6/main/php.h:414,
from /home/luke/Downloads/php-5.2.6/ext/libxml/libxml.c:28:
/home/luke/Downloads/php-5.2.6/main/php_reentrancy.h:57: error: expected ')' before '*' token
make: *** [ext/libxml/libxml.lo] Error 1

I have tried several times now, deleting the folder and files and starting from scratch with a fresh download, still the same ****. I'm sure I've seen this error before but I just can't remember what I did as I always forget to write things down - I usually find hours of frustration is solved by something silly. I got PHP 5.2.12 to compile fine, but ideally I would like to use PHP 5.2.6 to emulate the web host's environment.
I'm not sure if this will help you help me.
[root@localhost php-5.2.6]# gcc -v
Using built-in specs.
Target: i686-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-220.127.116.11/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch=i686 --build=i686-redhat-linux
Thread model: posix
gcc version 4.4.2 20091222 (Red Hat 4.4.2-20) (GCC)

Do I need to provide any more information that could help?
Comment: Have you looked at the configure log?  Sometimes there are errors with the configuration that can cause compilation errors.
Comment: Just had a look, but it's a huge file and most of it eludes me. There isn't anything that appears to shed any light on why this wont make.

I wonder if it is because I need to pass some compile settings to it somehow, or install compatibility libraries/headers/packages for it to use instead.

I'm just totally stumped.
Answer: The short answer is that the older PHP version probably does something dumb that GCC 4.4 can't handle.
Try installing gcc 4.3 and then using:
CC=gcc-4.3 make

Comment: Thanks for this, I will give 4.3.4 a try. I found this article to help me do it. http://www.mjmwired.net/resources/mjm-fedora-gcc.html
Comment: Well when compiling with 4.3.4 it only moans about errors with openssl, even if I configure it with [--with-openssl=/usr] or just [--with-openssl].

I'm sick of this, I've wasted days of time trying to prepare a testing enviroment the same as my host and I would be better off just developing and testing with php 5.3.1 doing another bout of testing directly on my host. Thanks for the help anyway.
Comment: I noticed I had version 1.0.0-beta4 of openssl installed. So I decided to install the latest stable 0.9.x of openssl and use that in the configure command. It has finally compiled successfully, but now I need to get it to work with fastcgi without timing out.
Answer: Careful, don't make the same mistake I did!
With PHP 5.2 it appears I have to also use these configure options [--enable-fastcgi] and [--enable-force-cgi-redirect] for it to work with mod_fastcgi. If you don't use those options with PHP 5.2 you will just get a server 500 error and an unhelpful error message in the error.log!
For some reason PHP 5.3 doesn't have those options, and I based my ./configure options for 5.2 on the ones I used for 5.3.
Thanks for your help LapTop006, when I find time I need to write all this down in a tutorial.
Answer: Make sure that you run
phpize

before any ./configure script (this includes other extensions for PHP).


PHP File Copy() Not working on IIS 6

Question: I have the following code that attempts to take a users form input of a file, and upload it to the webserver.
This code does work on a Apache server, however I'm now trying to get the same code working on my Windows IIS 6 web server, which has PHP (Version 5.2.3) installed and working.  I have set the PHP.INI file so that
file_uploads = On
upload_tmp_dir = "C:\Temp"
My form is
<form method="POST" action="do_upload.php" enctype="multipart/form-data">
    <input type="file" name="img1" size="30">
    <input type="submit" name="BtnUpload" value="Click To Upload Now">
</form>

My PHP code to do the upload is
$abpath = "C:\MyWebs\Website1\httdocs\images";

@copy($img1, "$abpath/$img1_name") or $log .= "Couldn't copy image 1 to server";

if (file_exists("$abpath/$img1_name"))
{
  $log .= "File 1 was uploaded";
}
else
{
  $log .= "File 1 is not an image";
}

For some reason when I check the value of $img1 e.g echo $img1; it is empty. Therefore I tried to get the file using $_FILES['img1']['name'].  This worked fine, but still I couldn't upload any files
Any ideas why this is happening.
Comment: Remove the error suppression operator (`@`) and make sure you're displaying all the errors by adding `ini_set('display_errors',1);
 error_reporting(E_ALL);` to the top of your script.
Comment: Because `$img1` and `$img1_name` hasn't yet been defined.
Comment: Yes I'm getting Notice: Undefined variable: img1_name.  But why do I get this on IIS but not Apache ?
Comment: Why no errors on Apache, that I couldn't say (probably error reporting is OFF). See [**Marc B's answer**](http://stackoverflow.com/a/19729140/1415724) below, which will give you a better insight. I was going to suggest the same thing, but he beat me to it. @Tommo1977
Comment: Do consult the manual on the [`move_uploaded_file()`](http://php.net/manual/en/function.move-uploaded-file.php) function for more information. @Tommo1977
Answer: Your code should be:
move_uploaded_file($_FILES['img1']['tmp_name'], "$abpath/$img1_name");

Don't copy() uploaded files. There are a few edge cases where an uploaded file can be tampered with, which is why move_uploaded_file() exists - it checks for those particular types of tampering.
As well, be VERY careful with how you create your filenames when processing the upload. If you directly use ANYTHING provided in $_FILES as part of the destination path/name for the file, you are opening bad security holes on your server, and a malicious user can exploit that to scribble a file anywhere they want on your server.
Comment: general tip: on windows you can still use `/` as the directory separator in PHP. PHP will auto-convert to backslashes for you, and it saves you having to double-backslash everything. `c:/mywebs/foo/bar` works just fine.
Comment: In your example above, am I going to be able to access "$abpath/$img1_name" ?
Comment: Probably. it would appear $abpath is inside your document root. But since you don't say what you mean by "access", no way to answer properly.
Comment: Thanks, changing my code to move_uploaded_file($_FILES['img1']['tmp_name'], "$abpath\\".$_FILES['img1']['name']) or $log .= "Couldn't copy image 1 to server"; worked.

PHP File Copy() Not working on IIS 6


Can I play a regular guitar as a Lap Steel by replacing its strings with steel strings?

Question: Is there any significant difference other then strings between "regular acoustic guitar" and an "acoustic lap steel guitar"?
Is replacing the strings with steel strings enough?
Answer: A purpose-built lap steel guitar has its strings typically much further from the fretboard than a conventional guitar. So much so, that it's extremely difficult to press the string to the fretboard: the frets are just for reference. Contact with the slide is how you get pitch.
Having said that, you can certainly get close to a lap steel sound using a conventional guitar. You'll need a precise touch, to get solid enough contact with the strings, without pressing onto the frets.
Lap steel players use open chord tunings such as D-G-D-G-B-D. If you intend to leave a conventional guitar in such a tuning for long periods, then it's wise to buy a set of strings designed for that tuning.
Conventional non-classical acoustic guitars already have steel strings. Do not under any circumstances fit steel strings to a guitar designed for nylon strings -- if the tension doesn't snap your guitar's neck, it will certainly bend it beyond repair. Guitars designed for steel strings have a metal truss rod providing the strength it needs.
Comment: Correct.  There's a handy device that will assist in this project, a "nut extender":
http://www.amazon.com/Golden-Gate-F-3303-Extension-Stevens/dp/B0002Z3N8O/ref=sr_1_1?ie=UTF8&qid=1317427258&sr=8-1
raises the strings about 1/8" and thus prevents whacking the frets with your slide.
For playing in the "lap" position, most pickers use a "steel" rather than a bottleneck-type slide.
The sort of thing used to play a steel guitar.
Comment: The action of my acoustic is naturally high enough that I can play steel on it, without a nut extender. Not that this is how it should be.

Be aware that you can get something playable like this, but for what we normally think of for this style, you really want something with a resonator.
Answer: Different instrument groupings going on here:

Spanish-style acoustic guitar
Spanish-style electric guitar
Lap-style acoustic guitar
Lap-style electric guitar
Resonator guitar (aka TIFKAD, The Instrument Formerly Known As Dobro)

You can, by getting a nut extender and tuning to an open tuning, turn a spanish style electric or acoustic guitar into a lap-style guitar. There are a number of differences in purpose-built lap-style instruments that you will want to consider. Primarily, the string spacing and height of spanish guitars are there to fit in the hand, and that is not what you want when playing lap steel. As a stop-gap until you get what you want, it works.
If you're wanting to play lap steel, that's about a good stopping point. If you're wanting to play resonator style, like Jerry Douglas and Brother Oswald and Mike Auldridge, throwing on a nut extender and tuning GBDGBD is only going to get you so far. The resonator setup was invented by the Dopyera Brothers (Do-Bros, thus dobro) in order to amplify, and amplifying an instrument changes the charactaristics of the tone. You will not get the bluegrass player sound without having a resonator instrument. You can get a sound that works for Hawaiian music and might have other uses and be fun, but it isn't the sound you probably want.
Answer: Yes. There are differences. Lap steel types need specially made strings so the 'friction' of tone bar does not damage the strings. If applied on a conventional guitar, the tension easily bend the neck and take it beyond repair.


Definition of correspondence

Question: A one-to-one correspondence is an alternative name for a bijection between two sets, but to what does the term 'correspondence' alone refer? As far as I can see, it seems to be another term for 'relation', but I think there must be a difference.
Comment: Correspondences come up routinely in mathematical economics.  One generally calls a map $f:X \to 2^Y$ a 'correspondence' or a set-valued map.  These are important, say, in optimization where the set of arguments that maximize a given objective function will generally not be a function, but rather a correspondence.
Comment: By use (though perhaps not by actual definition), a 1-1 correspondence is a bijection, and from here I deduce that correspondence from $\,A\,$ to $\,B\,$ must be an onto function from $\,A\,$ to $\,B\,$ (the order here is important)...I think.
Answer: Not that I ever use this regularly or believe everything that is written in it, The encyclopedic Dictionary of mathematics agrees with your guess. There may not have to be a difference after all: there are lots of synonymous words in mathematics.
What I read leads me to believe that "correspondence" is an older and dustier term for "relation".
If you asked me the answer without the benefit of resources, I would have told you my impression was that it is a synonym for "1-1 correspondence" and that the 1-1 part was usually added for emphasis.
Comment: @user50229 Yeah, but as we know well, mathematics does *not* always apply terminological conventions consistently or well. It may be that in history different people have used "correspondence" to mean "relation", "function", "onto relation", "onto function" and "bijection" or something entirely different.
Comment: @user50229 I'm not sure about the history of "1-1" either. Certainly today we just think that it sends distinct things to distinct things... but it seems plausible this could also be used in the sense that "everything is paired up between the two sets", and then onto would be implied, and functionality would be implied.
Comment: It's strange though that if correspondence is just a relation, that adding the qualification '1-1' alone turns this object into a bijection, as there was no suggestion of even being a function in the term 'correspondence'.
Comment: Good points, thanks
Answer: Correspondence is a synonim for the notion of relation. On the other hand, a one-to-one function (a subfamily of relations) is a synonim of injective function. Then, "one-to-one correspondence" literaly would mean an injective relation. However when we use it, we always mean a bijection.
Therefore, even though by "correspondence" we mean relation, when we use that term together with "one-to-one" we get a bijection.
As an analogy, take the derivative denoted as $\frac{dy}{dx}$. Even though it is represented as a quotion of two differentials, it is just a notation for a new notion (see this).

Definition of correspondence


Is the invariant subspace problem open for invertible maps?

Question: Let $T: H \rightarrow H$ be a bounded linear operator with bounded inverse on the separable complex Hilbert space. Does $T$ preserve a closed proper non-trival invariant subspace?
I'm aware the question is (famously) open for bounded linear maps, and of partial results, but no survey (or Tao's blog, etc) seem to address the invertible case.
If it is open, does a positive or negative answer imply the answer in the non-invertible case?
Comment: @TheoBendit Great contribution
Comment: Presumably, you want $T$ to preserve a *proper non-trivial* subspace.
Answer: The invertible case is indeed equivalent to the full (possibly non-invertible) problem.
Firstly, if $T$ is invertible and has a proper non-trivial invariant subspace, then this also answers the full conjecture in the negative. So, a negative answer in the invertible case leads to a negative answer in the full case.
Now, suppose $T$ has no proper non-trivial invariant subspace. Note that the kernel and range of $T$ are both invariant subspaces, and hence must be $\{0\}$ or $H$. If the range is $\{0\}$ or the kernel is $H$, then $T = 0$, in which case it leaves every subspace invariant! Hence, the range is $H$ and the kernel is $\{0\}$, implying that $T$ is invertible (boundedly so, by the bounded inverse theorem).
Therefore, a positive answer in the invertible case leads to a positive answer in the full problem. The invertible case is equivalent to the full problem.
Comment: The range may not be closed, though.
Comment: @EricWofsey Is that a requirement?
Comment: Yes, the problem is trivial if you don't require the invariant subspaces to be closed.
Comment: So just to be clear, maybe this is a more important condition for making the problem nontrivial than the above condition that the preserved subspace is nontrivial?
Comment: I'm afraid I still don't really understand where properness comes in. Again, apologies for my confusion
Comment: @Ryan Every linear operator leaves the entire space invariant (and it has nothing to do with linearity). Simply because $T : H \to H$, we know that $T(H) \subseteq H$. That is, $H$ is invariant under $T$.
Comment: @TheoBendit I think Ryan is being flippant


Aggregation operation to modify the key of a property from a subdocument of documents

Question: I have in mongo db a collection with documents like this:
{
    "prop1": "val1",
    "prop2": {
        "prop21": {
            "toBeChanged1_xyz": "val2",
            "toBeChanged2_zyx": "val3",
        },
        "prop22": {
            "whatever": "something"
        }
    }
}

Trying to create aggregation operation in Java Spring to remove from the keys of prop21's properties the substring after _. This if what I need to have:
{
    "prop1": "val1",
    "prop2": {
        "prop21": {
            "toBeChanged1": "val2",
            "toBeChanged2": "val3",
        },
        "prop22": {
            "whatever": "something"
        }
    }
}

Tried something like this:
List<AggregationOperation> operations = new ArrayList<AggregationOperation>();
        operations.add( Aggregation.project( "code" ).and( "code" ).minus( "_"+"$entityType" ).as( "newId" ));

It didn't worked, of course. I have no idea how can it be done or can it be done easier in other ways.
Answer: You should update your structure to below.
{
  "prop1": "val1",
  "prop2": [
    {
      "prop": "prop21",
      "value": [
        {
          "prop": "toBeChanged1_xyz",
          "value": "val2"
        },
        {
          "prop": "toBeChanged2_zyx",
          "value": "val3"
        }
      ]
    },
    {
      "prop": "prop22",
      "value": [
        {
          "prop": "whatever",
          "value": "something"
        }
      ]
    }
  ]
}

You can try below query in 3.4. The query will iterate over property elements and locate prop2 and $split to modify the property name.
[
  {
    "$addFields": {
      "prop2": {
        "$map": {
          "input": "$prop2",
          "as": "prop_2",
          "in": {
            "prop": "$$prop_2.prop",
            "value": {
              "$cond": [
                {
                  "$eq": [
                    "$$prop_2.prop",
                    "prop21"
                  ]
                },
                {
                  "$map": {
                    "input": "$$prop_2.value",
                    "as": "prop_21",
                    "in": {
                      "prop": {
                        "$arrayElemAt": [
                          {
                            "$split": [
                              "$$prop_21.prop",
                              "_"
                            ]
                          },
                          0
                        ]
                      },
                      "value": "$$prop_21.value"
                    }
                  }
                },
                "$$prop_2.value"
              ]
            }
          }
        }
      }
    }
  }
]

You can use the below query if you cant modify the structure from 3.4.4 version.
The query uses $arrayToObject and $objectToArray operator to modify the documents to above structure with same logic to modify the property name.
[
  {
    "$addFields": {
      "prop2": {
        "$arrayToObject": {
          "$map": {
            "input": {
              "$objectToArray": "$prop2"
            },
            "as": "prop_2",
            "in": {
              "k": "$$prop_2.k",
              "v": {
                "$cond": [
                  {
                    "$eq": [
                      "$$prop_2.k",
                      "prop21"
                    ]
                  },
                  {
                    "$arrayToObject": {
                      "$map": {
                        "input": {
                          "$objectToArray": "$$prop_2.v"
                        },
                        "as": "prop_21",
                        "in": {
                          "k": {
                            "$arrayElemAt": [
                              {
                                "$split": [
                                  "$$prop_21.k",
                                  "_"
                                ]
                              },
                              0
                            ]
                          },
                          "v": "$$prop_21.v"
                        }
                      }
                    }
                  },
                  "$$prop_2.v"
                ]
              }
            }
          }
        }
      }
    }
  }
]


SQL Server Join with Wildcard and stop on first match

Question:     IF OBJECT_ID('tempdb..#TABLE1') IS NOT NULL DROP TABLE #TABLE1
    IF OBJECT_ID('tempdb..#TABLE2') IS NOT NULL DROP TABLE #TABLE2

    CREATE TABLE #TABLE1
    (
        CODE_NAME_T1 NVARCHAR(20)
    )

    CREATE TABLE #TABLE2
    (
        CODE_NAME_T2 NVARCHAR(20)
    )

    INSERT INTO #TABLE1(CODE_NAME_T1)
    VALUES             ('BBX123')
                      ,('BC/230')
                      ,('1AC030')
                      ,('BB01BC')

    INSERT INTO #TABLE2(CODE_NAME_T2)
    VALUES             ('BB')
                      ,('BC')

    SELECT T1.CODE_NAME_T1, T2.CODE_NAME_T2
    FROM #TABLE1 T1
    LEFT OUTER JOIN #TABLE2 T2
    ON T1.CODE_NAME_T1 LIKE '%' + T2.CODE_NAME_T2 + '%'

    IF OBJECT_ID('tempdb..#TABLE1') IS NOT NULL DROP TABLE #TABLE1
    IF OBJECT_ID('tempdb..#TABLE2') IS NOT NULL DROP TABLE #TABLE2

RESULT
CODE_NAME_T1   |    CODE_NAME_T2
---------------|-----------------
BBX123         |     BB
BC/230         |     BC
1AC030         |     NULL
BB01BC         |     BB
BB01BC         |     BC

Hi, in above code I am using wildcard in join.  The problem I am facing that in result "BB01BC" row is appearing twice as it contains both "BB" and "BC" characters.  Is there way that it only appears once.  So if "BB" is matched in "BB01BC" then it should not look for "BC" in it?  Basically only doing one match/lookup and not doing more match/lookup?
Comment: Do you not care about the data in the `CODE_NAME_T2` column at all?  If the data doesn't matter, you can remove the column from the results and do a `SELECT DISTINCT`.  If you *do* care about the values, what one should it pick as the "first" value?  Are you intending for the value returned to always be *alphabetically* the first matching result?
Comment: I need both columns and want only the first match.  Don't has to be alphabetically.
Answer: Here is one method using OUTER APPLY:
SELECT T1.CODE_NAME_T1, T2.CODE_NAME_T2
FROM #TABLE1 T1 OUTER APPLY
     (SELECT TOP 1 t2.*
      FROM #TABLE2 T2
      WHERE T1.CODE_NAME_T1 LIKE '%' + T2.CODE_NAME_T2 + '%'
     ) T2;

Note:  You almost always want an ORDER BY when using TOP.  You don't seem particularly interested in which row from T2 matches, you just want one of them.  If you have a particular priority, then add ORDER BY for prioritization.
Comment: Thanks Gordon.  This what I was looking for :)
Answer: This seems to work for your situation:
SELECT T1.CODE_NAME_T1, (SELECT TOP 1 T2.CODE_NAME_T2 from #TABLE2 T2 where T1.CODE_NAME_T1 LIKE '%' || T2.CODE_NAME_T2 || '%')
    FROM #TABLE1 T1


Stepwise versus L2 regularized logistic regression: dataset-specific performance

Question: I have two data sets from different collections. The second data set is smaller. They were both analyzed with the same methods in order to derive feature sets of 10-30 features each. Each feature set was produced the same way for both data sets.
Then, I run many Logistic Regressions to fit both data sets with all feature sets. Additionally, all of the experiments were repeated with both L2 regularized and Stepwise Logistic Regression. The observation is that the best fitting for the first data set was done with Stepwise Logistic Regression, while for the second one was done with L2 regularized Logistic Regression. This is quite consistent, i.e. for all 15 experiments on each dataset.
Why did each method perform better on either data-set? May this have to do with particular characteristics of each data-set?
For example, I know that L2 deals better with multicollinearity and lower ratio of observations/variables. Can I assume that L2 performed better on 2nd data set because it had multicollinearity? Then, L2 does not zero out any coefficients, which Stepwise in fact does. Can I say that Stepwise did better on 1st data set because it may have had some too noisy features that needed to be zeroed out?
Comment: Hi lefterav; your question is quite broad. Are you able to edit to ask more specific questions that could be answered in a few paragraphs?
Comment: Does it seem better now? I have seen even more general questions asking for a broad comparison between L1 and L2. I practically ask for a comparison between L2 and stepwise LogReg applicable to my case.
Answer: What you observed follows from statistical theory and is completely expected.  And "best fitting on the first dataset" is a by-product of overfitting and is not really interesting.
Why the need to reduce the number of features to 10-30?  Why is parsimony good?  Why not just fit an L2 penalized model with all features?
Comment: As a side comment you would have had to reduce features to 10-30 not using $Y$ for your approach to work.  Stepwise feature selection without penalization has been proven to perform badly.  Penalized maximum likelihood estimation (e.g., L2 shrinkage) intentionally underfits the data at hand so that there is no overfitting of future validation data. Well-fitting the initial dataset can be a bad idea.  Consider 9 features on 100 subjects yielding an $R^2$ of 0.4.  Randomly removing 90 subjects and refitting will result in an $R^2$ of 1.0 on the training data but near 0.0 on new data.
Comment: Dear Prof Harell,

I would appreciate a more clear explanation or pointers to the theory that explain why the observation is completely expected.

Best fitting on the first data-set also has the best fit on a cross-validation over all available data, so I am not sure if I can consider this overfitting.

We have reduced the number of features to 10-30 because observation shows that (a) when adding more features, results go down (b) when running with all features our classifier script fails with a "not enough examples with so many attributes" error


Modifying bulk user account attributes in AD

Question: We created around 1,000 users but the first name, last name, display name, and logon name are all in uppercase. Now we are having a hard time changing all of these manually. Is there a way to we can modify all account properties to make name and display name capitalize only the first letter while also making logon name all lowercase?
Comment: Yup, pull each object in powershell and then for each relevant attribute, output it to a string variable, convert it to upper / lower as required, then feed the new strings back in.  What problems are you having in your script to do this?
Comment: OK, you'll need to find what we call a 'system administrator' and get them to help you.
Comment: It was done by someone manually.
Comment: No i wl do myself
Comment: ServerFault is not a script writing service.  However, if you can make a good faith attempt on your own, do a little research, and run into a problem we'll be happy to assist you.
Answer: Here's a basic conversion example for just the GivenName (First Name) attribute.  You can use this to help you do the rest.
<code>$firstname = (get-aduser -identity ACCOUNTNAME).givenname
$newfirstname = $firstname.Substring(0,1)+$firstname.Substring(1).toLower()
set-aduser ACCOUNTNAME -givenname $newfirstname
</code>
Comment: Lets try this, powershell?
Comment: Yes, it's powershell.
Comment: What about logon name? actually its all caps, first, name last name, display name, logon name
Comment: Givenname, surname, displayname, samaccountname
Comment: may be after modifying the display name it will help

Get-ADUser -SearchBase 'ou=users,dc=domain,dc=com' -Filter * -Properties firstname | % {Set-ADUser -Identity $_ -firstname $_.name}
Comment: that doesn't works
Comment: `-firstname` is not a valid parameter for `Set-ADUser`.  It's `-givenname`
Answer: Here is the sudocode you could use. Sudocode means a basic idea of the logic in English, you'll need to do some research and lookup commands but this should help you get started
<code># Get List of employees and their attributes using Get-ADUser
# Loop over that list of employees using ForEach-Object
## Pull out information about the attributes you need
## Change the case of the values
## Edit the attributes using Set-ADUser (Hint use "$_ | " to make this easier)
# EndLoop
</code>
If you post an attempt at writing code based on this sudocode I'm sure someone would be able to help you fill in the gaps.


Erro ao criar arquivo Makefile

Question: Quando estou tentando usar o arquivo Makefile com o seguinte conteudo:
all: teste
teste: arp_discover.o arp_poisoning.o
        gcc -o teste arp_discover.o arp_poisoning.o
arp_discover.o: arp_discover.c arp_discover.h
        gcc -o arp_discover.o -c arp_discover.c -W -lpthread -Wall
arp_poisoning.o: arp_poisoning.c
        gcc -o arp_poisoning.o -c arp_poisoning.c -W -lpthread -Wall
clean:
        rm -rf *.o
mrproper: clean
        rm -rf teste

O seguinte erro é apresentado:
gcc -o teste arp_discover.o arp_poisoning.o
arp_poisoning.o:(.data+0x0): múltipla definição de `capacidade'
arp_discover.o:(.data+0x0): definido primeiramente aqui
arp_poisoning.o:(.bss+0x0): múltipla definição de `posicao'
arp_discover.o:(.bss+0x0): definido primeiramente aqui
arp_poisoning.o: na função `sendRequests':
arp_poisoning.c:(.text+0x0): múltipla definição de `sendRequests'
arp_discover.o:arp_discover.c:(.text+0x0): definido primeiramente aqui
arp_poisoning.o: na função `receiveReplies':
arp_poisoning.c:(.text+0x2e2): múltipla definição de `receiveReplies'
arp_discover.o:arp_discover.c:(.text+0x2e2): definido primeiramente aqui
arp_poisoning.o: na função `getHosts':
arp_poisoning.c:(.text+0x553): múltipla definição de `getHosts'
arp_discover.o:arp_discover.c:(.text+0x553): definido primeiramente aqui
collect2: error: ld returned 1 exit status
Makefile:3: recipe for target 'teste' failed
make: *** [teste] Error 1

Sendo que no arquivo arp_poisoning existe a seguinte dependência:
/* utilizando os utilitarios */
#include "arp_discover.c"

Comment: o makefile parece correto. Pode mostrar os arquivos que você está compilando?
Comment: Opa, bem eles são gigantes hehehe, mas basicamente o que existe é uma arquivo .h que define o arp_discover e essa dependência declarada dentro do arquivo arp_poisoning com o #include "arp_discover.c"
Comment: pelo makefile dava para saber disso. Pelos erros apresentados, você está declarando `capacidade`, `posicao`, `sendRequests`, `receiveReplies` e `getHosts` mais de uma vez.
Comment: pois é, mas não deveria, pois o meu código está declarando isso somente em um arquivo, você vai conseguir dar uma olhada no código seguindo o link do github: https://github.com/emanoelvianna/trabalho-redes, o código do makefile está diferente e a dependência no arp_poisoning está comentada, o resto é o mesmo que estou usando.
Comment: @Emanoel, não inclua arquivos `.c`
Answer:
Repita comigo: jamais incluirei .c sem maiores razões

Podemos usar de modo mais eficiente o seu Makefile usando variáveis automáticas. Veja essa resposta explicando um pouco sobre a variável $<. Para uma explicação extensa e mais voltada para compilação de arquivos C/C++, veja essa outra resposta.
Sobre o uso dos arquivos .h, eu discorro um pouco sobre forward declaration nessa outra resposta.
Agora, vamos ao foco. O arquivo arp_poisoning.c não depende do arp_discover.c, mas depende das declarações dele. Depende das forward declarations dele, que ficam contidas no .h. Para explicar o que está realmente ocorrendo, preciso agora entrar em detalhes de como funciona a compilação de um arquivo fonte em C.
Compilação de arquivo C
Por incrível que pareça, o compilador C trabalha apenas uma única entrada de cada vez. Ele pega essa entrada do chamado pré processador C. Na próxima seção vou falar o que é o pré processador.
C é uma linguagem que na prática é parseada em uma única passada, como boa parte das linguagens de programação. O compilador vai identificar toda definição + referências abertas e vai colocar seus resultados nos chamados arquivos objetos (arquivos .o no mundo do GCC).
O que seria considerado definição nesse caso? Uma função com corpo está definitivamente definida. Uma variável global também está definida.
E referência aberta? Isso é um conceito para coisas que deveriam existir mas não existem no contexto do código compilado. Talvez exista por fora, mas o compilador não é capaz de fechar qual a implementação que está sendo de fato usada.
Quando acontece uma referência aberta? Acontece quando você informa que a variável existe, porém o arquivo não é "dono" dela; a variável é externa (extern). Isso acontece com a variável errno. Outro ponto de referência aberta? Funções que tiveram forward declaration.
Você pode e deve criar arquivos objetos com referências abertas. Porém você só pode criar executável depois de fechar todas as referências estáticas, depois de fazer todas as ligações, todos os binds. E quem faz isso? O linkador.
O linkador
O papel do linkador é resolver todas as referências abertas em cima do conjunto de arquivos objetos e bibliotecas disponíveis.
Como ele faz isso? Com um protocolo. Uma função em C vai ter um nome, e esse nome é reconhecido pelo linkador e gerado pelo compilador. O GCC gera esse valor colocando _ na frente do nome C da função. Por exemplo, a função capacidade teria seu nome de linkagem _capacidade.
O linkador vai procurar toda referência aberta e, caso não tenha encontrada a função para fechar essa referência, ele vai manter apontada essa referência aberta. Caso encontre uma definição de função, ele adicionará ao conjunto de funções conhecidas; caso essa função tenha uma referência aberta para ela, o linkador vai fechar a referência. Caso seja encontrada uma segunda definição, o linkador aborta com erro: duplicidade de definição.
O pré processador C
O pré processador C é um processador de textos em geral; também é conhecido como CPP. Ele surgiu para trabalhar com arquivos C, mas podem ser usados para processar outros arquivos textuais.
De modo geral, tudo que contém # em linha de código C vai ser interpretado pelo CPP. Depois de um #, vai vir um comando CPP. O CPP também fará substituição textual de tudo aquilo que está definido para pré processamento.
Alguns comandos:

#define MACRO val: define MACRO com o valor val; isso significa que toda string no texto, a partir do momento da definição de MACRO será substituída verbatim por val; caso o valor não seja definido, assume-se string vazia; pode-se usar argumentos para a definição;
#include "abcde": considera que,  o exato ponto deste include ele deve levar em consideração como continuação da entrada todo conteúdo do arquivo abcde, pré processando abcde também; todas as definições prévias continuam valendo.

O que acontece ao incluir outro .c na minha fonte?
Vamos lá. Tomemos como exemplo um arquivo mais simples. Vou chamar de hello.c e o say_hello.c.
hello.c:
#include <stdio.h>
void hello() {
    printf("hello\n");
}

say_hello.c
#include <stdio.h>
#include "hello.c"

int main() {
    hello();
    return 0;
}

Vamos ver qual vai ser a saída do CPP, que é a entrada do compilador propriamente dito? Vou ignorar a parte da biblioteca padrão porque não vem ao caso:
/* coisas do stdio.h */
void hello() {
    printf("hello\n");
}

int main() {
    hello();
    return 0;
}

Ok. Então, ao compilar say_hello.c, teremos duas definições devidamente implementadas e uma referência aberta no say_hello.o. As definições são:

_hello
_main

A referência aberta é:

printf

Ao mandar o GCC juntar o say_hello.o com o hello.o, teremos duas definições para _hello. O que significa que não vai rolar a compilação.
Como proceder?
Simples: inclua os headers/.h. Compile os arquivos .cindividualmente. Junte tudo em um grande executável. A resposta com a compilação em C++ trata disso muito bem. De modo geral, pode ser feito isso também no makefile:
.PHONY: all

all : teste

teste : arp_discover.o arp_poisoning.o
    gcc -o $@ $^

%.o : %.c
     gcc -o $@ $< -c

arp_discover.o : arp_discover.h

arp_poisoning.o : arp_discover.h

Comment: muito legal sua explicação, obrigado.

Erro ao criar arquivo Makefile


Dúvida na Normalização de Dados

Question: Tenho uma dúvida referente à normalização.
Tenho 3 tabelas: Veículos, Filtros e Combinações. Funciona assim, na tabela Combinações eu seleciono a ID do Veículo na tabela Veículo e 4 filtros relacionados a cada carro na tabela Filtros . Ex.:

A estrutura é aceitável pelas regras da normalização? ou teria que criar 4 tabelas de FiltrosN?
Isso está vinculado em como eu vou chamar no PHP. Por exemplo:
<code>$query = "SELECT * FROM Combinações c
             JOIN Veiculos v
             ON c.id = a.veiculo
                 JOIN Filtros f
                 ON..."       <<--- É aqui que estou em dúvida
</code>
Como eu vinculo a tabela Filtros a tabela Combinações ? e como eu chamaria um `echo' Filtro de Oleo, Filtro Ar, Filtro Cabine, Filtro Combustivel relacionando com a tabela Filtros?
Comment: Depende de que forma normal está falando, em alguma está sim, em outra não está, eu acho porque normalização não é uma regra mágica que resolve problemas, você tem um problema e tudo precisa ser normalizado para atender a demanda dele, sem saber a exata demanda não tem como saber se está certo ou não. Infelizmente toda vez que escrevo isso a pessoa repete o que ela já disse e não detalha a demanda e aí ficar difícil dizer se está certo. Não sei para que serve essas peças nas avarias, então não sei se está normalizado certo. A segunda parte deve ter dup,já vi várias vezes respostas de 3 tabelas
Comment: O problema é que agora tem duas respostas erradas na sua pergunta porque ela não foi feita de forma adequada desde o início, e pior, tem positivos nas duas.
Comment: Quantas peças pode ter nisso? Sempre 4, não pode ter 3 e não pode ter 5?
Comment: Então a resposta que você aceitou está errada.
Comment: Você acabou de dizer que elas estão erradas mesmo afirmando que não estão.
Comment: A demanda que você diz é em termos de tráfego? quantidade de consultas por tempo? Não entendi...
Comment: Não sei se serei repetitivo, mas vou tentar explicar como funciona meu sistema: é um sistema para oficina mecânica, então tenho uma lista de veículos e uma lista de peças especifica de cada veículo (por exemplo: Spin - Pneu X - Roda X - Calota X - Parafuso X ; Palio - Pneu Y - Roda Y - Calota Y - Parafuso Y...).
Assim ao consultar um veículo eu vou saber qual roda, calota, parafuso, pneu eu uso...
(Obs.: a imagem da tabela foi um exemplo que eu achei pronto, não sei se está atrapalhando)
Comment: Sim, sempre 4 peças.
Comment: É...acabei de perceber. Fiz mas deu um 'falso-positivo'...
Comment: Editei a pergunta e coloquei como realmente funciona. Agora acho que está mais compreensível rsrs...observe que na tabela Filtros tem todos os filtros, não importando sua aplicação (ar, óleo, ...) isso eu filtro no php
Comment: Posso ter errado na formulação da pergunta inicial, mas não vejo como respostas erradas, tanto que a estrutura inicial que eu fiz estava conforme essa última resposta. Mas eu mudei pq aumentava muito a quantidade de informações armazenadas...
Comment: Bom...podemos ficar debatendo filosoficamente o sigificado das frases...porém não disse que estavam erradas, disse que não é a melhor opção, existem boas e más opções, o que não as classificam como erradas...segue o jogo...
Answer: acredito que o melhor seria assim:
tabela veículos: continua idêntica
tabela Peças: continua idêntica
tabela Avarias: Você precisa construir um relacionamento e as primeiras perguntas são:
1) Um veículo pode ter mais de uma avaria e a avaria mais de um veículo? Acredito que não.
2) Uma avaria pode precisar ter mais de uma peça e a mesma peça estar em várias avarias? Acredito que sim e isso é uma relação N - N
Então você precisa criar uma tabela intermediária para o relacionamento N para N (pois ambos podem conter mais de uma linha de outra tabela, como em um carrinho de compras).
Então você terá 4 tabelas:

Veiculos
Avarias
Peças
avarias_pecas (id, veiculo_id, avaria_id, peca_id) <-- a nova que fará a ponte do relacionamento.

Assim você poderá fazer o Join de várias formas, por exemplo:
<code>// todas as peças que precisou em uma avaria
select pecas, from avarias_pecas ap, pecas p where ap.peca_id = p.id and avaria_id=X;

//todas as avarias de um veiculo
select veiculo from veiculos v, avarias a where v.id = a.veiculo_id where v.id=X;
</code>
Ok? Espero ter ajudado
Comment: Entendi seu comentário, eu trabalho com Magento e já fiz alguns bancos de lojas virtuais, em todos fiz uma tabela para "peças" e outra para categorias (como você citou os tipos de filtros) uma terceira tabela para filtros_categorias e outra filtros_veiculos; assim você controla e extrai dados como "filtros para determinados tipos de veículos", "todos os veículos que utilizam aquele filtro" e até exibi-lo em mais de uma situação caso seja um produto mais genérico. Boa sorte com seu banco!
Answer: Para atender ao que você precisa, de forma correta, você deve alterar a tabela de avarias para uma estrutura de crescimento "vertical":

Porque, se cada registro da tabela de peças virar uma coluna na tabela de avarias, sempre que criar um registro novo você terá executar "alter table" na tabela de avarias.
Daí sua consulta ficaria:
<code>select * from Avarias a
 join Veiculos v on v.idveiculo=a.idveiculo
 join Pecas p on p.idpeca=a.idpeca
</code>
Comment: @Nosredna, na minha resposta, a tabela "suja" é só o N-N avarias_pecas; e as outras 3 ficariam mais práticas para controle. São formas diferentes de fazer
Comment: @Nosredna você perguntou qual forma correta de se fazer. A forma correta é assim. Agora, se por outro lado você quer "mostrar de alguma outra forma", utilize a linguagem de programação (php,perl,.net,java) para montar um html ou no formulário conforme você quiser. Mas o banco de dados normalizado pra esse caso é assim.
Comment: Eu mudei a estrutura! Eu já tentei assim também, mas não deu certo...
Comment: O problema de fazer assim é que teria muitas linhas para cada veiculo. Porém se não houver outra forma...
Comment: @LeonardoNegrão entendi... Eu tinha feito outra forma também, tipo: tabela Combinações,  tabela Veiculo, tabela Filtro Ar, tabela Filtro Oleo, tabela Filtro Cabine, tabela Filtro Combustivel - ai eu relacionava cada tabelas 'Filtros' e a tabela 'Veiculo' na tabela 'Combinações'

Dúvida na Normalização de Dados


Background image position is weird in actual mobile view, but normal in desktop mobile view

Question: I'm building a website, and it has a banner in it. The banner works fine in desktop and also desktop mobile view. But for some reason when I open the site on my actual phone, it doesn't appear like it would on desktop mobile view. I want my face to be in the center, but instead my face is in the bottom left.
The other problem I am having within my website is that there seems to be a white space overflow beside it, and overflow-x: hidden, in the body wont fix it. Any help or ideas would be very much appreciated! :)
This is the code
HTML
<!DOCTYPE html>

    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link
      rel="stylesheet"
      href="https://firstname.lastname@example.com/dist/css/bootstrap.min.css"
      integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2"
      crossorigin="anonymous"
    />

    <link
      href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"
      rel="stylesheet"
      type="text/css"
    />
    <link href="./css/about-style.css" rel="stylesheet" />

    <title>Brian Wyann</title>

        BrianWyann

            Home(current)

            About Me

            Projects

          <button id="navbutton">Contacts</button>

Who Am I?

        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent ultricies vulputate auctor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ac volutpat lacus, a porta tellus. Nullam accumsan, massa eget condimentum convallis, mauris nunc efficitur augue, in dapibus risus diam euismod lorem. Ut non venenatis magna. Duis eget est aliquam sapien pretium molestie id eget felis. Praesent bibendum ultrices libero. Quisque sodales nulla dui, id iaculis dui dignissim sed. Nam iaculis erat interdum quam tincidunt, Donec viverra dignissim felis, sit amet luctus lacus gravida a. Pellentesque eu dapibus turpis.

        Sed accumsan ligula cursus. Nullam ut auctor velit, nec maximus mauris. Nullam fermentum volutpat lorem ut eleifend. Aenean facilisis et nisl eget euismod. Curabitur vitae ligula quis dolor cursus euismod ac eu tellus.Cras finibus, libero et molestie rutrum, lorem felis dapibus tellus, a vehicula nulla diam eu ante. Sed euismod leo ligula. Maecenas ut neque metus. Etiam placerat neque sed justo tempus, at fermentum eros ornare. Duis facilisis metus a turpis blandit, a mollis ipsum malesuada.

My Family

          Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse quis fermentum nibh. Maecenas elit ligula, efficitur in finibus a, pretium non ante. Mauris pharetra at libero vitae mollis. Aliquam erat volutpat. Suspendisse vehicula volutpat congue. Aenean commodo nibh efficitur, interdum nisi fermentum, ornare lacus. Donec ultricies orci at metus viverra.

My Hobbies

          Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse quis fermentum nibh. Maecenas elit ligula, efficitur in finibus a, pretium non ante. Mauris pharetra at libero vitae mollis. Aliquam erat volutpat. Suspendisse vehicula volutpat congue. Aenean commodo nibh efficitur, interdum nisi fermentum, ornare lacus. Donec ultricies orci at metus

BrianWyann

Myself

Home

About

Projects

Contacts

MOOCs

edX

              Coursera

              FutureLearn

              CognitiveClass

Address

                C 29, Perumahan Sunter Mediterania, 14340, North Jakarta City,
                Jakarta, Indonesia

All right reserved by ©wyannbrian 2020

CSS
@import url("https://fonts.googleapis.com/css2?family=Oswald:wght@700&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Montaga&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Dancing+Script:wght@600&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Poppins&family=Roboto+Slab&display=swap");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

button {
  outline: none !important;
}

/*NAVIGATION BAR*/
header {
  position: absolute;
  z-index: 10;
  width: 100%;
  padding: 25px 5%;
}

.navbar-nav {
  flex-direction: row;
}

.navbar-brand {
  font-family: "Oswald", sans-serif;
  font-size: 2em;
  text-transform: uppercase;
  letter-spacing: 0.2px;
  color: rgba(202, 210, 197, 1);
  text-shadow: 1px 1px 3px black;
  margin-right: 0;
}

.navbar-brand:hover {
  color: rgba(202, 210, 197, 1);
}

.nav-item,
.nav-link {
  font-size: 1.05em;
  text-transform: uppercase;
  font-weight: 800;
  margin-right: 20px;
  color: #cad2c5;
  text-shadow: 1px 1px 5px black;
  font-family: "Montaga", serif;
  letter-spacing: 1px;
  transition: all 0.5s;
}

.nav-link:hover {
  background: #2f3e46;
  color: #cad2c5;
}

#navbutton {
  font-size: 1.05em;
  text-transform: capitalize;
  font-weight: 500;
  font-family: "Montaga", serif;
  letter-spacing: 1px;
  padding: 9px 25px;
  background: #cad2c5;
  border: none;
  border-radius: 50px;
  transition: all 0.5s;
  margin-left: 10px;
}

#navbutton:hover {
  background: #2f3e46;
  color: #cad2c5;
}

.burger div {
  width: 25px;
  height: 3px;
  background: #cad2c5;
  margin: 5px;
  border-radius: 3px;
  transition: all 0.3s ease;
}

.burger {
  display: none;
}

/* Make from burger icon to X icon */
.toggle #line1 {
  transform: rotate(-45deg) translate(-5px, 6px);
}

.toggle #line2 {
  opacity: 0;
}

.toggle #line3 {
  transform: rotate(45deg) translate(-5px, -6px);
}

/* Animation for links */
@keyframes linkSlide {
  from {
    opacity: 0;
    transform: translateX(100px);
  }

  to {
    opacity: 1;
    transform: translateX(0px);
  }
}

/*BANNER*/
.banner {
  position: relative;
  background: linear-gradient(rgba(24, 25, 26, 0.4), rgba(24, 25, 26, 0.4)),
    url("../images/about/banner-img.JPG") center/cover no-repeat fixed;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}

#banner-text {
  font-size: 6rem;
  color: rgb(202, 210, 197);
  letter-spacing: 2px;
  text-shadow: 1px 1px 10px black;
  font-family: "Dancing Script", cursive;
}

/* Mobile */
@media screen and (max-width: 992px) {
  body {
    overflow-x: hidden;
  }

  .navbar-nav {
    position: absolute;
    height: calc(95vh - 80px);
    right: 0;
    width: 100%;
    top: 80px;
    background: #354f52;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    justify-content: space-between;
    padding: 100px 0px;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.5s ease-in;
  }

  .nav-item,
  .nav-link {
    margin-right: 0;
    text-shadow: none;
  }

  .navbar-nav li a:hover {
    color: #354f52;
    background: #edf0f1;
    padding: 10px 20px;
    text-shadow: none;
  }

  .nav-item {
    opacity: 0;
  }

  .burger {
    display: block;
    cursor: pointer;
  }

  .navbar-nav.mobilenav-active {
    transform: translateX(0%);
    opacity: 0.96;
  }

  #navbutton {
    margin-left: 0;
  }

  #banner-text {
    font-size: 5rem;
  }
}

/*PERSONAL*/
.personal {
  background: #425057;
  margin: 0;
  padding: 50px;
  color: #EEF0F2;
  position: relative;
  line-height: 1.8;
  font-family: "Roboto Slab", serif;
}

.personal p {
  max-width: 1200px;
  margin: auto;
  font-size: 17px;
}

.about {
  background: #425057;
  padding: 20px 50px 50px 50px;
  color: #EEF0F2;
  line-height: 1.8;
  font-family: "Roboto Slab", serif;
}

.about-container {
  display: flex;
  max-width: 1200px;
  margin: auto;
}

.about-container h3 {
  font-family: "Poppins", sans-serif;
  text-align: center;
  font-weight: 600;
  color: #f5f5f5;
  margin: auto;
  position: relative;
  z-index: 1;
  margin-bottom: 20px;
  letter-spacing: 1px;
  word-spacing: 1px;
}

.about-container p {
  text-align: justify;
  font-size: 17px;
}

.hobbies{
  margin-left: 50px;
}

.family{
  margin-right: 50px;
}

.about-container h3::before {
  content:"";
  display: block;
  width: 200px;
  height: 2px;
  background: #f5f5f5;
  position: absolute;
  left: 0;
  top: 50%;
  z-index: -1;
}

.about-container h3::after {
  content:"";
  display: block;
  width: 200px;
  height: 2px;
  background: #f5f5f5;
  position: absolute;
  right: 0;
  top: 50%;
  z-index: -1;
}

.about-container span{
  background: #425057;
  padding: 0 20px;
}

@media screen and (max-width: 900px) {
  .about-container {
    display: block;
  }

  .about {
    position: relative;
  }

  .about-container h3::before,
  .about-container h3::after {
    width: 50%;
  }

  .family,
  .hobbies {
    margin: auto;
  }

  .family {
    margin-bottom: 60px;
  }
}

/*TRANSITION*/
.transition {
  height: 50px;
  width: 100%;
  background: linear-gradient(#425057, #354f52);
}

/*FOOTER*/
footer {
  display: flex;
  flex-flow: row wrap;
  padding: 60px 50px 20px 50px;
  background: #2f3e46;
  line-height: 1.5;
  font-family: "Poppins", sans-serif;
}

.footer {
  margin: auto;
  position: relative;
}

.footer-container {
  position: absolute;
  margin: 0;
  padding: 0;
  top: 50%;
  transform: translateY(-50%);
}

#logo {
  margin: 0;
  font-family: "Oswald", sans-serif;
  font-size: 2em;
  text-transform: uppercase;
  letter-spacing: 0.2px;
  color: rgba(202, 210, 197, 1);
}

.footer > * {
  flex: 1 100%;
}

.footer-col-left {
  margin-right: 1.25em;
  margin-bottom: 2em;
}

.footer-col-right h4 {
  font-size: 20px;
  color: #cad2c5;
  margin-bottom: 35px;
  text-transform: capitalize;
  font-family: "Poppins", sans-serif;
  font-weight: 500;
  position: relative;
}

.footer-col-right h4::before {
  content: "";
  position: absolute;
  left: 0;
  bottom: -10px;
  background: #e91e63;
  height: 2px;
  box-sizing: border-box;
  width: 50px;
}

.footer ul {
  list-style: none;
  padding-left: 0;
}

.footer-col-right ul li:not(:last-child) {
  margin-bottom: 10px;
}

.box li a,
.box li p {
  font-size: 16px;
  color: #f5f5f5;
  text-decoration: none;
  font-weight: 300;
  display: block;
  font-family: "Roboto Slab", serif;
  transition: all 0.3s ease;
}

.footer-col-right ul li a:hover {
  color: #cad2c5;
  padding-left: 10px;
}

.footer a {
  text-decoration: none;
}

.footer-col-right {
  display: flex;
  flex-flow: row wrap;
}

.footer-col-right > * {
  flex: 1 50%;
  margin-right: 1.25em;
}

.footer-row-bot {
  text-align: center;
  color: #cad2c5;
  padding-top: 45px;
  font-family: "Poppins", sans-serif;
  font-weight: 500;
  font-size: 14px;
}

.footer-col-left p {
  padding-right: 20%;
}

.footer-col-left .socials a {
  display: inline-block;
  height: 40px;
  width: 40px;
  background: #52796f;
  margin: 0 10px 10px 0;
  text-align: center;
  line-height: 40px;
  border-radius: 50%;
  color: rgba(202, 210, 197, 1);
  transition: all 0.5s ease;
}

.socials {
  padding-top: 5px;
}

.footer-col-left .socials a:hover {
  background: rgba(202, 210, 197, 1);
  color: #52796f;
}

@media screen and (max-width: 780px) {
  footer {
    padding: 60px 10px 20px 10px;
  }
}
@media screen and (min-width: 700px) {
  .footer-col-right > * {
    flex: 1;
  }

  .footer-col-left {
    flex: 1 0px;
  }

  .footer-col-right {
    flex: 2 0px;
  }
}

@media screen and (max-width: 700px) {
  .footer {
    padding: 15px;
  }

  .footer-container {
    position: absolute;
    margin-top: 30px;
    padding: 0;
    top: 0;
    transform: translateY(0);
  }

  .footer-col-right {
    margin-top: 75px;
  }

  .footer-col-right h4 {
    margin-top: 50px;
  }
}

Answer: so I found out that the overflow is indeed the problem. But first I want to thank Kenneth for his response which ultimately helped me to find the solution.
The solution is to remove the overflow-x. But since mobile browsers ignore body and html tag, I needed to add a
 right below the body element and close it right before the body element closes. And then after adding it. All I needed to do was add this to the css.
.site {
    overflow-x: hidden;
    /* Unnecessary IMHO, uncomment next line to force hidden behavior */
    /* overflow-x: hidden !important; */
    /* Additional tunning proposed by the community */
    position: relative;
    width: 100%;
    }

P.S: I found the answer on another post (Overflow-x:hidden; on mobile device not working). The answer is written by Adrià.
Answer: Unless you keep the aspect ratio of the image you are not being able to keep the same image. Eventually if you keep the banner 100vh it will start cropping down on the horizontal axes. You can solve the issue (face not centered) with the background-image by defining a background-position. The example below the text will center the image on the X and Y axis. You can also lower the height so the image is keeping it ratio.
background-position: center center;

The issue with the overflow, there is probs an element outside of your viewport. Could you set up a code snippet for this?
Comment: Hi! Thank you for the response. I tried your answer, but it doesn't seem to be working, I changed the position to center center, bottom left, and other positions but the image stays the same. I think the problem may have something to do with the overflow. But since I am still quite new to this , I am not quite sure on what you mean by an element outside my viewport  . So, could you be more specific about what you mean by that? Sorry for the hassle and thanks!
Comment: Can you provide a code snippet so we can see it in action?
Comment: Sorry, but I don't know what you mean by code snippet. Could you provide an example? Because all of the related code have been attached in my original post. Sorry, once again.
Answer: In this code snippet I provided I can't see any overflow, I might just have to test it out on my local machine. In the example below the image has position center, but also note the image that is provided is actually a portrait in the center of the image.

@import url("https://fonts.googleapis.com/css2?family=Oswald:wght@700&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Montaga&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Dancing+Script:wght@600&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Poppins&family=Roboto+Slab&display=swap");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

button {
  outline: none !important;
}

/*NAVIGATION BAR*/
header {
  position: absolute;
  z-index: 10;
  width: 100%;
  padding: 25px 5%;
}

.navbar-nav {
  flex-direction: row;
}

.navbar-brand {
  font-family: "Oswald", sans-serif;
  font-size: 2em;
  text-transform: uppercase;
  letter-spacing: 0.2px;
  color: rgba(202, 210, 197, 1);
  text-shadow: 1px 1px 3px black;
  margin-right: 0;
}

.navbar-brand:hover {
  color: rgba(202, 210, 197, 1);
}

.nav-item,
.nav-link {
  font-size: 1.05em;
  text-transform: uppercase;
  font-weight: 800;
  margin-right: 20px;
  color: #cad2c5;
  text-shadow: 1px 1px 5px black;
  font-family: "Montaga", serif;
  letter-spacing: 1px;
  transition: all 0.5s;
}

.nav-link:hover {
  background: #2f3e46;
  color: #cad2c5;
}

#navbutton {
  font-size: 1.05em;
  text-transform: capitalize;
  font-weight: 500;
  font-family: "Montaga", serif;
  letter-spacing: 1px;
  padding: 9px 25px;
  background: #cad2c5;
  border: none;
  border-radius: 50px;
  transition: all 0.5s;
  margin-left: 10px;
}

#navbutton:hover {
  background: #2f3e46;
  color: #cad2c5;
}

.burger div {
  width: 25px;
  height: 3px;
  background: #cad2c5;
  margin: 5px;
  border-radius: 3px;
  transition: all 0.3s ease;
}

.burger {
  display: none;
}

/* Make from burger icon to X icon */
.toggle #line1 {
  transform: rotate(-45deg) translate(-5px, 6px);
}

.toggle #line2 {
  opacity: 0;
}

.toggle #line3 {
  transform: rotate(45deg) translate(-5px, -6px);
}

/* Animation for links */
@keyframes linkSlide {
  from {
    opacity: 0;
    transform: translateX(100px);
  }

  to {
    opacity: 1;
    transform: translateX(0px);
  }
}

/*BANNER*/
.banner {
  position: relative;
  background: linear-gradient(rgba(24, 25, 26, 0.4), rgba(24, 25, 26, 0.4)),
    url("https://t3.ftcdn.net/jpg/02/22/85/16/360_F_222851624_jfoMGbJxwRi5AWGdPgXKSABMnzCQo9RN.jpg");
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}

#banner-text {
  font-size: 6rem;
  color: rgb(202, 210, 197);
  letter-spacing: 2px;
  text-shadow: 1px 1px 10px black;
  font-family: "Dancing Script", cursive;
}

/* Mobile */
@media screen and (max-width: 992px) {
  body {
    overflow-x: hidden;
  }

  .navbar-nav {
    position: absolute;
    height: calc(95vh - 80px);
    right: 0;
    width: 100%;
    top: 80px;
    background: #354f52;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    justify-content: space-between;
    padding: 100px 0px;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.5s ease-in;
  }

  .nav-item,
  .nav-link {
    margin-right: 0;
    text-shadow: none;
  }

  .navbar-nav li a:hover {
    color: #354f52;
    background: #edf0f1;
    padding: 10px 20px;
    text-shadow: none;
  }

  .nav-item {
    opacity: 0;
  }

  .burger {
    display: block;
    cursor: pointer;
  }

  .navbar-nav.mobilenav-active {
    transform: translateX(0%);
    opacity: 0.96;
  }

  #navbutton {
    margin-left: 0;
  }

  #banner-text {
    font-size: 5rem;
  }
}

/*PERSONAL*/
.personal {
  background: #425057;
  margin: 0;
  padding: 50px;
  color: #EEF0F2;
  position: relative;
  line-height: 1.8;
  font-family: "Roboto Slab", serif;
}

.personal p {
  max-width: 1200px;
  margin: auto;
  font-size: 17px;
}

.about {
  background: #425057;
  padding: 20px 50px 50px 50px;
  color: #EEF0F2;
  line-height: 1.8;
  font-family: "Roboto Slab", serif;
}

.about-container {
  display: flex;
  max-width: 1200px;
  margin: auto;
}

.about-container h3 {
  font-family: "Poppins", sans-serif;
  text-align: center;
  color: #f5f5f5;
  margin: auto;
  position: relative;
  z-index: 1;
  margin-bottom: 20px;
  letter-spacing: 1px;
  word-spacing: 1px;
}

.about-container p {
  text-align: justify;
  font-size: 17px;
}

.hobbies{
  margin-left: 50px;
}

.family{
  margin-right: 50px;
}

.about-container h3::before {
  content:"";
  display: block;
  width: 200px;
  height: 2px;
  background: #f5f5f5;
  position: absolute;
  left: 0;
  top: 50%;
  z-index: -1;
}

.about-container h3::after {
  content:"";
  display: block;
  width: 200px;
  height: 2px;
  background: #f5f5f5;
  position: absolute;
  right: 0;
  top: 50%;
  z-index: -1;
}

.about-container span{
  background: #425057;
  padding: 0 20px;
}

@media screen and (max-width: 900px) {
  .about-container {
    display: block;
  }

  .about {
    position: relative;
  }

  .about-container h3::before,
  .about-container h3::after {
    width: 50%;
  }

  .family,
  .hobbies {
    margin: auto;
  }

  .family {
    margin-bottom: 60px;
  }
}

/*TRANSITION*/
.transition {
  height: 50px;
  width: 100%;
  background: linear-gradient(#425057, #354f52);
}

/*FOOTER*/
footer {
  display: flex;
  flex-flow: row wrap;
  padding: 60px 50px 20px 50px;
  background: #2f3e46;
  line-height: 1.5;
  font-family: "Poppins", sans-serif;
}

.footer {
  margin: auto;
  position: relative;
}

.footer-container {
  position: absolute;
  margin: 0;
  padding: 0;
  top: 50%;
  transform: translateY(-50%);
}

#logo {
  margin: 0;
  font-family: "Oswald", sans-serif;
  font-size: 2em;
  text-transform: uppercase;
  letter-spacing: 0.2px;
  color: rgba(202, 210, 197, 1);
}

.footer > * {
  flex: 1 100%;
}

.footer-col-left {
  margin-right: 1.25em;
  margin-bottom: 2em;
}

.footer-col-right h4 {
  font-size: 20px;
  color: #cad2c5;
  margin-bottom: 35px;
  text-transform: capitalize;
  font-family: "Poppins", sans-serif;
  font-weight: 500;
  position: relative;
}

.footer-col-right h4::before {
  content: "";
  position: absolute;
  left: 0;
  bottom: -10px;
  background: #e91e63;
  height: 2px;
  box-sizing: border-box;
  width: 50px;
}

.footer ul {
  list-style: none;
  padding-left: 0;
}

.footer-col-right ul li:not(:last-child) {
  margin-bottom: 10px;
}

.box li a,
.box li p {
  font-size: 16px;
  color: #f5f5f5;
  text-decoration: none;
  font-weight: 300;
  display: block;
  font-family: "Roboto Slab", serif;
  transition: all 0.3s ease;
}

.footer-col-right ul li a:hover {
  color: #cad2c5;
  padding-left: 10px;
}

.footer a {
  text-decoration: none;
}

.footer-col-right {
  display: flex;
  flex-flow: row wrap;
}

.footer-col-right > * {
  flex: 1 50%;
  margin-right: 1.25em;
}

.footer-row-bot {
  text-align: center;
  color: #cad2c5;
  padding-top: 45px;
  font-family: "Poppins", sans-serif;
  font-weight: 500;
  font-size: 14px;
}

.footer-col-left p {
  padding-right: 20%;
}

.footer-col-left .socials a {
  display: inline-block;
  height: 40px;
  width: 40px;
  background: #52796f;
  margin: 0 10px 10px 0;
  text-align: center;
  line-height: 40px;
  border-radius: 50%;
  color: rgba(202, 210, 197, 1);
  transition: all 0.5s ease;
}

.socials {
  padding-top: 5px;
}

.footer-col-left .socials a:hover {
  background: rgba(202, 210, 197, 1);
  color: #52796f;
}

@media screen and (max-width: 780px) {
  footer {
    padding: 60px 10px 20px 10px;
  }
}
@media screen and (min-width: 700px) {
  .footer-col-right > * {
    flex: 1;
  }

  .footer-col-left {
    flex: 1 0px;
  }

  .footer-col-right {
    flex: 2 0px;
  }
}

@media screen and (max-width: 700px) {
  .footer {
    padding: 15px;
  }

  .footer-container {
    position: absolute;
    margin-top: 30px;
    padding: 0;
    top: 0;
    transform: translateY(0);
  }

  .footer-col-right {
    margin-top: 75px;
  }

  .footer-col-right h4 {
    margin-top: 50px;
  }
}
<!DOCTYPE html>

    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link
      rel="stylesheet"
      href="https://firstname.lastname@example.com/dist/css/bootstrap.min.css"
      integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2"
      crossorigin="anonymous"
    />

    <link
      href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"
      rel="stylesheet"
      type="text/css"
    />
    <link href="./css/about-style.css" rel="stylesheet" />

    <title>Brian Wyann</title>

        BrianWyann

            Home(current)

            About Me

            Projects

          <button id="navbutton">Contacts</button>

Who Am I?

        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent ultricies vulputate auctor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ac volutpat lacus, a porta tellus. Nullam accumsan, massa eget condimentum convallis, mauris nunc efficitur augue, in dapibus risus diam euismod lorem. Ut non venenatis magna. Duis eget est aliquam sapien pretium molestie id eget felis. Praesent bibendum ultrices libero. Quisque sodales nulla dui, id iaculis dui dignissim sed. Nam iaculis erat interdum quam tincidunt, Donec viverra dignissim felis, sit amet luctus lacus gravida a. Pellentesque eu dapibus turpis.

        Sed accumsan ligula cursus. Nullam ut auctor velit, nec maximus mauris. Nullam fermentum volutpat lorem ut eleifend. Aenean facilisis et nisl eget euismod. Curabitur vitae ligula quis dolor cursus euismod ac eu tellus.Cras finibus, libero et molestie rutrum, lorem felis dapibus tellus, a vehicula nulla diam eu ante. Sed euismod leo ligula. Maecenas ut neque metus. Etiam placerat neque sed justo tempus, at fermentum eros ornare. Duis facilisis metus a turpis blandit, a mollis ipsum malesuada.

My Family

          Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse quis fermentum nibh. Maecenas elit ligula, efficitur in finibus a, pretium non ante. Mauris pharetra at libero vitae mollis. Aliquam erat volutpat. Suspendisse vehicula volutpat congue. Aenean commodo nibh efficitur, interdum nisi fermentum, ornare lacus. Donec ultricies orci at metus viverra.

My Hobbies

          Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse quis fermentum nibh. Maecenas elit ligula, efficitur in finibus a, pretium non ante. Mauris pharetra at libero vitae mollis. Aliquam erat volutpat. Suspendisse vehicula volutpat congue. Aenean commodo nibh efficitur, interdum nisi fermentum, ornare lacus. Donec ultricies orci at metus

BrianWyann

Myself

Home

About

Projects

Contacts

MOOCs

edX

              Coursera

              FutureLearn

              CognitiveClass

Address

                C 29, Perumahan Sunter Mediterania, 14340, North Jakarta City,
                Jakarta, Indonesia

All right reserved by ©wyannbrian 2020


How to Set a User-Defined Colormap in Octave?

Question: I have a trivial piece of code that calculates some quantity and plots it as contours:
%Calculate Biot number vs. h for a selected material
h = (0:5:1000)';
mat = "Copper";
lambda = 386;
r = (0:0.25:50);  %In cm
 R = r./100; %In m
%Calculate matrix of Bi values
% R = length(h) x C = length(r)
Bi = (h.*R)/lambda;
%Contour Plot of results
%Set boundaries at Bi = 0, 0.1, 1
conts = [0, 0.1, 1];
ptitle = ["Biot Number for a ", mat, " Sphere"];
%Create a personalized colormap with 30 values.
%    0<Bi<0.1  Green
%    0.1<=Bi<1 Yellow
%    Bi >= 1   Red
my_green = [229,255,204]./255;
my_yellow = [255,255,204]./255;
my_pink = [255,229,204]./255;
my_cmap = [repmat(my_green, 10, 1); repmat(my_yellow, 10, 1); repmat(my_pink, 10, 1) ];
clf;
colormap (my_cmap);
contourf(h, r, Bi, conts, 'showtext', 'on');
title(ptitle)
xlabel ("h(W/m^2*K)");
ylabel ("r(cm)");

The result is missing the intermediate color (yellow):

What can be done about this?
Comment: Create a Px3 array and set it as a colormap, `cm = [repmat([0 1 0], L, 1); repmat([1 1 0], M, 1); repmat([1 0 0], N, 1); ]`. The value of `L` `M` and `N` depends on your data.
Comment: Play around with different values for them and you'll see what I mean. I only meant that if you want your colorbar to be 60% green, 30% yellow and 10% red, make sure you keep a 60:30:10 ratio between L:M:N. If you want to compute the percentages automatically it would require some more tinkering. See also [`caxis`](https://octave.sourceforge.io/octave/function/caxis.html).
Comment: Can you expand a little about "The value of L M and N depends on your data."?
Comment: I see, I'm gonna try.
Answer: You have too few contours, so the wrong color is chosen. If you do contourf(h, r, Bi, 0:0.2:1, 'showtext', 'on'); you get:

Also, I'd suggest to make the "green" and the "yellow" more different, as it might be difficult to differentiate them on some displays.

Here's what I meant by "playing around with L, M, N:
conts = [0, 0.1, 1];
ptitle = ["Biot Number for a ", mat, " Sphere"];
%Create a personalized colormap
my_green = [229,255,204]./255;
my_yellow = [255,255,204]./255;
my_pink = [255,229,204]./255;
my_cmap = [repmat(my_green, 10, 1); repmat(my_yellow, 90, 1); repmat(my_pink, 1, 1) ];

figure(); contourf(h, r, Bi, conts, 'showtext', 'on');

colormap (my_cmap);
caxis([0 1.01])
title(ptitle)
xlabel ("h(W/m^2*K)");
ylabel ("r(cm)");

BTW, I ran this on MATLAB R2018a in case you're wondering why you're not getting the exact same thing.
Comment: I know I'm being a tad fastidious, but I need to have at least the contour at 0.1, because that value has a physical meaning.
Comment: No problem, just modify the contour steps as you need.
Comment: @FabioCapezzuoli Check out my edit, you might find it useful.
Answer: Adding the code below to define countours and to generate the colormap, the process can be automated.
conts = [0, 0.05, 0.1, 0.3, 0.7, 1];
%Create a personalized colormap with 50 values distributed proportionally to Bi values
step = 50/max(max(Bi));
L = ceil(step*0.1);
M = ceil(step*(1-0.1));
H = ceil(step*(max(max(Bi))-1));
my_green = [229,255,204]./255;
my_yellow = [255,255,204]./255;
my_pink = [255,229,204]./255;
my_cmap = [repmat(my_green, L, 1); repmat(my_yellow, M, 1); repmat(my_pink, H, 1)];

Obtaining:


to identify if there is a route zend framework 2

Question: I have a url that redraw $ this->view->url($item['action']) this way but this variable can contain the route in the system or not, how can I do this check, check if this route exists in ZF2 ?
Answer: One option in my mind is to pass the navigation object to the view
In controller:
return [
    'navigation' => $this->navigation,
];

In view:
if($this->navigation->findOneBy('route', $item['action'])) {
    $url = $this->view->url($item['action']);
}

Another option would be to enclose the call in a try/catch. If the function throws an exception, the route does not exist
try {
    $url = $this->view->url($item['action']);
} catch(Zend\Router\Exception\RuntimeException $e) {
    $url = '';
}