text:
Q: perl print hexadecimal as human-readable File forsojunk is as follows (with many more lines not shown).
    s/e\x27\x27\x27/é/g;
    s/e\x27/é/g;
    s/a\x5f/à/g;

junk.pl is as follows.
#! /usr/bin/perl
use strict; use warnings;
while(<>) {
   $_ =~ s/s\x2f([^\x2f\x5c]+)([^\x2f]*)\x2f([^\x2f]*).*/1=$1; 2=$2; 3=$3/ ;
   print $1;
   print $2;
   print " -> ";
   print $3;
   print "\n";
}

which gives
> junk.pl forsojunk
e\x27\x27\x27 -> é
e\x27 -> é
a\x5f -> ò

but I do not want to print out the literal hex code such as \x27\x27\x27. I want to print out what it looks like, the readable form. At the first line, $2 should print out as ''' and
the entire "message" in the first line should be
e''' -> é

How does one accomplish this?

A: You need to convert each 2-digit hexcode to a printable character.
pack works, or using a loop with hex to convert from a base-16 string to a number, and then chr, printf, etc to convert to the corresponding character:
#!/usr/bin/env perl
use strict;
use warnings;
use open qw/IO :locale :std/;

while(<>) {
    # Note the cleaned up regular expression
    if (my ($base, $rawaddons, $result) = m{s/([^/\\]+)([^/]*)/([^/]*)/}) {
        my @addons = split/\\x/, $rawaddons; # Split up the hexcodes and remove the \\x parts
        shift @addons; # Drop the first empty element
        print $base;
        # Any of the below ways work
        print pack('(H2)*', @addons);
        # printf '%c', hex for @addons;
        # print map { chr hex } @addons;
        print " -> $result\n";
    }
}

Example:

$ perl junk.pl forsojunk
e''' -> é
e' -> é
a_ -> à

A: Here is a pared-down version of @Shawn's answer, now named bbb.pl.
#!/usr/bin/env perl
use strict; use warnings;
while(<>) {
   if (my ($base, $rawaddons, $result) = m{s/([^/\\]+)([^/]*)/([^/]*)/}) {
        my @addons = split/\\x/, $rawaddons; # Split up the hexcodes and remove the \\x parts
        shift @addons; #first element is blank or null
        print $base;
        print pack('(H2)*', @addons);
        print " -> $result\n";
    }
}

example of it running:
> cat forsojunk
    s/\x3c/\x5ctextless{}/g; # < becomes \textless{}
    s/a\x27\x27\x27/á/g; #2020v05v21vThuv17h26m54s
    s/e\x27\x27\x27/é/g; #2020v05v21vThuv17h26m54s
    s/i\x27\x27\x27/í/g; #2020v05v21vThuv17h26m54s
    s/o\x27\x27\x27/ó/g; #2020v05v21vThuv17h26m54s
    s/u\x27\x27\x27/ú/g; #2020v05v21vThuv17h26m54s
    s/A\x27\x27\x27/Á/g; #2020v05v21vThuv17h26m54s
    s/E\x27\x27\x27/É/g; #2020v05v21vThuv17h26m54s
    s/I\x27\x27\x27/Í/g; #2020v05v21vThuv17h26m54s
    s/O\x27\x27\x27/Ó/g; #2020v05v21vThuv17h26m54s
    s/U\x27\x27\x27/Ú/g; #2020v05v21vThuv17h26m54s
    s/e\x60/è/g;
    s/E\x60/È/g;
    s/a\x60/à/g;
    s/A\x60/À/g;
    s/i\x5e/î/g;
    s/I\x5e/Î/g;
    s/o\x5e/ô/g;
    s/O\x5e/Ô/g;
    s/u\x3a/ü/g;
    s/U\x3a/Ü/g;
    s/a\x3a/ä/g;
    s/A\x3a/Ä/g;
    s/o\x3a/ö/g;
    s/O\x3a/Ö/g;
> bbb.pl forsojunk
a''' -> á
e''' -> é
i''' -> í
o''' -> ó
u''' -> ú
A''' -> Á
E''' -> É
I''' -> Í
O''' -> Ó
U''' -> Ú
e` -> è
E` -> È
a` -> à
A` -> À
i^ -> î
I^ -> Î
o^ -> ô
O^ -> Ô
u: -> ü
U: -> Ü
a: -> ä
A: -> Ä
o: -> ö
O: -> Ö


text:
Q: I have been trying to write a program to convert decimal to binary , I don't know what is wrong with my code ? i am using codeblocks this is my code , I think something wrong with the shift operator , I used them in embedded software but I don't know if it is ok to use them on normal code , I have written a code to do the same purpose but with the method of adding (2*10^digit) but it seems a lot easier to use shifts-if possible-, please help :
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

double find_power(double x);
int main()
{
    double bin=00000000, dec , k ;
    printf("enter decimal number:\n");
    scanf("%d",&dec);
    for(;;)
    {
        k=find_power(dec);
        bin|=(1<<k);
        dec-=pow(2,k);
        if(dec==1)
        {
            bin|=(1<<0);
            break;
        }
        else if(dec==0)
        {
            bin&=(~(1<<0));
            break;
        }

    }

    printf("%d",bin);
    return 0;
}

double find_power(double x)
{
    double i=1,j=0;
    for(;;)
    {
        i*=2;
        if(x>=i)
        {
            j++;
        }
        else if(x<i)
        {
             break;
        }

    }
    return j;
}

A: You are wildly mixing double and int all over the code. You try to read an int into a double with scanf, which invokes undefined behavior. And then you try to use double variables together with bitwise operators, which most likely doesn't make any sense. You'll want to use an unsigned integer of known size instead.
You should enable/listen to compiler warnings.

redpajama_set_name: RedPajamaStackExchange


text:
Q: My sound keeps repeating in Unity whenever I press the left mouse button instead of playing once I am working on an FPS game in Unity using C#. This code is supposed to play a sound once whenever you press the left mouse button, but whenever I press it the sound plays repeatedly with no break between the sounds. I did find a question very similar to this one but I couldn't implement the answer into my code, Link: https://forum.unity.com/threads/how-to-play-a-sound-with-c.206152/. Any help will be appreciated.
    using UnityEngine;

    public class GunFire : MonoBehaviour
    {
        void Update()
        {
            if (Input.GetButton("Fire1"))
            {
                AudioSource sound = gameObject.GetComponent<AudioSource>();
                sound.Play();
            }
        }
    }

A: Every time you click the button you want the sound to play. Then the problem is that you are using GetButton which returns true every frame that button is pressed.
Try using GetButtonDown which will only return true the first frame the button is pressed regardless of whether or not you are holding it.
Links to the API's pages for those functions : GetButton, GetButtonDown
You may also need to check if you have looping on or off on the audio source.

A: Check your AudioSource for loop checkmark, it must be false
If you need loop true on this AudioSource, you can use PlayOneShoot() instead of Play().
p.s. Execute GetComponent() every time you need play the sound is a bad practice. It will be better to cashe it once.


text:
Q: A question about $n\times n$ matrix
Possible Duplicate:
For every matrix $A\in M_{2}( \mathbb{C}) $ there's  $X\in M_{2}( \mathbb{C})$ such that $X^2=A$?
Square root of a matrix

Let $A$ be $n\times n$ matrix on $\mathbb C $. Can I find $B$ such that $B^2=A$?
If I can , how do I construct $B$?


text:
Q: Htaccess debug alternate rules for rewrite rules I need to parse one or two variables within /a/ "folder".  In the past we only needed the one for assoc.  Now I need to parse assoc/state separately WHEN someone uses state (it will be only 10% of use cases, so I need to support both use cases).
Example
1: domain.com/a/joe = domain.com/?assoc=joe
2: domain.com/a/joe/ohio = domain.com/?assoc=joe&state=ohio
The following is the first few lines of my htaccess file:
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^index\.html?$ / [NC,R,L]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$
RewriteRule ^a/(.*)$ https://%1/?assoc=$1 [L]
RewriteRule ^a/(.*)/(.*)$ https://%1/?assoc=$1&state=$2 [L]

I can get either line to work on its own (for the respective use case):
RewriteRule ^a/(.*)$ https://%1/?assoc=$1 [L]

or
RewriteRule ^a/(.*)/(.*)$ https://%1/?assoc=$1&state=$2 [L]

But with both lines it always parses the first line and I get;
domain.com/?assoc=joe/ohio  (as one variable only)
Any help on what I am missing here. How do I get htaccess to skip the first option when I have more than one variable?


text:
Q: How to access a variable defined out side into inside a class function My code is
$var = md5(rand(1,6));
class Session{
  protected $git;
  public function __construct($config = array())
  {
     //// some code

  }
  public function _start_session()
  {
      //code again..
  }
}

I want to use the "$var" value inside class functions as globally.
please update me how to do this.

A: functions outside any class are global an can be called from anywhere. The same with variables.. just remember to use the global for the variables.
$var = md5(rand(1,6));
class Session{
  protected $git;
  public function __construct($config = array())
  {
    global $var;
    //// some code`
  }
  public function _start_session()
  {
    //code again..
  }
}

A: define your $var as global and then use directly
like this..
<?php
function abc() {  }

$foo = 'bar';

class SomeClass {
 public function tada(){
     global $foo;

     abc();
     echo 'foo and '.$foo;
 }
}
?>

A: You can feel free to use variable, defined in global context (with keyword global).
But your example is not a good idea. When you want to change behavior or name of $var, you should rewrite all codes...
Try to use function wrap or even static class to globalize Your variable $var.

A: You could use dependency injection. where you pass the required variables to the constructor
$var = md5(rand(1,6));

$session = new Session($var);
$session->_start_session();

class Session{

   public function __construct($var, $config = array())
   {
       $this->var = $var;
   }
   public function _start_session()
   {
       echo $this->var;
      //code again..
   }
}


text:
Q: How to trigger "item.update" webhook on file upload? I've setup the 3 item webhooks (create, update & delete) so I can sync and log some data on an external service.
They all seem to work as inteded, except for the item.update, which doesn't trigger when a file is uploaded. It triggers when I change another field, but not when only uploading a file and then saving.
I've searched around but haven't found anything on the problem. Is it a setting I'm missing or doesn't the Podio API support this usecase?

A: In Podio an item and a file are two distinct entities. The behavior you are experiencing is as expected. The item update webhook will only be called when attributes of the item are changed; not when a file is uploaded and associated with an item. If you want to execute a webhook on a file update you'll have to set that up as well.
see 'file.change' hook
https://developers.podio.com/doc/hooks


text:
Q: How to read drl file by using drools API? Is there any function in drools that can parse drl file into some value or other formats? I am trying to visualize some drl file not using drools workbench(or business central). I've found the function to create drl file by passing value. However, I can't find the way to do opposite thing.
I expect to parse the existed drl file into some value or other format that can be easily used in my Vue project. At the moment I am looking for it in Drools souce code but can't find it.
I don't want to use drools workbench because it's not convenient enough to use. But if there are some functions or libraries in its souce code, please let me know. It's also very helpful.
I am using drools 7.0.0.final now.
Thanks for reading my question, if you have any idea, please help me.

A: I'm not sure about what you're trying to achieve, but let me give you some hints.
The org.drools.compiler.compiler.DrlParser  in the drools-compiler module will parse the DRL and generate the PackageDescr, pretty much an AST of the rule file. Take a look at org.drools.compiler.compiler.DrlParserTest for an example.
The org.drools.compiler.builder.impl.KnowledgeBuilderImpl will create the *Impl* classes which are used by the runtime of Drools.
Alternatively you can take a look at the drools-model-compiler module, in which theres a compiler org.drools.modelcompiler.builder.ModelBuilderImpl that compiles *Descrs into a Java DSL we created recently, the executable model. see org.drools.modelcompiler.CompilerTest and org.drools.modelcompiler.PatternDSLTest
Let me know if it helps.
Good luck


text:
Q: Sub-query Join Error
"Using subquery, list all product (product number, brand, and category) whose overall number of orders (containing that product) is greater than 500"

Before sub-query I tried using a join:
SELECT PRODUCT.PRODUCT_NO, PRODUCT.BRAND,PRODUCT.PRODUCT_CATEGORY
FROM PRODUCT JOIN ORDERLINE
ON PRODUCT.PRODUCT_NO = ORDERLINE.PRODUCT_NO
WHERE SUM(ORDERLINE_NO) >= 500 ;

And got the following error;

ORA-00934: group function is not allowed here
00934. 00000 -  "group function is not allowed here"
*Cause:
*Action:
Error at Line: 28 Column: 6

A: You are almost there but since you've used aggregate function, you must  have a  GROUP BY clause and a HAVING clause to filter the aggregated result:
SELECT PRODUCT.PRODUCT_NO,
       PRODUCT.BRAND,
       PRODUCT.PRODUCT_CATEGORY
FROM PRODUCT JOIN ORDERLINE ON PRODUCT.PRODUCT_NO = ORDERLINE.PRODUCT_NO
GROUP BY PRODUCT.PRODUCT_NO,
       PRODUCT.BRAND,
       PRODUCT.PRODUCT_CATEGORY
HAVING COUNT(ORDERLINE_NO) >= 500 ;

And use COUNT() instead of SUM().

A: Try this:
not sure if this is what you want
SELECT PRODUCT.PRODUCT_NO, PRODUCT.BRAND,PRODUCT.PRODUCT_CATEGORY
FROM PRODUCT JOIN ORDERLINE
ON PRODUCT.PRODUCT_NO = ORDERLINE.PRODUCT_NO
GROUP BY PRODUCT.PRODUCT_NO, PRODUCT.BRAND,PRODUCT.PRODUCT_CATEGORY
HAVING COUNT(ORDERLINE_NO) >= 500 ;


text:
Q: Why would a list() method be used on a python list in a recursion problem? I'm currently learning Depth-First Search in Python and a problem asked that, given a Binary Search Tree and a number N, find all paths from root-to-leaf such that the sum of all the node values of each path equals N.
I did everything right, but my code didn't work (it resulted in an empty 2D array). When looking at the solution, the only difference was "allPath.append(list(currPath))", while the code I wrote was simply 'allPath.append(currPath)'. When I made this change, the code worked perfectly Here's the full code:
def findPathSum(root, sum):
    allPath = []
    _findPathSum(root, sum, [], allPath)
    return allPath

def _findPathSum(currNode, sum, currPath, allPath):
    if currNode is None:
        return

    currPath.append(currNode.val)

    if currNode.val == sum and currNode.left is None and currNode.right is None:
        print(currPath)
        allPath.append(list(currPath))

    else:
        _findPathSum(currNode.left, sum-currNode.val, currPath, allPath)
        _findPathSum(currNode.right, sum-currNode.val, currPath, allPath)

    del currPath[-1]

What I'm confused about is that currPath is already a list, and only contains integers (which are the node values). When I print currPath before it is appended to allPaths, it also correctly displays a list with integer values. Yet after I append it to allPaths, allPaths is just an empty array. However, using the list() method on it, for some reason, displays the correct 2D array with the right integer values. I have no clue why this would work.
From my understanding, the list() method simply takes an iterable and turns it into a list...however currPath was already a list. I feel like I'm missing something really obvious.

A: list creates a brand new list (although the elements are not brand new), a new list object. In your case, without using list you will simply be appending the exact same list object to allPath on each recursive call.
Therefore, since all the elements of allPath are the exact same list, changing that list changes all of the elements of allPath. For example, when at the end of _findPathSum you do del currPath[-1], you are effectively deleting the final element of every element of allPath. Since in the end currPath will be empty, that is what you see at the end in allPath - a list containing empty lists.


text:
Q: Want Css drop down sub menu to come down on click and not on Hover Hey Guys i have a sub menu which drops down when i hover over an icon and it works well
GOAL:
I want the sub menu to drop down only when i click on the icon, and want the sub menu to minimize when i click the icon again. I know similar questions have been asked before and it did not help me out. Please help me. I have added the HTML and the CSS Code below. Thanks a lot for your time.
HTML

<class="logo" >

                 MENUS

Item 1

Item 2

Item 3

Item 4

Item 5

Item 6

CSS

.menu {
  float:left;
  margin: 9px;
  margin-top: 40px;
  margin-left:3px;
    text-align: center;
  width: 150px;
    height: 90px;
    line-height: 50px;
    border-top-right-radius: 10px;
    border-top-left-radius: 10px;
    border-bottom-right-radius: 10px;
    border-bottom-left-radius: 10px;
    background-color: #3764d600;
}

.row1 {
    line-height: 40px;
    height: 50px;
    background-color: #0f276998;
    display: none;
    width: 200px;
  margin-left: 2px;
  opacity: 0;
  border-radius: 5px;

}

.row1:hover,
.menu:hover {
  background-color: #631b6d00;
  color:rgb(96, 29, 102); /*font colour*/
    cursor: pointer;
}

.row:last-child {
    border-bottom-right-radius: 10px;
    border-bottom-left-radius: 10px;
}

.menu:hover {
    border-bottom-right-radius: 0;
    border-bottom-left-radius: 0;
}

.menu:hover > .row1 {
    display: block;
}

/*
** MENU 1
*/

.rowa {
  transform-origin: left;
    transition: transform 300ms;
}

.rowa:hover {
    transform: translateX(10px);
}

.menu1:hover
.rowa1 {
    animation: rowa 300ms 0ms forwards;
}
.rowa2 {
    animation: rowa 300ms 100ms forwards;
}
.rowa3 {
    animation: rowa 300ms 200ms forwards;
}
.rowa4 {
    animation: rowa 300ms 300ms forwards;
}
.rowa5 {
    animation: rowa 300ms 400ms forwards;
}
.rowa6 {
    animation: rowa 300ms 500ms forwards;
}

@keyframes rowa {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

A: you can use an input element behind scenes to acces to the checked css pseudo selector:
take a look to this pen uses the  #menu-toggle:checked to show or hide the menu

A: You have to follow some simple steps to achieve that.
1.) Create an input checkbox and keep the dropdown icon on top of it.
2.) Hide the checkbox. (Not the icon)
3.) Simply use the :checked pseudo class on that input element to do the same thing you do with :hover
4.) See the this codepen for example -
[Codepen](https://codepen.io/maverickcreative/pen/BaLZjqp)


text:
Q: css positioning/color I would like to have an all gray background, with a smaller blue background inside it.
Something like

and then in the css
#background_1
{
background-color : gray;
z-index : 1;
}
#background_2
{
background-color : blue;
z-index : 2;
}

Can anyone help me with this? I know it is a bit vague, but I basically want an all gray background, with a smaller blue rectangle in the foreground.

A: Everything is ok with your code... but no need of z-index for that.
Perhaps, put some content into your divs, or fix their sizes
Edit regarding your other questions
// HTML

    Test content

// CCS
html,body
{
  margin:0 20px 0 20px;
  background-color : gray;
  height: 100%;
}
#background
{
  width:100%;
  height: auto !important;
  height: 100%;
  min-height: 100%;
  background-color : blue;
}

You can see the result here : http://jsfiddle.net/Nz5WK/1/

A: z-index only works on position: relative,fixed, or absolute.
Also, if it's old for looks, consider using border:
div { width:100px; height:100px; background:lightblue; border:50px solid gray;}

A: You can eliminate one of the divisions by applying the initial grey background to the body:
body { background: gray }
body > div.blue { background: blue }

Some text.

Note that in this case, the grey part will be 8px wide, as defined by the body's default margin.

Or, if you want the blue part to take up the entire screen with a grey "border" around it, you don't even need the division:
body { background: blue; border: 10px solid gray }

Some text.


text:
Q: OpenCV246 and Qt LNK1104 cannot open file lib.obj I have this strange error in Qt: LNK1104: cannot open file 'C:\OpenCV246PC\build\x86\vc10\lib.obj'
Settings in Qt are all the same as in VS2010 (where they work fine), but here Qt is complain about the file it can't find even that I see no obvious reference to x86 libraries at all!
Here are my *.pro settings:
#-------------------------------------------------
#
# Project created by QtCreator 2013-07-12T14:50:04
#
#-------------------------------------------------

QT       += core

QT       -= gui

TARGET = myQtConsoleProject
CONFIG   += console
CONFIG   -= app_bundle

TEMPLATE = app

SOURCES += main.cpp

INCLUDEPATH += C:\OpenCV246PC\build\include

LIBS += -LC:\OpenCV246PC\build\x86\vc10\lib \
-lopencv_core246d \
-lopencv_highgui246d \
-lopencv_imgproc246d \
-lopencv_features2d246d \
-lopencv_calib3d246d

And this is simple code I am trying to compile
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>

int main ()
{
    // read an image
    cv::Mat image = cv::imread("img.jpg");
    // create image window named "My Image"
    cv::namedWindow("My Image");
    // show the image window
    cv::imshow("My Image", image);
    // wait key for 5000 ms
    cv::waitKey(5000);

    return 1;
}

A: Problem was resolved by manually adding release build directory:
build-myQtConsoleProject-Desktop_Qt_5_1_0_MSVC2010_32bit-Release
From reasons unknown, probably something with permissions, Qt created debug folder such as: C:\Users\Nenad\Qt\opencv2cookbook\build-myQtConsoleProject-Desktop_Qt_5_1_0_MSVC2010_32bit-Debug
but was unable to do so with:
C:\Users\Nenad\Qt\opencv2cookbook\build-myQtConsoleProject-Desktop_Qt_5_1_0_MSVC2010_32bit-Release
Noticed it after I clicked on Projects Build Settings. Path for Release was in red indicating that it can't be found.
Later it happened again. By checking project folder I realize it was set as "read only". Setting this folder's permission definitely resolved this issue.

A: Similar issue happened to me after I performed the latest Windows 7 critical updates yesterday.  The above fix is temporary for me, since upon the 3rd rebuild attempt, it happens again.
I did follow the instructions above and unfortunately I am back to square one.


text:
Q: Is this question of sequence a Mathematical one, i.e. does it have objectively only one answer for each subpart. This question is taken from 11th class Math book. Look at this question:

At the very first glance one can tell that all the three sequences are G.P But! by using interpolation(as this answer explains) we can give any number of answers to (a),(b) and (c).

*

*Is the above mentioned question technically, a mathematical question ?

The above mentioned question is taken from NCERT, Mathematics textbook for Class XI, chapter-9 Exercise 9.3, 5th question.
Can we use interpolation to solve this question on sequences? The book mentions only one correct answer for 5th question. If The question-5 that I quoted in the question above can also be answered by interpolation then this way the book will be technically incorrect; which is less likely to be because it is a standard book.

So, is the book technically incorrect?

A: As this question is trying to be pedantic, then yes, the answers are not quite right in the sense that the given solution is not unique. However, such question do have a place in a maths text book. To quote Jim Belk's find answer to a very related question on MathEducators.SE,

Theoretically, there's no way to determine the next term in the sequence
  $$
1,\quad 2,\quad 4,\quad 8,\quad 16,\quad\ldots
$$
  It literally could be anything.
At the same time, it is a vitally important skill to be able to look at this sequence and say "it looks like the powers of 2".  This answer is correct in the sense that any mathematician looking at this sequence would have that response, and a student who doesn't have that response when looking at this sequence has a serious gap in their knowledge.

These questions are not about giving the correct answer, but about "sensing" what the answer should be. This is an important skill. I suggest that you read his whole answer, which can be found here.
In the comments to this answer, and elsewhere in this thread, the idea of placing a disclaimer in the text's answers (pointing out that any solution can be justified) is suggested. However, most students who are reading the book will not be very mathematically mature. This disclaimer will confuse them, and it will shift the point of the question: The question is about pattern recognition, and these confused students will be trying to work out what on earth this disclaimer is going on about! Which is not a good thing. A better state of affairs would be for a teacher to point out this discrepancy to the better students in a class, and then these students can have some fun trying to work out different patterns, and hence increase their understanding. This means that the good students are encouraged more, while the poorer students are not sidetracked into confusion.

A: I've already answered the actual question in my comments, but I'd like to answer the question in the textbook. I think (b) and (c) are not geometric progressions. In each case, just multiply the previous two to get the next one.
In case you didn't realize, I'm joking. =)

A: It depends how you define a mathematical question. It's mathematical in the sense that there are numbers, patterns and the such. Then again there's a good joke that shows how everything comes down to math and thus down to philosophy.
Nonetheless I think  the question you're asking is as follows:

Does question $5$ have a well defined unique answer?

This is still somewhat of a subjective question. If you're in a calculus class and you've been studying sequences then in some sense, yes, there is a unique well defined answer as the students probably only know about simple sequences, i.e. geometric progressions. This leads us to questioning what to do about the students (like me) who would be smart a**** and give their favorite number as an answer and an explanation as

Really we can have this number appear at any term besides the first few that are listed since the sequence isn't defined as a formula, thus we can assume that any term of the sequence is any value we want.

This is where the subjectivity comes out; that is, I personally would say this person clearly understood the point of the question and thus deserves full credit. Although, others may think that they shouldn't get any credit since it's not the answer the teacher was looking for for a calculus class.
Anyhow if this problem was given in a more advanced class I think that reasoning above is valid, thus the question was either a trick question or was ill-posed.
At least these are my thoughts on the matter at hand, I'm open to disagreement.
Nonetheless if we were given, for example for $5a)$ that the sequence $a_n$ was defined as
$$
a_n := \left( \sqrt{2}\right)^{n} \; \forall n \in \mathbb{N}
$$
then I would say the question is well posed, since every term of the sequence is accurately defined (to some extent).
In the end I would say whether or not this is a well-posed problem comes down to context. I personally don't find it to be very constructive the way it is, and thus I don't think it's a good question, but again that's subjectivity.


text:
Q: What's the best way to deal with multiple QT Designer UI files in one program? Hi I have a program that uses multiple QT Designer UI forms.  When I add the second form (the main window form) to the project by simply adding the UI file I can no longer build or run the project.  What's the best way to deal with this situation?  One of the forms is an introductory wizard to guide the user through some steps.  When the wizard is complete I would like to show another form - the main window form.  These two forms are contained in separate files.  The project runs fine with one UI file but when I add the second is when the trouble starts.  It looks like my project defaulted to using the pointer variable single inheritance approach as described here.  Thanks!

A: you should add a Qt Designer Form Class. use the .ui form file to design your UI, and use the C++ class to code the logic. This way, when you want to your UI to show up, just create an object of the class and call .show() on it (the same way MainWindow works). . .


text:
Q: I am trying to install 8192eu driver on Ubuntu 20.04.01, after following every guide and forum I can find it is still not coming up on my driver list I have just installed Ubuntu 20.04.01 and am trying to install the correct driver for my TP-LINK TL WN-821N, there is a popular github repo for it that I have followed and is basically the only answer to every question surrounding this driver. The only problem I can see is that when I 'make' from the directory of the driver some fallthrough's occur.
Ubuntu is detecting the adapter, the driver is just not coming up on lsmod.
lsusb:
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 002: ID 0cf3:e500 Qualcomm Atheros Communications
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 5986:2115 Acer, Inc Integrated Camera
Bus 001 Device 002: ID 2357:0107 TP-Link TL-WN821N Version 5 RTL8192EU
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

iwconfig:
lo        no wireless extensions.

wlp2s0    IEEE 802.11  ESSID:"vodafone06378B"
      Mode:Managed  Frequency:5.54 GHz  Access Point: D6:35:1D:06:37:93
      Bit Rate=6 Mb/s   Tx-Power=27 dBm
      Retry short limit:7   RTS thr:off   Fragment thr:off
      Power Management:on
      Link Quality=70/70  Signal level=-33 dBm
      Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
      Tx excessive retries:0  Invalid misc:68   Missed beacon:0

lsmod:
Module                  Size  Used by
ccm                    20480  9
rfcomm                 81920  16
cmac                   16384  3
algif_hash             16384  1
algif_skcipher         16384  1
af_alg                 24576  6 algif_hash,algif_skcipher
bnep                   24576  2
snd_hda_codec_realtek   122880  1
snd_hda_codec_generic    81920  1 snd_hda_codec_realtek
ledtrig_audio          16384  2 snd_hda_codec_generic,snd_hda_codec_realtek
snd_hda_codec_hdmi     61440  1
joydev                 24576  0
snd_acp3x_pdm_dma      16384  1
snd_soc_dmic           16384  1
acp3x_rn               16384  1
snd_hda_intel          53248  4
snd_intel_dspcfg       24576  1 snd_hda_intel
snd_soc_core          245760  3 acp3x_rn,snd_soc_dmic,snd_acp3x_pdm_dma
snd_hda_codec         131072  4 snd_hda_codec_generic,snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec_realtek
snd_hda_core           90112  5 snd_hda_codec_generic,snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec,snd_hda_codec_realtek
snd_compress           24576  1 snd_soc_core
snd_hwdep              20480  1 snd_hda_codec
ac97_bus               16384  1 snd_soc_core
snd_pcm_dmaengine      16384  1 snd_soc_core
nls_iso8859_1          16384  1
snd_pcm               106496  7 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec,snd_soc_core,snd_hda_core,snd_acp3x_pdm_dma,snd_pcm_dmaengine
btusb                  57344  0
snd_seq_midi           20480  0
btrtl                  24576  1 btusb
btbcm                  16384  1 btusb
snd_seq_midi_event     16384  1 snd_seq_midi
btintel                24576  1 btusb
uvcvideo               98304  0
snd_rawmidi            36864  1 snd_seq_midi
videobuf2_vmalloc      20480  1 uvcvideo
videobuf2_memops       20480  1 videobuf2_vmalloc
ath10k_pci             49152  0
bluetooth             581632  41 btrtl,btintel,btbcm,bnep,btusb,rfcomm
edac_mce_amd           32768  0
videobuf2_v4l2         24576  1 uvcvideo
videobuf2_common       49152  2 videobuf2_v4l2,uvcvideo
snd_seq                69632  2 snd_seq_midi,snd_seq_midi_event
kvm_amd                98304  0
videodev              225280  3 videobuf2_v4l2,uvcvideo,videobuf2_common
ccp                    86016  1 kvm_amd
ath10k_core           475136  1 ath10k_pci
input_leds             16384  0
snd_seq_device         16384  3 snd_seq,snd_seq_midi,snd_rawmidi
ecdh_generic           16384  2 bluetooth
mc                     53248  4 videodev,videobuf2_v4l2,uvcvideo,videobuf2_common
wmi_bmof               16384  0
serio_raw              20480  0
ecc                    28672  1 ecdh_generic
hid_multitouch         28672  0
snd_timer              36864  2 snd_seq,snd_pcm
kvm                   663552  1 kvm_amd
ath                    36864  1 ath10k_core
k10temp                16384  0
snd                    90112  23 snd_hda_codec_generic,snd_seq,snd_seq_device,snd_hda_codec_hdmi,snd_hwdep,snd_hda_intel,snd_hda_codec,snd_hda_codec_realtek,snd_timer,snd_compress,snd_soc_core,snd_pcm,snd_rawmidi
mac80211              843776  1 ath10k_core
rtsx_pci_ms            24576  0
snd_rn_pci_acp3x       20480  0
snd_pci_acp3x          16384  0
memstick               20480  1 rtsx_pci_ms
soundcore              16384  1 snd
libarc4                16384  1 mac80211
ideapad_laptop         20480  0
sparse_keymap          16384  1 ideapad_laptop
mac_hid                16384  0
sch_fq_codel           20480  1
cfg80211              704512  3 ath,mac80211,ath10k_core
parport_pc             40960  0
ppdev                  24576  0
lp                     20480  0
parport                53248  3 parport_pc,lp,ppdev
ip_tables              32768  0
x_tables               40960  1 ip_tables
autofs4                45056  2
crct10dif_pclmul       16384  1
crc32_pclmul           16384  0
ghash_clmulni_intel    16384  0
amdgpu               4579328  31
amd_iommu_v2           20480  1 amdgpu
gpu_sched              32768  1 amdgpu
i2c_algo_bit           16384  1 amdgpu
hid_generic            16384  0
rtsx_pci_sdmmc         28672  0
aesni_intel           372736  10
ttm                   106496  1 amdgpu
drm_kms_helper        184320  1 amdgpu
crypto_simd            16384  1 aesni_intel
nvme                   49152  2
syscopyarea            16384  1 drm_kms_helper
cryptd                 24576  3 crypto_simd,ghash_clmulni_intel
sysfillrect            16384  1 drm_kms_helper
glue_helper            16384  1 aesni_intel
sysimgblt              16384  1 drm_kms_helper
fb_sys_fops            16384  1 drm_kms_helper
drm                   491520  12 gpu_sched,drm_kms_helper,amdgpu,ttm
i2c_piix4              28672  0
nvme_core             102400  4 nvme
rtsx_pci               73728  2 rtsx_pci_sdmmc,rtsx_pci_ms
wmi                    32768  2 wmi_bmof,ideapad_laptop
i2c_hid                28672  0
video                  49152  1 ideapad_laptop
hid                   131072  3 i2c_hid,hid_multitouch,hid_generic

I am pretty much a newbie when it comes to linux so don't go too harsh
Edit: I didnt really find a solution to my problem, but instead of using kubuntu I just changed to normal ubuntu as I am having less issues, it just happens that it has also fixed my driver issues


text:
Q: disable matplotlib toolbar Is there a way to disable/hide matplotlib Toolbar that shows up on the bottom?
I'd tried something like this:
import matplotlib as mpl
mpl.rcParams['toolbar'] = 'None'

but unfortunately that didn't work.

A: If you are in Jupyter using %matplotlib widget (ipympl) you can do:
fig.canvas.toolbar_visible = False

You can also disable header and footer with:
fig.canvas.header_visible = False
fig.canvas.footer_visible = False

A: Make sure to call mpl.rcParams['toolbar'] = 'None' before you instantiate any figures.

A: Alternatively, you can hide the toolbar:
QToolBar.hide()

or
QToolBar.setVisible(False)

Obviously this will only work with a Qt backend.
To expand on this answer, given the figure fig:
First, if using Qt5:
from PyQt5 import QtWidgets

Otherwise:
from PyQt4 import QtGui as QtWidgets

Then:
try:
    win = fig.canvas.manager.window
except AttributeError:
    win = fig.canvas.window()
toolbar = win.findChild(QtWidgets.QToolBar)
toolbar.setVisible(False)

A: To expand on bejota's answer:
Obviously this will only work with a Qt backend.
To expand on this answer, given the figure fig:
First, if using Qt5:
from PyQt5 import QtWidgets

Otherwise:
from PyQt4 import QtGui as QtWidgets

Then:
toolbar = win.findChild(QtWidgets.QToolBar)
toolbar.setVisible(False)
try:
    win = fig.canvas.manager.window
except AttributeError:
    win = fig.canvas.window()
toolbar = win.findChild(QtWidgets.QToolBar)
toolbar.setVisible(False)

A: you can go to C:\Python27\Lib\site-packages\matplotlib\mpl-data ,
there you will see the file named matplotlibrc, open the file and
you will find a line like:
#toolbar      : toolbar2# None | toolbar2  ("classic" is deprecated)

uncomment that line and place None after the colon like:
toolbar      : None# None | toolbar2  ("classic" is deprecated) and save the file,

I guess after you can disable the toolbar in graphs plotted by matplotlib.


text:
Q: Why is "Asking all remaining processes to terminate" failing during shutdown? I installed Debian 7. Sometimes when I quick X and type sudo shutdown -h now, it says, Asking all remaining processes to terminate, then after a few seconds, it prints a long list of processes, then it says that it failed to stop them, then the computer powers off.

*

*The computer was only recently installed.

*I have had the same distribution on this computer and on other computers, installed in the same manner, but never encountered this before.

Is this problem serious? If so, what could be causing it?

A: The init scripts first try to send a TERM signal, so the process ends gracefully. When that fails, the kernel starts to killing them, without waiting that the process finish. You should check which process and maybe end them yourself instead of waiting for the script.


text:
Q: Flask - set URL for file I've created a simple app in Flask. When the user fill the form in, which is in the index.html it returns results.html template which is very similar to index but the results are returned here (results are data from database found using the form).
I would like to make "results.html" able to recieve data so I can fill in the form, see the results and again fill the form...etc.
The problem is that I don't  know how to set the "results.html" to recieve those data because when they are rendered, there is still "http://127.0.0.1:5000/" without any suffix - results.html or something hence I can't assign function which works with the input.
@app.route('/results.html' ....

The code:
# -*- coding: utf-8 -*-
from flask import request,render_template,Flask
from databases import db_manager

app = Flask(__name__)
app.config.from_object(__name__)

def is_instance(a):
    return isinstance(a,basestring)

app.jinja_env.globals.update(is_instance=is_instance)

@app.route('/', methods=['GET', 'POST'])
# @app.route('/index', methods=['GET', 'POST'])
def index():
    if request.method == 'POST':
        query = request.form['query']
        if query.isdigit():
            _data = db_manager.manager().get_subject_by_ICO(query)
        else:
            _data = db_manager.manager().get_subject_by_name(query)

    else:
        return render_template('index.html')
    return render_template('results.html', data = _data)

if __name__ == '__main__':
    app.run(debug=True)

Now, I can go to: "http://127.0.0.1:5000/" and fill in the form and see the data but I can't do it again without refreshing the page.
Do you know what I have to do?

A: A bit simpler example (without the database stuff).
app.py
# -*- coding: utf-8 -*-
from flask import Flask, request, render_template

app = Flask(__name__)

@app.route('/', methods=['GET', 'POST'])
def index():
    if request.method == 'POST':
        query = request.form['query']
        _data = 'querying "{q}"'.format(q=query)
        return render_template('results.html', data=_data)

    return render_template('index.html')

if __name__ == '__main__':
    app.run(debug=True)

index.html
<form action="" method="post">
 <input type="text" name="query">
 <input type="submit" value="Query">
</form>

{% block results%}
{% endblock %}

results.html
{% extends "index.html" %}

{% block results%}
  {# only rendering data here #}
  {{ data }}
{% endblock %}

But now you have a different issue to solve - reloading the page will send a POST request again. You need to employ the Post/Redirect/Get pattern.
app.py
# -*- coding: utf-8 -*-
from flask import Flask, request, session, render_template, redirect, url_for

app = Flask(__name__)
app.config['SECRET_KEY'] = 'hard to guess string'

@app.route('/', methods=['GET', 'POST'])
def index():
    if request.method == 'POST':
        query = request.form['query']
        _data = 'querying "{q}"'.format(q=query)
        session['data'] = _data

        return redirect(url_for('index'))

    return render_template('index.html',
                           data=session.get('data'))

if __name__ == '__main__':
    app.run(debug=True)

index.html
<form action="" method="post">
 <input type="text" name="query">
 <input type="submit" value="Query">
</form>

{% block results%}
  {{ data }}
{% endblock %}


text:
Q: Please Help me to optimise mysql query containing subqueries for just a few hundred records Table details-->
CREATE TABLE `redeem_vouchers` (
  `voucherid` int(11) NOT NULL,
  `voucheramount` decimal(18,2) DEFAULT NULL,
  `redeemedto` int(11) DEFAULT NULL,
  `redeemedon` datetime DEFAULT NULL,
  `transid` varchar(100) DEFAULT NULL,
  `paymentconfirmed` tinyint(1) NOT NULL DEFAULT '0',
  `confirmedby` int(11) DEFAULT NULL,
  `confirmedon` datetime DEFAULT NULL,
  `redeemedby` int(11) DEFAULT '0',
  PRIMARY KEY (`voucherid`),
  KEY `NewIndex2` (`redeemedto`),
  KEY `NewIndex3` (`voucheramount`),
  FULLTEXT KEY `NewIndex1` (`transid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

Query-->
SELECT DISTINCT(transid),
    (SELECT (COUNT(voucheramount)*16) FROM redeem_vouchers WHERE transid = r.transid) AS  amount,
    (SELECT redeemedto FROM redeem_vouchers WHERE transid = r.transid LIMIT 0,1) AS 'Name'
FROM
    redeem_vouchers r
WHERE
    confirmedon
BETWEEN ('2013-07-23 19:00:00') AND ('2013-07-24 19:00:00')

Table contains just 4909 rows and query is taking 35 seconds to return result.
I have added 4 indexes but found no speed gain. I know I am doing something dangerous but I am new to sql. Please help me.

A: I would try this query, that uses GROUP BY:
SELECT
  transid,
  COUNT(voucheramount)*16 AS Amount,
  redeemedto As `Name`
FROM
  redeem_vouchers
WHERE
  confirmedon BETWEEN '2013-07-23 19:00:00' AND '2013-07-24 19:00:00'
GROUP BY
  transid

redeemedto is a non-aggregated column, and its value will be undetermined, but it is undetermined in your original query as well since you are using LIMIT to get the first record, but you are not using ORDER BY.
If all redeemedto values are the same, it will be fine - or you can use
MAX(redeemedto) As `Name`

to make the query SQL standard.


text:
Q: Foundation Export What is the use of FOUNDATION EXPORT in Objective-c?
So I have:
KError.h
FOUNDATION_EXPORT NSString *const KAPPErrorDomain;

enum {
    KPUnexpectedError = -1,
};

KError.m:
#import "KError.h"

NSString *const KAPPErrorDomain = @"com.kexample.myapp";

I assume that when you use Foundation_export in this case, it is to be able to use a variable in another file?
So that in KService.m, I cam reference KAppErrorDomain without any problem?

A: Yes. FOUNDATION_EXPORT is a macro that expands to extern
(or extern "C" in a C++ file), and that is the
keyword to declare a variable that is shared across source files (better: shared
across "translation units").
See How do I use extern to share variables between source files?
for many good answers why extern is necessary and how it works.


text:
Q: subgroups of the direct product intersecting trivially with the direct sum Suppose I take an infinite direct power $\prod G$ of some (not necessarily finite) group $G$.  I want to know about the subgroups of $\prod G$ that are maximal subject to having trivial intersection with $\oplus G$.  Is there a general description of such subgroups (in terms of ultrafilters maybe), without delving into the structure of $G$?  If not, are there at least some interesting general constructions of 'large' subgroups of $\prod G$ that intersect trivially with $\oplus G$?
One way to construct subgroups intersecting trivially with $\oplus G$ is as follows: take a family $\mathcal{P}$ of partitions of the indexing set $I$ that is closed under coarsest common refinement, such that all the parts in any given $P \in \mathcal{P}$ are infinite.  (For instance $I = \mathbb{Z}$ and $\mathcal{P}$ is congruence classes modulo $n$.)  Now take all those $g \in \prod G$ for which there is some $P$ in $\mathcal{P}$ for which the $i$-th entry of $g$ is determined by which part of $P$ contains $i$.
Are the groups I just described ever maximal?

A: Here is an example showing that the particular subgroups
you describe need not be maximal.
Consider the case of $\Pi_{n\in\mathbb{N}}
\mathbb{Z}/2\mathbb{Z}$, with the subgroup $H$ consisting
of the periodic elements of the product, which I think is the same as the
subgroup you describe in your modulo $n$ example. This is a subgroup and has trivial
intersection with the direct sum.
But I claim that it is not maximal. The reason is that this
$H$ is countable, but I claim any subgroup of this product that is maximal with respect to having trivial intersection with the direct sum must be
uncountable (and in fact must have size continuum). To see
this, suppose that $H$ is a countable subgroup having
trivial intersection with the direct sum. Thus also, the
set of elements of the product that differ at most finitely
from an element in $H$ is also countable. Since the direct
product is uncountable, there is an element $h$ in the
direct product that does not differ finitely from any
element of $H$. It follows that the group generated by $H$
and $h$ continues to have trivial intersection with the
direct sum. So $H$ is not maximal.
More generally, the same argument shows in this case that
any maximal group with the property must have size
continuum, for if not, then the set of elements differing
finitely from $H$ will also have size less than continuum,
and we will be able to find an $h$ that can be added.


text:
Q: Centos 6.5 error installing wal-e On a fresh CentOS 6.5 install (Python 2.6.6), after doing pip install wal-e successfully, running wal-e gives the following error:
# wal-e
Traceback (most recent call last):
  File "/usr/bin/wal-e", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 2655, in <module>
    working_set.require(__requires__)
  File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 648, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 546, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: argparse>=0.8

If i do pip list argparse I get a bunch of stuff, including argparse 1.3.0

A: You're missing the argparse package.  wal-e is looking for version 0.8 or higher.
pip install argparse

Also see this:
pip broke. how to fix DistributionNotFound error?


text:
Q: iOS : View visible but not active I got a UIViewController that init a UIView.
This view containing Interactive Elements like UITextField or UIButton.
View is added on ViewDidLoad, at the bottom of the method to be sure that when I made it visible it can be reach by user interaction.
But when I show the view, no interaction can be done on this View.
Is this only possible? Am I doing something wrong?
The View
public class AddBusinessEventView : UIView
{
    public UILabel LblTitle;
    public UITextField TxtType;
    public UIButton BtnClose;

    public AddBusinessEventView(nfloat bw, nfloat bh)
    {

        //Bouton pour fermer le popup
        BtnClose = new UIButton();
        BtnClose.SetImage(UIImage.FromFile("Images/Boutons/lightbox_close.png"), UIControlState.Normal);
        BtnClose.Frame = new CGRect(bw - 80, 30, BtnFermer.ImageView.Image.CGImage.Width * 0.5, BtnFermer.ImageView.Image.CGImage.Height * 0.5);

        //Doit se trouver par dessus txtSite et ajouté après dans la vue pour se trouvé en premier plan

        LblTitle = new UILabel();
        LblTitle.Frame = new CGRect((bw - (lw + 200)) / 2, 100, lw + 200, 30);
        LblTitle.Text = "Fill with your event elements";
        LblTitle.Font = UIFont.FromName("GillSans-Bold", 22);
        LblTitle.TextColor = UIColor.FromRGB(211, 3, 67);
        LblTitle.TextAlignment = UITextAlignment.Center;

        TxtType = new UITextField(new CGRect((bw - 750) / 2, 140, 350, 40));
        TxtType.BackgroundColor = UIColor.White;
        TxtType.TextAlignment = UITextAlignment.Center;
        TxtType.BorderStyle = UITextBorderStyle.RoundedRect;
        TxtType.AutocorrectionType = UITextAutocorrectionType.No;
        TxtType.AutocapitalizationType = UITextAutocapitalizationType.AllCharacters;
        TxtType.Placeholder = "Type";

        AddSubviews(BtnClose, LblTitle, TxtType);
    }
}

The UIViewController
partial class EvenementViewController : EnhancedUIViewController
{
    AddBusinessEventView AddBusinessEventView;

    public EvenementViewController(IntPtr handle) : base(handle) { }

    public EvenementViewController() : base() { }

    public override void ViewDidAppear(bool animated)
    {
        base.ViewDidAppear(animated);
        if (myEvent == null)
        {
            ShowAddBusinessEventView();
        }
    }

    public override void ViewDidLoad()
    {
        base.ViewDidLoad();
        nfloat bw = View.Bounds.Width;
        nfloat bh = View.Bounds.Height;
        //Another Elements are adding to view here
        //...

        AddBusinessEventView = new AddBusinessEventView(bw, bh);
        AddBusinessEventView.Hidden = true;

        //Much more View.Add with all elements here
        //...

        View.Add(AddBusinessEventView);
        AddBusinessEventView.BtnType.TouchUpInside += BtnClose_TouchUpInside;
    }

    #region BusinessEventAdd
    void ShowAddBusinessEventView()
    {
        UIView.Animate(duration: 1,
            delay: 0,
            options: UIViewAnimationOptions.CurveEaseInOut,
            animation: () =>
            {
                AddBusinessEventView.Alpha = 1.0f;
            },
            completion: () =>
            {
                AddBusinessEventView.Hidden = false;
                AddBusinessEventListener();
            }

        );
    }

    void HideAddBusinessEventView()
    {
        UIView.Animate(duration: 1,
            delay: 0,
            options: UIViewAnimationOptions.CurveEaseInOut,
            animation: () =>
            {
                AddBusinessEventView.Alpha = 0.0f;
            },
            completion: () =>
            {
                AddBusinessEventView.Hidden = true;
                RemoveBusinessEventListener();
            }

        );
    }

    void BtnClose_TouchUpInside(object sender, EventArgs e)
    {
        System.Diagnostics.Debug.Print("Touching myself");
    }
    #endregion
}

please concidere EnhancedViewController as standard UIViewController, I'm juste adding some enhancements to show users a message from an Overlay.
As I said, we can't interact neither with TxtType nor BtnClose.
Edit :
Don't sure if it can help; but when the View is added to the Main View on the UIViewController, it display well, but all user interaction are catches on element under this View
i.e : The AddBusinessEventView act as a popup, so it covered all other element, when i press an element, if another element adding prior of this View is under, it's this element rather than the AddBusinessEventView element that catch the touch event.
As said, the main purpose is to cut View element on different file for more readability and maintenability of this application.enter code here

A: There is no reason you can't do that.
You can architect your code like

*

*UIViewController

*

*Controller1

*Controller2

*...

*Views

*

*View1

*View2

*...

And then use View1 and View2 in any of Controller.
I tried your code and I got all the things popup correctly.
As you said, if view show up on screen but it's element from another View from below that interact with user maybe you can try to bring your View to front.
Try this
View.BringSubviewToFront(AddBusinessEventView);

At the end of your ViewDidLoad function.


text:
Q: How to Run Anaconda as admin on MacOS Catalina? When I run the following code in Jupyter Notebook on my Mac
import keyboard
if keyboard.is_pressed('q'):
    print("Yes")

It shows the following error:
Exception in thread Thread-4:
Traceback (most recent call last):
  File "/Users/mayankmalviya64/opt/anaconda3/lib/python3.7/threading.py", line 926, in _bootstrap_inner
    self.run()
  File "/Users/mayankmalviya64/opt/anaconda3/lib/python3.7/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/mayankmalviya64/opt/anaconda3/lib/python3.7/site-packages/keyboard/__init__.py", line 294, in listen
    _os_keyboard.listen(self.direct_callback)
  File "/Users/mayankmalviya64/opt/anaconda3/lib/python3.7/site-packages/keyboard/_darwinkeyboard.py", line 430, in listen
    raise OSError("Error 13 - Must be run as administrator")
OSError: Error 13 - Must be run as administrator

Since on MacOS, run as administrator option is NOT available like Windows, what should I do ?
I want to detect keypress like when any-key on the keyboard is pressed, the program stops !!
I have also tried to run the above code through my terminal in iPython. It shows the same error there too.

A: You can open it using the terminal with this command
sudo open /Users/<your-username>/Applications/Anaconda

Use the proper directory if you changed


text:
Q: Ugly URLs when there's pagination My Permanent Link Setting:
/%category%/%post_id%.html
When there's pagination, the Url looks like this:
www.example.com/%category%/%post_id%.html/2
But I want this:
www.example.com/%category%/%post_id%-2.html
Plz tell me how to do (with Functions.php?)


text:
Q: send - recv not working as expected with command line arguments I am passing cmd arguments one by one from send function from clients like this :
    for( i = 3; i < argc; i++)
    {
            //memset(buffer, '\0', sizeof(buffer));
            //bzero(buffer, sizeof(buffer));
            //strcpy(buffer, argv[i]);
            n = send(sockfd, argv[i], strlen(argv[i]), 0);
            //n = send(sockfd, buffer, strlen(buffer), 0);
            if(n <= 0 )
            {
                    perror("Error in writing2 : ", sockfd);
                    return FAILURE;
            }
    }

here's the server side code for recv :
            for( j = 0; j < arg_no; j++)
            {
                    //memset(buffer, '\0', sizeof(buffer));
                    bzero(buffer, sizeof(buffer));
                    n = recv(clientfd, buffer, sizeof(buffer), 0);
                    if(n <= 0)
                    {
                             showerror("Error in reading2 : ", clientfd);
                             break;
                    }

              }

The problem I am facing here is that whole of the **argv is getting passed
once and its waiting for recv after that, causing the program to halt. I even tried passing arguments by copying it to a buffer and then sending(commented code), but it din't work.

A: TCP is stream based, not message based.  That means that there is not a one-to-one correlation between send and recv calls.  It's possible, as is apparently happening in your case, that multiple send calls are consolidated into a single recv call.
To account for this, your application needs to define some kind of message boundary.  You could, for example, first pass the number of strings to expect, then for each string pass the length followed by the actual string.
On the sender side, you would have the following:
char numargs = argc - 3;
// send the number of strings to expect
n = send(sockfd, &numargs, sizeof(numargs), 0);
if(n <= 0 )
{
        showerror("Error in writing2 : ", sockfd);
        return FAILURE;
}
for( i = 3; i < argc; i++)
{
        // send the string length
        char len = strlen(argv[i]);
        n = send(sockfd, &len, sizeof(len), 0);
        if(n <= 0 )
        {
                showerror("Error in writing2 : ", sockfd);
                return FAILURE;
        }
        n = send(sockfd, argv[i], strlen(argv[i]), 0);
        if(n <= 0 )
        {
                showerror("Error in writing2 : ", sockfd);
                return FAILURE;
        }
}

Then on the receiving side:
char numargs;
// get the number of strings to expect
n = recv(clientfd, &numargs, sizeof(numargs), MSG_WAITALL);
if(n <= 0 )
{
        showerror("Error in reading2 : ", clientfd);
        return FAILURE;
}

        for( j = 0; j < numargs; j++)
        {
                char len;
                // get the string length
                n = recv(clientfd, &len, sizeof(len), MSG_WAITALL);
                if(n <= 0)
                {
                         showerror("Error in reading2 : ", clientfd);
                         break;
                }
                bzero(buffer, sizeof(buffer));
                // get the string
                n = recv(clientfd, buffer, len, MSG_WAITALL);
                if(n <= 0)
                {
                         showerror("Error in reading2 : ", clientfd);
                         break;
                }

          }


text:
Q: Browser router is not rendering I'm new to react and want to learn about browser routers but the browser router is not rendering
import React from 'react';
import ReactDOM from 'react-dom\client';
import { BrowserRouter,Route,Routes } from 'react-router-dom';
import Home from './pages/Home';

const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
    <BrowserRouter>
    <Routes>
    <Route index element={<Home/>}/>
    </Routes>
  </BrowserRouter>

);

The Home component is perfectly rendering with react strict mode but it is not rendering with browser router
can someone explain why Iam getting this issue?
This is my Home.jsx file
import React from 'react'

export default function Home()
{
  return (

Home

  )
}

The error I'm getting :

Uncaught TypeError: Cannot read properties of null (reading 'useRef')
    at useRef (react.development.js:1625:1)
    at BrowserRouter (index.tsx:151:1)
    at renderWithHooks (react-dom.development.js:16305:1)
    at mountIndeterminateComponent (react-dom.development.js:20074:1)
    at beginWork (react-dom.development.js:21587:1)
    at beginWork$1 (react-dom.development.js:27426:1)
    at performUnitOfWork (react-dom.development.js:26557:1)
    at workLoopSync (react-dom.development.js:26466:1)
    at renderRootSync (react-dom.development.js:26434:1)
    at performSyncWorkOnRoot (react-dom.development.js:26085:1)

A: You must specify the path prop to the <Route> component.
<Route index path="/" element={<Home/>}/>

A: Use BrowseRouter in index.js and wrap your App.
import { BrowserRouter } from 'react-router-dom';

<BrowserRouter>
   <App />
</BrowserRouter>

and in App.js
import {Routes,Route} from "react-router-dom";

function App() {
  return (
      <Routes>
        <Route path="/" element={<Home/>} />
        <Route path="/home" element={<Home/>} />
        <Route path="/about" element={<About />} />
       ... ...
      </Routes>


text:
Q: Android invoke interface inside class file in lib module Hi in my lib module I'm having a interface like this,
public interface ServiceData {
    void deviceName();
}

I implement this in Main app module in Activity as follows,
MainActivity extends AppCompatActivity implements ServiceData

    @Override
    public void deviceName() {

    }

}

I have to invoke this in a class file which is also in lib module. I searched and found solution like
ServiceData service = (ServiceData) context;

But it throws ClassCastException. How can I invoke this in a class file? Any help will be appreciated and thanks in advance.

A: Use localbroadcastmanager.
 In lib
Intent intent = new Intent("YOUR_INFO");
LocalBroadcastManager manager = LocalBroadcastManager.getInstance(context);
manager.sendBroadcast(intent);

In app.

IntentFilter intentFilter = new IntentFilter("YOUR_INFO");

LocalBroadcastManager manager = LocalBroadcastManager.getInstance(this);
manager.registerReceiver(broadcastReceiver, intentFilter);

private final BroadcastReceiver broadcastReceiver = new BroadcastReceiver() {

    @Override
    public void onReceive(Context context, Intent intent) {
        String action = intent.getAction();
        Log.d("MainActivity","your info" +"  "+action);
        if(action.equals("YOUR_INFO")) {

        }
    }
};


text:
Q: what is the algorithm used in pandas.query() to let this function so fast? I am trying to develop a data operating framework with pure Python called DaPy(http://www.github.com/jacksonwuxs/dapy) to improve my skills. I am wondering that why query function in pandas is so fast?
Of course I know pandas is implemented by C, but I don't believe it is the only reason. Can anyone give me some suggestions?
this is the code what I used
df.query('pm25 >= 500')
df[df['pm25'] >500]

I am very grateful some answers like: "binary search is used in pandas query function to match the exactely record" or "I know a website which best illustrates the detail of query function"


text:
Q: How to hide TextFieldCursorHandle in Jetpack compose for TextField/BasicTextField? The solution I have so far is to use a Transparent Color for the cursor.
I am looking for a better way to hide it if there is any.
cursorBrush = SolidColor(Transparent)

TextField should be focused, the keyboard should be open and the user should be able to type input.

The problem with this is I can still see the TextFieldCursorHandle after entering text.

A: *

*In the BasicTextField you can hide the cursor using cursorBrush = SolidColor(Unspecified).

*In the TextFieldyou can use the attribute colors = TextFieldDefaults.textFieldColors(cursorColor = Color.Unspecified)
The TextFieldCursorHandle and the selected text use the color provided by LocalTextSelectionColors.current
You override this color defining a custom TextSelectionColors:
val customTextSelectionColors = TextSelectionColors(
    handleColor = Color.Transparent,
    backgroundColor = Color.Transparent
)

CompositionLocalProvider(LocalTextSelectionColors provides customTextSelectionColors) {
   BasicTextField(
       value = text,
       onValueChange = {text = it},
       cursorBrush = SolidColor(Unspecified)
   )

   TextField(
       value = text,
       onValueChange = {text = it},
       colors = TextFieldDefaults.textFieldColors(cursorColor = Color.Unspecified)
   )

}


text:
Q: react native map not rendering nested array components I'm trying to use this Code to render a nested array of images inside the array of objects but it doesn't work it just left an empty space according to CSS added
            {
                POSTDATA.map((data =>
                {
                    data.productImages && data.productImages.length > 0 &&
                        data.productImages.map((image) =>
                        <Image
                            key={image}
                            style={styles.wrap}
                            resizeMode="stretch"
                            source={{ uri: image }}
                             />
                        )
                    }
                ))
            }

this is the function which is then rendered in the main exported function.
wrap: {
    width: width,
    height: height * 0.50,
},

this is the css used in the code where the width and height are from Dimensions components decided through 'window'
const POSTDATA =[
    {
        key: 1,
        name: 'You Shine',
        rating: '3.5',
        gender: 'female',
        likes: 300,
        productImages:[

            "../../assets/image/ethnicDress.jpg",

            "../../assets/image/ethnicDress2.jpg",

            "../../assets/image/ethnicdress3.jpg",

            "../../assets/image/ethnicdress4.jpg"

        ],
    productTitle: "ladies trendy Evening gouns with a traditional touch",
    productDescription: "This is really a new Trend. Where the western gouns are made with a slight touch of Indian Tradition",
    commentsNumber: 235,
    productComments: [
        {
            key: 1,
            userName: "_user_name_",
            comment:"this is really an amazing product and can make you stand out"
        },
        {
            key: 2,
            userName:"_user_name_2",
            comment:"I Think this is not a genuine price for such a product it must be somewhat cheaper"
        }
    ]

}
]


text:
Q: Arduino TMP36 not enough resolution -- how to improve I have connected a TMP36 to an Arduino Uno, and eventually figured that the 10-bit resolution allows for the smallest step to be 4.8mV. Using the proper conversion results in half degree temperature steps. Since the TMP36 changes 10mV per degree this makes sense.
However, this is simply not good enough for a smooth transition in the first decimal digit.
What do I need to do to:

*

*spread -- say -- -10 to 40 deg C over the 1024 steps, or

*increase the bits in the A/D converter, or

*use an extra/external A/d with higher resolution,

... to achieve a higher resolution?
What I figured is that in other posts, resolution is mistaken for accuracy. I am after a higher resolution; e.g. 4096 steps would be close to 1mV steps. I reckon even more is required for smooth transitions.
Any help appreciated... as I am sort of to new to this.

A: One technique to achieve higher resolution is over sampling. Here is an application note from Atmel with more details for this technique

A: You can increase resolution by using the internal 1.1V analog voltage reference instead of the default 5V one. You can do that with the following code:
analogReference(INTERNAL);

That will let you spread the temperature reading over a smaller range and will yield approximately 1.075mV resolution per unit from your analogRead() calls.
Here's more information about the analogReference() function call: AnalogReference.

A: My solution: Reach a resolution truly equal or better than \$0.1^{\circ}C/LSB\$, by using an amplifier in between the TMP36 and microcontroller ADC (also with \$V_{REF}=1.1V\$). The idea is to change the sensor transfer function, but sacrificing the original temperature range, from\$-40^{\circ}C/+125^{\circ}C\$ to \$-10^{\circ}C/+40^{\circ}C\$ (according you said).
Let:
\$V_A\$: Analog voltage from TMP36, with \$V_A=0.01T + 0.5\$ (where \$T\$ is the temperature)
\$V_A'\$: amplified \$V_A\$
\$V_D\$: Digital value converted by ADC, \$V_D=INT(\frac{1024}{1.1}V_A')\$

Doing the math, the required equation for that tranformation is:
$$V_A'=2V_A-0.7$$
Notice that \$0.4V\leq V_A< 0.9V\$
A possible circuit (w/ rail-to-rail input op. amp):

So, the expression for the temperature (to be implemented on microcontroller code) is:
$$T=0.05371V_D-15$$
Using differences:
$$\Delta T=0.05371\Delta V_D$$
or
$$\Delta T< 0.1\Delta V_D$$
The smaller change in \$V_D\$ is 1 bit on ADC (\$\Delta V_D \Leftrightarrow 1 LSB\$). In other words, a resolution better than \$0.1^{\circ}C/LSB\$. Not accounting for the implementation issues (rounding, fixed point, ...).


text:
Q: Work with the actual hypotheses in pymc3 - Porting examples from ThinkBayes to pymc3 I am replicating some of the examples presented in "Think Bayes" by Allen Downey to pymc3.
His great book provides us some introductory examples to Bayesian Methods and is done using Allen's own library.
There is the "Train Problem", where you need to predict the number of trains a company have based on the number you see painted on each train (each train is numbered from 1 to N)
The likelihood of this problem is basically
def likelihood(self, data, hypo):
    if data > hypo:
        return 0
    return 1/hypo

for data in stream:
    for hypo in hypothesis:
        self.posterior[hypo] *= likelihood(data, hypo)

data in the number you've seen on a train.
How can I define that custom likelihood is pymc3? I'm using DensityDist to create my own likelihood function, but this one that I'm replicating is dependent on the hypothesis that ranges from 1 to N (let's say N = 100) and in pymc3 I couldn't find a way to get the X's from the tensors.

A: This problem is also know as the German Tank problem. Since during WWII the allies were trying to find the number of German tanks based on the serial number of captured tanks.
I think the problem can be solved by the following model
with pm.Model() as model:
    N = pm.DiscreteUniform('N', lower=y.max(), upper=y.max()*10)
    y_obs = pm.DiscreteUniform('y', lower=0, upper=N, observed=y)

    trace = pm.sample(10000)

Depending on your actual problem you may relax the discrete assumption (that is really reasonable) and use a continuous distribution like the Uniform one.
with pm.Model() as model:
    N = pm.Uniform('N', lower=y.max(), upper=y.max()*10)
    y_obs = pm.Uniform('y', lower=0, upper=N, observed=y)

    trace = pm.sample(1000)

One advantage of relaxing the discrete assumption is that now you can use NUTS. Instead, in the previous model you are restricted to Metropolis since you were using discrete variables.


text:
Q: Calculation surface of building external walls from shapefile I have two datasets (attached):
1) A shapefile of buildings containing the height of each building.
2) A parcel shapefile. Several buildings are assigned to a single parcel.
I am interested in calculating the sum of the surface of external walls of buildings (m2) in each parcel. In other words, I want to know how many square meters (m2) of external walls I have in each parcel.
However, it is important for me to exclude those walls which are in common in between buildings. For instance, if two buildings with the heights of 10 m and 6 m are attached from one side, the goal would be to include 4 m of the 10 m external wall and exclude the 6 m which both walls are attached with each other.
I hope I was successful in describing the question.


text:
Q: Fetch images from mySQL into 3D model in unity3d I have a project that needs to get images from MySQL DB and show it in 3D model in unity, the 3D model is shared on the same website, so I need to know how to get images dynamically and put it as a material on the model, not just fetching and put it at any place.
If anyone has any simple information please share it with me, thanks.


text:
Q: TypeError: Argument 'MLP( # attributes num_neurons_per_layer = [4, 1] )' of type  is not a valid JAX type I'm having some issues testing a basic model on Jax. For example, I'm trying to implement the value_and_grad() function from Jax manually for a binary classification problem. Here is my model initializer:
class MLP(nn.Module):
    num_neurons_per_layer: Sequence[int]

    @nn.compact
    def __call__(self, x):
        activation = x
        for i, num_neurons in enumerate(self.num_neurons_per_layer):
            activation = nn.Dense(num_neurons)(activation)
            if i != len(self.num_neurons_per_layer) - 1:
                activation = nn.relu(activation)
        return nn.sigmoid(activation)

And here is my BCE loss which is using vmap to batch the samples quicker all wrapped in a jit:
def make_bce_loss(xs, ys):

    def bce_loss(params, model):
        def cross_entropy(x, y):
            preds = model.apply(params, x)
            return y * jnp.log(preds) + (1 - y) * jnp.log(1 - preds)
        return -jnp.mean(jax.vmap(cross_entropy)(xs, ys), axis=0)

    return jax.jit(bce_loss)

bce_loss = make_bce_loss(X, y)
value_and_grad_fn = jax.value_and_grad(bce_loss)

Then I proceed to create the model and init the parameters:
model = MLP(num_neurons_per_layer=[4, 1])
params = model.init(key, X)  # I create a jnp.array() to create X earlier on

When I test out my jitted version of value_and_grad_fn(params, model) I get the following error:
TypeError: Argument 'MLP( # attributes num_neurons_per_layer = [4, 1] )' of type <class '__main__.MLP'> is not a valid JAX type.

I'm not sure what I should be doing to correct this. It is throwing an error about the [4, 1] but those aren't involved in the calculation at all, they are only used to initialize the model in the MLP class.

A: Flax models must be marked as static for use in jit:
    return jax.jit(bce_loss, static_argnums=1)

It looks like flax has an issue to improve this error message: https://github.com/google/flax/issues/853


text:
Q: Sparse 3D matrix in python just for insertion/deletion of elemets, deletion of rows, and fast access to non empty z dimension I'm looking for a matrix-like datatype that would get triplets (x, y, z) as keys, and can implement:
- initial value
- fast insertion/deletion
- deletion of rows
- given x, y  get all z indices so that x, y, z is non default value.
This is used for an NFA parser, where x and z are states and y is a terminal.

A: A python 3.4 implementation:
class Sparse3DMatrix():
  def __init__(self, default_value=False, max_x=100, max_y=100):
    self._dim = 3
    self._max_x = max_x
    self._max_y = max_y
    self._init_non_empty_z()
    self._default_value = default_value
    self._elements = {}
  def __getitem__(self, triplet):
    assert(len(triplet) == self._dim)
    return self._elements.get(triplet, self._default_value)
  def __setitem__(self, triplet, value):
    assert(len(triplet) == self._dim)
    if value == self._default_value:
      if triplet in self._elements:
        self._delete_element(triplet)
    else:
      if triplet not in self._elements:
        self._add_element(triplet, value)
      else:
        self._elements[triplet] = value
  def _init_non_empty_z(self):
    self.non_empty_z = {}
    for i in range(self._max_x):
      for j in range(self._max_y):
        self.non_empty_z[i, j] = []
  def _delete_element(self, triplet):
    """ Deletes an element. Element is assumed to exist. """
    del self._elements[triplet]
    self.non_empty_z[triplet[0], triplet[1]].remove(triplet[2])
  def _add_element(self, triplet, value):
    """ Adds an element. triplet is assumed to be default value before call. """
    self._elements[triplet] = value
    self.non_empty_z[triplet[0], triplet[1]].append(triplet[2])
  def delete_by_axis(self, index, axis):
    """ Slow deletion of entire row / column / depth """
    old_triplets = self._elements.copy().items()
    self._elements = {}
    self._init_non_empty_z()
    for triplet, value in old_triplets:
      if triplet[axis] < index:
        self._add_element(triplet, value)
      elif triplet[axis] > index:
        new_triplet = list(triplet)
        new_triplet[axis] -= 1
        self._add_element(tuple(new_triplet), value)
  def all_non_default_value(self):
    return list(self._elements.keys())


text:
Q: Spring autowired collection of qualified beans I have some Spring @Components with @Qualifier annotations, let's say it's in example "A" and "B". I want to inject them (using only annotations) into List. How can I do that ?
@Component
public class WhatIHave {

    @Autowired
    @Qualifier("A")
    private MyType firstBean;

    @Autowired
    @Qualifier("B")
    private MyType secondBean;
    ....
}

@Component
public class WhatIWantToHave {

    @Autowired
    @Qualifier("A", "B") //something like that
    private List<MyType> beans;
    ...
}

Do I need to make it in @Configuration class ?
@Configuration
public class MyConfiguration {

    @Autowired
    @Qualifier("A")
    private MyType firstBean;

    @Autowired
    @Qualifier("B")
    private MyType secondBean;

    @Bean
    public List<MyType> beans() {
        return Lists.newArrayList(firstBean, secondBean);
    }
}

Or there is another way to do that ?

A: @Qualifier is to know which bean is qualify to autowired on a field in case of same type beans so why not:
@Autowired
@Qualifier("A")
private MyType firstBean;

@Autowired
@Qualifier("B")
private MyType secondBean;

then:
List<MyType> list = new ArrayList<>();
list.add(firstBean);
list.add(secondBean);

A: How about this workaround
import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
@Component
public class TypeCollector implements ApplicationContextAware {

    private ApplicationContext applicationContext;

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {

        this.applicationContext = applicationContext;
    }

    public <T> List<T> getBeans(Class<T> clazz, String... names) {
        List<T> list = new ArrayList<>();
        for (String name : names) {
            list.add(applicationContext.getBean(name, clazz));
        }
        return list;
    }
}

The you can autowire the TypeCollector and ask for the beans runtime. The disadvantage is that you will get NoSuchBeanDefinitionException at runtime, and you have to use bean names instead of qualifier.


text:
Q: Creating new property in Record says that new value can be undefined I upgraded to typescript 4-beta and my reducers where my state is typed with Record<string, string> are showing my that when I create new property with value in them, then the value can be undefined.
I dont know if I really understand what is going on or is this some sort of bug.
On version 3.9 it this kind of error did not show up.
Type '{ [x: string]: string | undefined; }' is not assignable to type 'Record<string, string>'. Index signatures are incompatible. Type 'string | undefined' is not assignable to type 'string'. Type 'undefined' is not assignable to type 'string'.

Here is TS playground with example.
type State = Record<string, string>

const initialState = {};

const reducer = (state: State = initialState, action: {type: string; payload: {key: string, value: string}}):State => {
    switch(action.type) {
        case "foo":
            return {
                ...state,
                [action.payload.key]: action.payload.value
            }
        default:
            return state;
    }
}

playground link
Many thanks maybe I am just dumb and I am doing somthing wrong.

A: This is a known issue (microsoft/TypeScript#39494) and is already fixed in the current nightly builds of TypeScript 4.0 (see playground link).  So when TS 4.0 is officially released this is probably not going to be an issue.  Hope that helps; good luck!


text:
Q: Are community AMI's eligible for EC2 free tier? AWS states:

When you start an Amazon EC2 instance, you must select an Amazon Machine Image (AMI) that is eligible for the AWS Free Tier. Because of licensing restrictions, some AMIs aren't eligible for the AWS Free Tier.

It's also stated

To stay within the Free Tier, use only EC2 Micro instances.

Are some community AMIs eligible for the free tier if they are open source and can be run on a t2.micro instance?
Edit: It seems it might be the case that some are eligible, as a comment in the AWS forums states:

There are some community AMI's that are eligible for the free tier. You can see these by selecting the AMI, and then looking at the available Instance Types. If there is a "Micro" option annotated with a star then it is eligible.

Moreover an answer on SO also explains this could be true.

A: I deployed ami-07f493412d6213de6 which is NixOS 20.09.1632.a6a3a368dda x86_64-linux, and also happens to be a community ami.
The result was that it was detected as free tier usage when verifying on the billing page.

Service
Free Tier usage limit
Month-to-date usage

Amazon Elastic Compute Cloud
750 hours per month of Amazon EC2 Linux, RHEL, or SLES t2.micro or t3.micro instance dependent on region
0.18% (1.32/750 Hrs)

Amazon Elastic Compute Cloud
30 GB of Amazon Elastic Block Storage in any combination of General Purpose (SSD) or Magnetic
0.02% (0.01/30 GB-Mo)

It looks like linux community ami's can be considered free tier if they have no licence fee and are deployed on a free tier instance for less than 750 hours per month.


text:
Q: Image with rollovers I have a big image that has to go in the background.
Say the image is a square.  Now when someone does a mouseover on any of the square's corners, the image should change to the green version of the image.
Actually the background image is going to remain, but I have to somehow overlay the green image slice over the background image.
So I have a file called 'background.png' and then 'corner1.png', corner2.png etc.
How can I implement this?  Do I have to know the exact number of pixels to place the image in the corner properly?

A: It should be possible for you to use CSS to place the corner images overlaid into each of the corners of your background image.  You shouldn't need to know the size of those corner images to place them, just use alignment parameters,
The mouse-over actions would then be associated with those invisible image objects.

A:

Might require some fine-tuning

A: The following example has hotspots on the four corners of background.png (with their own corner backgrounds) and when those hotspots are moused over, shows an overlay image on top of the background (but not over the corners). This can be altered to remove the corner images, etc. Is this what you're looking for?


text:
Q: javascript / узнать имя цвета по hex Мне надо узнать имя цвета по HEX, пример #fbfa73 - Soft yellow.
Пробовал npm пакет - ntcjs и другие, но они определяют не правильно.
Некоторые пишут, что #fbfa73 - это green или golden, мне же надо что бы в название было конкретное по типу "Yellow" или "Blue" как на сайте https://www.colorhexa.com/color-names

A: Можете воспользоваться прекрасным сервисом https://www.thecolorapi.com/

const hexValue = document.querySelector('#hexValue');
const search = document.querySelector('#search');
const result = document.querySelector('#result');

const getColorName = (hexValue) => {
  fetch(`https://www.thecolorapi.com/id?hex=${hexValue}`)
  .then(res => res.json())
  .then(data => {
    console.log(data);

    result.innerHTML = data.name.value
  })
  .catch(e => console.log(e.message))
}

search.addEventListener('click', () => getColorName(hexValue.value));
<input id="hexValue">
<button id="search">Search</button>

Единственная проблема, которую я заметил - это то что при неправильном формате hex он всё равно пытается что-то да и выдать (например мне выдавал Black). Так что валидацию надо будет вам самим писать

A: Определитель названия цвета можно сделать с помощью двухмерного массива, в котором находится база соответствия кодов цветов и их названий: