NumPy: create ndarray of objects

Question: I like to create a numpy array -- with a shape, say [2, 3], where each array element is a list. Yes, I know this isn't efficient, or even desirable, and all the good reasons for that -- but can it be done?
So I want a 2x3 array where each point is a length 2 vector, not a 2x3x2 array. Yes, really.
If I fudge it by making it ragged, it works:
>>> np.array([[0, 0], [0, 1], [0, 2], [1, 0], [9, 8], [2, 4, -1]], dtype=object).reshape([2, 3])
array([[list([0, 0]), list([0, 1]), list([0, 2])],
       [list([1, 0]), list([9, 8]), list([2, 4, -1])]], dtype=object)

but if numpy can make it fit cleanly, it does so, and so throws an error:
>>> np.array([[0, 0], [0, 1], [0, 2], [1, 0], [9, 8], [2, 4]], dtype=object).reshape([2, 3])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: cannot reshape array of size 12 into shape (2,3)

So putting aside your instincts that this is a silly thing to want to do (it is, and I know this), can I make the last example work somehow to create a shape 2x3 array where each element is a Python list of length 2, without numpy forcing it into 2x3x2?
Comment: Are you trying to keep it a `2x3` array of lists, rather than a `2x3x2` array? Did you try `dtype=list`?
Answer: First, you should create an object array with expected shape.
Then, use list to fill the array.
l = [[[0, 0], [0, 1], [0, 2]], [[1, 0], [9, 8], [2, 4]]]
arr = np.empty((2, 3), dtype=object)
arr[:] = l

Comment: @xpqz: If that's what you want, you can make a flat array, populate it, and *then* reshape it to whatever shape you want.
Comment: ...huh. I remember that slice assignment not working when I tried it earlier (years ago), but [it seems to work now](https://ideone.com/6wbPKz). Either I'm remembering wrong, or they changed it since then.
Comment: This is beautiful
Comment: I'd like to share my opinion that I do find this question very relevant and deserving upvotes. The answers here prove that this is not trivial, while I think it can be useful in multiple cases and needs, e.g., when integrating Python code with a C application
Comment: @user2357112, perhaps you remember trying to assign an array.  That will produce a `broadcasting` error.  Assigning a list works.
Comment: Nice, that almost does the job, apart from it forces me to first 'nest' the list-of-lists to the right shape -- what I'd ideally want to do is to populate the shaped, empty array from a flat list of values (the len-2 lists) -- analogous to `np.arange(9).resahpe([3, 3])`.
Comment: Yes! That does it.
Answer: You can create an empty array and fill it with objects manually:
>>> a = np.empty((3,2), dtype=object)
>>> a
array([[None, None],
       [None, None],
       [None, None]], dtype=object)
>>> a[0,0] = [1,2,3]
>>> a
array([[list([1, 2, 3]), None],
       [None, None],
       [None, None]], dtype=object)

Answer: Anwering my own question, based on the fine answers provided by others, here's what I did:
l = [
    np.array([0, 0]),
    np.array([0, 1]),
    np.array([0, 2]),
    np.array([1, 0]),
    np.array([9, 8]),
    np.array([2, 4])
]

arr = np.empty(len(l), dtype=object)
arr[:] = l
arr = arr.reshape((2, 3))

which gives
array([[array([0, 0]), array([0, 1]), array([0, 2])],
       [array([1, 0]), array([9, 8]), array([2, 4])]],  dtype=object)

which is exactly what I wanted. Thanks all!
Comment: It wasn't clear from your question that the objects you wanted to assign were numpy arrays rather than lists

NumPy: create ndarray of objects


Clean URLs with multi-site only with suffixes / sub-folders

Question: In D7 Multisite, I'd like to use clean URLs. However, these sites share the same domain but have different folder names.
For example, the login pages would are currently
https://domain.ext/red/?q=user
https://domain.ext/pink/?q=user
https://domain.ext/green/?q=user
https://domain.ext/purple/?q=user

How might I set this up to allow clean urls and have login pages as such:
https://domain.ext/red/user
https://domain.ext/pink/user
https://domain.ext/green/user
https://domain.ext/purple/user

The .htaccess file is untouched. The apache config file /etc/httpd/conf.d/aliases.conf contains:
Alias /blue /var/www/html
Alias /pink /var/www/html

And inside of /var/www/html/sites/ I have folders
/var/www/html/sites/blue
/var/www/html/sites/pink

Can I accomplish this by editing the $baseurl in each settings.php file and adding a redirect per site in .htaccess?
Comment: Have you considered using a module like [SubFolders Domains](https://www.drupal.org/project/subfolders_domain)?
Comment: For future projects perhaps, but I'd like to solve this particular problem (as a learning exercise).
Answer: think you will require a separate virtualhost entry for each of the sub-sites.  That should direct visitors to the correct location and negate any need for redirection.
At the moment you're using aliases to effectively send all traffic to the same place, I think using virtualhosts will separate the traffic a bit better and help you turn on clean URLs.
I'm going to assume your core Drupal files are at /var/www/html.

You definitely need to read the documentation in /var/www/html/sites/sites.php and set that up if you haven't already.
You do need to set the $basepath in each site's settings.php
In Apache it kind of depends what OS you're using but you basically want to turn on NameVirtualHost in Apache and then tell it where to send visitors:

Here's how to do it in Ubuntu
Here's how to do it in CentOS which probably also translates to RHEL/Fedora

Those links give the full setup, so you've probably already done the first few steps.  Keep going down the page to find the Virtual Host section.
Finally, clean URLs need to be enabled in each of your sites, one by one.
Comment: Can you expandon on how you'd set this up?
Comment: Sure, updated answer.
Answer: If you'd enable clean URLs, and enable module Global Redirect, then this is one of the module's features you'd get (from its project page):

Checks if the Clean URLs feature is enabled and then checks the current URL is being accessed using the clean method rather than the 'unclean' method.

Wouldn't that be "a" possible alternative to consider to address your question? If not, please explain why not.
PS: maybe consider changing green or purple to blue in your question?


Navigation drawer rounded corner background for items

Question: I want to have a rounded corner for the items in navigation drawer like this :

it's an example of material design in material.io website
is it possible ?
Answer: Just use the app:itemShapeAppearanceOverlay attribute:
<com.google.android.material.navigation.NavigationView
   app:itemShapeAppearanceOverlay="@style/ShapeAppearanceOverlay.Nav"
   ...>

with:

Comment: @Nekomajin42 Check https://stackoverflow.com/a/63481242/2016562
Comment: I would like to achieve the opposite, to fill the whole area like this: https://developer.android.com/training/material/images/navigation-view.png Could you help me with that?
Answer: First, I recommend you move to Flutter, it is more intuitive and you got the best integration flow of Material guidelines.
Now, for add round corners, color, font and padding to a checked item with XML and Android Studio, you have the 'app' attributes on NavigationView:
<android.support.v4.widget.DrawerLayout
    android:layout_width="match_parent"
    ...>

<android.support.design.widget.NavigationView
    android:layout_width="match_parent"
    ...
    app:itemIconTint="@color/custom_color_config"
    app:itemTextColor="@color/custom_color_config"
    app:itemBackground="@drawable/custom_drawable_resource"
    app:itemTextAppearance="@style/custom_style"/>

With itemIconTint and itemTextColor you set the color config of the hole item (icon and text) when is checked or non-checked. First, do res > new > directory, and name directory as 'color'. Then, create the color resource file in color directory with new > color resource file > custom_color_config (name) and put this:
<?xml version="1.0" encoding="utf-8"?>
<selector
    xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:color="your_checked_item_color"
        android:state_checked="true" />
    <item
        android:color="your_non_checked_item_color"/>
</selector>

The item with the state_checked=true attribute will apply his color to the current navigation checked item.
To add the background rounded box, create in drawable directory a new drawable resource file to set at itemBackground later. So, new > drawable resource file > custom_drawable_resource (name) and put this:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:left="9dp"
        android:right="9dp"
        android:top="2dp"
        android:bottom="2dp">

        <shape>
            <solid android:color="@color/new_color_resource_name"/>
            <corners android:radius="5dp"/>
        </shape>

    </item>
</layer-list>

And next, create again a second color resource file in color directory to associate with the solid color attribute in file custom_drawable_resource (new_color_resource_name) and there put this:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:color="your_background_checked_item_color"
        android:state_checked="true" />
    <item
        android:color="your_background_non_checked_item_color"/>
</selector>

And
VOILA! just add to text appearance a custom style with some semi bold font.
PD: Sorry if I've a bad english, I usually read more than I write, regards from MX.
Comment: "I recommend you move to Flutter" You should not give off-the-cuff "advice" like this without understanding OP's situation. They wanted rounded corners on a layout item. Telling them to switch their entire app to flutter is a ridiculous suggestion.
Answer: This is done with navigationview and menuItem and create a shape file for the round border and a selected_state file was created with the selected_checked when it is active and when it is deactivated.


L'Hospital's Rule Question.

Question: show that if $x $ is an element of $\mathbb R$ then $$\lim_{n\to\infty} \left(1 + \frac xn\right)^n = e^x $$
(HINT: Take logs and use L'Hospital's Rule)
i'm not too sure how to go about answer this or putting it in the form $\frac{f'(x)}{g'(x)}$ in order to apply L'Hospitals Rule.
so far i've simply taken logs and brought the power in front leaving me with
$$ n\log \left(1+ \frac xn\right) = x $$
Comment: Sometimes this is the _definition_ of $e^x$. What is your definition of $e^x$?
Comment: I think, I saw something like this before at the site.
Comment: @BabakSorouh. Yes definitley
Comment: @BabakSorouh do either of you remember the question title by any chance?
Comment: Possible duplicate: http://math.stackexchange.com/questions/39170/how-come-such-different-methods-result-in-the-same-number-e
Comment: @JulianKuelshammer: The problems are similar, but depending on the actual definition used for $e$, the answers could be different.
Answer: The '$=x$' is getting ahead of yourself a bit. Let $$L=\lim_{n\to\infty}\left(1+\frac{x}n\right)^n\;,$$ and take the logarithm to get
$$\begin{align*}
\ln L&=\ln\lim_{n\to\infty}\left(1+\frac{x}n\right)^n\\
&=\lim_{n\to\infty}\ln\left(1+\frac{x}n\right)^n\\
&=\lim_{n\to\infty}n\ln\left(1+\frac{x}n\right)\;,
\end{align*}$$
where the interchange of the log and the limit is justified by the fact that the logarithm function is continuous.
This limit is now a so-called $\infty\cdot 0$ indeterminate form, and there is a standard approach to those: move one of the factors into the denominator. In this case we have
$$\ln L=\lim_{n\to\infty}\frac{\ln\left(1+\frac{x}n\right)}{1/n}\;,$$
a limit in which both numerator and denominator approach $0$ as $n\to\infty$. Now you can apply l'Hospital's rule.
Don't forget that at this point you're actually finding $\ln L$, not $L$, so you'll have to exponentiate to get $L$.
Answer: Taking $\,n\,$ as a continuous variable:
$$\lim_{n\to\infty}\log\left(1+\frac{x}{n}\right)^n=\lim_{n\to\infty}n\log\left(1+\frac{x}{n}\right)=\lim_{n\to\infty}\frac{\log\left(1+\frac{x}{n}\right)}{\frac{1}{n}}\stackrel{\text{L'Hospital}}=$$
$$=\lim_{n\to\infty}-\frac{x}{n^2}\frac{\frac{1}{1+\frac{x}{n}}}{-\frac{1}{n^2}}=x\lim_{n\to\infty}\frac{1}{1+\frac{x}{n}}=x$$
Now just apply the exponential function at both ends of the above, remembering this function is a continuous one on the whole real line.
Comment: @jill: Note that to **... this function is continuous one...** above. It is very important for getting the desire result.
Answer: $$\lim_{n\to\infty} (1 + \frac xn)^n =\lim_{n\to\infty} e^{n\ln(1 + \frac xn)}  $$
The limit
$$\lim_{n\to\infty} n\ln(1 + \frac xn)=\lim_{n\to\infty} \frac{\ln(1 + \frac xn)}{\frac1n}=\lim_{n\to\infty} \frac{\frac{1}{1 + \frac xn}\frac{-x}{n^2}}{-\frac1{n^2}}=\lim_{n\to\infty} \frac{x}{1 + \frac xn}=x$$
By continuity of $e^x$,
$$\lim_{n\to\infty} (1 + \frac xn)^n =\lim_{n\to\infty} e^{n\ln(1 + \frac xn)}=e^x  $$
Answer: If $\lim\limits_{x\to{+\infty}} f(x)^{g(x)}$ be as $1^{+\infty}$, which is an indeterminate form, then we have this fact that: $$\lim_{x\to{+\infty}} f(x)^{g(x)}=e^{\lim\limits_{x\to +\infty}\big(f(x)-1\big)g(x)}$$ Try to verify and then prove it. :)
Answer: Write the limit in the following form $$\lim_{n\to\infty}\frac{\log(1+x/n)}{1/n}=\lim_{n\to\infty}\frac{f(n)}{g(n)}$$ where $f(n)=\log (1+x/n)$ and $g(n)=1/n$ and the limit is in $0/0$ form, so applying L'Hospitals rule we have the above limit is same as $$\lim_{n\to\infty}\frac{f^\prime(n)}{g^\prime(n)}=\lim_{n\to\infty}\frac{1/(1+x/n).(-x/n^2)}{-1/n^2}=\lim_{n\to\infty}\frac{x}{1+x/n}=x$$

L'Hospital's Rule Question.


Ffmpeg SCRIPT: image sequence conversion to tiff

Question: I have a problem with a simple script
in the FOLDER have image sequence in .jpg
all jpg files I would like to convert them to tiff
this is my script, but not work fine:
for I in *.jpg; do ffmpeg -start_number 000001 -f image2 -i "$I" -c:v tiff TIFF/"%6d.tif";

when I run the script,
ffmpeg for every jpg continually reboots
and in the output directory I have only one tif converted.
how I do not restart for each jpg ffmpeg?
thank you
Comment: Which TIFF file is converted?  The *first* one that should get processed, or the *last* one?
Answer: In ffmpeg, the start number generally refers to your input images, not the output image.  FFMPEG will also take *.jpg as input using the glob option (check the docs rather than looping through yourself and calling it 1000 times.
Currently, your script will generate the same tiff file for each of the different jpegs that you are calling, because you are just re-calling it with the same parameters.
You could try putting $I.tif at the end instead of "%6d.tif";
for I in *.jpg; do
    ffmpeg -i "$I"  -c:v tiff TIFF/${I%%.jpg}.tif
done

This part ${I%%.jpg} takes your original file name and strips off the .jpg
In Imagemagick you can simply do:
convert *.jpg tiff


Passing Variables to Send-MailMessage

Question: I'm trying to create a PowerShell script that will search my Active Directory for users with passwords that will expire in 14 days and email the user a reminder message. For the most part I have the script working as intended, but I am not getting the proper output for the emails.
This is the script:
Import-Module ActiveDirectory
$below = (Get-Date).AddDays(-77)
$above = (Get-Date).AddDays(-76)
$Persons = Get-ADUser -Filter {PasswordNeverExpires -eq $False -AND (PasswordLastSet -lt $above -AND PasswordLastSet -gt $below) -AND (LastLogonDate -like "*") -AND (MAil -like "*")}

foreach ($Person IN $Persons) {
$body = "Your Windows password will expire in 14 days. Please consider changing your password. - $User.Name - $User.PasswordLastSet"
Send-MailMessage -To $User.Mail -Subject "Alert! Password Expiring Soon!" -From 'firstname.lastname@example.com' -Body $body -SmtpServer smtp.server.com
}

This is what I am getting in the body of the mails it sends.

Your Windows password will expire in 14 days. Please consider changing your password. - .Name - .PasswordLastSet

How do I pass the users name and password last set data to the body text?
Answer: You need to use subexpressions $(...) to access the properties on $User in the string:
"... - $($User.Name) - $($User.PasswordLastSet)"

Otherwise, PowerShell will only parse $User as a variable and the .Name and .PasswordLastSet parts will be treated as normal text.
Answer: An alternative to iCodez's (correct) answer is to use the format operator (-f):
$body = "...your password. - {0} - {1}" -f $User.Name,$User.PasswordLastSet

Passing Variables to Send-MailMessage


Can statistics really be used in education to determine test scores?

Question: I am a middle school teacher. My district prides itself on having the kids take 3 tests during the year to predict their score, and my teaching, on "the real test" at the end of the year. My question: Is this practice even real? Or is the district fooling themselves in thinking these numbers mean more than what they do?
Comment: What do the data show?
Answer: Probably some combination of both.

Have the (predictive) tests been validated as measuring the same constructs as "the real test"?
Are there three different tests (types) or is it the same test three times (tokens)?  If it is the same test three times, the students may get better at it by virtue of exposure, rather than by having learned anything more.  The question then is whether that fact had been taken into account when modeling the predictive relationship.
In addition, what happens if scores are low to these tests? If the school responds by helping and/or providing additional resources during the remainder of the year, that can change the predictive relationship between the predictive tests and the real test.  For example, the predictive relationship may have been modeled as what would have happened if nothing had changed, but it could also be modeled as what is likely to happen given the changes that will be made as a result.
Moreover, these tests will always have some measurement error, so the scores will bounce around; unless the measurement error is very low, the prediction can only be so good w/ just three measurements per student.
Comment: Even if the individual questions are different across sessions, there's some benefit to getting familiar with the format and the type of questions. If you take the SAT twice, you're likely to better the second time around. In theory, one could model this out, but I'd be surprised if anyone actually does....
Comment: I'm guessing that #2 is more of feature than a bug here, at least as far as the individual school is concerned.
Comment: @MattKrause, if the predictive tests are the same test as the 'real' test, probably so.
Answer: @tom: Not sure what you mean by "real", but if it is happening in the real world, it appears that it is real enough.  The question is perhaps one of validity, and I would encourage you to search this site for questions and answers on reliability and validity.  This is a very, very large field. If you wish to discuss this in any depth, it would be good to become familiar with the loaded terms that are used.
Basically, the question rests on the quality of "the real test" at the end of the year and the quality of the classroom tests during the year. The school district should have evidence upon which to base its actions, so I sincerely hope you could retrieve that evidence by contacting the district.
If the evidence does not exist, then this is a research project in the making.  School and district decisions should be evidence based.  Again, this is a huge field, please have a look at this site in more depth.
Answer: It is certainly possible that practice test scores can predict (not determine) test scores.  However, this depends a lot on how well the practice tests simulate the real test. For instance, practice ACT/SAT scores could certainly be used to predict how a student may do on the actual ACT/SAT.  On the other hand, giving a middle school English class a practice test from an AP physics book is certainly not a valid test to measure English ability, and it would likely not predict their final test results very well at all.
Comment: Yes, but it's worth noting that tests always tap more constructs beyond just what they are intended to measure. Eg, an English test (TOEFL) can help predict physics GRE scores for non-native English speakers.


Which set is unwell-orderable?

Question: In textbook it says that every well-orderable set is equipotent to an initial ordinal number. However, of course unwell-orderable cannot equipotent to any ordinal number, but is there any set is unwell-orderable? By axiom of regularity we know that every set is well-founded, so can we conclude that every set is well-orderable? If not, which set is unwell-orderable?
Answer: You cannot really point out at an arbitrary set and say "Aha! I found something which cannot be well-ordered!" because if you only assume ZF it is possible that the universe also satisfies the axiom of choice.
To actually point out a set which cannot be well-ordered you need to assume that one exists, but the problem is that you are only assuming it exists and you don't really know where. In some cases that is enough to produce a counterexample for some things (e.g. Zorn's lemma) but it is not enough in order to identify where this set lies.
It is consistent that the real numbers cannot be well-ordered, and it is consistent that every set that "usual" mathematician would care about is well-ordered but the axiom of choice fails in a very acute way.
This is why often "anti-choice" axioms point out where the axiom of choice fails in a rather explicit way. For example the axiom of determinacy tells us that the axiom of choice fails for the real numbers. It tells us that because we know that if the real numbers can be well-ordered then there is a set which cannot be determined.
Perhaps a simpler case would be "all sets of real numbers are measurable", but the idea is the same.
The requirement that $\in$ is well-founded is not enough to ensure well-orderability, because well-foundedness tells you that you are never "too far" from the bottom, but you can be very wide nonetheless.

I want to add some personal experience of mine on the topic, that usually when doing work without the axiom of choice you want to first figure out what exactly you are trying to prove, after you figured that out you can pinpoint your assumptions better. Do you want a particular set to be non-well ordered, or just a non-well ordered set which has a certain property, and so on.
But ultimately this really depends on what you are trying to prove.
Comment: @Popopo: No... $2^{\aleph_0}$ does not have to be an ordinal.
Comment: @Popopo: No. Under this definition of cardinals the exponentiation is not well-defined. Cardinality can be defined without the axiom of choice as equivalence classes under bijections.
Comment: @Popopo: AC will fail. As for CH it depends on the formulation, and I have written a very nice answer on this site about this. If you formulate it as $2^{\aleph_0}=\aleph_1$ the it fails. It is possible, however that every uncountable set of reals has size continuum.
Comment: Okay, my original purpose is to find out a particular set which is non-well ordered. But I was surprised that whether a set is well-orderable or not is depend on the axiom system. Furthermore, I don't quite understand why it is consistent that the real numbers cannot be well-ordered. Though the real field itself is not well-ordered, $\mathbb{R}$ is equipotent to $2^{\aleph_0}$, which is an ordinal number, thus $\mathbb{R}$ must be well-orderable $\ldots$
Comment: But $2^{\aleph_0}$ is a cardinal number, and in some books the cardinal number of a set is the least ordinal number which equipotent to it(seems called Von Neumann cardinal assignment). So every cardinal number is an ordinal number.
Comment: Ok, I see. So if we add 'the real numbers cannot be well-ordered' into ZF as an axiom, both AC and CH will not hold?
Comment: Okay, I understand, thank you very much.
Answer: The statement that all sets are well-orderable is a well-known equivalent of the Axiom of Choice (perhaps even the first, as Zermelo devised the Axiom of Choice precisely to prove this consequence).  Because the Axiom of Choice is relatively consistent with ZF -- as proved by Kurt Gödel --  one will not be able to construct a non-well-orderable set using standard set-theoretic operations.
However Paul Cohen proved that the negation of Axiom of Choice is also relatively consistent with ZF, and so one can devise "set theoretic models" in which not all sets are well-orderable.
Answer: The axiom of choice is equivalent to there being some well-order on every set. The axiom of choice is independent of the other axioms of set theory, so it is consistent that a set exists that cannot be well-ordered. But it is not provable that such a set exists, for this would violate the consistency of the axiom of choice.
So you cannot construct such a set in any meaningful way. But it is consistent (in the absense of the axiom of choice) for example that there is no well-ordering on $\mathbb{R}$. So $\mathbb{R}$ could be an example.

Which set is unwell-orderable?


Extending JavaScript's Date.parse to allow for DD/MM/YYYY (non-US formatted dates)?

Question: I've come up with this solution to extending JavaScript's Date.parse function to allow for dates formatted in DD/MM/YYYY (rather then the American standard [and default] MM/DD/YYYY):
(function() {
    var fDateParse = Date.parse;

    Date.parse = function(sDateString) {
        var a_sLanguage = ['en','en-us'],
            a_sMatches = null,
            sCurrentLanguage,
            dReturn = null,
            i
        ;

            //#### Traverse the a_sLanguages (as reported by the browser)
        for (i = 0; i < a_sLanguage.length; i++) {
                //#### Collect the .toLowerCase'd sCurrentLanguage for this loop
            sCurrentLanguage = (a_sLanguage[i] + '').toLowerCase();

                //#### If this is the first English definition
            if (sCurrentLanguage.indexOf('en') == 0) {
                    //#### If this is a definition for a non-American based English (meaning dates are "DD MM YYYY")
                if (sCurrentLanguage.indexOf('en-us') == -1 &&      // en-us = English (United States) + Palau, Micronesia
                    sCurrentLanguage.indexOf('en-ca') == -1 &&      // en-ca = English (Canada)
                    sCurrentLanguage.indexOf('en-ph') == -1 &&      // en-ph = English (Philippians)
                    sCurrentLanguage.indexOf('en-bz') == -1         // en-bz = English (Belize)
                ) {
                        //#### Setup a oRegEx to locate "## ## ####" (allowing for any sort of delimiter except a '\n') then collect the a_sMatches from the passed sDateString
                    var oRegEx = new RegExp("(([0-9]{2}|[0-9]{1})[^0-9]*?([0-9]{2}|[0-9]{1})[^0-9]*?([0-9]{4}))", "i");
                    a_sMatches = oRegEx.exec(sDateString);
                }

                    //#### Fall from the loop (as we've found the first English definition)
                break;
            }
        }

            //#### If we were able to find a_sMatches for a non-American English "DD MM YYYY" formatted date
        if (a_sMatches != null) {
            var oRegEx = new RegExp(a_sMatches[0], "i");
                //#### .parse the sDateString via the normal Date.parse function, but replacing the "DD?MM?YYYY" with "YYYY/MM/DD" beforehand
                //####     NOTE: a_sMatches[0]=[Default]; a_sMatches[1]=DD?MM?YYYY; a_sMatches[2]=DD; a_sMatches[3]=MM; a_sMatches[4]=YYYY
            dReturn = fDateParse(sDateString.replace(oRegEx, a_sMatches[4] + "/" + a_sMatches[3] + "/" + a_sMatches[2]));
        }
            //#### Else .parse the sDateString via the normal Date.parse function
        else {
            dReturn = fDateParse(sDateString);
        }

            //####
        return dReturn;
    }
})();

In my actual (dotNet) code, I'm collecting the a_sLanguage array via:
a_sLanguage = '<% Response.Write(Request.ServerVariables["HTTP_ACCEPT_LANGUAGE"]); %>'.split(',');

Now, I'm not certain my approach to locating "us-en"/etc. is the most proper. Pretty much it's just the US and current/former US influenced areas (Palau, Micronesia, Philippines) + Belize & Canada that use the funky MM/DD/YYYY format (I am American, so I can call it funky =). So one could rightly argue that if the Locale is not "en-us"/etc. first, then DD/MM/YYYY should be used. Thoughts?
As a side note... I "grew up" in PERL but it's been a wee while since I've done much heavy lifting in RegEx. Does that expression look right to everyone?
This seems like a lot of work, but based on my research this is indeed about the best way to go about enabling DD/MM/YYYY dates within JavaScript. Is there an easier/more betterer way?
PS- Upon re-reading this post just before submission... I've realized that this is more of a "can you code review this" rather then a question (or, an answer is embedded within the question). When I started writing this it was not my intention to end up here =)
Comment: Used this code for a jQuery calendar plugin. Thanks for sharing! You can check it out here: https://github.com/joelalejandro/jquery-ja/wiki/ja.Calendar
Answer: I would use Datejs.  You can directly load the version appropriate for a given ISO language code (e.g. date-en-CA.js or date-en-GB.js).  Only the capitalization is different.
Comment: I looked at this one this afternoon, but it seemed a bit heavier weight then I was looking for. Plus I wasn't convinced by the documentation that it's Date.parse was any different then the in-built version (as it's CulturalInfo page is just a stub). It sorta looked to me it was using .parseExact to accomplish DD/MM/YYYY (but I am most likely wrong on that point).

Am I correct in assuming that Datejs replaces/overrides the inbuilt JavaScript Date object?
Comment: Also re: Datejs... Despite my example above (which was simplified and made to modify Date.parse itself), in my JavaScripting I always strive to only create 1 variable and otherwise leave the JavaScript namespace untouched (I learned this thanks to YUI). So I create a single base object and attach all of my functions/objects/etc. under it. I do this so that my code (save that 1 variable name) will cause no conflicts/collisions with any other JavaScript on the page. Basically I shun "prototype" =) Anyway... it looks like Datejs not only tweaks the Date object, but integers as well.


Yii framework time() not the same as the behavior time()

Question: I try to update de last_login_time in my user table, but the time() is always 5h higher than the updatedTime behavior with the function
public function behaviors()
{
    return array(
        'timestamps' => array(
            'class' => 'zii.behaviors.CTimestampBehavior',
            'createAttribute' => 'create_time',
            'updateAttribute' => 'update_time',
            'setUpdateOnCreate' => true,
        )
    );
}

My function to update the last_login_time is very simple:
private function userLogedin()
{
    $user = User::model()->findByPk($this->auth->user_id);
    $user->last_login_time = date('Y-m-d H:i:s',time());
    return $user->save();
}

How can i have the same time than the behaviors one? Is there a way more kindly to create this kind of update?
Thank you very much! I'm a newb with Yii, it's my first app, so be kind please ^^
Answer: CTimestampBehavior sets the time based on the database server's local time, as reported by NOW(). Your code sets the time based on the web server's local time, as reported by time().
The timezone difference between the two servers should account for the 5 hour discrepancy.
If you want to achieve the same effect as CTimestampBehavior with similar syntax as your own code, you will have to use CDbExpression:
$user = User::model()->findByPk($this->auth->user_id);
$user->last_login_time = new CDbExpression('NOW()');
return $user->save();

There's also an example of the same here.


Using ISA with two external connections?

Question: I currently have an ISA 2006 server connected to my company's internet connection.
At the moment there is only a single NIC in the ISA Server and all it is doing it publishing Outlook Web Access and acting as a web proxy.  All our client machines have the internal IP of our ISP managed firewall as their gateway address as there is a VPN we need to route across.
To lighten the load on our VPN I would like to route web browsing across a separate ADSL connection whilst retaining the proxying of the ISA server.
Is this possible?  Can anyone point me in the right direction with regard to the NIC configuration on ISA and the routing?
Comment: I don't believe ISA is able to do policy based routing.
Answer: ISA Server can't do that. There used to be a product called RainWall or RainConnect by RainFinity that did this for ISA Server; there might be other alternatives out there, though I don't know of them offhand.
Forefront TMG 2010 supports a new feature called ISP Redundancy, which does some of this; it might be worth investigating.
Edit: ISA 2004/2006 can use different paths for Web destinations, using Web Chaining rules, though. In this case, you create a rule that tells ISA that for the following destinations (perhaps Anywhere, or if you have an Internal subnet defined, External or anywhere-but-your-internal-subnet-range), there's an upstream proxy available. Then you'd ensure that its route to the upstream proxy uses the DSL connection. It's a tab under Networks.
So, the VPN traffic would still flow to and from whatever network, and the web traffic would go via ADSL - but any non-Web traffic would be pushed via the Default Gateway, as per usual. this might cause interesting issues once in a while (for eg, with Java applets, or other things that use their own proxy configuration that isn't the ISA box), but they're normally easy enough to fix.
Comment: I've heard of something called a multi-homed ISA server but haven't had time to read up properly.  Would this not serve my purposes?
Comment: Multihoming is typically having membership in more than one network, usually by having multiple NICs. But now you've mentioned that... (edit)
Comment: Thanks for the follow-up.

So I could have the current, single, NIC connected to the external connection that provides our VPN access and upon which we publish OWA etc.

I could then have a second NIC connected to the (for arguments sake) ADSL connection and define this as the route (via an second ISA network object) for our firewall policies that allow web access and the like?
Comment: I don't think you need a second NIC - Web Chaining should let you route traffic via the DSL connection, as long as you have an upstream proxy (for eg, an ISP proxy) available on the other side of it, which you can add a static route for.
Comment: So yes, what you said - it'll only affect web destinations, and only when there's an upstream proxy available.
Comment: And if there isn't an upstream proxy server?
Comment: Then you can't do it, at least, not without addon software.


Ambari show namenode is stop but actually namenode is still working

Question: We are using HDP 18.104.22.168.3  with Ambari 2.1.2
After finish setup, every node status is correct.
But oneday ambari suddenly show namdenode is stopped.(we don't change any config of ambari or namenode)
However, we still can use HBASE and run MapReduce.
we think name node status should be normal.
We try to restart namenode and check ambari-server log
It shows:

ServiceComponentHostImpl:949 - Host role transitioned to a new state, serviceComponentName=NAMENODE, oldState=STARTING, currentState=STARTED
  HeartBeatHandler:657 - State of service component NAMENODE of service HDFS of cluster wae has changed from STARTED to INSTALLED

we don't understand why its status change from "STARTED" to "INSTALLED".
In namenode side, we check ambari-agent.log
It shows one warning:

[Alert][namenode_directory_status] HA nameservice value is present but there are no aliases for {{hdfs-site/dfs.ha.namenodes.{{ha-nameservice}}}}

We think it is irrelevant.
What's the reason that ambari think namenode is stopped?
Is there any way that we can fix this issue?
Comment: Did you solve this?
Answer: Run the command ambari-server restart from linux terminal in Ambari server node
Run the command ambari-agent restart from linux terminal in all the nodes in the cluster.
You can run the command hdfs dfsadmin -report from the terminal as hdfs user to confirm all the nodes are up and running.
Comment: I run the hdfs dfsadmin -report. Report shows data node status but no status of name node.
Comment: What you mean by no status for namenode ? Is it in safe mode ? If yes, then you can try **hadoop fs -safemode leave** to leave the safe mode.
Comment: The report is as below: Configured Capacity: xxx
Present Capacity: xxx
DFS Remaining: xxx
DFS Used: xxx
DFS Used%: xxx
Under replicated blocks: xxx
Blocks with corrupt replicas: 0
Missing blocks: 0
Missing blocks (with replication factor 1): 0

-------------------------------------------------
Live datanodes (3):

Name: data node 1Decommission Status : Normal, Name: data node 2 Decommission Status: Normal, Name: data node 3 Decommission Status: Normal,
Comment: I see the hdfs report looks fine. Have you tried restarting the HDFS from Ambari UI, then restarting the ambari-server and ambari-agent as suggested in my previous comment.
Comment: Yes. we try to restart HDFS from ambari UI. name node will show "started" for a while and then change to "stopped"


What is the unique solution to this system of equation?

Question: The solution sets:

-2x + 2y + 5z = -12 (A)
4x + 3y - Z = -8 (B)
-5x + 3y - 4z = 7 (C)

I aligned Set A with Set B, multiplying set B by 5 to cancel out the z's:

-2x + 2y + 5z = -12
20x + 15y -5z = -40
18x + 17y = -52 (D)

Next, I aligned Set B with Set C, multiplying Set B by 4 to cancel out the z's once more:

-16x - 12y + 4z = -32
-5x + 3y - 4z = 7
-21x - 9y = - 25 (E)

Aligning Sets D & E I multiplied D by 21 and E by 18 to cancel the x's:

378x + 357y = -1092
-378x - 162y = -450
195y = -1542/- 195

From this point I need assistance. Somewhere I believed I made a mistake but I do not know where.
Comment: It should be $-16 x - 12 y + 4 z = 32 $ not $-32$.
Comment: I got the solution as  $x = -1, y = -2, z = -2 $
Comment: I multiplied by $(-4)$
Comment: @HosamHajjir Peace and thank you. Did you multiply it by 4?
Answer: Your last equation has only $y$ as a variable, so find its value.  I can't read the formatting on the last line to say what the answer is.  Then plug that $y$ into $D$ or $E$ and you find $x$.  Now plug both $x,y$ into any of the first equations and you can find $z$.
When you aligned set B with set C you dropped a sign.  You multiplied by $-4$, not $4$, so the right side should be $32$.  A good way to find these is to follow the first paragraph to get a full solution.  It will satisfy your last equation.  Now plug it into each earlier equation and find where it fails.  That is the place you made the error.
Comment: I edited the format


Criar estilo para vários elementos gerados dinamicamente

Question: Tenho a seguinte função, que cria blocos dinamicamente:

function criar(){
    let box = document.querySelector('.box');
    box.style.display = 'flex'
    let element = document.createElement('div')
    element.style.width = '100px';
    element.style.height = '100px';
    element.style.background = '#f00';
    element.style.marginRight = '6px';
    element.className = 'container';
    element.setAttribute('onmousemove', 'getRandomColor()')
    box.appendChild(element)

}

function getRandomColor(){
    let letters = "0123456789ABCDEF";
    let color = "#";
    let container = document.querySelector('.container');
    for (var i = 0; i < 6; i++) {
    color += letters[Math.floor(Math.random() * 16)];
    }
    container.style.backgroundColor = color;
    return color;

}
<button onclick="criar()">Criar Quadrado</button>

A função getRandomColor() gera cores aleatórias para o bloco criado. O problema é que isso só funciona para o primeiro bloco criado, os outros recebem o evento de mouse mas não sofrem a mudança. Tentei usar o querySelectorAll() para selecionar mais de um elemento, mas o console retorna erro. Alguém sabe como fazer funcionar?
Answer: Danúbio,
Uma forma bem simples de fazer esse evento onmousemove funcionar para todos os blocos, é passar o this para a função getRandomColor:
element.setAttribute('onmousemove', 'getRandomColor(this)');

E alterar assim a função getRandomColor para receber o container por parâmetro.
function getRandomColor(container){

Veja seu exemplo com essas alterações:

function criar(){
  let box = document.querySelector('.box');

  box.style.display = 'flex';

  let element = document.createElement('div');

  element.style.width = '100px';
  element.style.height = '100px';
  element.style.background = '#f00';
  element.style.marginRight = '6px';
  element.className = 'container';
  element.setAttribute('onmousemove', 'getRandomColor(this)');
  box.appendChild(element);
}

function getRandomColor(container){
  let letters = "0123456789ABCDEF";
  let color = "#";

  for (let i = 0; i < 6; i++) {
    color += letters[Math.floor(Math.random() * 16)];
  }

  container.style.backgroundColor = color;
}
<button onclick="criar()">Criar Quadrado</button>

Comment: O this é o elemento DIV criado na função criar(), container é somente o nome dado ao parâmetro, poderia ser qualquer outro nome, nesse contexto, o container é na verdade um elemento div do DOM que o mouse está posicionado no momento.
Comment: O this nesse caso faz referência à div criada dinamicamente. Mas como ele acessa a class Container?


Polar decomposition of real matrices

Question: Can we decompose real matrices in a way that is analogous to polar decomposition in the complex case?
What I mean is: given an invertible real matrix $M$, can we always write:
$$
M = OP,
$$
maybe uniquely, where $O$ is orthogonal, and $P$ is symmetric positive-definite?
Thanks.
Comment: https://en.wikipedia.org/wiki/Polar_decomposition
Comment: @BillCook More or less... oh wait, I forgot symmetry!
Comment: The answer is yes.  This is a consequence of the spectral theorem, whereby $M^TM$ can be orthogonally diagonalized.
Comment: @Omnomnomnom Wow. Can you explain more? (Or make it into an answer?)
Answer: The answer is yes. In fact, we don't need the spectral theorem to prove it.
Suppose that $M$ is a real invertible matrix.  Then $M^TM$ is positive definite and has the unique positive semidefinite square root $P = \sqrt{M^TM}$. Now, note that $P$ has the property $\|Px\| = \|Mx\|$ for all vectors $x$.
If $M$ is invertible, then $P$ is invertible as well, and we have $M = (MP^{-1})P$.  We note that $MP^{-1}$ is orthogonal since for all $y = Px$, we have
$$
\|MP^{-1}y\| = \|y\|
$$
Thus, we have a polar decomposition with $O =( MP^{-1})$ .
We note that this decomposition is unique. In particular, suppose $M = OP$ for orthogonal $O$ and positive $P$. then
$$
M^TM = PO^TOP = P^2
$$
And so, by the uniqueness of positive definite square roots, $P$ is uniquely determined.  Then we can rearrange $M = OP$ to find $O = MP^{-1}$ is also unique determined.

Things get a bit trickier when $M$ is not invertible, but we can still guarantee a (non-unique) polar decomposition.
Comment: This can also be derived easily from the singular value decomposition.
Comment: Wait...how do you prove that $PM^{-1}P=M$?
Comment: I think I meant to write $MP^{-1}$... the proof is pretty much the same, though.  The only other thing we need to show is that $M$ invertible $\iff$ $M^TM$ invertible $\iff$ $P$ invertible, which isn't too hard.
Comment: See my latest edit.
Comment: Oh yeah, like this it works! Thanks.
Comment: +1 Elegant proof!
Answer: A derivation of the polar decomposition for a 2x2 matrix can be found on Polar Decomposition
I also elaborate the relation with SVD.
In short, shuffling around with the SVD decompostion:
$A= U \Sigma V^T$ = $(UV^T) (V \Sigma V^T) $= $R_{\theta} S_{AT}$
$S_{AT}$ scales along the principal axes of the ellipse defined by $A^T(unitcircle)$
$R_{\theta}$ rotates over the angle between the principal axes of $A$ and $A^T$
$A^{-1}=\left({\ \ U\ \mathrm{\Sigma}}^{-1}U^{-1}\right)^{-1}R_\theta$ = $S_A R_\theta$
$R_{\theta}$ rotates over the angle between the principal axes of $A$ and $A^T$
$S_{A}$ scales along the principal axes of the ellipse defined by $A(unitcircle)$
Comment: Is this voted down because it is wrong? not helpful?
Answer: Theory of Polar Decomposition is described in Wikipedia
For the sake of simplicity we shall restrict our attention to real-valued non-singular square (invertible) matrices.
Theorem. Every such a matrix B can be decomposed as follows and the decomposition is unique:
$$
B = U Q
$$
Where $U =$ orthogonal matrix and $Q=$ symmetric positive definite matrix.
Instead of providing still another proof of the above theorem, I have decided to be practical and describe how to numerically
obtain the decomposition.First define the transpose of the matrix multiplied with the original:
$$
P = B^T B = \left(B^TB\right)^T = P^T \quad \mbox{: symmetric}
$$
It follows that $P$ is symmetric and positive definite.
Then what we need is the square root of the matrix $P$. In order to understand how to obtain it, let's take a look at
Newton's method for obtaining the square root
of a real positive number $p$:
$$
f(x) = x^2 - p\quad \Longrightarrow \\ x_{n+1} = x_n - \frac{x_n^2-p}{2x_n} = \left(x_n + p\,x_n^{-1}\right)/2
$$
Let's do the same for our matrix $P$, iterations starting with the unit matrix:
$$
X_0 = I \quad ; \quad X_{n+1} = \left(X_n + P X_n^{-1}\right)/2 \quad ; \quad \sqrt{P} = \lim_{n\to\infty} X_n
$$
According to a
MSE reference
$X_n^{-1}$ is positive definite and symmetric, provided that $X_n$ is positive definite and symmetric. Products and sums
of positive definite and symmetric matrices are positive definite and symmetric too. Therefore,
by induction to $n$, it can be proved that $\sqrt{P}$ is positive definite and symmetric as well. Now define $Q=\sqrt{P}=Q^T$.
At last define $U = B Q^{-1}$ and prove that $U$ is orthogonal:
$$
U^{T}U = \left(B Q^{-1}\right)^T\left(B Q^{-1}\right) = \left(Q^{-1}\right)^T\left(B^TB\right)Q^{-1} = \\
\left(Q^T\right)^{-1} Q^2 Q^{-1} = \left(Q^{-1}Q\right)\left(QQ^{-1}\right) = II = I
$$
The conclusion looks like trivial:
$$
B = \left[B\left(B^TB\right)^{-1/2}\right]\left[\left(B^TB\right)^{1/2}\right]
$$
So far so good about theory. I want to talk about practice now, which in modern times is computer programming:
Accompanying software
My favorite programming language is (Delphi) Pascal.
First we need some standard matrix manipulation routines and a Newton-Raphson routine for calculating the matrix
square root. These are implemented in a Unit called 'Wiskunde'. The software is completed by testing if theory
works in practice as expected. The number of iterations in procedure 'Newton' has been determined as follows. A suitable stopping criterion is:
$$
\left|\left| X^2 - B^TB\,\right|\right| < \epsilon
$$
with $\epsilon = 10^{-10}$ and the norm of a $n \times n$ matrix $A$ defined as:
$$
\left|\left|A\right|\right| = \sqrt{\sum_{i=1}^n \sum_{j=1}^n A_{ij}^2}
$$
Convergence is very fast. When cast in MathJax format the output looks like this:
$$ \small
\begin{bmatrix} 0.361048 & -0.297419 & -0.227079 \\ 0.171654 & -0.181309 & -0.338205 \\ -0.127762 & -0.074326 & -0.417988 \end{bmatrix} = \\ \small
\begin{bmatrix} 0.491571 & -0.868969 & -0.057015 \\ 0.599413 &  0.385125 & -0.701701 \\ -0.631714 & -0.310760 & -0.710187 \end{bmatrix}
\begin{bmatrix} 0.361082 & -0.207928 & -0.050301 \\ -0.207928 & 0.211719 & 0.196967 \\ -0.050301 & 0.196967 & 0.547115 \end{bmatrix}
$$

Polar decomposition of real matrices


Problema em configurar "Figuras" no Latex

Question: Olá, estou começando a mexer no Latex e encontrei um problema que não consigo resolver.
Ao inserir uma figura no Latex tudo da certo, porém, antes da imagem (em pdf) aparece o nome dela, atrapalhando o texto e ficando desalinhado.
Seguem abaixo a linha de código utilizada e o resultado.
Código:
<code>\begin{figure}[!h]
    \includegraphics[scale=0.6]{imagens/Questionario Flipped Classroom.pdf}
    \caption{Tabela com os resultados obtidos através de um questionário respondido pelos alunos que frequentaram a metodologia ativa de Flipped Classroom}
    \label{fig: quest fc}
\end{figure}
</code>
Resultado:
Comment: Tenta colocar no nome do arquivo: `imagens/"Questionario Flipped Classroom".pdf`, com as aspas.
Comment: Assim nem aparece a imagem, só fica um texto escrito a linha de código e um quadrado.
Comment: E se "colocar tudo dentro das aspas"?
Answer: O problema são os espaços no caminho da imagem, inclua o pacote <code>\usepackage[space]{grffile}</code> no seu LaTeX.
Segue um código de exemplo:
<code>\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}

\usepackage[space]{grffile}

\begin{document}
\begin{figure}[!htb]
    \centering
    \includegraphics[scale=0.6]{imagens/Questionario Flipped Classroom.pdf}
    \caption{Tabela com os resultados obtidos através de um questionário respondido pelos alunos que frequentaram a metodologia ativa de Flipped Classroom}
    \label{fig: quest fc}
\end{figure}
\end{document}
</code>
Veja no Overleaf
Referência
How to include graphics with spaces in their path?
Comment: Muito obrigado, deu certo aqui!!


number of euler cycle graphs with degree of 2

Question: I got the following question -

what is the number of 2-regular graphs containing an Euler cycle with n vertices

what I came up with so far -
as I understand we are looking for a circle (every vertex is of degree of 2)
so let's say we pick some random vertex - we have to pick his neighbors
out of $n-1$ vertices - $$\left(\begin{array}{c}n-1\\ 2\end{array}\right)$$
and then we have to fill all the other vertices untill we reach the end of the cicrcle - $$(n-3)!$$
so the final answer would be $$\left(\begin{array}{c}n-1\\ 2\end{array}\right)\cdot (n-3)!$$
It works for $n=3$ and $n=4$ and I think it works for $n=5$
what do you think? what is wrong with my logic here?
how I solve this kind of problems?
Comment: How does your formula work for $n=4$? There is only one possible 2-regular graph with $4$ vertices.
Comment: as I understand there is 3 such graphs ... can you explain how did you count?
Comment: With four vertices the only possible 2-regular graph is the "square", isn't it? What are the other two graphs?
Comment: let's say we have numbers in a square from 1 to 4 (clockwise): {1,2,3,4},{1,3,2,4},{1,2,4,3}
Comment: But they represent the same graph.
Comment: for the first graph for example 1 knows 2 and 4 but in the second 1 doesn't know 2 so the graphs are different
Answer: A 2-regular graph which has an Euler cycle with $n$ vertices is necessarily connected and therefore it is a cycle-graph with $n$ vertices. If we are counting the labeled graphs then the number should be for $n>2$
$$\frac{n!\;\mbox{(permutations)}}{2\cdot n\; \mbox{(orientations)(rotations)}}=\frac{(n-1)!}{2}$$
See  OEIS's A001710.
Comment: @misha312 Do I understand your question correctly? Is it just like the number of necklaces one can make with $n$ distinct beads?
Comment: yes that's exactly it thanks


OTP/SMS auto fetch issue using SMS Retriever API Android

Question: I'm trying to use Google's SMS Retriever API for Automatic SMS Verification, but there is an issue in it.
previously , I was reading sender number using getOriginatingAddress() and  if it's valid sender number then read OTP otherwise it should not read message. As , forwarded OTP is disturbing user's privacy.
I have the following scenario.
My app is auto-fetching forwarded OTP messages.

 User A installs app on his mobile and enters User B mobile number.
 User B receives OTP and forwards it to User A.
App reads OTP on User A mobile and goes to home screen.

is there any way around to get sender number.?
Answer: There is no way for you to achieve sender verification by using SMS Retriever API.
There is a workaround to handle this scenario for this which would be at SMSC end. That would be that share the hashcode of your verification SMS with SMSC guys to not to forward or restrict SMS that contains that specific hashcode in SMS body. It's not a good approach but that's the only option with SMS Retriever API
Though there is another way which I will recommend
Google has released another API that deals with sender verification but it has different flow then SMS Retriever API and Its called SMS User Consent API This API has following criteria for a message to be delivered and auto fetch by device
A message triggers the broadcast only if it meets these criteria:

The message contains a 4-10 character alphanumeric string with at
least one number.
The message was sent by a phone number that's not in the user's
contacts.
If you specified the sender's phone number, the message was sent by
that number.

Hope this will help you!


Deleted files from /etc/exim4

Question: I installed Exim4. But then I deleted it and purged it. Now a I want to reinstall it, but all config files are gone (in /etc/exim4). Can I recorver them?
Comment: Retrieve them from your backups?
Answer: Some rpm based distros save config files when removing packages by naming them something like app.config.rpmsave. I don't know where Ubuntu puts them, but if they were saved they are probably sitting around somewhere obvious. Do a search by partial file name and see what you come up with.
Answer: If you don't have backups, you will have lost what was there.  If you made any additions to the split configuration, I would expect them to have been left behind.  All of the standard configuration files will be created if you reinstall.  This includes the update-exim.conf.conf file which is where most of the configuration is normally done.
There are a few tools which monitor changes to /etc.  The keep a copy of the directory to do the comparisons against. None of them are installed by default.  If you had one of them installed I would expect you would have been notified of the change.
Comment: If he removed the package, the config files are kept; once the package is purged, the config files are deleted.
Comment: @Steven: Correct, but it was stated that the package was purged.  This will result in the conffiles being deleted.  Conffiles are listed in the package's `.conffiles` file in the `/var/lib/dpkg/info` directory.  Files the user added are kept as the are not listed, and the corresponding directories are kept because they are not empty.

Deleted files from /etc/exim4


Facet filter in Views wrongly returns "No results"

Question: I'm running into a strange behavior with Search API and Facets API, and I hope someone can point what I'm doing wrong.
I am working in Drupal 7 with Views, Search API, Database Search (search_api_db), Facets API, and Search Facets (search_api_facetapi). My view is working fine otherwise: exposed filters and facet filters work fine in isolation.
The problem happens when I search using an exposed filter, and then try to narrow it with a facet filter.
First step: I search using a exposed filter (see image 1). I get 606 results which display fine.

Then I try to narrow clicking "2" in the facet "Filter by level". The field level is an Integer, and is indexed by Search API as an Integer. Weirdly, I supposedly get 33 results (the View says "Displaying 1 - 20 of 33") but NOTHING gets displayed in the View body (the View says "No results"). Still, the pager at the bottom correctly indicates that there are 2 pages.

Any help will be appreciated.
PS: The field "Composer" is indexed as Fullsearch.
Answer: I figured out what the problem was. I was using Indexed Node: Composer for the exposed filter instead of Search: Fulltext search (the field composer was indexed as a fulltext index).


Como fazer um timeout e reexecutar uma linha de comando em Python?

Question: Tenho um requisição de informação que simplesmente não recebe informação e fica parado, então reenvio executo e tenho a resposta. Então, como fazer que a linha de comando seja cancelada depois de um limite de tempo e reexecutada até que um evento ocorra?
Exemplo:
def atrasado():
    import random
    import time
    a = random.random()
    time.sleep(a*10)
    if a < 0.5:
        print('Foi')
        print(a*10)
    else:
        print('erro')
        print(a*10)

Então, como dar timeout em atrasado() se ele demorar mais de 5 segundos e reiniciar a função?
Há sempre a situação de atrasado() demorar mais de 5 segundos apesar de ter sido reiniciar.
Comment: Marcio, marquei como duplicata uma pergunta em que respondi como implementar o timeout. Se ficar com alguma dúvida ou achar que a resposta não lhe seja útil, por favor me avise.
Comment: @Woss melhorei a pergunta, pois só 'matar' o comando não me adianta, preciso que ele seja reexecutado.
Comment: É só colocar um teu/except dentro de um laço de repetição
Answer: Você pode usar o retry pattern para executa sua função novamente.
O retry é um pattern utilizado em varias linguagem para refazer a chamada de uma função caso ocorra algum erro, na sua implementação você pode especificar o numero de tentativas que sua função terá para executar após esse numero de tentativas se ainda persistir o erro ela será finalizada e uma exceção será lançada
Sempre que presumirmos que uma resposta inesperada - ou nenhuma resposta nesse caso - pode ser corrigida enviando a solicitação novamente, o uso do padrão de repetição pode ajudar.
from retry import retry
@retry()
def make_trouble():
    '''Retry until succeed'''

Também existe outas bibliotecas como timeout-decorator que você pode usar para limitar o tempo da sua função.
timeout-decorator também é um pattern usado para limitar o tempo de execução de uma função
O timeout pattern é bastante simples e muitos clientes HTTP têm um tempo limite padrão configurado. O objetivo é evitar tempos de espera ilimitados por respostas e, assim, tratar cada solicitação como falha quando nenhuma resposta foi recebida dentro do tempo limite.
import time
import timeout_decorator

@timeout_decorator.timeout(5)
def mytest():
    print("Start")
    for i in range(1,10):
        time.sleep(1)
        print("{} seconds have passed".format(i))

if __name__ == '__main__':
    mytest()

Fora esse dois ainda existe alguns pattern que vem a calha de vez em quanto como o
Circuit breaker, fallback
Sua função ficaria da seguinte forma:
from retry import retry
import random
import time

@retry(tries=3, delay=2)
def atrasado():
    a = random.random()
    time.sleep(a*10)
    if a < 0.5:
        print('Foi')
        print(a*10)
    else:
        print("Nova Tetativa")
        raise Exception("Erro de tempo")

if __name__ == "__main__":
    atrasado()

Comment: Acho que sua resposta ficaria bem melhor se você desse uma explicada no que o `@retry()` faz
Comment: @yoyo, dei uma melhorada na explicação
Answer: Como comentado, você pode utilizar a resposta de Timeout na função input do Python junto com um laço de repetição, assim re-executar a função quando ocorrer o timeout.
@timeout(seconds=5)
def read_user_name():
    name = input('Qual é o seu nome? ')
    print('Seja bem-vindo,', name)

attempts = 5

while attempts:
    try:
        read_user_name()
        break
    except Exception as error:
        print(error)
        attempts -= 1
else:
    print('Erro: acabaram suas tentativas')

Veja funcionando no repl.it
Answer: Uma solução para o seu problema é utilizar o módulo asyncio.
asyncio é uma biblioteca para escrever código concorrente assíncrono usando a sintaxe async/await.
asyncio opera sobre corrotinas que são uma forma mais generalizada de sub-rotinas. Sub-rotinas tem a entrada iniciada em um ponto, e a saída em outro ponto. Corrotinas podem entrar, sair, e continuar em muitos pontos diferentes e corrotinas são declaradas com a sintaxe async/await.
Execute uma corrotina com:

asyncio.run() executa e retorna o resultado da corroutina.
asyncio.create_task() agenda e execução de uma corrotina em a envolve num Task retornando-o.
wait aguardando o retorno de uma corrotina. Só pode ser usado dentro de outra corrotina.

Como exemplo serão criada duas corrotinas:

demorada() que é uma corrotina que poderá ou não levar 10s para ser executada, é uma escolha aleatória decidida na linha await asyncio.sleep(random.choice((0,10))) que prende ou não o processamento por 10s. Retorna um numero aleatório no intervalo [0,65536[.
main(timeout=1) é a corrotina de nível superior. Cria uma atividade para a corrotina demorada() e fica no aguardo com timeout por meio do método asyncio.wait_for(aw, timeout) gerando uma exceção asyncio.TimeoutError caso o tempo de execução da atividade dure mais que timeout.

Exemplo:
import asyncio
import random

async def demorada():
    await asyncio.sleep(random.choice((0,10)))            #Aleatoriamente sorteia se demora ou não 10s
    return random.randint(0, 65536)                       #Retorna no internalo [0,65536[

async def main(timeout=1):
   task = asyncio.create_task(demorada())                 #Agenda a corrotina demorada() e retorna um task.
   try:
       await asyncio.wait_for(task, timeout)              #Aguarda a execução da Task com timeout.
   except asyncio.TimeoutError:
       task.cancel()                                      #Cancela a atividade.
       print("A função demorou demais para responder.")   #Imprime a mensagem.
   else:
       print(f"A função retornou {task.result()}")        #Imprime a mensagem com resultado de demorada()

#Faz 10 chamadas de main() com timeout 5s
for _ in range(10):
    print(">>> ",end="", flush="True")
    asyncio.run(main(5))

Resultando:
>>> A função retornou 43258
>>> A função demorou demais para responder.
>>> A função retornou 14525
>>> A função retornou 6355
>>> A função demorou demais para responder.
>>> A função retornou 39265
>>> A função demorou demais para responder.
>>> A função retornou 39502
>>> A função demorou demais para responder.
>>> A função retornou 50657

Aplicando essa informação ao exemplo da pergunta basta criar um loop entorno da atividade e reiterar caso de timeout ou verificar seu resultado em tempo hábil.
import asyncio
import random

async def demorada():
    await asyncio.sleep(random.randint(0,10))
    return random.randint(0, 65536)

async def main(timeout=1):
   #Abre um loop de duração indeterminada...
   while True:
       task = asyncio.create_task(demorada())          #Agenda a execução da atividade demorada
       print('Fazendo uma tentativa...')               #Imprime mensagem
       #Abre um bloco de tratamento de exceções...
       try:
           await asyncio.wait_for(task, timeout)       #Aguarda a execução da Task com timeout.
       except asyncio.TimeoutError:                    #Havendo exceção de timeout...
           task.cancel()                               #Cancela a atividade.
           print('Time out...')                        #Imprime mensagem permanecendo no loop.
       else:
           return task.result()                        #Retorna o resultado da atividade.

req = asyncio.run(main(5))
print(f'Resultado da chamada {req}')

Resultando:
Fazendo uma tentativa...
Time out...
Fazendo uma tentativa...
Time out...
Fazendo uma tentativa...
Resultado da chamada 20864

Comment: Poderia informar o motivo do negativo para que eu melhore a resposta?


Microsoft Azure Cognitive Services Handwriting Detection Bounding Box Parameters

Question: I am currently using Microsoft Azure Cognitive Services Handwriting Detection API.
The API returns a set of values for the bounding box:
<code>{
    "boundingBox": [
      2,
      52,
      65,
      46,
      69,
      89,
      7,
      95
    ],
    "text": "dog",
    .
    .
    .
</code>
I would like to make sense of these 8 parameters. What is their significance and what do they reflect? I tried hard finding about them in Microsoft API's documentation, but of no use. Kindly help me understand what these parameters mean or link me to some place where this doubt can be cleared.
Also let me know if you need any more information.
Comment: can you know how to draw a bounding box with those coordinates? any help is highly appreciated.
Answer: According to this, the API returns the four corners of the box in X,Y coordinates. So:
X top left, Y top left, X top right, Y top right, X bottom right, Y bottom right, X bottom left, Y bottom left
Comment: Official reference: https://westus.dev.cognitive.microsoft.com/docs/services/computer-vision-v3-2-preview-1/operations/5d9869604be85dee480c8750
Answer: This information is unnecessarily hidden. I finally found it in their edx course


Zebra groups and counting stripes

Question:
How many stripes can you paint on a $2$-group of fixed size?

A group of order $2^ap^b$ is solvable, by Burnside's theorem, so its chief factors are either abelian $2$-groups or abelian $p$-groups.  Such a group is a zebra group if its chief factors in any chief series alternate between the $2$ and the $p$.  In other words, if you take a chain of normal subgroups $$1 = N_1 ⊲ N_2 ⊲ \cdots ⊲ N_n = G$$ of maximal length, then the quotient groups $N_{i+1}/N_i$ alternate between being abelian $2$-groups (the stripes) and abelian $p$-groups (the background).

If we fix $a$, say $a=8$, then how many stripes can a zebra group have?

Obviously no more than $8$ $2$-stripes, but with a little work one can see that it can have no more than $4$ $2$-stripes.  Unfortunately, I'm having trouble getting even $3$ stripes.
Comment: Just to see if I am understanding the definition of a zebra group right. So if we take two steps in any series of chief factors, we get groups which alternatingly have normal Sylow-2-subgroups but not Sylow-p-subgroups and vice versa?
Comment: Yes, N(2i+2)/N(2i) has a normal Sylow p-subgroup N(2i+1)/N(2i), but no normal non-identity 2-subgroups, and  N(2i+1)/N(2i-1) has a normal Sylow 2-subgroup N(2i)/N(2i-1), but no normal non-identity p-subgroups.  G has a unique chief series, since minimal normal subgroups commute.  An example of a zebra group with 2 stripes is the symmetric group on 4 points.
Answer: I doubt whether 3 stripes is possible with $a=8$, although I have not tried to prove it. The problem is that, if you construct the group from the top downwards, then each new layer needs to be a faithful module for the group you have already, which means that the dimensions grow rapidly.
The obvious way to start is a 2 at the top, followed by a 3 and then $2^2$, so we now have $S_4$. The smallest faithful module for $S_4$ over any field has dimension 3, so we can put a $3^3$ under the $S_4$ to get a group $G$ of order $2^33^4$. Now the smallest faithful irreducible module for $G$ over the field of order 2 has dimension 6 (I did that calculation in Magma, but I expect you can do it in GAP), so we get a group of order $2^93^4$ with three stripes, which is a subgroup of ${\rm AGL}(6,2)$, and I would be surprised if you can do better.
Comment: Exactly.  I also did not check if there were better choices, but the list of possible choices must be pretty short, since the prime factorization of |GL(5,2)| is pretty short.  Do you know of anything relating the p-length to the dimension of a faithful module in characteristic p?
Comment: If it helps, the obvious route gives 4 stripes of type 2⋉3⋉2^2⋉3^3⋉2^6⋉3^9⋉2^18.  It seems like the requirements grow very quickly.
Comment: Thanks, I used the derived length instead of the p-length, and got a theoretical answer that agreed with experiments.
Answer:
2 is the maximum number of stripes possible on a zebra group with a=8.  S stripes require  a ≥ C⋅9S  for large S.

The number of stripes S of a zebra group gives bounds on the derived length D of a zebra group: 2S - 1 ≤ D ≤ 2S + 1.  The action of G/H on a chief factor H/K must be irreducible and faithful, and so G/H embeds in GL(H/K) = GL(n,q) for q in {2,p} the prime dividing the order q^n of H/K.  However, for large n, the maximal derived length of a solvable subgroup of GL(n,q) is about log(n-2)/log(9), or in other words, n ≥ 9^D.  In particular, as S increases, the "a" from 2a pb increases exponentially.
For small n, the maximal derived length of soluble subgroups of GL(n,2) are: 2, 3, 4, 4.  The maximal derived length of irreducible soluble subgroups of GL(n,2) appear to be 2,2,3,2,6,2,5,4,4.  Hence the minimum dimensions for derived length D=2 is n=2, D=3 is n=4, D=4 is n=6, D=5 is n=6, D=6 is n=6, and D≥7 is n≥11.
The top stripe has order at least 2^1.  By the time H/K is the second stripe, G/H has derived length 2, and so H/K has order at least 2^2.  By the time H/K is the third stripe, G/H has derived length 4, and so H/K has order at least 2^6.
  Since 1+2+6 ≥ 8, this shows there is no three-striped zebra group with a Sylow 2-subgroup of order 2^8.
Three stripes is attainable at a=9.  Four stripes is not attainable for a≤14 and is attainable for a=27.  Roughly speaking, S stripes require a ≥ C⋅9S (though my proof needs S really large).

Zebra groups and counting stripes


Should string saddles touch each other?

Question: I was investigating a buzzing sound in my Squier Stratocaster that had started a couple of days ago, and finally narrowed it down to the (hard-tail) bridge. None of the height-adjustment screws was floating, and after I had used a piece of paper to slide between the individual saddles to gauge the distance between them, I found that the buzzing sound had disappeared. In three of the gaps the paper would move freely, but in two gaps I had to use more force to move the paper. So I assume that the buzzing was caused by two saddles being so close to each other that they rattled against each other when their strings were being played.
Which leads me to wonder: are the saddles on a Strat supposed to touch each other? Do they touch on a more expensive Fender model? There's so little space between them on my Squier that it's hard to tell whether they're supposed to touch or not; the outer saddles move on ridges in the bridge, so I can't press them closer together, but the inner four can move sideways freely.
Here's an image I found on eBay of this type of bridge:
Comment: Looking at my Strats and Stratalikes, all saddles are touching, but should be held tight by either neighbour, and the fact that the strings' tensions hold them down tight, and at that point on the string there's little movement anyhow. Check all screws for approriate tightness.
Comment: I'm not an expert but I don't think the saddles touching each other is a problem. If the saddle is moving when the string vibrates that seems like a problem. Might just be cheap saddles.
Comment: @ToddWilcox They're definitely cheap saddles, but the problem was fixed by spacing them out evenly by sliding a piece of paper between them, so the buzzing must have been caused by them rattling against each other.
Comment: I'm just saying the fact that they wiggle when you play might be the real problem, not that the wiggling makes them rattle against each other.
Comment: @Tim So you can't slide thin paper between them? Then this Squier bridge is definitely badly designed. Btw, I guess I'm dragging the middle four saddles sideways with bends.
Answer: I cannot be definitive, as I'm not a Strat guy, but later G&L bridges have a set screw to force the saddles together so they resonate.
Comment: I guess that suggests that having them touch just slightly is not ideal.

Should string saddles touch each other?


F#: Accessing values of decision Union

Question: Is there a better way or an alternative for the getHandRankValue function?
Maybe without the match
type HandRank =
    | StraightFlush of int list
    | FourOfAKind of int list
    | FullHouse of int list
    | Flush of int list
    | Straight of int list
    | ThreeOfAKind of int list
    | TwoPair of int list
    | OnePair of int list
    | HighCard of int list

let getHandRankValue handRank =
    match handRank with
    | StraightFlush x -> x
    | FourOfAKind x -> x
    | FullHouse x -> x
    | Flush x -> x
    | Straight x -> x
    | ThreeOfAKind x -> x
    | TwoPair x -> x
    | OnePair x -> x
    | HighCard x -> x

let ranks = [Flush([8;6;4;3;2]); TwoPair([8;4;7]); Straight([8])]

let rankValues = ranks |> List.map getHandRankValue

result is [[8;6;4;3;2]; [8;4;7]; [8]]
Comment: Have you considered separating the two - e.g. `type Hand = Hand of HandRank * int list`?
Answer: I agree with the suggestion to factor out the int list from your type. Barring that, you can also simplify your getHandRankValue function somewhat, as follows:
let getHandRankValue = function
    | StraightFlush x
    | FourOfAKind x
    | FullHouse x
    | Flush x
    | Straight x
    | ThreeOfAKind x
    | TwoPair x
    | OnePair x
    | HighCard x -> x

I've made two changes here:

Replaced match handRank with a pattern matching function.
Removed redundant -> x expressions.

F#: Accessing values of decision Union


VHDL - Conditional attribute declaration depending on a generic

Question: How do I write a code segment which would evaluate a generic and create (or not create) an attribute accordingly?
Example :
if G_MY_GENERIC then
    attribute my_attribute_typ : string;
    attribute my_attribute_typ of signal_having_an_attr : signal is "value";
else
    --nothing is created
end if;

Answer: It is perfectly possible to write something similar to that, but the attribute will only be visible in the scope of the generate statement.
g_something: if test_condition generate
   attribute my_attribute_typ : string;
   attribute an_attribute of my_attribute_typ: signal is "value";
begin
    -- attribute is visible in this scope

    p_my_process: process(clk)
    begin
        -- attribute is also visible here
    end process;
end generate;

-- but not here

Answer: Instead you have to use something like the following to conditionally set an attribute (cumbersome, but achieves the result):
  signal asvRam : svRam_at(0 to gc_nFifoDepth-1) := (others => (others => '0'));

  type svStr_at is array(boolean) of string(0 to 10);
  constant c_svRamStyle : svStr_at := (false => "           ", true => "distributed");
  attribute ram_style : string;
  attribute ram_style of asvRam : signal is c_svRamStyle(gc_bDistributedRam);

Comment: This is much better than the accepted answer, since this does not limit the scope of the attribute. It works with Vivado at least.
Comment: As the author of the other answer, I agree
Answer: We talked more generalized conditional compilation in the IEEE VHDL Working Group.  The debate was heated.  Some wanted a compile time approach (similar to 'C') and some an elaboration time approach.  Compile time approach works well in C because constants are also compile time objects, however, in VHDL, a compile time approach will not understand things in the VHDL environment, and hence, using a generic is not an option.  OTOH, the compile time option would probably give you vendor name, tool type (simulator, synthesis, ...), ...
I have added your code as a requirement to the proposal page.  It is at: http://www.eda.org/twiki/bin/view.cgi/P1076/ConditionalCompilation
If you are willing to share additional insight on your application, I would like to add that to the proposal also.
Comment: I wished to declare a different RAM Style attribute name depending on the technology used. Altera use 'ramstyle' and Xilinx use 'ram_style'. Also, my request would have permitted to have a different default value for each attribute.
Comment: Oh and I slightly edited my example, you should check it out.
Answer: Basically: this is exactly how VHDL does not work. In VHDL you declare your intent to use specific bits of hardware, and then the synthesizer attempts to connect those bits of hardware. Any semblance of dynamically creating hardware like for ... generate loops are essentially just a semblance: syntactic sugar to take the pain away.
What you can do   is conditionally assign to signals/variables:
process (sig1, sig2, enable) is
begin
  if enable = '1'
  then
    out <= sig1;
  else
    out <= sig2;
  end if;
end process;

Comment: @Ollie ... you may be surprised just how well modern synth tools do with "programming" styles of VHDL. Sure there are constraints - static loop bounds - but for example, procedures and functions can be used to simplify a complex state machine, and synthesise perfectly well. I find I can take a chunk of (suitable) C or Ada, transcode it into VHDL, and synthesise it. The art then - ironically - comes in extracting serialism out of the parallel VHDL code (turning it into a state machine) to keep the HW size down...
Comment: This is unhelpful. VHDL is a Turing-complete programming language. Admittedly, it's extremely painful to use it as such, and is used almost exclusively for hardware specification, but that doesn't alter the fact you can use it for more than that, just as long as you're not expecting a synthesis tool to do anything with your program.


Count the freq of each value for each key in a dictionary, and put the count info into dataframe

Question: Currently I have a dictionary like this: {'axin': ['GAUAUG', 'AAAUGC', 'AAAUGC', 'GUCAUG', 'UUUGAU', 'UUUGAU'], 'hedgehog-protein': ['ACUGGC', 'GUCAUG', 'UUUGAU'],  'pangolin': ['GAACAC', 'GAAAGA', 'UUUGAU', 'AAUACU']}.
I want to create a dataframe with each key as a column, and each value as the row name (or vice-versa, doesn't really matter), whilst also counting the occurrences of each value per key.
For example the first few lines of output would be this:
        axin hedgehog-protein pangolin
GAUAUG  1    0                0
AAAUGC  2    0                0
GUCAUG  1    1                1
UUUGAU  2    1                1
ACUGGC  0    1                0

The most similar question I found was Create a pandas dataframe of counts however they had different types of values for each key, and so weren't common across keys. Also, as the length of my value lists are different for each key, ValueError is a problem I keep running into.
Answer: Use Counter in dictionary comprehension, then replace missing values and convert to integers:
d = {'axin': ['GAUAUG', 'AAAUGC', 'AAAUGC', 'GUCAUG', 'UUUGAU', 'UUUGAU'],
     'hedgehog-protein': ['ACUGGC', 'GUCAUG', 'UUUGAU'],
     'pangolin': ['GAACAC', 'GAAAGA', 'UUUGAU', 'AAUACU']}

from collections import Counter

df = pd.DataFrame({k: Counter(v) for k, v in d.items()}).fillna(0).astype(int)
print (df)
        axin  hedgehog-protein  pangolin
AAAUGC     2                 0         0
AAUACU     0                 0         1
ACUGGC     0                 1         0
GAAAGA     0                 0         1
GAACAC     0                 0         1
GAUAUG     1                 0         0
GUCAUG     1                 1         0
UUUGAU     2                 1         1

Comment: @dondapati - use `df = pd.DataFrame.from_dict({k: Counter(v) for k, v in d.items()}, orient='index').fillna(0).astype(int)`
Comment: Thank you, very simple solution!
Comment: @jezrael how to covert key's as rows and values as columns?


Solve the system of linear inequalities with parameters

Question: Solve the system of inequalities
\begin{cases}
0\leq \phantom{-2\;}x+2\,y-3\,b+3\,a \leq 2 \\
0\leq -2\,x-3\,y+6\,b\phantom{\;+3a\;\,} \leq 1 \\[4pt]
0 \leq x \leq 1 \\
0 \leq y \leq 2 \\[4pt]
0\leq a \leq 1 \\
0\leq b \leq 1 \tag{*}
\end{cases}
Here $x,y$ are unknown variables and $a,b$ are parameters.
My attempt. By adding the inequalities with some coeficients I separated the variables and get the simple system
\begin{cases}
0 \leq y+6a \leq 5,\\
0 \leq -x+9a+3b\leq 8.\\ \tag{**}
\end{cases}
and I am able to solve it. But the solutions of the last system  are not solution of the initial system!
Maple and wolframAlpha cant solve the system.
Any help?
P.S.1 For $a=\frac{63}{100}$ and $b=\frac{59}{100}$  ( as at G Cab's picture  below ) Maple gives the solutions
\begin{gather*}
 \left\{ x=1,{\frac{9}{50}}\leq y,y\leq {\frac{11}{25}} \right\} , \left\{ x=-3/2\,y+{\frac{127}{100}},{\frac{9}{50}}<y,y<{\frac{11}{25}} \right\} ,  \left\{ {\frac{9}{50}}<y,x<1,y<{\frac{11}{25}},-3/2\,y+{
\frac{127}{100}}<x \right\} , \left\{ y={\frac{11}{25}},{\frac{61}{100
}}\leq x,x<1 \right\} , \left\{ x=-3/2\,y+{\frac{127}{100}},{\frac{11}
{25}}<y,y<{\frac{127}{150}} \right\} ,  \left\{ {\frac{11}{25}}<y,x<-2
\,y+{\frac{47}{25}},y<{\frac{127}{150}},-3/2\,y+{\frac{127}{100}}<x
 \right\} , \left\{ x=-2\,y+{\frac{47}{25}},{\frac{11}{25}}<y,y<{\frac
{127}{150}} \right\} , \left\{ x=0,{\frac{127}{150}}\leq y,y\leq {
\frac{47}{50}} \right\} , \left\{ y={\frac{127}{150}},x\leq {\frac{14}
{75}},0<x \right\} , \left\{ 0<x,{\frac{127}{150}}<y,x<-2\,y+{\frac{47
}{25}},y<{\frac{47}{50}} \right\} , \\ \left\{ x=-2\,y+{\frac{47}{25}},{
\frac{127}{150}}<y,y<{\frac{47}{50}} \right\}
\end{gather*}
P.P.S. I am interested in finding not the whole set of solutions but in finding at least one solution from the area, if it exists,  but in terms $a$ and $b$, for example, $x=(a+b)/2, y=(2a-b)/10$ is a solution.
Comment: @Leox: *"I am interested in finding not the whole set of solutions but in finding at least one solution from the area"* ... You seem to be changing the specific requirement of your question after it has already received answers. Doing so is inconsiderate to answerers whose responses now seem incomplete (and who may receive downvotes as a result). If you have found that your question has not clearly articulated your intent, then the better course of action would be to post a new-and-improved question separately (linking to this one for context).
Comment: @Blue OK, maybe you are  right and I will post a new question
Comment: The two inequalities you call "simple system" are indeed consequences of the initial system. What specifically did you get for the solution(s) of the "simple system", that you think are not solutions of the initial system? Seems an error might have crept in when you solved the simple system...
Comment: the region of solutions of $(**)$ is a rectangle   but the region of solutions of $(*)$  in the general case is not rectangle.
Comment: I'm not sure if you like this idea, but if you separate it into cases, you can find the  exact shape of the region (a triangle, a pentagon etc.) of solutions of $(*)$. (Also,  you can find $(a,b)$ such that the system has no solutions.) The problem of this idea might be that there are many cases, but the idea itself is simple and the way to separate is not difficult. If you like this idea, I might try :)
Comment: @mathlove. Try solve the simplified problem - for any $a$ and $b$ find  one solution $(x,y)$, see edited post
Comment: @Blue  I dont sure that I received anwer and therefore decided to simplify the task.
Comment: @Leox: *"I dont sure that I received anwer and therefore decided to simplify the task."* ... But you *have* received answers. If they are *unsatisfactory* to you for whatever reason, then you don't have to accept them, but altering what you expect from them *after* they have been posted isn't appropriate. In particular, @ GCab's response is detailed and thorough, and was updated a time or two to address clarifications you wanted. Now, it appears you're saying "I've changed my mind about what I'm asking, so all that time and effort you've expended on my behalf was wasted." That's rather rude.
Comment: @Leox  So, you want to find one feasible $(x, y)$ of the system (*) having the form of $x = f(a, b)$ and $y = g(a, b)$?
Answer: When you have a system of (double) inequalities like this
$$
\left\{ \matrix{
  a \le x \le b \hfill \cr
  c \le x \le d \hfill \cr}  \right.
$$
you may think that each one represents a segment on the $x$ axis, with the system
standing for AND, i.e.
$$
\eqalign{
  & \left\{ \matrix{
  x \in \left[ {a,b} \right] \hfill \cr
  x \in \left[ {c,d} \right] \hfill \cr}  \right.\quad  \Rightarrow \quad x \in \left( {\left[ {a,b} \right] \cap \left[ {c,d} \right]} \right)\quad  \Rightarrow   \cr
  &  \Rightarrow \quad x \in \left[ {\max (a,c),\min \left( {b,d} \right)} \right] \cr}
$$
Therefore in your case we can do some manipulation as follows
$$
\eqalign{
  & \left\{ \matrix{
  0 \le x + 2y + 3a - 3b \le 2 \hfill \cr
  0 \le  - 2x - 3y + 6b \le 1 \hfill \cr
  0 \le x \le 1 \hfill \cr
  0 \le y \le 2 \hfill \cr
  0 \le a \le 1 \hfill \cr
  0 \le b \le 1 \hfill \cr}  \right. \Rightarrow   \cr
  &  \Rightarrow \left\{ \matrix{
  3\left( {b - a} \right) \le x + 2y \le 3\left( {b - a} \right) + 2 \hfill \cr
  6b - 1 \le 2x + 3y \le 6b \hfill \cr
  0 \le x \le 1 \hfill \cr
  0 \le y \le 2 \hfill \cr
  0 \le a \le 1 \hfill \cr
  0 \le b \le 1 \hfill \cr}  \right. \Rightarrow   \cr
  &  \Rightarrow \left\{ \matrix{
  0 \le a \le 1 \hfill \cr
  0 \le b \le 1 \hfill \cr
  0 \le y \le 2 \hfill \cr
  3\left( {b - a} \right) \le x \le 3\left( {b - a} \right) + 2 - 2y \hfill \cr
  3b - 1/2 - 3/2y \le x \le 6b - 3/2y \hfill \cr
  0 \le x \le 1 \hfill \cr}  \right. \Rightarrow   \cr
  &  \Rightarrow \left\{ \matrix{
  0 \le a \le 1 \hfill \cr
  0 \le b \le 1 \hfill \cr
  0 \le y \le 2 \hfill \cr
  m = \max \left( {3\left( {b - a} \right),3b - 1/2 - 3/2y,0} \right) \hfill \cr
  n = \min \left( {3\left( {b - a} \right) + 2 - 2y,\;6b - 3/2y,\;1} \right) \hfill \cr
  m \le x \le n \hfill \cr}  \right. \cr}
$$
where at the third step we chose to isolate the $x$, but of course we could have done that with $y$
in this case obtaining
$$
\left\{ \matrix{
  0 \le a \le 1 \hfill \cr
  0 \le b \le 1 \hfill \cr
  0 \le x \le 1 \hfill \cr
  m = \max \left( {3/2\left( {b - a} \right) - x/2 2b - 1/3 - 2/3x 0} \right) \hfill \cr
  n = \min \left( {3/2\left( {b - a} \right) + 1 - x/2 \;2b - 2/3x \;2} \right) \hfill \cr
  m \le y \le n \hfill \cr}  \right.
$$
So, once fixed $a, \; b, \; y$ within the allowed range, we can finish to
compute $x$ in the first case, or viceversa in the second version.
The system sketched in Geogebra gives

note in reply to your comment
As you can see from the sketch, the solutions (when they exist) will in general define a 2D area.
Referring to the case depicted, once fixed $a$ and $b$, you can describe the area by having  the $y$ to span the allowed range $[0,2]$
and consequently determine $x$ to be within two bounds, necessarily depending from $y$.
There is no possibility to express the bounds on $x$ and $y$ independently from each other.
example with $a=0.63 ,\; b=0.59$
$$
\begin{array}{l}
 \left\{ \begin{array}{l}
 a = 0.63 \\
 b = 0.59 \\
 0 \le y \le 2 \\
 m = \max \left( { - 0.12,1.27 - 3/2y,0} \right) \\
 n = \min \left( {1.88 - 2y,\;3.54 - 3/2y,\;1} \right) \\
 m \le x \le n \\
 \end{array} \right.\;\; \Rightarrow  \\
  \Rightarrow \left\{ \begin{array}{l}
 0 \le y \le 2 \\
 \begin{array}{*{20}c}
   {1.27 - 3/2y \le x \le 1} \hfill & {\left| {\;0 \le y < 0.44} \right.} \hfill  \\
   {1.27 - 3/2y \le x \le 1.88 - 2y} \hfill & {\left| {\;0.44 \le y < 2.54/3} \right.} \hfill  \\
   {0 \le x \le 1.88 - 2y} \hfill & {\left| {\;2.54/3 \le y < 0.94} \right.} \hfill  \\
   {0 \le x \le 1.88 - 2y\; \to \;\emptyset } \hfill & {\left| {\;0.94 \le y \le 2} \right.} \hfill  \\
\end{array} \\
 \end{array} \right.\; \Rightarrow  \\
  \Rightarrow \left\{ {\begin{array}{*{20}c}
   {1.27 - 3/2y \le x \le 1} \hfill & {\left| {\;0.18 \le y < 0.44} \right.} \hfill  \\
   {1.27 - 3/2y \le x \le 1.88 - 2y} \hfill & {\left| {\;0.44 \le y < 2.54/3} \right.} \hfill  \\
   {0 \le x \le 1.88 - 2y} \hfill & {\left| {\;2.54/3 \le y < 0.94} \right.} \hfill  \\
\end{array}} \right. \\
 \end{array}
$$
The second version instead gives the more simple result
$$
\left\{ \matrix{
  a = 0.63 \hfill \cr
  b = 0.59 \hfill \cr
  0 \le x \le 1 \hfill \cr
  m = \max \left( { - 0.06 - x/2,1.18 - 1/3 - 2/3x,0} \right) =  \hfill \cr
   = 1.18 - 1/3 - 2/3x \hfill \cr
  n = \min \left( {0.94 - x/2,\;1.18 - 2/3x,\;2} \right) =  \hfill \cr
   = 0.94 - x/2 \hfill \cr
  m \le y \le n \hfill \cr}  \right.
$$
addendum
I do not catch properly your requirement, but in any case I will introduce a more geometric approach
to the problem that might offer a different view of the solutions.
Each  double inequality represent a stripe comprised between two parallel lines with constant separation.
The two stripes overlap to define a parallelogram, which is just translated while maintaining its shape unaltered.

The coordinates of the four vertices are
$$
\begin{array}{c|cccc}
   {} & &  {Vsi} & {Vss} & {Vii} & {Vis}  \\
\hline
   x & &  {9a + 3b - 8} & {9a + 3b - 6} & {9a + 3b - 2} & {9a + 3b}  \\
   y & &  { - 6a + 5} & { - 6a + 4} & { - 6a + 1} & { - 6a}  \\
\end{array}
$$
Now, until the x of $Vsi$ is greater than $1$ the whole parallelogram $P$ will be out of the rectangle $R = [0,1] \times [0,2]$.
Same if the y of $Vsi$ is below zero.
So to have solutions it shall be
$$
\eqalign{
  & \left\{ \matrix{
  0 \le b \le 2 \hfill \cr
  0 \le a \le 1 \hfill \cr
  9a + 3b - 8 \le 1 \hfill \cr
  0 \le  - 6a + 5 \hfill \cr}  \right.\quad  \Rightarrow \quad \left\{ \matrix{
  0 \le b \le 2 \hfill \cr
  0 \le a \le 1 - b/3 \hfill \cr
  a \le 5/6 \hfill \cr}  \right.\quad  \Rightarrow   \cr
  &  \Rightarrow \quad \left\{ \matrix{
  0 \le b \le 1/2\; \wedge \;0 \le a \le 5/6 \hfill \cr
  1/2 < b \le 2\; \wedge \;0 \le a \le 1 - b/3 \hfill \cr}  \right. \cr}
$$
Note that the above is a necessary condition yet not sufficient.
That's because when the upper vertex is in the second quadrant we have still to impose
that $P$ intersects $R$, which is as complicated as to use the previous min/max conditions.
Comment: @Leox: I re-shaped the answer to make it better readable and added example
Comment: @Leox: sorry but I do not grasp what you want actually to get. However I added a geometric perspective of the problem, might that help ?
Comment: the  $m,n$ depend  on $y$ but final answer must be in terms $a$ and $b$ only.
Comment: @Leox: added a note to reply to you comment
Comment: @G Cab I  added  P.S. with the solution for $a=0.63, b=0.59$. How do you get the same solution by your method?
Comment: @G Cab please read my edited question
Comment: @G Cab Thank you. in any case, your attempt helped me
Comment: glad that it helped you.
Answer: Let us consider the system in the form of
\begin{cases}
6b-1\le 2x+3y \le 6b\\
3b-3a \le x+2y \le 2+3b-3a\\
x,y \in[0,1]\tag1
\end{cases}
over the set of the possible pairs $(a,b)\in[0,1]^2.$
$$\color{blue}{\mathbf{Case\ 1.\quad a-b >\dfrac23.}}$$
The system $(1)$ does not have solutions.
$$\color{blue}{\mathbf{Case\,2.\quad 0\le a \le \min\left[\frac{2+3b}3,1\right].}}\tag2$$
$\color{blue}{\mathbf{Case\,2.1.\quad  b\in \bigg[0,\dfrac16\bigg],\quad a\in\bigg[0,b\bigg].}}$
The first equation of the system in the form of
\begin{cases}
0 \le 2x+3y \le 6b\\
3b-3a\le x+2y \le 2+3b-3a\tag{3.1}
\end{cases}
over the first quadrant defines the triangle with the vertice $\quad (0,0),\quad (3b,0),\quad (0,2b).$
The second equation over the first quadrant defines the trapezoid with the vertice
$(3b-3a, 0),\quad (2+3b-3a,0),\quad (0, \frac{2+3b-3a}2),\quad(0, \frac{3b-3a}2).$
Since

$\ 0 \le 3b-3a\le 3b \le 2+3b-3a,$

$\ 0 \le \frac{3b-3a}2 \le 2b \le \frac{2+3b-3a}2,$

then the solution is the simplex with the vertice
$(3b-3a, 0),\quad (3b,0),\quad (0,2b),\quad (0, \frac{3b-3a}2).$
Analytically,
$$\bigg(x\in\bigg[0,3b\bigg]\bigg)\wedge\bigg(y\in\bigg[\max\left(\frac{3b-3a-x}2,0\right),\frac{6b-2x}3\bigg]\bigg).\tag{4.1}$$

Solution for $\quad a=\dfrac1{10},\quad b=\dfrac18.$
$\color{blue}{\mathbf{Case\,2.2.\quad  b\in \bigg[0,\dfrac16\bigg],\quad a\in\bigg[b,\dfrac{2+3b}3\bigg].}}$
The first equation of the system in the form of
\begin{cases}
0 \le 2x+3y \le 6b\\
0\le x+2y \le 2+3b-3a\tag{3.2}
\end{cases}
over the first quadrant defines the triangle with the vertice $\quad (0,0),\quad (3b,0),\quad (0,2b).$
The second equation over the first quadrant defines the triangle with the vertice
$(0,0),\quad (2+3b-3a,0),\quad (0, \frac{2+3b-3a}2).$
Since

equality $2b = \frac{2+3b-3a}2$ takes place if $a=\frac{2-b}3,$
equality $3b = 2+3b-3a$ takes place if $a=\frac{2}3,$

then the next cases should be considered.
$$\color{green}{\mathbf{Case\,2.2.1.\quad  b\in \left[0,\dfrac16\right],\quad a\in\bigg[b,\dfrac{2-b}3\bigg].}}$$
Solution is the triangle with the vertice $\quad (0,0),\quad (3b,0),\quad (0,2b).$
Analytically,
$$\bigg(x\in\bigg[0,3b\bigg]\bigg)\wedge\bigg(y\in\bigg[0, \frac{6b-2x}3\bigg]\bigg).\tag{4.2.1}$$

Solution for $\quad a\in\bigg[\dfrac1{8},\dfrac58\bigg],\quad b=\dfrac18.$
$$\color{green}{\mathbf{Case\,2.2.2.\quad  b\in \left[0,\dfrac16\right],\quad a\in\bigg[\dfrac{2-b}3,\dfrac23\bigg].}}$$
The lines $2x+3y=6b$ and $x+2y = 2+3b-3a$ have intersection at the point $(x_i,y_i) = (9a+3b-6, 4-6a).$
Solution is the simplex with the vertice $\quad (0,0),\quad (3b,0),\quad (9a+3b-6, 4-6a),\quad (0,\frac{2+3b-3a}2).$
Analytically,
$$\bigg(x\in\bigg[0,3b\bigg]\bigg)\wedge\bigg(y\in\bigg[0, \min\left(\frac{2+3b-3a-x}2,\frac{6b-2x}3\right)\bigg]\bigg).\tag{4.2.2}$$

Solution for $\quad a = \dfrac{9}{14},\quad b=\dfrac18.$
$$\color{green}{\mathbf{Case\,2.2.3.\quad  b\in \left[0,\dfrac16\right],\quad a\in\bigg[\dfrac23,\dfrac{2+3b}3\bigg].}}$$
Solution is the triangle with the vertice $\quad (0,0),\quad (2+3b-3a,0),\quad (0,\frac{2+3b-3a}2).$
Analytically,
$$\bigg(x\in\bigg[0,2+3b-3a\bigg]\bigg)\wedge\bigg(y\in\bigg[0, \frac{2+3b-3a-x}2\bigg]\bigg).\tag{4.2.3}$$

Solution for $\quad a = \dfrac{17}{24},\quad b=\dfrac18.$
$\color{blue}{\mathbf{Case\,2.3.\quad  b\in \bigg[\dfrac16,\dfrac13\bigg],\quad a\in\bigg[0,b\bigg].}}$
The first equation of the system in the form of
\begin{cases}
6b-1 \le 2x+3y \le 6b\\
3b-3a\le x+2y \le 2+3b-3a\tag{3.3}
\end{cases}
over the first quadrant defines the trapezoid with the vertice $\quad (\frac{6b-1}2,0),\quad (3b,0),\quad (0,2b),\quad (0,\frac{6b-1}3).$
The second equation over the first quadrant defines the trapezoid with the vertice
$(3b-3a, 0),\quad (2+3b-3a,0),\quad (0, \frac12(2+3b-3a)),\quad (0, \frac12(3b-3a)).$
Since

equality $\frac{6b-1}3 = \frac{3b-3a}2$ takes place if $a=\frac{2-3b}9,$
equality $\frac{6b-1}2 = 3b-3a$ takes place if $a=\frac16,$

then the next cases should be considered.
$$\color{green}{\mathbf{Case\,2.3.1.\quad  b\in \left[\dfrac16,\dfrac13\right],\quad a\in\bigg[0,\dfrac{2-3b}9\bigg].}}$$
Solution is the simplex with the vertice
$(3b-3a,0),\quad (3b, 0),\quad (0,2b),\quad (0, \frac{3b-3a}2).$
Analytically,
$$\bigg(x\in\bigg[0,3b\bigg]\bigg)\wedge\bigg(y\in\bigg[\max\left(\frac{3b-3a-x}2,0\right),\frac{6b-2x}3\bigg]\bigg).\tag{4.3.1}$$

Solution for $\quad a=\dfrac1{12},\quad b=\dfrac14.$
$$\color{green}{\mathbf{Case\,2.3.2.\quad  b\in \left[\dfrac16,\dfrac13\right],\quad a\in\bigg[\dfrac{2-3b}9,\dfrac16\bigg].}}$$
The lines $2x+3y=6b-1$ and $x+2y = 3b-3a$ have intersection at the point $(x_i,y_i) = (9a+3b-2,1-6a).$
Solution is the simplex with the vertice
$(3b-3a,0),\quad (3b, 0),\quad (0,2b),\quad (0, \frac{6b-1}3),\quad (9a+3b-2,1-6a).$
Analytically,
$${\small\bigg(x\in\bigg[0,3b\bigg]\bigg)\wedge\bigg(y\in\bigg[\max\left(\frac{6b-1-2x}3, \frac{3b-3a-x}2,0\right),\frac{6b-2x}3\bigg]\bigg)}.\tag{4.3.2}$$

Solution for $\quad a=\dfrac3{19},\quad b=\dfrac14.$
$$\color{green}{\mathbf{Case\,2.3.3.\quad  b\in \left[\dfrac16,\dfrac13\right],\quad a\in\bigg[\dfrac16,b\bigg].}}$$
Solution is the trapezoid with the vertice
$(3b,0),\quad (3b-3a, 0),\quad (0, \frac{3b-3a}2),\quad (0,2b).$
Analytically,
$$\bigg(x\in\bigg[0,3b\bigg]\bigg)\wedge\bigg(y\in\bigg[\max\left(\frac{6b-1-2x}3,0\right),\frac{6b-2x}3\bigg]\bigg).\tag{4.3.3}$$

Solution for $\quad a=\dfrac15,\quad b=\dfrac14.$
$\color{blue}{\mathbf{Case\,2.4.\quad  b\in \left[\dfrac16,\dfrac13\right],\quad a\in\bigg[b,b+\dfrac23\bigg].}}$
The first equation of the system in the form of
\begin{cases}
6b-1 \le 2x+3y \le 6b\\
0 \le x+2y \le 2+3b-3a\tag{3.4}
\end{cases}
over the first quadrant defines the trapezoid with the vertice $\quad (\frac{6b-1}2,0),\quad (3b,0),\quad (0,2b),\quad (0,\frac{6b-1}3).$
The second equation over the first quadrant defines the triangle with the vertice
$(0,0),\quad (2+3b-3a,0),\quad (0, \frac{2+3b-3a}2).$
Since

equality $2b = \frac{2+3b-3a}2$ takes place if $a=\frac{2-b}3,$

equlaity $3b = 2+3b-3a$ takes place if $a = \frac23,$

equaity $\frac{6b-1}3 = \frac{2+3b-3a}2$ takes place if $a=\frac{8-3b}9,$

equaity $\frac{6b-1}2 = 2+3b-3a$ takes place if $a=\frac56,$

then the next cases should be considered.
$$\color{green}{\mathbf{Case\,2.4.1.\quad  b\in \left[\dfrac16,\dfrac13\right],\quad a\in\bigg[0,\dfrac{2-b}3\bigg].}}$$
Solution is the trapezoid from the paragraph $2.3.3$ above.
$$\color{green}{\mathbf{Case\,2.4.2.\quad  b\in \left[\dfrac16,\dfrac13\right],\quad a\in\bigg[\dfrac{2-b}3,\dfrac23  \bigg].}}$$
The lines $2x+3y=6b$ and $x+2y = 2+3b-3a$ have intersection at the point $(x_i,y_i) = (9a+3b-6,4-6a).$
Solution is the simplex with the vertice
$(\frac{6b-1}2,0),\quad (3b, 0),\quad (9a+3b-6,4-6a),\quad (0,\frac{2+3b-3a}2),\quad (0, \frac{6b-1}3).$
Analytically,
$${\small\bigg(x\in\bigg[0,3b\bigg]\bigg)\wedge\bigg(y\in\bigg[\max\left(\frac{6b-1-2x}3,0\right),\min\left(\frac{2+3b-3a-x}2,\frac{6b-2x}3\right)\bigg]\bigg)}.\tag{4.4.2}$$

Solution for $\quad a=\dfrac58,\quad b=\dfrac14.$
$$\color{green}{\mathbf{Case\,2.4.3.\quad  b\in \left[\dfrac16,\dfrac13\right],\quad a\in\bigg[\dfrac23,\dfrac{8-3b}9  \bigg].}}$$
Solution is the simplex with the vertice
$(\frac{6b-1}2,0),\quad (2+3b-3a, 0),\quad (0,\frac{2+3b-3a}2),\quad (0, \frac{6b-1}3).$
Analytically,
$${\small\bigg(x\in\bigg[0,2+3b-3a\bigg]\bigg)\wedge\bigg(y\in\bigg[\max\left(\frac{6b-1-2x}3,0\right),\frac{2+3b-3a-x}2\bigg]\bigg)}.\tag{4.4.3}$$

Solution for $\quad a=\dfrac34,\quad b=\dfrac14.$
$$\color{green}{\mathbf{Case\,2.4.4.\quad  b\in \left[\dfrac16,\dfrac13\right],\quad a\in\bigg[\dfrac{8-3b}9,\dfrac56  \bigg].}}$$
The lines $2x+3y=6b-1$ and $x+2y = 2+3b-3a$ have intersection at the point $(x_i,y_i) = (9a+3b-8,5-6a).$
Solution is the triangle with the vertice
$(\frac{6b-1}2,0),\quad (2+3b-3a, 0),\quad (9a+3b-8,5-6a).$
Analytically,
$${\small (x\in[9a+3b-8,2+3b-3a])\wedge\bigg(y\in\bigg[\max\left(\frac{6b-1-2x}3,0\right),\frac{2+3b-3a-x}2\bigg]\bigg)}.\tag{4.4.4}$$

Solution for $\quad a=\dfrac{14}{17},\quad b=\dfrac14.$
Answer: $9a+3b-8\leq x \leq9a+3b$
$-6a \leq y \leq 5-6a$
These are the equations, and there are constraints
$0≤x≤1$
$0≤y≤2$
$0≤a≤1$
$0≤b≤1$
The intersect can exist or not depending to a and b.
The graph will help:
https://www.desmos.com/calculator/9dbajg4hcx
The blue part is the result, and the green part are constraints.
Comment: Yours system has no solutions. In fact \begin{cases} y\leq 5-6a,\\ y \leq 2 \end{cases} $ \implies a\geq \frac{1}{2}$. But then $x \leq 9a+3b \leq \frac{9}{2}+3 b \implies x > \frac{9}{2} >1$  but must be $x\leq 1.$