text:
Q: Showing that a rectangle is equal to the closure of its interior I'm trying to show that if Q is a rectangle, then Q equals the closure of Int Q. I have that the closure of Int Q is a subset of Q and I'm now working to show that Q is a subset of the closure of Int Q. I understand that this last inclusion is not true in general but I am confused about which property of rectangles I can use to show this. Could someone give me a hint?

A:
Definition · A subset $Q$ of $\mathbb{R}^n$ is called a rectangle iff it is of the form
  $$ Q = [a_1,b_1] \times \dotsb \times [a_n,b_n]$$
  for certain $a_1,\dotsc,a_n,b_1,\dotsc,b_n \in \mathbb{R}$ with $a_1 \lt b_1,\dotsc,a_n \lt b_n$.

Let $Q = [a_1,b_1] \times \dotsb \times [a_n,b_n] \subseteq \mathbb{R}^n$ be a rectangle.

*

*We claim $Q^{\circ} = ]a_1,b_1[ \times \dotsb \times ]a_n,b_n[$.
Since $]a_1,b_1[ \times \dotsb \times ]a_n,b_n[$ is an open subset of $Q$, clearly $]a_1,b_1[ \times \dotsb \times ]a_n,b_n[ \subseteq Q^\circ$. We also know $Q^\circ \subseteq Q$.
Now assume $]a_1,b_1[ \times \dotsb \times ]a_n,b_n[ \subsetneq Q^\circ$. Then we had an $x=(x_1,\dotsc,x_n) \in Q^\circ$ with $x_i=a_i$ or $x_i=b_i$ for some $1 \leq i \leq n $. Let $x_i=a_i$ (the other case is very similar). Since $Q^\circ$ is open, there also was an $\epsilon \gt 0$ such that $B_\epsilon(x) \subseteq Q^\circ$. So we had $(x_1,\dotsc,x_i-\epsilon , \dotsc,x_n) \in B_\epsilon(x)$ but — since $x_i \lt a_i $ — also $(x_1,\dotsc,x_i-\epsilon , \dotsc,x_n) \notin Q $ and thus even more $(x_1,\dotsc,x_i-\epsilon , \dotsc,x_n) \notin Q^\circ $, a contradiction. It follows that indeed $Q^{\circ} = ]a_1,b_1[ \times \dotsb \times ]a_n,b_n[$.

*We claim $\overline{Q^\circ} = [a_1,b_1] \times \dotsb \times [a_n,b_n]$.
Since $Q$ is closed and $Q^\circ \subseteq Q$, we clearly have $\overline{Q^\circ} \subseteq \overline{Q} = Q$. Further more we also know $]a_1,b_1[ \times \dotsb \times ]a_n,b_n[ \subseteq \overline{Q^\circ}$.
Now assume $\overline{Q^\circ} \subsetneq Q = [a_1,b_1] \times \dotsb \times [a_n,b_n]$. Then we had an $x=(x_1,\dotsc,x_n) \in Q$ with $x \in \mathbb{R}^n \setminus \overline{Q^\circ}$ and therefore $x_i=a_i$ or $x_i=b_i$ for at least one $1 \leq i \leq n $. Let $I := \{ i \in {1,\dotsc,n} | x_i = a_i \text{ or } x_i = b_i\} \neq \emptyset$. We now continue the proof only for the case $x_j=a_j$ for all $j \in I$ but the other cases can be treated very similar. Since $\overline{Q^\circ}$ is closed, $\mathbb{R}^n \setminus \overline{Q^\circ}$ is open and we have an $ 0 \lt \epsilon$ such that $B_\epsilon(x) \subseteq \mathbb{R}^n \setminus \overline{Q^\circ}$. Let $j \in I$ be arbitrary. Then $ a_j \lt x_j+\epsilon $ and we can choose an $0 \lt \epsilon_j \lt \epsilon$ such that $x_j + \epsilon_j \in ]a_j,b_j[$. For $j \in \{1,\dotsc,n\} \setminus I$ we have $x_j \in ]a_j,b_j[$ anyway. Now consider the point $y=(y_1,\dotsc, y_n)$ with $y_j := x_j + \frac{\epsilon_j}{\sqrt{|I|}}$ for $j \in I$ and $y_j := x_j$ for $j \notin I$. With $k' \in \{ k \in I | \epsilon^2_j \leq \epsilon^2_k \text{ for all } j \in I\}$ (i.e. $\epsilon_{k'}$ has the biggest "$\epsilon$-square") we get
$$ ||y-x|| = \sqrt{\sum_{j \in I} \frac{\epsilon^2_j}{|I|}} \leq \sqrt{|I| · \frac{\epsilon^2_{k'}}{|I|}} = \epsilon_{k'} \lt \epsilon $$
hence $y \in B_\epsilon(x) \subseteq \mathbb{R}^n \setminus \overline{Q^\circ} \subseteq \mathbb{R}^n \setminus Q^\circ$ but also $y \in ]a_1,b_1[ \times \dotsb \times ]a_n,b_n[ = Q^\circ$, a contradiction. It follows that indeed $\overline{Q^\circ} = [a_1,b_1] \times \dotsb \times [a_n,b_n]$.

A: Since proving $[a_1,b_1] \times \dotsb \times [a_n,b_n] \subseteq \overline{Q^\circ}$ was the hardest part in my previous answer, here is another (maybe easier) way to prove this. You need to know that for a set $S \subseteq \mathbb{R}^n $ the closure $\overline{S}$ is exactly the set of all $x \in \mathbb{R}^n $ that appear as limits of arbitrary converging sequences $(s_k)_{k\in\mathbb{N}}$ with $s_k \in S$. Sometimes this property is even the definition of closure in a metric space.
Let $x = (x_1,\dotsc,x_n) \in [a_1,b_1] \times \dotsb \times [a_n,b_n]$ be arbitrary. Define the sets $I := \{i \in \{1,\dotsc,n\} | x_i = a_i \}$ and $ J := \{i\in \{1,\dotsc,n\} | x_i = b_i \}$. For $i \in \{1,\dotsc,n\} \setminus (I \cup J)$ we then have $x_i \in ]a_i,b_i[$. Now define for each $k \in \mathbb{N}$ and each $i \in \{1,\dotsc,n\}$
$$y^{(k)}_i :=\begin{cases}a_i+\frac{b_i-a_i}{2k} &\text{if } i \in I, \\ b_i-\frac{b_i-a_i}{2k} &\text{if } i \in J, \\ x_i &\text{else} \end{cases} $$
and consider the sequence $(y_k)_{k \in \mathbb{N}}$ with $y_k := (y^{(k)}_1,\dotsc,y^{(k)}_n)$. Note that for each $k \in \mathbb{N}$ we have $y_k \in ]a_1,b_1[ \times \dotsb \times ]a_n,b_n[ = Q^\circ$ and
$$\lim_{k \to \infty} y_k = (\lim_{k \to \infty} y^{(k)}_1, \dotsc, \lim_{k \to \infty} y^{(k)}_n) = (x_1,\dotsc,x_n) = x.$$
Therefore, $x \in \overline{Q^\circ}$.


text:
Q: Help accessing xml attribute in php I'm new to php and coding in general.  I'm trying to parse xml from a remote device and access specific value data. I would like to display group 9 probe 1 value for example and I cannot get it to work.  Any tips?
Here is the xml:
<?xml version="1.0" encoding="ISO-8859-1" ?>
- <Device id="S10011" hb="1935">
  <Group id="1" />
  <Group id="2" />
  <Group id="3" />
  <Group id="4" />
  <Group id="5" />
  <Group id="6" />
  <Group id="7" />
  <Group id="8" />
- <Group id="9">
- <Probe id="99">
  <Value>1.0</Value>
  </Probe>
- <Probe id="1">
  <Value>86.4</Value>
  </Probe>
- <Probe id="2">
  <Value>45.7</Value>
  </Probe>
- <Probe id="3">
  <Value>2.9</Value>
  </Probe>
- <Probe id="4">
  <Value>1.0</Value>
  </Probe>
  </Group>
  </Device>

Here is my php code to read in the xml:
    <?php
   // Establish a port 80 connection
   $http = fsockopen("192.168.2.106",80);

   // Send a request to the server
   $req = "GET /xmldata HTTP/1.0\r\n";
   $req .= "Host: 192.168.2.106\r\n";
   $req .= "Connection: Close\r\n\r\n";
   fputs($http, $req);

   // Output the request results
   while(!feof($http)) {
      $xmlstr .= fgets($http, 2048);
   }
   // Close the connection
   fclose($http);

   $xml = simplexml_load_string($xmlstr);

   print_r($xml);

   $myValue = $xml->xpath('//Group[@ID="9"]/Probe[@ID="1"]/value');
   echo $myValue;
?>

A print_r($xml); shows the following info:
    SimpleXMLElement Object
(
    [@attributes] => Array
        (
            [id] => S10011
            [hb] => 158221
        )

    [Group] => Array
        (
            [0] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [id] => 1
                        )

                    [0] =>

                )

            [1] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [id] => 2
                        )

                    [0] =>

                )

            [2] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [id] => 3
                        )

                    [0] =>

                )

            [3] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [id] => 4
                        )

                    [0] =>

                )

            [4] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [id] => 5
                        )

                    [0] =>

                )

            [5] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [id] => 6
                        )

                    [0] =>

                )

            [6] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [id] => 7
                        )

                    [0] =>

                )

            [7] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [id] => 8
                        )

                    [0] =>

                )

            [8] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [id] => 9
                        )

                    [Probe] => Array
                        (
                            [0] => SimpleXMLElement Object
                                (
                                    [@attributes] => Array
                                        (
                                            [id] => 99
                                        )

                                    [Value] => 2.0
                                )

                            [1] => SimpleXMLElement Object
                                (
                                    [@attributes] => Array
                                        (
                                            [id] => 1
                                        )

                                    [Value] => 89.6
                                )

                            [2] => SimpleXMLElement Object
                                (
                                    [@attributes] => Array
                                        (
                                            [id] => 2
                                        )

                                    [Value] => 42.7
                                )

                            [3] => SimpleXMLElement Object
                                (
                                    [@attributes] => Array
                                        (
                                            [id] => 3
                                        )

                                    [Value] => 3.9
                                )

                            [4] => SimpleXMLElement Object
                                (
                                    [@attributes] => Array
                                        (
                                            [id] => 4
                                        )

                                    [Value] => 1.0
                                )

                        )

                )

        )

)

A: Try this instead:
   $myValue = $xml->xpath('//Group[@id="9"]/Probe[@id="1"]/Value');
   echo $myValue[0];

A: You have to strip the HTTP header from the HTTP response or you won't get a valid XML document. Depending on your hosting environment you may be able to pass an HTTP URL to simplexml_load_file() which is much simpler than what you're doing.
Also your xpath doesn't work because XML attributes and tag names are case sensitive.
$xml = simplexml_load_file("http://192.168.2.106/xmldata");
$myValue = $xml->xpath("//Group[@id='9']/Probe[@id='1']/Value");
echo $myValue[0];

Are all these dashes in the XML source just a copy/paste issue?

A: <?php
$device = getDoc();
// iterate over all Group elements that have one or more Probe elements that have one or more Value elements.
foreach( $device->xpath('Group[Probe/Value]') as $group ) {
  echo 'Group id=', $group['id'], "\n";
  foreach( $group->Probe as $probe ) {
    echo '  probe id=', $probe['id'], "\n";
    foreach( $probe->Value as $value ) {
      echo '   value=', $value, "\n";
    }
  }
}

function getDoc() {
  return new SimpleXMLElement('<?xml version="1.0" encoding="ISO-8859-1" ?>
    <Device id="S10011" hb="1935">
      <Group id="1" />
      <Group id="2" />
      <Group id="3" />
      <Group id="4" />
      <Group id="5" />
      <Group id="6" />
      <Group id="7" />
      <Group id="8" />
      <Group id="9">
      <Probe id="99">
        <Value>1.0</Value>
      </Probe>
      <Probe id="1">
        <Value>86.4</Value>
      </Probe>
      <Probe id="2">
        <Value>45.7</Value>
      </Probe>
      <Probe id="3">
        <Value>2.9</Value>
      </Probe>
      <Probe id="4">
        <Value>1.0</Value>
      </Probe>
      </Group>
    </Device>');
}

prints
Group id=9
  probe id=99
   value=1.0
  probe id=1
   value=86.4
  probe id=2
   value=45.7
  probe id=3
   value=2.9
  probe id=4
   value=1.0

see also: http://docs.php.net/simplexml.examples-basic and http://www.w3.org/TR/xpath/

A: xml:
<root><item attrname="5"/></root>

php:
$var = $xml->xpath('root/item/@attrname');
echo $var[0];

or >= php5.3
$var = $xml->xpath('root/item/@attrname')[0];
echo $var;

result:
5

redpajama_set_name: RedPajamaStackExchange


text:
Q: Convert Date to UTC with timezone I'm migrating some data in my DB and have date as a string "date" : "2020-10-23",. I want to convert that date into a datetime object to store it in another field. I'm using luxon

let DateTime = luxon.DateTime;

// Function
function timeZoneToUTC(timezone, year, month, day, hours) {
  const dateObj = `${year}-${month}-${day} ${hours}:00`;
  let date = DateTime.fromFormat(dateObj, 'yyyy-M-d H:mm', {
    zone: timezone
  });
  return date.toUTC().toString();
}

// Example
let record = {preparationTime: "18",
              date : "2020-10-23"};
let dateISO = DateTime.fromISO(record.date, {zone: 'Europe/Amsterdam'});
dateISO = dateISO.minus({days: 1});
let year = dateISO.year;
let month = dateISO.month;
let day = dateISO.day;

record.newOrderTime = timeZoneToUTC('Europe/Amsterdam', year, month, day, 22);

console.log(record.newOrderTime);
<script src = "https://cdn.jsdelivr.net/npm/luxon@1.25.0/build/global/luxon.min.js" > </script>

The code above returns a wrong time, for example: 2020-10-23 will be 2020-10-22T20:00:00.000Z the day is correct however the time is not, it should be 21 instead of 20

A: This maybe due to Daylight savings times. (https://moment.github.io/luxon/docs/manual/zones.html#dst-weirdness)
To check whether current time is based on DST or not
https://moment.github.io/luxon/docs/class/src/datetime.js~DateTime.html#instance-get-isInDST


text:
Q: How to store data on who rated and recommended a song or item in MySQL/SQL Basically I am trying to keep a record of the number of people who recommended a resource AND also the number of people who recommended a song and per - however I am not sure how to do this in a relational database. This is my schema and an example on SQLFiddle Link: http://sqlfiddle.com/#!9/29063/1
This is my DDL:
  CREATE TABLE IF NOT EXISTS Users(
  userID INT NOT NULL AUTO_INCREMENT,
  forename VARCHAR(100),
  surname VARCHAR(100),
  PRIMARY KEY(userID)
  );

CREATE TABLE IF NOT EXISTS Type(
  typeID INT NOT NULL AUTO_INCREMENT,
  typeName VARCHAR(100),
  PRIMARY KEY(typeID)
  );

CREATE TABLE IF NOT EXISTS Songs(
    songID INT NOT NULL AUTO_INCREMENT,
    typeID INT NOT NULL,
    songName VARCHAR(100),
    rating INT,
    recommended TINYINT(1),
    FOREIGN KEY (typeID) REFERENCES Type(typeID),
    PRIMARY KEY (songID)
);

INSERT INTO Users VALUES
(NULL, "Jack", "Son"),
(NULL, "Bob", "Marley"),
(NULL, "Ringo", "Star");

INSERT INTO Type VALUES
(NULL, "Rap"),
(NULL, "RnB"),
(NULL, "HipHop"),
(NULL, "Jazz");

INSERT INTO Songs VALUES
(NULL, 1, "California Love", 2, 1),
(NULL, 2, "Locked Up", 4, 0),
(NULL, 3, "Tell Em", 5, 0),
(NULL, 4, "Jazz it up", 1, 1);

You see the Rating row/column in the table Songs - I want to keep a record of who rated that song and store it in another table maybe? I just want to then store the average rating. I also want to keep a record of who recommended the song as well as their details.
How would I do this? It would save me a lot of time and headaches if someone could give me the schema or idea.

A: Create a new table UserRating with userid, songid and rating columns. Probably a date column too, for when they rated it. Table with FKUserID int, FKSongID int, Rating it, RankDate datetime.
Then you can use select songs.id, AVG(Rating) from songs inner join UserRating on UserRating.FKSongID = songs.ID group by songs.id Which will give you all songs by their average ranking.
Or if you need all songs rated by a user Select * from users inner join UserRating on UserRating.FKUserID = user.ID
or if you need all songs rated higher than 5
select * from songs inner join UserRating on UserRating.FKSongID = Songs.ID where rating > 5 etc etc


text:
Q: running kernel on QEMU I face this message:
Failed to execute /initKernel panic - not syncing: no init found.
Try passing init=option to kernel.

I am using this command line:
qemu-system-x86_64 -hda disk.img -kernel /home/marssonubuntu/linux_qemu/linux-3.3.3/arch/x86/boot/bzImage -initrd my-initramfs.cpio -append "root=/dev/sda rdinit=/sbin/init"

on qemu, the full message is:
Failed to execute /sbin/init Kernel panic - not syncing: No init found.
Try passing init= option to kernel. see Linux Documentation/init.txt for guidance.
Pid: 1, comm: swapper Not tainted 3.3.3 #1
Call Trace:
[<ffffffff811d78b4>] ? panic+0xa9/0x197
[<ffffffff811d6927>] ? init_post+0xb2/0xb2
[<ffffffff812aad96>] ? kernel_init+0xff/0xff
[<ffffffff811dcd44>] ? kernel_thread_helper+0x4/0x10
[<ffffffff812aac97>] ? do_one_initcall+0x121/0x121
[<ffffffff811dcd40>] ? gs_change+0xb/0xb

A: I had this issue, and increasing the guest's RAM fixed it. Try passing -m 1024.

A: I used:
qemu-system-x86_64 --enable-kvm -m 1024 -machine smm=off -cdrom mint.iso -boot order=d mint_hdd.img

Specifying RAM size i.e.
-m 1024

fixed this issue and booted into mint successfully.

A: Ok, here is my Qemu command line:
KERNEL=vmlinuz-2.6.32-5-686
INITRD=initrd.img-2.6.32-5-686
APPEND="root=/dev/sda2 ro "
IMG=qemu.img
qemu -kernel $KERNEL -initrd $INITRD -append "$APPEND"  -hda $IMG

$ file $IMG $INITRD $KERNEL
qemu.img: DOS/MBR boot sector
initrd.img-2.6.32-5-686: gzip compressed data
vmlinuz-2.6.32-5-686:    Linux kernel x86 boot executable bzImage

A: I had the same problam and I managed to build mini Linux following the steps below.

Steps in Building Base Mini Linux Distro

*

*Compile the kernel and see the result in terms of size of the compilation

*Create rootfs image (format as ext2 mke2fs for example) that will contain the root system and some basic programs (used busybox)

*Mount rootfs and create basic directories and files

*Compile busybox and install it inside the rootfs

*Check the kernel size (with or without modules enabled) and Ciar image (with mkdosfs applied to the image linux.img example) that contain linux.img grub or syslinux setting the boot process of the system

*After rootfs created and linux, copy for syslinux.cfg linux.img , bzImage, into the linux.img

*Applies the command sync syslinux to finish the linux.img image ;

*After all settings and installations test it with qemu, for example, the following command qemu linux.img

*If everything's OK, the system will boot to the basic shell.

But the current attempts can not enter the terminal ( shell )
I leave these steps here in case they can help someone or someone can help me.


text:
Q: How to set up google analytics account service? I'm new in using Google Analytics API and I'm facing a problem.
i got the error labeled as  (403) User does not have any Google Analytics account.
With my google account I am able to view google anaytics pages and by code, I just can't.
Here is my code. i think I misused something in the 6 first lines, but what ?
Any idea is welcomed.
$scope = "https://www.googleapis.com/auth/analytics";
$client_id = "[12 numbers]-[32 letters/numbers].apps.googleusercontent.com";
$service_account_name = "[same 12 numbers]-[same 32 letters/numbers] @developer.gserviceaccount.com";
$key_file_location = "./google-account-service.p12";
$projectId = "[same 12 numbers]";
$projectName = "[my project name defined in console.developers.google.com]";

$client = new Google_Client();
$client->setApplicationName($projectName);

$key = file_get_contents($key_file_location);
$cred = new Google_Auth_AssertionCredentials($service_account_name, array($scope), $key);

$client->setAssertionCredentials($cred);

if($client->getAuth()->isAccessTokenExpired()){
    $client->getAuth()->refreshTokenWithAssertion($cred);
}

$client->getAccessToken();

$service = new Google_Service_Analytics($client);

// metrics
$_params[] = 'date';
$_params[] = 'date_year';
$_params[] = 'date_month';
$_params[] = 'date_day';
// dimensions
$_params[] = 'visits';
$_params[] = 'pageviews';
$_params[] = 'bounces';
$_params[] = 'entrance_bounce_rate';
$_params[] = 'visit_bounce_rate';
$_params[] = 'avg_time_on_site';

$from = date('Y-m-d', time()-2*24*60*60); // 2 days
$to = date('Y-m-d'); // today

$metrics = 'ga:visits,ga:pageviews,ga:bounces,ga:entranceBounceRate,ga:visitBounceRate,ga:avgTimeOnSite';
$dimensions = 'ga:date,ga:year,ga:month,ga:day';
$data = $service->data_ga->get('ga:'.$projectId, $from, $to, $metrics, array('dimensions' => $dimensions));

foreach($data['rows'] as $row) {
   $dataRow = array();
   foreach($_params as $colNr => $column) echo $column . ': '.$row[$colNr].', ';
}

A: the service account mail that you use is not valid. You need to create a project in console.developers.google.com and activate the api for google analytics. then you will get acces to you service account email use it in your code.

A: just a tip i noticed in your code u set the $projectid = the first 12 number as in the $clientid which is as far as i know wrong .. the $projectid must be equal to ( go to your google analytics account , take a look at the URL you will notice there is a segment looks like /a39569200w68518820p70543179/ take the numbers after the 'p' letter in this case the 70543179 numbers and set them as a value for $projectid variable ) i dont know if it solve your problem but i think you should know ..


text:
Q: How to highlight input words in autocomplete jquery ui Could you please help me in highlighting the typed words in the auto complete text box. i am already populating the autocomplete words and i need to just highlight the typed words alone.i am new to Jquery autocomplete
i am getting the output as text like Brijesh  // seen as text
and not as highlighting the Br alone.
Below is the snippet
$(document).ready(function () {
$("#studentName").autocomplete({
    source: function (request, response) {
        $.ajax({
            type: "POST",
            contentType: "application/json; charset=utf-8",
            url: "Webservice.asmx/GetStudentNames",
            data: "{'prefixText':'" + request.term + "'}",
            dataType: "json",
            success: function (data) {
           var regex = new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + request.term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1") + ")(?![^<>]*>)(?![^&;]+;)", "gi");
                response($.map(data.d, function (item) {
                    return {
                    label: item.split('|')[0].replace(regex, "$1"),
                    val: item.split('|')[1]
                    }
                }))
            },

            failure: function (response) {
                ServiceFailed(result);
            }
        });
    },
    select: function (event, ui) {
     txtStudent(ui.item.val, ui.item.label); //Student name and id used in this method
    },
    minLength: 2
});
});              // End of ready method

Please help me.

A: For a correct render in jQuery UI - v1.12.1 use "div", not "a"
$.ui.autocomplete.prototype._renderItem = function (ul, item) {
    var t = String(item.value).replace(
            new RegExp(this.term, "gi"),
            "$&");
    return $("

")
        .data("item.autocomplete", item)
        .append("
" + t + "
")
        .appendTo(ul);
};

A: It seems to me you should overwrite the _renderItem method to have custom rendering of the items. The code could be about the following:
$("#studentName").autocomplete({/* all your parameters*/})
    .data("autocomplete")._renderItem = function (ul, item) {
        var newText = String(item.value).replace(
                new RegExp(this.term, "gi"),
                "$&");

        return $("

")
            .data("item.autocomplete", item)
            .append("
" + newText + "
")
            .appendTo(ul);
    };

In the code I use jQuery UI CSS "ui-state-highlight" for highlighting. You can use  instead. Moreover I don't include the code which would escape any RegEx characters which could be inside of this.term. I wanted to explain you the main idea only. Look at the answer for example for additional information.
UPDATED: More recent versions of jQuery UI uses .data("ui-autocomplete") instead of .data("autocomplete"). To make your code working in both (old and new) versions of jQuery you can do something like the following:
var $elem = $("#studentName").autocomplete({/* all your parameters*/}),
    elemAutocomplete = $elem.data("ui-autocomplete") || $elem.data("autocomplete");
if (elemAutocomplete) {
    elemAutocomplete._renderItem = function (ul, item) {
        var newText = String(item.value).replace(
                new RegExp(this.term, "gi"),
                "$&");

        return $("

")
            .data("item.autocomplete", item)
            .append("
" + newText + "
")
            .appendTo(ul);
    };
}

UPDATED 2: In the same way the name "item.autocomplete" should be changed to "ui-autocomplete-item". See here.

A: we can also implement it like this.
 $("#studentName").autocomplete({/* all your parameters*/});
    $.ui.autocomplete.prototype._renderItem = function (ul, item) {
        var t = String(item.value).replace(
                new RegExp(this.term, "gi"),
                "$&");
        return $("

")
            .data("item.autocomplete", item)
            .append("" + t + "")
            .appendTo(ul);
    };

A: If you are using new JQueryUI, You should replace this:
.data("autocomplete")._renderItem

to this:
.data("uiAutocomplete")._renderItem

A: $.ui.autocomplete.prototype._renderItem = function (ul, item) {
item.label = item.label.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + $.ui.autocomplete.escapeRegex(this.term) + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "$1");
    return $("

")
            .data("item.autocomplete", item)
            .append("" + item.label + "")
            .appendTo(ul);
};

Use this

A: Here is the code I used to make it work (case insensitive):
open: function (e, ui) {
      var acData = $(this).data('ui-autocomplete');
      acData.menu.element.find('li').each(function () {
         var me = $(this);
         var keywords = acData.term.split(' ').join('|');
         me.html(me.text().replace(new RegExp("(" + keywords + ")", "gi"), '$1'));
      });
   }


text:
Q: Update code works in manual stored procedure but not when run as SQL Server Agent Job I have a stored procedure that deletes all records from an existing table, and then inserts new records. After the insert I have several update operations that change the value of one field.
If I run the SQL Server Agent job, the update does not happen. If I select and execute the update code manually, the update occurs.
If I execute the entire stored procedure manually, the update occurs.
No errors are thrown; everything 'works' but the update does not occur when I kick off the SQL Server job.

A: I resolved the issue - but do not understand it.
The system has a View corresponding to each Table.  One of the Views was used in my FOR XML PATH view.
I substituted the no-permission Table for the View, and it works.
The View has Public SELECT permissions.  The Table has no named permissions.
I think the SQL Server Agent Job should be able to SELECT from the View because of the public permission, but it cannot.

A: If i am getting you right and what i also witnessed when the job did not ran an update code because of the limit of the text size with hold by sql server agent job:
Therefore you can try something like limiting the amount of data returned via sql agent job as The default TEXTSIZE for SQL Agent is 512.
You can specify the text size as per output you get after a success manual run.
Refer to below link for more info:
http://www.mssqltips.com/sqlservertip/1398/limit-amount-of-data-returned-with-the-sql-server-textsize-command/


text:
Q: SharePoint WebPart rendering at runtime I've been through all SharePoints posts all over the interwebs and I can't find anything to point me in the right direction.
I'm developing a web part, that should, in theory re-render the contents of web parts situated within a given zone, into itself. Lot of words, let me explain a bit more.
I have a zone, for example: MyZone that will hosts "WebPartA" and "WebPartB", and "WebPartC". WebPartC needs to hide A and B, and render their contents in itself, however, I cannot find any reference to how to accomplish this. Is this possible, and does anyone out there have an example I can look at.
I've only started SP development recently and would love to see if I can achieve something like this.
Thanks

A: If you can modify the source of webparts A and B, you could expose the data they provide to WebPartC using Sharepoint provider/connector plumbing. Google can supply you with tons of sample code for connecting webparts.
If that's not an option, another option would be to do it all in javascript. A framework like jquery would help immensely. In a nutshell, WebPartC would need to render javascript code to...

*

*Grab the HTML rendered by the other webparts

*Hide the other webparts


text:
Q: Как спрятать картинку в android? Дело такое: при запуске time-managera пустой список в начале. Нужно туда вставить картинку, которая бы пропадала как только мы что-то добавили. Отсюда и вопрос: как сначала показать картинку, а потом спрятать?

A: Нашёл сам ответ. Сначала нужно в layout сделать элементы, которые нам нужны.
<?xml version="1.0" encoding="utf-8"?>
   <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="@color/background">

<android.support.v7.widget.RecyclerView
    android:id="@+id/task_recycler_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/background"
    android:textAlignment="center" />

<ImageView
    android:id="@+id/imageEmptyViewFirst"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
    app:srcCompat="@android:drawable/ic_menu_view"
    tools:layout_editor_absoluteX="176dp"
    tools:layout_editor_absoluteY="239dp" />

<TextView
    android:id="@+id/textEmptyViewFirst"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/imageEmptyViewFirst"
    android:layout_centerHorizontal="true"
    android:gravity="center"
    android:text="@string/empty_first"
    android:textColor="@color/text" />

<ImageView
    android:id="@+id/imageEmptyViewSecond"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_marginStart="16dp"
    android:layout_toEndOf="@+id/textEmptyViewFirst"
    app:srcCompat="@android:drawable/ic_menu_upload" />

<TextView
    android:id="@+id/textEmptyViewSecond"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignStart="@+id/textEmptyViewFirst"
    android:layout_below="@+id/imageEmptyViewSecond"
    android:layout_marginStart="34dp"
    android:gravity="center"
    android:text="@string/empty_second"
    android:textColor="@color/text" />

Затем в классе организовываем их подключение, получаем где-то ответ, что экран пустой и меняем просто setVisibility
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                     Bundle savedInstanceState) {
 ...

View view = inflater.inflate(R.layout.fragment_task_list, container,
        false);

isEmptyImageFirst = view.findViewById(R.id.imageEmptyViewFirst);
isEmptyTextFirst = view.findViewById(R.id.textEmptyViewFirst);
isEmptyImageSecond = view.findViewById(R.id.imageEmptyViewSecond);
isEmptyTextSecond = view.findViewById(R.id.textEmptyViewSecond);

mTasksRecyclerView = (RecyclerView) view
        .findViewById(R.id.task_recycler_view);

mTasksRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));

if (TaskLab.get(getActivity()).getTasks().size() > 0) {
    mTasksRecyclerView.setVisibility(View.VISIBLE);
    isEmptyImageFirst.setVisibility(View.GONE);
    isEmptyTextFirst.setVisibility(View.GONE);
    isEmptyImageSecond.setVisibility(View.GONE);
    isEmptyTextSecond.setVisibility(View.GONE);
}
else {
    mTasksRecyclerView.setVisibility(View.GONE);
    isEmptyImageFirst.setVisibility(View.VISIBLE);
    isEmptyTextFirst.setVisibility(View.VISIBLE);
    isEmptyImageSecond.setVisibility(View.VISIBLE);
    isEmptyTextSecond.setVisibility(View.VISIBLE);
}

...
    return view;
}

Скрин с телефона, что получилось. Как только список пополняется элементами - надписи становятся невидимыми.


text:
Q: Как работает background в разных браузерах? В IE11 картинку расплющило. В chrome всё хорошо. Пытался менять значения background-position и background-size

.callback {
    background-color: #8387db;
    background-image: url(../img/icons/plain.svg);
    background-repeat: no-repeat;
    background-size: 23% 103%;
    background-position: 12% 0;
}

A: Проблема решена. Дело было в background-size. Не знаю как отображают его разные браузеры, но после его удаления всё стало норм.


text:
Q: Is it possible for users to view a post's up and down vote history? Is it possible to view a graph showing a post's up and down votes over time?
Not who voted for it, just "vote received at [timestamp]". I know if a user has enough rep they can see the total up and down votes their post has received so far, but I'm not aware of being able to see the history of votes on a post.

A: You want a graph, you get a graph. It's holiday season after all:

As you noticed, vote timestamps are missing time information, and data may be (up to) 7 days old since SEDE is refreshed once a week on Sunday morning. Notice the use of parameters to reuse the query for multiple posts. Editing them repeatedly gets rather tedious :)

A: There is a tool called Stack Exchange Data Explorer that allows users to perform queries on Stack Exchange's databases. Although it's not graphical, the raw data can be used to create a graph.
For instance, to view the voting history of the first ever Meta Stack Exchange question go to https://data.stackexchange.com/meta.stackexchange/query/new and run the below query:
SELECT v.Id
      ,v.PostId
      ,vt.Name as VoteType
      ,v.UserId
      ,v.CreationDate
      ,v.BountyAmount
FROM Votes v
JOIN VoteTypes vt
  ON vt.id = v.VoteTypeId
WHERE PostId = 1
ORDER BY CreationDate

Output:
Id | PostId | VoteType | UserId | CreationDate        | BountyAmount
---+--------+----------+--------+---------------------+-------------
 2 |      1 | UpMod    |        | 2009-06-28 00:00:00 |
 4 |      1 | UpMod    |        | 2009-06-28 00:00:00 |
 5 |      1 | UpMod    |        | 2009-06-28 00:00:00 |
 7 |      1 | UpMod    |        | 2009-06-28 00:00:00 |
 8 |      1 | Favorite |  84671 | 2009-06-28 00:00:00 |
.
.
.

The timestamps are all at midnight of that day, and the data is not available until about 7 days have passed. For the votes on this question, replace WHERE PostId = 1 with WHERE PostId = 341195.


text:
Q: Django: Display related model as radio button choices I have the following models defined:
class Test(models.Model):
    name = models.CharField(max_length=50)
    description = models.CharField(max_length=200)

class Page(models.Model):
    test = models.ForeignKey(Test, related_name='pages')

class Question(models.Model):
    name = models.CharField(max_length=100)
    page = models.ForeignKey(Page, related_name='questions')

class Answer(models.Model):
    name = models.CharField(max_length=100)
    score = models.IntegerField()
    question = models.ForeignKey(Question, related_name='answers')

I need to make a form using ModelForm that should display for each page of a specified test a list of question together with their answers, rendered as radio buttons.
How should I approach this? In my view, I have the test_id and the page_id of the current page within the test. Shall I make a TestForm, or PageForm or even an AnswerForm? What is the approach that matches what I need in the most Django-ish mode?


text:
Q: Problem with SendMessage I am developing an application using C# having similar functionality of copy,paste as in Windows.
I have added menu items and linked with respective applications.
Please look at the following image for getting more idea.
Items added to shell menu http://softwaregenius.net/myimages/menu.jpg
Like we select multiple items in windows explorer, you need to select multiple files and/or folders and then select OS Util->FastCopy. A form is opened as shown below
Form shown on FastCopy http://softwaregenius.net/myimages/fastcopy1.jpg
The application is working perfectly. The major problem here is that after selecting the files all these files are opening up within there respective softwares. That is if i selected word document then the filename is added to FastCopy form but the is also opening up within Word also.
When i investigate i found that this problem is due to SendMessage. I have to use PostMessage instead of SendMessage. But when i do so the application is not working.
Below is my Main function coding in C# 2005
static class Program
{
    static Mutex mutex = new Mutex(true, "{8F6F0AC4-B9A1-45fd-A8CF-72F04E6BDE92}");
    [STAThread]
    static void Main(string[] args)
    {
        string fileName = "";
        if (args.Length > 0)
        {
            fileName = args[0];
        }
        if (mutex.WaitOne(TimeSpan.Zero, true))
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            frmFastCopy frm = new frmFastCopy();
            frm.AddItemToList(fileName);
            Application.Run(frm);

        }
        else
        {
            //The following message is sent just to show up the form
            NativeMethods.PostMessage(
                    (IntPtr)NativeMethods.HWND_BROADCAST,
                    NativeMethods.WM_SHOWME,
                    IntPtr.Zero,
                    IntPtr.Zero);

            //Send the filename
            SendFileName(fileName);
        }
    }

    static void SendFileName(string s)
    {
        Win32.CopyDataStruct cds = new Win32.CopyDataStruct();

        cds.cbData = (s.Length + 1) * 2;
        cds.lpData = Win32.LocalAlloc(0x40, cds.cbData);
        Marshal.Copy(s.ToCharArray(), 0, cds.lpData, s.Length);
        cds.dwData = (IntPtr)1;
        Win32.SendMessage((IntPtr)NativeMethods.HWND_BROADCAST, Win32.WM_COPYDATA, IntPtr.Zero, ref cds);
        //NativeMethods.PostMessage((IntPtr)NativeMethods.HWND_BROADCAST, Win32.WM_COPYDATA, cds.lpData, IntPtr.Zero);
    }
}

}

Below is the copy for WndProc and other code from within the Form
public partial class frmFastCopy : Form
    {
        delegate void AddItemToListDelegate(string itm);
    public frmFastCopy()
    {
        InitializeComponent();
    }

    public void AddItemToList(string itm)
    {
        if (lvFilesAndFolders.InvokeRequired)
        {
            AddItemToListDelegate m = new AddItemToListDelegate(AddItemToList);
            this.Invoke(m, new object[] { itm });
        }
        else
        {
            lvFilesAndFolders.Items.Add(itm);
        }
    }
    protected override void WndProc(ref Message m)
    {
        if (m.Msg==NativeMethods.WM_SHOWME)
        {
                ShowMe();
        }
        if (m.Msg==Win32.WM_COPYDATA)
        {
                //string s = Marshal.PtrToStringUni(m.LParam);
                MessageBox.Show("Got message");

                Win32.CopyDataStruct st = (Win32.CopyDataStruct)Marshal.PtrToStructure(m.LParam, typeof(Win32.CopyDataStruct));
                string strData = Marshal.PtrToStringUni(st.lpData);
                AddItemToList(strData);
        }
        base.WndProc(ref m);
    }
    private void ShowMe()
    {
        this.Show();
        if (WindowState == FormWindowState.Minimized)
        {
            WindowState = FormWindowState.Normal;
        }
        // get our current "TopMost" value (ours will always be false though)
        bool top = TopMost;
        // make our form jump to the top of everything
        TopMost = true;
        // set it back to whatever it was
        TopMost = top;
    }

Here is the NativeCode class
internal class NativeMethods
{
    public const int HWND_BROADCAST = 0xffff;
    public static readonly int WM_SHOWME = RegisterWindowMessage("WM_SHOWME");
    [DllImport("user32")]
    public static extern bool PostMessage(IntPtr hwnd, int msg, IntPtr wparam, IntPtr lparam);
    [DllImport("user32")]
    public static extern int RegisterWindowMessage(string message);

}

I know you guys are genius. Could someone tell me where should i make changes to that the selected files should be opened or rather how i should use postmessage.
Thanks for sharing your valuable time.
Regards
Irfan

A: Please look at my comment (I wonder why you don't use the Clipboard class here). But ignoring that: Why do you broadcast the message?
Can you locate your application (by name, window class, whatever) and only send the message to your own application?

To elaborate on the message handling:
You say regarding HWND_BROADCAST in the comments below:

Thats nothing but the global handle to
  my application.

No, it's not. It is a special value that tells Windows "this message is for all applications". You are sending a WM_SHOWME to all applications. Which is why I asked why you would want to do that?
Please see this post on the old new things blog regarding message broadcasts.


text:
Q: Paging not working in GridView when ajax control is removed I have a grid view in my aspx page. I have enabled paging also.
Paging is working fine when an ajax control is in page, but when I removed the ajax control paging is not working anymore. ie, on clicking page number 2 grid becomes empty.
What could be the possible reason? Please suggest a solution.
code
<asp:GridView ID="SitesGrid" runat="server" AllowPaging="True" AllowSorting="True" DataSourceID="SitesDataMgr" AutoGenerateColumns="False" DataKeyNames="ID" CellPadding="3"   CellSpacing="3" OnRowDataBound="viewSite_RowDataBound" class="tbl_blck gridtable clearfix" PageSize="4" EmptyDataText="No rows found">
    <Columns>
         <asp:TemplateField Visible="false">
            <ItemTemplate>
                <asp:Label ID="clientID" runat="server" Text='<%# Bind("ID") %>'></asp:Label>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Name"  HeaderStyle-ForeColor="White" SortExpression="ClientName">
            <ItemTemplate>
                <asp:Label ID="clientLabel" runat="server" Text='<%# Bind("ClientName") %>'></asp:Label>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Status" HeaderStyle-ForeColor="White" SortExpression="SiteStatus">
            <ItemTemplate>
                <asp:Label ID="siteLabel" runat="server" Text='<%# Bind("SiteStatus") %>'></asp:Label>
            </ItemTemplate>
        </asp:TemplateField>
         <asp:TemplateField HeaderText="Details" HeaderStyle-ForeColor="White" >
         <ItemTemplate>
                 <asp:LinkButton ID="viewSite" runat="server" OnClick="viewSite_click"  CausesValidation="False" CommandName="Edit"
                    Text="View"></asp:LinkButton>
                    </ItemTemplate>
        </asp:TemplateField>
    </Columns>
</asp:GridView>
<asp:ObjectDataSource ID="SitesDataMgr" runat="server" ConvertNullToDBNull="True" OldValuesParameterFormatString="{0}" SelectMethod="GetAllSitesByUser" FilterExpression="ClientName LIKE '%{0}%'"  TypeName="Creation.DataMgr">
    <SelectParameters>
        <asp:SessionParameter  Name="createdUserID" Type="String" SessionField="strUserName" />
    </SelectParameters>
    <FilterParameters>
        <asp:ControlParameter Name="ClientName" ControlID="txtSearch" PropertyName="Text" />
    </FilterParameters>
</asp:ObjectDataSource>

A: It looks like you have not added the SelectCount method to your ObjectDataSource.
This is required for the ObjectDatasource to correctly page your data.
Your select method needs the int parameters maximumRows and startRowIndex  This is the default parameter names required for paging. if you do have them in. Please use them to filter your data.


text:
Q: JavaFX How can I get the coordinates of an object in 3D scene For example - there is such a code
    //create new cylinder
    Cylinder cylinder = new Cylinder(2, 6);
    ...
    //somewhere add transform
    cylinder.getTransforms().add(new Translate(0, -5, 0));
    ...
    //and somewhere i call
    cylinder.setTranslateX(3);
    cylinder.setTranslateY(-2);

as a result, the cylinder moves and its coordinates on the scene {3, -7, 0}
for get actual coords i try something like that:
    double coordY = 0;

    for(Transform t : cylinder.getTransforms() ){
        coordY += t.getTy();
    }

    coordY += cylinder.getTranslateY();

it work, but this is clearly not the most rational way...
UPDATE 1
As rightly remarked fabian
The method does not take into account if a rotation was made relative to a point other than the origin
for examle:
        Rotate rotate = new Rotate();
        rotate.setAngle(60);

        rotate.setPivotX(2);
        rotate.setPivotY(1);
        rotate.setPivotZ(3);

        cylinder.getTransforms().add(rotate);

in this case, the result will be incorrect

How can I get the real coordinates{x,y,z} of this cylinder or any other object like Shape3d or MeshView
Thanks!

A: Query the Node#getBoundsInParent property:

The rectangular bounds of this Node which include its transforms. boundsInParent is calculated by taking the local bounds (defined by boundsInLocal) and applying the transform created by setting the following additional variables

*

*transforms ObservableList

*scaleX, scaleY, scaleZ

*rotate

*layoutX, layoutY

*translateX, translateY, translateZ
The resulting bounds will be conceptually in the coordinate space of the Node's parent, however the node need not have a parent to calculate these bounds.
Note that this method does not take the node's visibility into account; the computation is based on the geometry of this Node only.
This property will always have a non-null value.
Note that boundsInParent is automatically recomputed whenever the geometry of a node changes, or when any of the following the change: transforms ObservableList, any of the translate, layout or scale variables, or the rotate variable. For this reason, it is an error to bind any of these values in a node to an expression that depends upon this variable. For example, the x or y variables of a shape, or translateX, translateY should never be bound to boundsInParent for the purpose of positioning the node.

You'll get a Bounds object which has methods for querying the location and dimensions of the node, including for three dimensional objects. As stated in the above documentation, the bounds-in-parent takes into account the applied transformations (it's the bounds-in-local + transformations). Of course, the values are all within the context of the node's parent. If you need the coordinates in a different space then you need to convert them—the Node class provides many methods for this purpose.


text:
Q: How to pass the id name to the jQuery validation and send to the controller? I have two anchor tag and on click, I have to get the id value.
so I tried below code and I am getting the id. Now after getting the id, I have to display the popup. so popup is also displaying.

  Sample one
  Sample two

    $(".buttonSet a").click(function() {
        alert(this.id);//getting the id name, just for an example
        $('#Popup').show();
    });

Popup code is

    <form action="" method="post" name="form1" id="form1" autocomplete="off">

        Name
        <input type="text" name="name" class="form-control" id="name">

        Email
        <input type="email" name="email" class="form-control" id="email">

        Mobile Number
        <input type="text" name="mobileno" class="form-control" id="mobileno">

        <input type="submit" name="send" class="" value="Submit">

    </form>

Now I am confused how do I pass the id value to the jQuery validation and how to submit button will work. I mean I have one form and two buttons. The Same form will open on button click.  I have to get the information that which button is clicked and pass that button id to the jQuery validation and send to the form. Because I have to store the name of the button which is clicked.
jQuery validation
$("#form1").validate({
  rules: {
    name: {
      required: true,
      minlength: 3,
      lettersonly: true
    },
    email: {
      required: true,
      email: true
    },
    mobileno: {
      required: true,
      minlength: 10,
      maxlength: 10,
      number: true
    }
  },
  submitHandler: function(form) {
    $.ajax({
      url: "//my url",
      type: "POST",
      data: $('#form1').serialize(),
      success: function(data) {
        $("#Popup").hide();
        $("#popup_success").show();
      },
    }); // AJAX Get Jquery statment
  }
});

A: after getting the id you must add it to the form as a hidden input as follow
 $(".buttonSet a").click(function() {
        alert(this.id);//getting the id name, just for an example
        var id=$(this.id);
        $('#Popup #id').val(id);
        $('#Popup').show();
    });

for that you have to add a input element to the form

    <form action="" method="post" name="form1" id="form1" autocomplete="off">
     <input type="number" name="id" class="form-control" id="id">

        Name
        <input type="text" name="name" class="form-control" id="name">

        Email
        <input type="email" name="email" class="form-control" id="email">

        Mobile Number
        <input type="text" name="mobileno" class="form-control" id="mobileno">

        <input type="submit" name="send" class="" value="Submit">

    </form>

now it is time to add following rule your validation script
id: {
      required: true
    }


text:
Q: Upgrade cert-manager to v1.8.2 I removing other versions from cert-manager. After that i install the new version with helm  using.
Installation works fine.
but when i use the command:
$ kubectl get orders,challenges,clusterissuers

Error from server: request to convert CR from an invalid group/version: acme.cert-manager.io/v1alpha2
Error from server: request to convert CR from an invalid group/version: acme.cert-manager.io/v1alpha2
Error from server: request to convert CR from an invalid group/version: cert-manager.io/v1alpha2

The CRDs:
Name:         orders.acme.cert-manager.io
Namespace:
Labels:       app=cert-manager
              app.kubernetes.io/instance=cert-manager
              app.kubernetes.io/managed-by=Helm
              app.kubernetes.io/name=cert-manager
              app.kubernetes.io/version=v1.8.2
              helm.sh/chart=cert-manager-v1.8.2
Annotations:  cert-manager.io/inject-ca-from-secret: cert-manager/cert-manager-webhook-ca
              meta.helm.sh/release-name: cert-manager
              meta.helm.sh/release-namespace: cert-manager
API Version:  apiextensions.k8s.io/v1
Kind:         CustomResourceDefinition
....

    Last Transition Time:  2022-06-24T15:25:23Z
    Message:               no conflicts found
    Reason:                NoConflicts
    Status:                True
    Type:                  NamesAccepted
    Last Transition Time:  2022-06-24T15:25:23Z
    Message:               the initial names have been accepted
    Reason:                InitialNamesAccepted
    Status:                True
    Type:                  Established
  Stored Versions:
    v1

i dont found the CR where still using cert-manager.io/v1alpha2 and acme.cert-manager.io/v1alpha2

A: First of all, suggest to backup all your objects (certs, orders, issuer, clusterissuer, etc. with velero for example) !
Cert-manger documentation suggests using the cert-manager cli as:
cmctl upgrade migrate-api-version

You may need --skip-stored-version-check if you already tried to fix CRD api manually (like described in this issue):
cmctl upgrade migrate-api-version --skip-stored-version-check

Finally, if it's failing with the same message, install the 1.6.3 (if CRD is manually installed, upgrade CRD with 1.6.3) and repeat the command cmctl upgrade migrate-api-version. At last, you can upgrade minor version one by one (1.7, 1.8, etc.) as recommended


text:
Q: How to display Login wise data in whole application? I make database for signup and login, i authenticate when user is enter email and password in signup form then and then he/she login.
Now i want to display userwise data in application means eg. user A and user B, if user A login and enter the data in database then only user A is show his/her entered data not user B. Same way user B is enter data in database then and then only user B show his/her entered data.
I have signup,login,account,expense,income tables. In short i want to display user wise data in whole application.


text:
Q: What if base.OnCreateView(.....) is not called when overridden? Here is the code that inherits from fragment.
I tried it without base.OnCreateView (inflater, container, savedInstanceState); and it worked just fine. Is it necessary to call it?
It looks like it calls the Abstract Class and supposedly registers View but do we have to do it ?
OnCreateView is overridden and here it is
public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
    {
        base.OnCreateView (inflater, container, savedInstanceState);

        View oView = inflater.Inflate (Resource.Layout.EntityDetailsDialogFragment, container, false);

        return oView;
    }

A: Android is open-source, so you can check for yourself.  This is the source of Fragment.onCreateView():
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup , @Nullable Bundle savedInstanceState) {
    return null;
}

Calling super.onCreateView() won't do anything since there's no implementation.  Also, this method returns a value unlike other lifecycle methods like onCreate(), so to do something meaningful you would have to do View blah = super.onCreateView() since you are otherwise throwing away the return value.


text:
Q: Ruby programing Quiz Please help me in solving ruby program
Let us Suppose you have three strings say s1, s2 and s3.Now coding F(s1, s2, s3) should be shortest continuous subsequence of s1 such that it has all the chars of s2 and none of s3.
s2 has uniq chars
For example: s1 = "peeeeloisagood", s2 = "le", s3 = "z". Ans = el

A: This should do it. (Don't be fooled by the fact that I posted before @AFaderDarkly, who has a similar answer. My original answer had a flaw.  When I noticed it, I deleted my answer and set about the repair. Darkly posted before I completed the fix, but I didn't know that until I undeleted my amended answer.)
Code
def find_it(s1,s2,s3)
  arr = s1.chars
  good = s2.chars
  bad = s3.chars
  (good.size..arr.size).each { |n| arr.each_cons(n) { |c|
    return c.join if (good-c).empty? && (c-bad) == c } }
  nil
end

Examples
find_it("peeeeloisagood", "le", "z") #=> "el"
find_it("abcdezfherdzn", "def", "z") #=> "fherd"

Explanation
Let s1, s2 and s3 be as in the second example above:
s1 = "abcdezfherdzn"
s2 = "def"
s3 = "z"

We will first look at substrings of s1 of length 2 (the size of s2). If we find one that contains all the letters of s2, we are finished (as it could not contain any letters of s3). If we do not find a match we look at substrings of s1 of length 3. We are finished if we find a substring that contains all the letters of s2 and none of s3, and so on. If no substring of s1 of any length contains all the letters of s2 and none of the letters of s3, nil is returned.
arr = s1.chars
  #=> ["a", "b", "c", "d", "e", "z", "f", "h", "e", "r", "d", "z", "n"]
good = s2.chars
  #=> ["d", "e", "f"]
bad = s3.chars
  #=> ["z"]

enum1 = (good.size..arr.size).each
  #=>   (3..13).each
  #=>   #<Enumerator: 3..13:each>

We can convert an enumerator to an array to what it will be passing into its block:
enum1.to_a
  #=> [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]

This enumerator first passes 3 into its block and assigns it to the block variable:
n = 3

enum2 = arr.each_cons(n)
  #=>   #<Enumerator: ["a", "b", "c", "d", "e", "z", "f", "h",
  #                    "e", "r", "d", "z", "n"]:each_cons(3)>
enum2.to_a
  #=> [["a", "b", "c"], ["b", "c", "d"], ["c", "d", "e"], ["d", "e", "z"],
  #    ["e", "z", "f"], ["z", "f", "h"], ["f", "h", "e"], ["h", "e", "r"],
  #    ["e", "r", "d"], ["r", "d", "z"], ["d", "z", "n"]]

It first passes ["a", "b", "c"] into the block and assigns it to the block variable:
c = ["a", "b", "c"]

and executes
return c.join if (good-c).empty? && (c-bad) == c
  #=> return "abc" if (["d", "e", "f"]-["a", "b", "c"]).empty? &&
  #                   (["a", "b", "c"] - ["z"]) == ["a", "b", "c"]
  #=> return "abc" if (["d", "e", "f"]).empty? &&
                      (["a", "b", "c"]) == ["a", "b", "c"]
  #=> return "abc" if false and true
  #=> false

This continues until the array ["d", "e", "z", "f"] comes up, at which point we obtain:
return c.join if (good-c).empty? && (c-bad) == c
  #=> return "dezf" if (["d", "e", "f"]-["d", "e", "z", "f"]).empty? &&
                       (["d", "e", "z", "f"]-["z"]) == ["d", "e", "z", "f"]
  #=> return "dezf" if [].empty? && ["d", "e", "f"] == ["d", "e", "z", "f"]
  #=> return "dezf" if true && false
  #=> false

so we reject that substring as well, this time because of the presence of z.
When we get to
c = ["f", "h", "e", "r", "d"]

we obtain:
 return c.join if (good-c).empty? && (c-bad) == c
   #=> return "fherd" if (["d", "e", "f"]-["f", "h", "e", "r", "d"]).empty? &&
                (["f", "h", "e", "r", "d"]-["z"]) == ["f", "h", "e", "r", "d"]
   #=> return "fherd" if [].empty? &&
                 ["f", "h", "e", "r", "d"] == ["f", "h", "e", "r", "d"]
   #=>return "fherd" if true && true

and therefore return "fherd".

A: search_string = s1.gsub(/^[^#{s2}]+|[^#{s2}]+$/, '')

The shortest string containing all of s2 will always start and end with a character from s2, so this reduces the search space.
included = s2.chars.to_a.uniq
excluded = s3.chars.to_a.uniq
input = search_string.chars.to_a

This just makes things easier to deal with - all are converted to arrays. We run uniq over the included and excluded arrays to catch edge cases and optimise the algorithm.
Now we can scan through the string, brute-force style:
(included.length..search_string.length).each do |l|

The shortest string can only be as short as the set of included characters, so we set up a search window moving through the string, starting at this length and moving up to the full length of the string. l is the window length.
    input.each_cons(l) do |s|

Move the window through the input array.
      if (included - s).length == 0 && excluded == excluded - s

Check if the string matches by subtracting arrays.
      puts s.join

This will show all matches, shortest first.
    end
  end
end

Putting it all together:
def find_string(s1, s2, s3)
  search_string = s1.gsub(/^[^#{s2}]+|[^#{s2}]+$/, '')
  included = s2.chars.to_a.uniq
  excluded = s3.chars.to_a.uniq
  input = search_string.chars.to_a

  (included.length..search_string.length).each do |l|
    input.each_cons(l) do |s|
      if (included - s).length == 0 && excluded == excluded - s
        return s.join
      end
    end
  end
  ""
end

find_string  "pleeeesoisalzesgood", "les", "z"
# => "leeees"

find_string  "pleeeesoisalesgood", "les", "z"
# => "les"

find_string  "pleeeesoisalesgood", "lees", "z" # Without the .uniq on included this would return 'sale'
# => "les"

find_string  "peeeeloisagood", "le", "z"
# => "el"


text:
Q: Checking homotopy of curves Consider two curves defined as $f:S^1 \rightarrow \mathbb{R}^2-\left\lbrace x_0\right\rbrace$ and $g:S^1 \rightarrow \mathbb{R}^2-\left\lbrace x_0\right\rbrace$. You can see them in the picture below.

I need to answer the following questions:

*

*Are they homotopic?

*Keeping $x_0$ fixed for f, determine all possible regions L of $\mathbb{R}^2 - g(S^1)$ such that, taking $x_0\in L$, f and g are homotopic.

For the first one, I noticed their winding numbers, with respect to $x_0$, are different, so, $f$ and $g$ are not homotopic.
I'm not sure how to proceed with the second question. I have the feeling I may have not been given enough information in class to answer that. Homotopy was defined very intuitevely: two curves are homotopic if they can be deformed into each other continuously.
I searched for a better definition to see if it helped (it didn't): $f_1:X\rightarrow Y$ and $f_2: X \rightarrow Y$ are homotopic if there exists a continous map $F:X\times [0,1] \rightarrow Y$ such that $F(x,0)=f_0(x)$ and $F(x,1)=f_1(x)$.
Just a nudge in the right direction would be greatly appreciated.

A: The wording of question 2 is very poor. My best guess is that they are asking you consider each of the six different regions $L$ of $\mathbb R^2 - g(S^1)$, and to imagine that $x_0$ is placed, in turn, in each of those regions $L$, and then to reconsider question 1 for each of those six placements.
Assuming this interpretation is correct, you can certainly make progress on this question. You've already computed the winding number of $f$ around $x_0$. Next you can compute the six winding numbers of $g$, around points in the six different regions $L$. Once you've done those computations, perhaps you can make further progress.


text:
Q: Иконка svg в pwa приложении "icons": [{"src": "/favicon.svg",
           "sizes": "any",
           "type": "image/svg+xml"}]

Не понимаю, в яндекс браузере(на боковой понеле) иконка отображается таковой какой она есть. А на панеле задач или на рабочем столе отображается темный фон и на нем первая буква домена...
Вопрос в том, как сделать отвязку от фиксированных размеров при помощи иконки svg. И сделать так, чтобы в любых случаях отображалась иконка svg которая бы подстраивалась под необходимый размер в тех или иных случаях?


text:
Q: Google Play Services aar download for above 11.0.4 From where to download the google-play-services aar files for version 11.6.0 OR above 11.0.4
I know just by adding the dependency in apps build.gradle adds the library in it.
compile 'com.google.android.gms:play-services-location:11.6.0'
compile 'com.google.android.gms:play-services-ads:11.6.0'

This is fair in case of Android Studio.
But as a Unity Developer, I have downloaded the Google Mobile Ads Unity Plugin which after import gives the play services ads, lite, basement, gass of version 11.6.0
Now we have some location dependency in our project. So I have downloaded the Android SDK and its stored in this path.
/Users/USERNAME/Library/Android/sdk
After navigating to /Users/USERNAME/Library/Android/sdk/extras/google/m2repository/com/google/android/gms,
I got the latest play services library of version 11.0.4 only and if I tried to create a Android Studio project by adding GPS dependency of 11.6.0, its getting added properly.
So my question is,
where google play services library of version 11.6.0 is downloaded. So that I can go to that location and get all the aar file needed for my Unity Project

A: Following are the details from Android developer documentation:
Programmatic access:
For programmatic access to Google's Maven artifacts, you can get an XML list of artifact groups from maven.google.com/master-index.xml (link) which gives the group path
Then, for any group, you can view its library names and versions at:
maven.google.com/group_path/group-index.xml
For example, libraries in the android.arch.lifecycle group are listed at maven.google.com/android/arch/lifecycle/group-index.xml (link).
You can also download the POM and JAR files at:
maven.google.com/group_path/library/version/library-version.ext
For example:
maven.google.com/android/arch/lifecycle/compiler/1.0.0/compiler-1.0.0.pom. (link)
For more details please refer:
https://developer.android.com/studio/build/dependencies.html#gmaven-access
For complete list of Google Play Services libraries, refer below xml:
https://dl.google.com/dl/android/maven2/com/google/android/gms/group-index.xml
Eg: To download Google Play Services Location library AAR file, use the following link:
https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-location/11.6.0/play-services-location-11.6.0.aar
You can replace group name, version, file, extension to download other files.
Note: Do check the pom file for each module, it may have dependencies on other Google Play Services libraries. If so, you will need to download all dependent files.
[Update]:
You can use Google's Unity Jar Resolver for this:
https://github.com/googlesamples/unity-jar-resolver

A: Check the links below:
play-services-ads-11.6.0
play-services-location-11.6.0

A: You can find and download all versions of the aar libraries at the MVN repository.
Also:
I came across a github project for Titanium/Appcelerator/AxWay. It has a script that downloads the latest play-services libraries.
The project is at: https://github.com/appcelerator-modules/ti.playservices
The relevant script is: updater/index.js
Hopefully the script will not go away because it is very useful.


text:
Q: change the template of the message that arrives via e-mail I ask about the  messages that arrive via email
I  if I want to change the template of the message that arrives via e-mail
,Where do I change the template from server or code?

A: On the sender side, you may set a template or set up emails in the format needed for sending out.

A: From code.
You can add a component to your app to build template easely : https://em.wlocalhost.org/?utm_source=category_description&utm_medium=forum


text:
Q: dafa of flink`s source operator from kafka is nonuniform There is a topic of kafka which has 9 partitions. My flink job need to consume the topic to do ETL and sink data to another topic. So my source operator of flink job parallelism is configured 9. The flink cluster has 3 task manager, and every task manager have 3 source operator. But dafa of flink`s source operator from kafka  is nonuniform.
the source operator code:
env.addSource(new FlinkKafkaConsumer09<byte[]>(topic, new DeserializationSchema<byte[]>() {
    @Override
    public byte[] deserialize(byte[] bytes) throws IOException {
        return bytes;
    }

    @Override
    public boolean isEndOfStream(byte[] bytes) {
        return false;
    }

    @Override
    public TypeInformation<byte[]> getProducedType() {
        return PrimitiveArrayTypeInfo.BYTE_PRIMITIVE_ARRAY_TYPE_INFO;
    }
}, props)).setParallelism(9);

I attach the monitor screenshot below:
enter image description here
what may I do to enhance this defect?


text:
Q: ASP.Net Razor Web Application Connect to LocalDB issues; Database does not exist in this context I'm programming a Razor website from the Ground up using VS 2013.  I started with a blank Web Application Project and slowly added files and functionality to suit what I need.  Basically its just jquery ui, css, and a few basic test webpages.
Keep in mind, I have added a reference to: WebMatrix.Data.dll
Now when I try to connect to my database, I use the following code:
@{
Layout = @"~\_SiteLayout.cshtml";
Page.Title = "Main Tabs";
var DB = Database.Open("NASDB");
var QString = "SELECT * from Tabpage";
}

But this code doesn't work.  It says "Database does not exist in this context."
But when I use this code everything works:
@{
Layout = @"~\_SiteLayout.cshtml";
Page.Title = "Main Tabs";
var DB = WebMatrix.Data.Database.Open("NASDB");
var QString = "SELECT * from Tabpage";
}

This is functional, but not easily readable.  Is there any way to fix this?  So just Database will work.  I also have to have the "Copy Local" property of the "WebMatrix.Data" reference set to true.  Is there any way to avoid this as well?

A: At The top of the page:
@using Webmatrix.Data
or you can add a reference in the webconfig file that exists in your views folder.


text:
Q: Read binary data from multiple files into an archive file and then extract them I want to merge multiple files to one archive. and I used python 2.7 to do this. Here is my code:
the code to read binary data from every file(some is txt with utf8 and some is png or jpeg):
       for we in self.entries:
        with open(we['fullname'], 'rb') as f:
            data = f.read()
            if not data:
                print("mpq flush error. the file no data or error:"+we['fullname'])
                break

            self.file.write(data)

this is ok, and all the binary data is archived into one file. and now I want to extract the archive, I do this like :
   def read_file(self, filename):

    if self._writable():
        print("curr mode is write, cannot read")
        return None

    entry = self._get_entry(filename)

    if not entry:
        print("the file is not in curr archive:"+filename)
        return None

    self.file.seek(entry.file_offset)
    data = self.file.read(entry.file_size)

    if not data:
        print("file read error:"+filename)
        return None

    return data

def extract_file(self, filename):

    print("extract_file:"+filename)

    data = self.read_file(filename)
    if not data:
        return

    targetFile = self._fullname(filename)

    self._makepath(targetFile)

    with open(targetFile, 'wb') as f:
        f.write(data or b'')

def extract_all(self):

    for entry in self.entries:
        self.extract_file(entry.file_name)

every file extract success, but all data in every file extract is binary data,  I want them to be what they are before.
I tried encode and decode, but not help~
anyone can help me ? thanks very much!!!


text:
Q: How can I embed a simple mapbox url using the leaflet directive? I'm new with Mapbox and Leaflet and after checking out the leaflet-directive and Mapbox documentation I can get example maps to work but now when I integrate the two and use the URL I must work with, http://a.tiles.mapbox.com/v3/myMap.map-12341234.html for example.
This should be simple enough however I'm having an issue where the map is white.
my HTML looks like
<leaflet tiles="tiles"defaults="defaults"></leaflet>

and the js
angular.extend($scope, {
    // tiles: 'http://a.tiles.mapbox.com/v3/myMap.map-12341234.html',
    tiles: 'myMap.map-12341234',
    defaults: {
      scrollWheelZoom: false
    }
  });
})

how can I embed a url like my http://a.tiles.mapbox.com/v3/myMap.map-12341234.html

A: I'm not sure I understand you correctly, Are you just trying to use leaflet with your custom Mapbox style? If that is the case, heres a example:
<!DOCTYPE html>

<meta charset=utf-8 />
<title>Plain Leaflet API</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />

<link href='https://api.mapbox.com/mapbox.js/v2.4.0/mapbox.css' rel='stylesheet' />

Hope this helps you out!


text:
Q: Numerically stable evaluation of $x\ln(x)$ I have numerical difficulties with the function $$x\ln(x/x_0)-x+x_0$$ with $x\ge0$ and $x_0>0$ since it bears the evil evaluation of $\ln(x)$ for $x\rightarrow0$ which is the domain of interest for my numerical application. I am thus looking for a approximate function that :

*

*is numerically stable for $x$ in the range of (at least) $[0,x_{max}]$, with  $x_{max}$ a physical property that is real and strictly positive, say between 5 and 20, usually 10.

*has controllable error (for instance by systematically improving the approximation by increasing some order, like in a series expansion)

*must be derivable.

*must not be indetermined for $x=0$.

*must contain only one minima, like the original function.

If that can be of any help, $x_0>0$ is usually of the order of 0.033.
I tested Series expansions and Padé approximants but none fill my requirements.
I think the $-x+x_0$ part is of no-importance in all of this.
I would really love some help. Thanks!

A: Other than for $0$ itself, the expression seems well behaved as $ x\rightarrow 0$. Based on the information in the question, $\epsilon \lt x_0 \lt 1$, so there is no intermediate underflow in the computation of $x/x_0$. There is also no overflow in either the division or the product since $x \le x_{max} \approx 20$. Since, as $x \rightarrow 0$, the expression $x \ln(x/x_0) -x + x_0$ approaches $x_0$, zero could easily be handled as a special case.
However, there are numerical issues for $x$ close to $x_0$. In that case, there is subtractive cancellation, as $x \ln(x/x_0) -x + x_0 = O((x-x_0)^2)$. In addition, the accuracy of $\ln(x/x_0)$ suffers as $x \rightarrow x_0$ and thus $x/x_0 \rightarrow 1$. These issues can be substantially mitigated (but not completely eliminated) as follows.
According to the Sterbenz lemma, when binary floating-point arithmetic is used, $x_0 - x$ is exact when $\frac{1}{2}x_0 \lt x \lt 2x_0$. It is therefore advantageous to compute the logarithmic term using the function log1p() for $x$ in that interval, where log1p(x) computes $\ln(1+x)$. So instead of log (x / x0) we code log1p ((x0 - x) / -x0).
Since $x_0 - x$ is exact, with trailing zero bits, we would want to compute $x \ln(x/x_0)$ to better than working precision, thus retaining additional valid bits even though the leading bits cancel during effective subtraction. An easy way of achieving this is through the use of the fused multiply-add (FMA) operation. This operation is exposed in C/C++ as the function fma(), where fma(a,b,c) computes $ab+c$ with only a single rounding at the end.
Putting the various pieces together, we arrive at the following example implementation for C/C++. Implementations for other environments should be easy to derive from this, especially if they offer ready access to fma() and log1p() functionality.
/* computes x*log(x/x0)-x+x0 for x >= 0, eps < x0 < 1 */

double func (double x, double x0)
{
    double y;
    if (x == 0) { // zero
        y = x0;
    } else if ((x <= 0.5 * x0) || (x >= 2.0 * x0)) { // x not close to x0
        y = fma (x, log (x / x0), x0 - x);
    } else {
        y = fma (x, log1p ((x0 - x) / -x0), x0 - x); // x close to x0
    }
    return y;
}

To achieve (close to) full machine accuracy, one suitable, if somewhat slow approach is the use of a Taylor series expansion when $x$ is very close to $x_0$. Using the command taylor series x*ln(x/k)-x+k at x=k at Wolfram Alpha gives us the following expansion around $x_0$:
$${x\log\frac{x}{x_0}-x+x_0}=\sum_{n=1}^{\infty}{\frac{(x_0-x)^{(n+1)}}{n(n+1)x_0}}; \left|x_0-x\right|\lt x_0$$
By adjusting the number of terms of the expansion used in the computation one can achieve varying levels of accuracy. In the code below I maximized accuracy by adding terms until the size of the last term falls below machine round-off. When using $\epsilon \lt x_0 \lt 1$ and $0 \le x \le 20$, the maximum errors observed with IEEE-754 double-precision computation with hundreds of millions of test vectors are on the order of 8 ulps.
#include <float.h>
#include <math.h>

double func (double x, double x0)
{
    double y;
    if (x == 0) { // x is zero
        y = x0;
    } else if ((x <= 0.5 * x0) || (x >= 2.0 * x0)) { // x not close to x0
        y = fma (x, log (x / x0), x0 - x);
    } else if ((x <= 0.7 * x0) || (x >= 1.4 * x0)) { // x quite close to x0
        y = fma (x, log1p ((x0 - x) / -x0), x0 - x);
    } else { // x very close to x0. Use series expansion around x0
        // sum_{n=1}^{inf} (x0-x)**(n+1) / (x0*n*(n+1)); |x0-x| < x0
        const double eps = DBL_EPSILON; // 2**(-52)
        const double z = x0 - x;
        const double f = z / x0;
        double t, q = z, n = 1;
        y = 0;
        do {
            q = q * f;
            t = q / (n * (n + 1));
            y = y + t;
            n = n + 1;
        } while (fabs (t) > (eps * fabs (y)));
    }
    return y;
}

A: If $x > 0$
and
$b^{-n}
\le x
< b^{-n+1}
$,
where $b$ can be any of
$e, 2, 10,$
or otherwise
depending on your
inclination,
since
$x = b^{-n}c$
where
$1 \le c < b$,
we have
$\ln(x)
=-n\ln(b)+\ln(c)
$.


text:
Q: equivariant map $\mathbb{CP}^1 \to \mathbb{CP}^2:$ where does it send the boundary Start from a map $\mathbb{CP}^1 \ni (u:v) \mapsto (x:y:z) \in \mathbb{CP}^2$ given by
$$ x = au^2, \quad y = av^2, \quad z = uv,$$
where $a \in \mathbb{R}$ is a parameter.
The image of the map is the conic
$$ xy - a^2z^2=0,$$
which is real under $(x:y:z) \mapsto (\overline{y}:\overline{x}:\overline{z}).$
To make the map equivariant, we choose to act on $\mathbb{CP}^1$ with the involution
$$ \Omega:(u:v) \mapsto (\overline{v}:\overline{u}).$$
The statement I want to prove or disprove is that we obtain a map from the disk to $\mathbb{CP}^2$ (and this is OK) with boundary on $\mathbb{RP}^2.$

I'm not fully convinced that the boundary is on $\mathbb{RP}^2:$ since the equation reduces by one the number of complex variables, and then reality is imposed, I would expect the boundary to be mapped to $\mathbb{RP}^1.$
In other terms, calling $C=\left\{ (x:y:z) \in \mathbb{CP}^2 \left| xy = a^2z^2 \right. \right\}$ the boundary should go to $L,$ where $L=\left\{ x \in C \left| \Omega(x)=x \right.\right\}$ is topologically $\mathbb{RP}^1.$


text:
Q: Custom View with XML Layout in Android I have a ListAdapter with a lot of different layouts for the rows. To have a clean code I want to outsource the layouts for the rows from the getView() of the adapter in View classes. Is it possible to inflate a XML layout into a custom view? I've only found the LayoutInflater but it returns a View and that does not help. I want to have something like the setLayout() of an Activity. Is this possible?
Thanks!

A: You can have a custom row view and inflate your xml in its constructor:
public MyRow extends LinearLayout {
    public MyRow(Context context) {
        super(context);
        LayoutInflater.from(context).inflate(R.layout.my_row, this, true);
          ... other initialization ...
    }
}

and then use merge in my_row.xml:
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android">
  ... your row layout ...
</merge>

The merge element causes its children to be added as children of your custom view. Check out Merging Layouts for more info.

A: I alwas use a custom Adapter with a viewholder like:
public class CalendarAdapter extends BaseAdapter {
protected static CalViewHolder holder;
private LayoutInflater mInflater;
public HashMap<Integer,String[]> appointments = new HashMap<Integer,String[]>();

public CalendarAdapter(Context context,HashMap<Integer,String[]> set_appointments) {
    // Cache the LayoutInf
     mInflater = LayoutInflater.from(context);
     appointments = set_appointments;
}
@Override
public int getCount() {
    // TODO Auto-generated method stub
    return appointments == null ? 0:appointments.size();
}
@Override
public Object getItem(int arg0) {
    // TODO Auto-generated method stub
    return null;
}
@Override
public long getItemId(int arg0) {
    // TODO Auto-generated method stub
    return 0;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
     if (convertView == null) {
         convertView = mInflater.inflate(R.xml.appointment, null);
         holder = new CalViewHolder();
         holder.app_lay = (LinearLayout) convertView.findViewById(R.id.appointment_layout);
         holder.app_head = (TextView) convertView.findViewById(R.id.appointment_head);
         holder.app_body = (TextView) convertView.findViewById(R.id.appointment_body);
         convertView.setTag(holder);
     }else{
        holder = (CalViewHolder) convertView.getTag();
     }
     holder.app_head.setText(appointments.get(position)[0]);
     holder.app_body.setText(appointments.get(position)[1]);
     return convertView;
}

static class CalViewHolder {
    LinearLayout app_lay;
    TextView app_head;
    TextView app_body;
}

}


text:
Q: Unable to add Imageview reference in dictionary to view I'm not sure if I'm doing this correctly, but essentially I want to instantiate my uiimageviews when the controller loads. Afterwards, when I implement a method that executes on a timer, I want to grab the reference of the uiimageview depending on the index and add it to the view.
I'm using a NSMutableDictionary. I have all the code in the same method just to test it out. Shouldn't [self.view addSubview:poster]; place the first image in the current view?
self.images = [NSMutableDictionary dictionary];

CGRect imageFrame = CGRectMake(0.0, 0.0, 1024.0, 280.0);

UIImageView *image_one = [[UIImageView alloc] initWithFrame:imageFrame];
image_one.image = [UIImage imageNamed:@"image_one.png"];
NSString *theKey = [NSString stringWithFormat:@"%d",0];
[self.images setObject:image_one forKey:theKey];

UIImageView *image_two = [[UIImageView alloc] initWithFrame:imageFrame];
image_two.image = [UIImage imageNamed:@"image_two.png"];
NSString *theKey1 = [NSString stringWithFormat:@"%d",1];
[self.images setObject:image_two forKey:theKey1];

UIImageView *poster = (UIImageView *)[self.images objectForKey:0];
[self.view addSubview:poster];

A: First, I would suggest using an NSMutableArray. Since you are referencing the items in the array by an index anyways, might as well use an array.
Although with this code, there are a couple things you should change. You should allocate the NSMutableArray instead of using the autoreleased version.
When you are accessing the UIImageView, the key is a string, not an integer. So, it should read:
UIImageView *poster = (UIImageView *)[self.images objectForKey:@"0"];


text:
Q: MongoDB error - Command failed with error 352: 'Unsupported OP_QUERY command: insert' Exception message - 'Unsupported OP_QUERY command: insert. The client driver may require an upgrade. For more details see https://dochub.mongodb.org/core/legacy-opcode-removal' on server localhost:27017. The full response is { "ok" : 0.0, "errmsg" : "Unsupported OP_QUERY command: insert. The client driver may require an upgrade. For more details see https://dochub.mongodb.org/core/legacy-opcode-removal", "code" : 352, "codeName" : "UnsupportedOpQueryCommand" }
Dependency -
        <!-- mongodb java driver -->
        <dependency>
            <groupId>org.mongodb</groupId>
            <artifactId>mongo-java-driver</artifactId>
            <version>3.3.0</version>
        </dependency>

        <!-- Spring data mongodb -->
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-mongodb</artifactId>
            <version>1.2.0.RELEASE</version>
        </dependency>

Properties
info.mongo.host=localhost
info.mongo.port=27017
info.mongo.dbname=testing

Code -
private static MongoClient mongo;
DBCollection dbCollection = mongo.getDB(dbName)).getCollection(collectionName);
BasicDBObject document = new BasicDBObject();
document.put("field", "test field");
dbCollection.insert(document);

Can anyone please come up with a favor regarding this issue?


text:
Q: Return an array where the new elements are the sum of sum of distances between indices with same value in a given array For each index in a given array I want to find the sum of sum of the distances between that index and other indices which have the same value in a given array.
So for [1,2,1,1,2,3], we would have [5,3,3,4,3,0] because
for index 0) |2-0|+|3-0| = 5, for index 1) |4-1| = 3 ,... , for index 3) |3-0|+|3-2| = 4,... etc..
Here is my attempt which gets TLE for arrays of length near 10000.
How can I make my solution more efficient?
def getDistanceMetrics(arr):
    if len(arr) > 10**5 or len(arr) < 1:
        return -1
    for z in range(len(arr)):
        if arr[z] > 10**9 or arr[z] < 1:
            return -1

    # Write your code here
    hm = collections.defaultdict(set)

    for i,value in enumerate(arr):
        hm[value].add(i)

    ans = []

    for j,val in enumerate(arr):
        tmp = 0
        for element in hm[val]:
            tmp += (j-element) if (j-element) >= 0 else element - j
        ans.append(tmp)

    return ans

I would also appreciate knowing as to why and where my answer is slow, because to me it looks like O(n), which seems as good as you could do here.

A: In [1]: a = [1,2,1,1,2,3]

In [2]: b = [sum(abs(n-m) for m, j in enumerate(a) if i==j) for n, i in enumerat
   ...: e(a)]

In [3]: b
Out[3]: [5, 3, 3, 4, 3, 0]

A: instead of iterating over arr, you can iterate over hm.
say we want to calculate the distance where hm of number one is {a1, ..., an}
and we want to calculate the answer for a_k then for all i < k we need to add a_k - a_i since a_k is greater. let's save a partial sum called p[i] (= a1 + ... a_i), you can add all the distances at once (that is adding a_k * (k) - p[k]) you can update p[k] as iterating through the set.
after this is done we will maintain a partial sum starting from the last element that is  p[k] = a_n + a_(n-1) + ... + a_k
again we iterate, but this time from the last element to the first element and add p[k] - a_k * (n-k) to the answer for a_k
This is will be done in linear time over all.
# Write your code here
hm = collections.defaultdict(set)

for i,value in enumerate(arr):
    hm[value].add(i)

ans = [0] * len(arr)

for key in hm:
    p = 0
    for i in range(len(hm[key])):
        p += hm[key][i]
        ans[hm[key][i]] += hm[key][i] * (i+1) - p
    p = 0
    for i in range(len(hm[key]) - 1, -1, -1):
        p += hm[key][i]
        ans[hm[key][i]] += p - hm[key][i] * (len(hm[key]) - i)
return ans

A: for every element in array, you iterate over its hm once.
thus, in the worst case if we have lots of numbers with the same value (say n), for every element, you will iterate over the whole array, which is O(n^2)


text:
Q: How to open drop-down list of combobox when user types in text field? I am trying to write an event such that when user clicks in combo text field it should open the drop-down list of combobox matching the key-stroke.
For example, if user types 'a' in the text field, it should show drop-down list with selected text 'a'.
If user types 'cc', it should open the list and select the item matching the text, and so on. Here is a little code with missing event.
import tkinter as tk
from tkinter import ttk

tkwindow = tk.Tk()

lst = ['a','aa', 'aaa', 'b', 'c','cc','ccc','d']
cbox = ttk.Combobox(tkwindow, values=lst)
cbox.grid(column=0, row=0)

tkwindow.mainloop()

A: Easier for newbie(Entry Level).
Code:
 import tkinter as tk

root = tk.Tk()
lst = ('a','aa', 'aaa', 'b', 'c','cc','ccc','d' )

def checkkey(event):
   if (value := event.widget.get()) =='':
       data = lst
   else:
       data = [item for item in lst if value.lower() in item.lower()]

   update(data)

def update(data):
    lb.delete(0, 'end')

    for item in data:
        lb.insert('end', item)

e = tk.Entry(root)
e.pack()
e.bind('<KeyRelease>', checkkey)

lb = tk.Listbox(root)
lb.pack()
update(lst)

root.mainloop()

Output user types a:

Output user types b:

Output user types c:


text:
Q: How to authenticate SSRS externally using automatic NTLM credential passing? I am attempting to set up our SSRS server to authenticate over the internet using user entered NTLM credentials with the Automatic Logon setting in IE.
The result so far has been the generic 'Internet Explorer Cannot Display the Webpage' error when attempting to navigate to the report manager or report server. I am not getting much relevant information off of google.
Has anyone else encountered this edge case? Any suggestions?

A: SSRS will fail to authenticate over the internet with automatic NTLM credential passing if the <RSWindowsNegotiate/> authentication type is present in the <Authentication> section of the  rsreportserver.config file.
Comment out the <RSWindowsNegotiate/> Authentication Type to resolve this issue.
(C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\ReportServer\rsreportserver.config)
    <Authentication>
    <AuthenticationTypes>
    <RSWindowsNTLM/>
    <!-- <RSWindowsNegotiate/> -->
    </AuthenticationTypes>
    <RSWindowsExtendedProtectionLevel>Off</RSWindowsExtendedProtectionLevel>
    <RSWindowsExtendedProtectionScenario>Proxy</RSWindowsExtendedProtectionScenario>
    <EnableAuthPersistence>true</EnableAuthPersistence>
    </Authentication>


text:
Q: I am trying to make a field for a model which is unique for the choices but could be blank or null I have a field in a model that I would like to be a choice or blank. There may be as many blank items as possible but need to be unique for all others ie there may not be two specials on the same day.
Here is my views.py
class Item(models.Model):
    CATEGORY_CHOICES = (('Sandwich', 'Sandwich'), ('Salad', 'Salad'), ('Slider', 'Slider'), ('Side', 'Side'), ('Drink', 'Drink'))
    DAYS = (('Monday','Monday'), ('Tuesday','Tuesday'), ('Wednesday','Wednesday'), ('Thursday','Thursday'), ('Friday','Friday'), ('Saturday','Saturday'), ('Sunday','Sunday'))

    name = models.CharField(max_length=50)
    description = models.TextField()
    category = models.CharField(max_length=50)
    price = models.DecimalField(max_digits=6, decimal_places=2)
    category = models.CharField(max_length=30, choices=CATEGORY_CHOICES)
    order = models.PositiveSmallIntegerField(default=0, blank=True, null=True)
    special = models.BooleanField(default=False)
    day = models.CharField(max_length=30, choices=DAYS, unique=True, blank=True)
    publish = models.DateField(auto_now=False, auto_now_add=False),
    updated = models.DateTimeField(auto_now=True, auto_now_add=False)

    def __str__(self):
        return self.name

I am also trying to order the daily specials by day of the week ie (Monday, Tuesday, etc) and I thought the following view was working but it seems to be ordering the Items by id
def specials(request):
    specials_list = Item.objects.filter(special = True).order_by('day')
    context = {
        'specials_list': specials_list,
    }
    return render(request, 'menu/specials.html', context)

Thanks in advance for the help!

A: From Django Docs

Unless blank=False is set on the field along with a default then a label containing "---------" will be rendered with the select box. To override this behavior, add a tuple to choices containing None; e.g. (None, 'Your String For Display'). Alternatively, you can use an empty string instead of None where this makes sense - such as on a CharField.

So, for you to allow for a blank choice in any of your tuples, just add the bolded text from the above quote
eg:
CATEGORY_CHOICES = (('Sandwich', 'Sandwich'), ('Salad', 'Salad'), ('Slider', 'Slider'), ('Side', 'Side'), ('Drink', 'Drink'), ('None', 'N/A'))

As for being unique, you already have the days of the week set as unique.


text:
Q: How to search the database for a field which is a substring of the query by using sqlite Problem description
I want to search for the query = Angela in a database from a table called Variations. The problem is that the database does not Angela. It contains Angel. As you can see the a is missing.

Searching procedure
The table that I want to query is the following:
"CREATE TABLE IF NOT EXISTS VARIATIONS
    (ID        INTEGER PRIMARY KEY NOT NULL,
     ID_ENTITE INTEGER,
     NAME      TEXT,
     TYPE      TEXT,
     LANGUAGE  TEXT);"

To search for the query I am using fts4 because it is faster than LIKE% especially if I have a big database with more than 10 millions rows. I cannot also use the equality since i am looking for substrings.

*

*I create a virtual table create virtual table variation_virtual using fts4(ID, ID_ENTITE, NAME, TYPE, LANGUAGE);

*Filled the virtual table with VARIATIONS insert into variation_virtual select * from VARIATIONS;

*The selection query is represented as follow:
SELECT ID_ENTITE, NAME FROM variation_virtual WHERE NAME MATCH "Angela";

Question
What am I missing in the query. What I am doing is the opposite of when we want to check if a query is a subtring of a string in a table.

A: You can't use fts4 for this. From the documentation:
SELECT count(*) FROM enrondata1 WHERE content MATCH 'linux';  /* 0.03 seconds */
SELECT count(*) FROM enrondata2 WHERE content LIKE '%linux%'; /* 22.5 seconds */

Of course, the two queries above are not
  entirely equivalent. For example the LIKE query matches rows that
  contain terms such as "linuxophobe" or "EnterpriseLinux" (as it
  happens, the Enron E-Mail Dataset does not actually contain any such
  terms), whereas the MATCH query on the FTS3 table selects only those
  rows that contain "linux" as a discrete token. Both searches are
  case-insensitive.

So your query will only match strings that have 'Angela' as a word (at least that is how I interpret 'discrete token').


text:
Q: Relational tables: a 3rd table with relations I'm building a php page that will show an specific banner when the user enters his/her phone number in a form field.
So here's my logic for the database:
Table phones with fields: id, name of user and phone number.
Table banners with fields: id, banner's name/title and banner (path to the image).
Table relation with fields: here's where the phone number should be related to a banner and where I need your help :)
And here's my logic for the php page:
-form gets the phone number
-I query the data base
-I show the banner related to the phone number entered in the form.
Below is the code for the table creation so far .. as you'll see don't know how to advance.
Thanks a million
    CREATE TABLE phones(

id_phone INT NOT NULL AUTO_INCREMENT,

nombre VARCHAR(30),

number INT (9),

PRIMARY KEY (id_phone)

) TYPE = INNODB;

CREATE TABLE banners (

id_banners INT NOT NULL AUTO_INCREMENT,

id_phone INT NOT NULL,

name VARCHAR(250),

banner VARCHAR(250),

PRIMARY KEY(id_phone),

INDEX (id_phone),

FOREIGN KEY (id_phone) REFERENCES clientes(id_phone)

) TYPE = INNODB;

A: First of all what's the question?
What can I mention at this step is, does the relation between this entities is one to one? If so, you'd better put all this data into one single table.
++
CREATE TABLE phones(
phone_id INT NOT NULL AUTO_INCREMENT,
name VARCHAR(30),
number INT (9),
PRIMARY KEY (id_phone)
) TYPE = INNODB;

CREATE TABLE banners (
banner_id INT NOT NULL AUTO_INCREMENT,
phone_id INT NOT NULL,
name VARCHAR(250),
banner VARCHAR(250),
PRIMARY KEY(id_phone),
INDEX (id_phone),
FOREIGN KEY (phone_id) REFERENCES clientes(phone_id)
) TYPE = INNODB;

and the query would be:
$query = "SELECT * FROM clients LEFT JOIN banners USING(phone_id) WHERE clients.number='.$number.'";

A: From your question, it seems that each phone number has only one banner associated with it. Therefore, delete the banners.id_banners field and add a phones.id_banners
Then to select the data, you can do a JOIN:
SELECT phones.id_phone, phones.nombre, phones.number,
banners.id_banners, banners.name, banners.banner
JOIN banners ON phones.id_banners = banners.id_banners
WHERE phone = '123-456-789'


text:
Q: Difference between boost ptr containers and normal containers? What is the difference between using boost ptr containers and containers that contains smart pointers?
class A {}

// ptr containers:
boost::ptr_unordered_map<int, A> p;

// containers:
boost::unordered_map<int, boost::intrusive_ptr<A>> m;

A: boost::ptr_unordered_map does not have the reference-counting overhead that would be incurred in a container of boost::shared_ptr<A>
It also does not require the additional A object interface that  boost::intrusive_ptr<A> demands.
That makes it a good solution for managing heap-allocated objects that do not require reference counting of the contained objects.


text:
Q: Aliasing in SQL Server I wrote this query in Oracle and want to compile it as well on SQL Server:
SELECT DISTINCT
    HOLDER_CODE, CALCULATED_AMOUNT
FROM
    (SELECT
         DA.HOLDER_CODE,
         ROUND(FAB.AMOUNT * FCE.EXCHANGE_RATE,0) AS CALCULATED_AMOUNT,
         FAB.BALANCE_DATE_ID as FAB_DATE,
         MAX(FAB.BALANCE_DATE_ID) OVER (PARTITION BY DA.HOLDER_CODE) as MAX_DATE_BALANCE
     FROM
         DIM_ACCOUNT DA
     JOIN
         FACT_AS_BALANCE FAB ON FAB.ACCOUNT_ID  = DA.ID
     JOIN
         DIM_AS_CHARACTERISTICS DAC ON DAC.ID = FAB.BALANCE_TYPE_ID
     LEFT JOIN
         FACT_CURRENCY_EXCHANGE FCE ON FCE.FROM_CURRENCY_ID = FAB.CURRENCY_ID
     WHERE
         DAC.BALANCE_CLOSING_FLAG = 'Y'
         AND TO_CURRENCY_ID = (SELECT DC.ID
                               FROM DIM_CURRENCY DC
                               WHERE DC.IS_DEFAULT_CURRENCY = 'Y')
         AND FAB.AMOUNT > 0)
WHERE
    FAB_DATE = MAX_DATE_BALANCE
ORDER BY
    CALCULATED_AMOUNT DESC;

But when I run it I get the following exception:

Error: Incorrect syntax near the keyword 'WHERE'. SQLState:  S0001
  ErrorCode: 156

So I guess, it's the last where clause, which indicates this. What is wrong and what should it be?

A: You just need to alias the subquery
SELECT DISTINCT HOLDER_CODE, CALCULATED_AMOUNT
FROM (
  SELECT DA.HOLDER_CODE,
         //// snip subquery
    AND FAB.AMOUNT > 0
 ) alias_name_here //<--- here
WHERE FAB_DATE = MAX_DATE_BALANCE
ORDER BY CALCULATED_AMOUNT DESC;

You can use as alias_name_here or just alias_name_here - SQL Server allows either syntax.

A: you must give a name at your "table"
i give is with "as T"
SELECT DISTINCT HOLDER_CODE, CALCULATED_AMOUNT
FROM (
  SELECT DA.HOLDER_CODE,
         ROUND(FAB.AMOUNT * FCE.EXCHANGE_RATE,0) AS CALCULATED_AMOUNT,
         FAB.BALANCE_DATE_ID as FAB_DATE,
         MAX(FAB.BALANCE_DATE_ID) OVER (PARTITION BY DA.HOLDER_CODE) as MAX_DATE_BALANCE
  FROM DIM_ACCOUNT DA
        JOIN FACT_AS_BALANCE FAB ON FAB.ACCOUNT_ID  = DA.ID
        JOIN DIM_AS_CHARACTERISTICS DAC ON DAC.ID = FAB.BALANCE_TYPE_ID
        LEFT JOIN FACT_CURRENCY_EXCHANGE FCE ON FCE.FROM_CURRENCY_ID = FAB.CURRENCY_ID
  WHERE DAC.BALANCE_CLOSING_FLAG = 'Y'
  AND TO_CURRENCY_ID = (
SELECT DC.ID FROM DIM_CURRENCY DC
WHERE DC.IS_DEFAULT_CURRENCY = 'Y')
    AND FAB.AMOUNT > 0
 ) as T
WHERE FAB_DATE = MAX_DATE_BALANCE
ORDER BY CALCULATED_AMOUNT DESC;


text:
Q: Google Maps Info Window is smaller since last night Google just changed the way that the info window appears. It is smaller and it displays a vertical scrollbar, like in their demo: http://code.google.com/apis/ajax/playground/#info_windows_complex_v3
Did Google announced anywhere this change? Any idea how to fix it (to make the info window automatically adjust its height based on its content - as it was until last night)?

A: Yesterday version 3.14 has been released where google.maps.visualRefresh is set to true by default, what causes infoWindows to look different than in previous versions.
3.14 is an experimental version, I would suggest to explicitly set the version of the  used API to the release-version 3.13 and wait if there will be any options available in the future(currently there is no option documented).