text:
Q: Append element with SAX in python I know how to parse xml with sax in python, but how would I go about inserting elements into the document i'm parsing? Do I have to create a separate file?
Could someone provide a simple example or alter the one I've put below. Thanks.

from xml.sax.handler import ContentHandler
from xml.sax import make_parser
import sys

class aHandler(ContentHandler):

    def startElement(self, name, attrs):
        print "<",name,">"

    def characters(self, content):
        print content

    def endElement(self,name):
        print "</",name,">"

handler = aHandler()
saxparser = make_parser()
saxparser.setContentHandler(handler)

datasource = open("settings.xml","r")
saxparser.parse(datasource)

<?xml version="1.0"?>
<names>
    <name>
      <first>First1</first>
      <second>Second1</second>
    </name>
    <name>
      <first>First2</first>
      <second>Second2</second>
    </name>
    <name>
      <first>First3</first>
      <second>Second3</second>
    </name>
</names>

A: With DOM, you have the entire xml structure in memory.
With SAX, you don't have a DOM available, so you don't have anything to append an element to.
The main reason for using SAX is if the xml structure is really, really huge-- if it would be a serious performance hit to place the DOM in memory. If that isn't the case (as it appears to be from your small sample xml file), I would always use DOM vs. SAX.
If you go the DOM route, (which seems to be the only option to me), look into lxml. It's one of the best python xml libraries around.


text:
Q: How to load a images in a website faster using php I am creating an image using the code below:
http://php.net/manual/en/function.imagecreatefromjpeg.php.
Now, I displayed the image in my webpage, localhost/home.php and fetched the image in here.
 <img src="<?php echo  http://localhost/imagecreate.php; ?>" />

and displayed correctly.
However, my problem is that, it takes time to load the website because of that imagecreate script unlike with the usual image below:

Is there any other way to load the imagecreatefromjpeg faster?

A: You are dynamically creating an image every time. So the caching won't work. That's why it's taking more time to load. Better convert the image while uploading, to desired format and save it. Then load image directly without imagecreate.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Prove: the density operator of a pure state has exactly one non-zero eigenvalue equal to unity What is the proper way of proving : the density operator $\hat{\rho}$ of a pure state has exactly one non-zero eigenvalue and it is unity, i.e,
the density matrix takes the form (after diagonalizing):
\begin{equation}
\hat{\rho}=
{\begin{bmatrix}
1 & 0 & \cdots & 0 \\
0 & 0 & \cdots & 0 \\
\vdots & \vdots & \ddots & \vdots \\
0 & 0 & \cdots & 0 \\
\end{bmatrix}}
\end{equation}
For mixed state: $\hat{\rho}=\sum \limits_{i}P_{i}|\psi_{i}\rangle\langle\psi_{i}|$
For any state: $Tr(\hat{\rho})=\sum\limits_{i}P_{i}=1$
For pure state: $\hat{\rho}=|\psi\rangle\langle\psi|$
$|\psi\rangle$ is the statevector of the system
$P_{i}$ is the probability to be in the state $|\psi_{i}\rangle$, which are the eigenvalues of the density operator.

A: Since $\langle \psi|\psi\rangle=1$, we have
$$
(|\psi\rangle\langle\psi|)^2=|\psi\rangle\langle\psi|\psi\rangle\langle\psi|=|\psi\rangle\langle\psi|
$$
Then $|\psi\rangle\langle\psi|$ is a projection, and its eigenvalues are $0$ and $1$. Since we know that the trace of $|\psi\rangle\langle\psi|$ is one we conclude that, counting multiplicities, the eigenvalues of $|\psi\rangle\langle\psi|$ are $1,0,\ldots,0$. So its diagonal form is
\begin{equation}
\hat{\rho}=
{\begin{bmatrix}
1 & 0 & \cdots & 0 \\
0 & 0 & \cdots & 0 \\
\vdots & \vdots & \ddots & \vdots \\
0 & 0 & \cdots & 0 \\
\end{bmatrix}}
\end{equation}

A: Do you not know how to find the eigenvalues of a matrix by solving the "characteristic equation" of the matrix?   The characteristic equation of any diagonal matrix is just the product of linear terms, each the number on the diagonal minus x so the eigenvalues [b]are[/b] the numbers on the diagonal.


text:
Q: Created New Facebook Application for Android publish permission not working.Used Facebook sdk 3.14.xx and samples I am using facebook sdk 3.14(latest updated sdk) and created application for android platform
like other old applications which i have added same options and everything.
i want to use share photo feature for that I am using below code to add publish_actions permission. but permission is not getting updated or granted.
** I have checked with other old application which i have created last month which is working fine with same code photo sharing and all is working , permissions also getting add.
But application which i have created today.with that app id I am not able to add permission for publish.
if (session.isOpened()) {
                // We need to get new permissions, then complete the action when
                // we get called back.
                Session.NewPermissionsRequest permission = new NewPermissionsRequest(
                        this, PERMISSION);
                permission.setCallback(new StatusCallback() {

                    @Override
                    public void call(Session session, SessionState state,
                            Exception exception) {
//session.getPermissions() //here m not getting publish_permission in list
                        Log.e("", "");
                    }
                });
                session.requestNewPublishPermissions(permission);
                return;
            }

i have also tried with samples which is provided with facebook sdk.
onActivity result and all are as per facebook sample given in sdk .
any help?
** try to create new facebook application and use that app id.

A: I found the solution for testing facebook application.After 30th April facebook changed some structure regarding roles.For testing some of the permissions like publish_actions , friends related need to add roles in facebook app.Add testers and developer roles in facebook application after adding role(s) i am able to test that sharing image and other things with that added testers or developer id.For live now its required to post application for review process.After login into developer account Open facebook application and  check the Roles Menu.


text:
Q: Update field with value according to occurence I have the following problem: I would like to update a Access table with a value. The value should be added if multiple conditions are true.

*

*If a value in column A exists more than once AND

*If a value in column B exists more than once AND

*If column C is not empty

I tried it with the following query, which almost works but seems to ignore the condition on column B. For example, there are three records. Those three have the same value in "a" but only two of them have the same value in "b". Still, the query writes "f" for all three of them.
UPDATE table1 SET a = "f"
WHERE a IN (SELECT a FROM table1 GROUP BY a, b HAVING COUNT(a) > 1)
AND b IN (SELECT b FROM table1 GROUP BY a, b HAVING COUNT(b) > 1) AND [c] <> " ";

It could be doable with VBA (Looping through everything) but I want to avoid that. And I really want to know why it does not work.
Thanks a lot!

A: I think your group by conditions are wrong.  Based on your description:
UPDATE table1
    SET a = "f"
WHERE a IN (SELECT a FROM table1 GROUP BY a HAVING COUNT(a) > 1) AND
      b IN (SELECT b FROM table1 GROUP BY b HAVING COUNT(b) > 1) AND
      c <> " ";


text: Q: Перекодирование файла из Windows ANSI кодировки в utf-8 Появилась такая проблема во время разработки программы на C++. Программа должна прочитать содержимое текстового файла input.txt, обработать и записать в другой файл output.txt. Текст внутри файла input.txt имеет кодировку cp1251. Чтобы программа корректно работала нужно перекодировать файл в UTF-8. Ни как не могу разобраться, как это сделать. Может уже есть какие-то готовые функции? Помогите, пожалуйста.


text:
Q: Tornado file uploads - high memory usage We have a tornado application running behind nginx, supporting user file uploads (I just use self.request.files to access the uploaded files). The maximum file size is 10MB and this is set in the nginx config, so the python process should never see files larger than that.
I've noticed that every time a user uploads a file, the memory goes up by a little. But I can't figure out a pattern there. I've tried to figure out if there are any memory leaks (using pympler and objgraph) but couldn't find anything particularly suspicious. They only show me that the top memory consuming objects are strings and dicts, with combined object sizes not more than 7-8MB. If the uploaded file itself would still have a reference after the request completed, then I would also expect the bytes type to be reported by pympler and/or objgraph, which I don't.
I wonder how to best deal with this situation. Is this another case of the "high water" behavior? Would switching to stream_request_body yield better results? Or is it easier to simply restart the process once it hits a certain threshold?


text:
Q: What does $P(A)\cdot P(B)$ mean for non independent events? When two events $A$ and $B$ are independent, $P(A)\cdot P(B)$ equals the probability of both events occurring together.
$$P(A|B) = \frac{P(A\cap B)}{P(B)}.$$
If $A$ and $B$ are not independent,  $P(A\cap B)$ is either greater than or less than $P(A)\cdot P(B)$.

*

*I want to understand the intuitive meaning of $P(A)\cdot P(B)$ for non independent event. What does it signify?

*Also, what is intuition behind
If $P(A|B) > P(A)$, then $P(B|A) > P(B)$.
I understand it is direct consequence of $P(A\cap B) > P(A)\cdot P(B)$, but it is not very intuitive to me.

A: When $A,B$ are not independent, and if there is no more information, there's no natural interpretation of $P(A){\,\cdot\,}P(B)$.

The condition $P(A|B) > P(A)$ means $A$ is more likely to have occurred if it's given that $B$ has occurred, than if there is no information as to whether or not $B$ has occurred.

Equivalently, $A$ is more likely to have occurred if it's given that $B$ has occurred, than if it's given that $B$ did not occur (i.e., $B'$ occurred, where $B'$ is the complement of $B$).

The interpretation for $P(B|A) > P(B)$ is analogous.

As regards the question as to why $P(A|B) > P(A)$ implies $P(B|A) > P(B)$ . . .

Assume $P(A),P(B) > 0$.
\begin{align*}
\text{Then}\;\;&P(A|B) > P(A)\\[4pt]
\implies\;&\frac{P(A\cap B)}{P(B)} > P(A)\\[4pt]
\implies\;&P(A\cap B) > P(A)P(B)\\[4pt]
\implies\;&\frac{P(A\cap B)}{P(A)} > P(B)\\[4pt]
\implies\;&P(B|A) > P(B)\\[4pt]
\end{align*}
As regards the intuition . . .

Assume $P(A),P(B) > 0$.

Suppose we have $P(A|B) > P(A)$.

Thus, when $B$ happens, $A$ tends to happen more than when $B$ doesn't happen.

So if $A$ happens, it suggests that $B$ might have been "responsible", hence it's more likely that $B$ occurred than $B'\;(\text{not}\,B)$.

Thus, the occurrence of $A$ increases the likelihood of the occurrence of $B$.

Which means $P(B|A) > P(B)$.

A: For events $A,B$, the correlation is measured by $$\mathsf{Corr}(A,B)=\dfrac{ \mathsf P(A\cap B)-\mathsf P(A)\cdotp \mathsf P(B)}{\sqrt{\mathsf P(A)\cdotp\mathsf P(B)\cdotp(1-\mathsf P(A))\cdotp(1-\mathsf P(B))}}$$
Similarly the covariance is measured as: $$\mathsf{Cov}(A,B)= \mathsf P(A\cap B)-\mathsf P(A)\cdotp \mathsf P(B)$$
You might extract an interpretation for $\mathsf P(A)\cdotp\mathsf P(B)$ from that.
$\mathsf P(A\mid B)>\mathsf P(A)$ intuitively means that outcomes of $A$ are overrepresented among event $B$ in comparison to their proportion of the whole outcome space -- we say there is a positive correlation between the events.   Then it should feel right that outcomes of $B$ are likewise overrepressented among event $A$.   Indeed, if they were underrepresented, there would be a negative correlation, but it would be a contradiction for the correlation to be both positive and negative.
Ipso facto, $\mathsf P(A\mid B)>\mathsf P(A)\iff \mathsf P(B\mid A)>\mathsf P(B)$ (preassuming $A,B$ both have positive probability mass).

A: Consider the following events $M$={pass midterm exam}, $F$={pass final exam} and the probabilities:
$$P(M)=0.8, P(F)=0.7,P(M\cap F)=0.6.$$
Then:
$$P(M|F)=\frac{P(M\cap F)}{P(F)}=\frac{0.6}{0.7}=\frac67>0.8=P(M); \\
P(F|M)=\frac{P(F\cap M)}{P(M)}=\frac{0.6}{0.8}=\frac34>0.7=P(F).$$
Hence, passing one exam increases the probability of passing the other exam, which is a consequence of a positive correlation.


text:
Q: How to undo fastboot disable and CSM enable option in BIOS? currently have no display. Is clearing CMOS my only option? So I just disabled fast boot and enabled CSM boot in order to try and get a windows 10 install USB to boot. The system won't boot now and I have no display.
Is CMOS reset my only option in this case? If I go that route are my SSD's in risk of corruption? Should I disconnect them before the CMOS reset? Also I have applied a BIOS update using the EZ update utility provided by ASUS a while back. will I need to re-apply this update upon reset?
I am currently using a gtx 770 gpu which has it's own UEFI BIOS, could this be the problem that is preventing the display from initializing and the system from POSTing
Because I am trying to dual boot with an existing windows 7 install,  I made the USB using Rufus, and I selected the MBR partition scheme for BIOS or UEFI. The windows 10 install USB would boot from the UEFI option using the f8 menu, but I need to use legacy not UEFI. When using the legacy option from the f8 menu, the windows 10 install USB would initialize, and say "press any key  to boot..." ,  but when I would press enter, it would say "failed to start, press ctrl+alt+del to restart".
So like I Already mentioned, I disabled fast boot, and enabled CSM boot, to try and get the windows 10 install USB to boot/start. But now my PC/bios fails to POST. I have the ASUS Maximus VII Hero Z97 chipset motherboard. The mobo includes a Q-led display that displays startup and error codes. On a successful boot the code displayed is "AO" , which stands for "IDE initialization is started". As of now the system powers up but I have no display, and the code "92" is displayed, which stands for "PCI"  bus initialization is started" but it doesn't make it past that.
In Comment to @Rich Manson,
My motherboard is the  ASUS Maximus VII Hero with Z97 chipset. I was messing around with my windows 7 system a while back, and it failed to boot. I used the MBR repair option on the Rescatux live GRUB/MBR repair CD and it worked. Everytime I boot I see the letters MBR flash, then the loading splash screen for windows 7 comes up. That is why I believe my Windows 7 install is using the MBR scheme, and not the GPT scheme. Also when I initially installed Windows 7, the option I chose didn't say (UEFI) beside it on the boot options screen, so I thought choosing the other option means you are using legacy boot, which uses MBR instead of GPT. And I'm not trying to install a hybrid system, I am trying to install windows 10 with legacy boot/MBR since I supposedly already use the MBR scheme.
Update, It was indeed my graphics card that causing the system to stop on initialization of the PCI-E bus. I pulled my GPU's out and used the on-board graphics to revert the BIOS settings. CMOS reset wasn't necessary. And I had gotten the boot options that I changed confused. I had indeed disabled fast boot before the problem, but I had also disabled CSM boot, whereas it was actually already enabled beforehand. I was previously stating that I had enabled it. If I had left it enabled then I believe my display still would have worked.

A: Resetting the CMOS may not fix your issue or garner the results your looking to realize.  Also, resetting the CMOS should not effect data on an SSD. But to answer your other question, Yes you can unplug them if it worries you. Resetting CMOS just resets the system setup to default.
You mentioned your gpu has its own UEFI and that you enabled CSM boot after it was installed. It sounds like you set up the gpu in UEFI mode and you then switched to UEFI/Legacy/CSM mode. This would prevent your graphics from initializing and the display to not be working. Your particular system board, ASUS MAXIMUS VII HERO, has on-board graphics. To get you gpu to show a display or initialize, you could try pulling out the gpu and see if on-board graphics work to get into setup. UEFI boards have a basic graphics driver to enable on-board graphics.
Make sure you set your system up in one mode
You will need to set up the hardware and software (OS) in the same system mode. You can't set up part of your system in one mode and switch to another mode since this would imply trying to get the system board to run in both modes at the same time, which it will not.
Windows 7 is documented to be able to install in UEFI mode. You are getting the "failed to start, press ctrl+alt+del to restart" message because it is not finding some boot files either because there are not where they should be or corrupt, or they appear to not be there because the system is looking in the wrong place. This could be simply a setup setting that is wrong as this can also generate this message.


text:
Q: how do I disable random play order on the windows version? my playback options is in the screenshot below.
On my mac, I have the same settings and vlc plays my playlist in order.  On windows, the app does it in random order.
Thanks

EDIT1: I tried the to disable/enable the randon icon (the last one to the right). no effect.


text:
Q: replace curdate() - interval with $variable - interval The code below is to select and then echo stuff from my db grouped by either weeks or months. I have a couple of more of these and then use offset to get the second week etc.
FROM my_db WHERE DATE >= CURDATE() - INTERVAL 10 ".$grouping1." GROUP BY ".$grouping."(DATE) order by DATE desc limit 1

I have two questions:

*

*I would like to exchange curdate() with a variable instead so that we are able to "pick a startdate" and then look 10 weeks/months back from that date.

*Is there a simpler/better way to do this?
I've tried to exchange the curdate with a variable like this:
FROM my_db WHERE DATE >= '". $startdate ."' - INTERVAL 10 ".$grouping1." GROUP BY ".$grouping."(DATE) order by DATE desc limit 1

but the weeks/months stay the same even though the variable (start date) changes.
Edit: My $startdate variable is formatted like this 2013-05-07 and the DATE column in the mysql db is of date format.
Peace
/Adis

A: Something like:
FROM my_db WHERE DATE >= '".date(Y-m-d, strtotime($my_date))."'

Will work

A: Try this.
This will subtract 10 months from current date
FROM my_db WHERE DATE >= '".date("Y-m-d", strtotime("-10 months"))."'

This will subtract 10 weeks from current date
FROM my_db WHERE DATE >= '".date("Y-m-d", strtotime("-10 weeks"))."'


text:
Q: Add additional matching between two arrays to Here's what I want to achieve. I've 2 arrays, one for artists and one for releases. I am currently matching "ArtistID" to each to display "Releases by this artists" on my SingleArtist page. However I want to take it a step further and add another identifier if the release features them. Example : release A has artist A, but a remixer B. Is there a way to do it within by doing more filtering on the arrays(s)? Not sure how to go about it. Thanks.
example from releases.json
{
"id": 9,
"artistID": "SU",
"featuredartist": "ES, FG",
"imageURL": "../images/releases/dulcie.jpg",
"title": "Dulcie Caught a Cricket",
"description": "Released 2020",
"artist": "Sumsuch",
"buy": "https://www.beatport.com/release/we-choose/1916121",
"stream": "https://open.spotify.com/album/4cutoknbgciTGGpAYSZXfK?si=gsNvR6ytTN6KdrPORfSLOg"
},

example from artists.json (the second object is a remixer 'id:0' who is featured on 'id:3' and would like that to display under the "ES" releases
{
"id": 3,
"artistID": "SU",
"imageURL": "./images/sumsuch.jpg",
"singleimageURL": "../images/artists/sumsuch.jpg",
"name": "SUMSUCH",
"bio": "Will Sumsuch has been a musician, producer and DJ",
"soundcloud": "sumsuch"
},

{
"id": 0,
"artistID": "ES",
"imageURL": "./images/artists/ericblue.jpg",
"singleimageURL": "../images/artists/ericblue.jpg",
"name": "ERIC SHANS",
"bio": "A producer and DJ residing in Brooklyn, NY,
},

code for singleartist.js (abbreviated)
 function SingleArtist() {
  const { id } = useParams() //finds single artist from array & matches ID
  const artist = artists.find((a) => a.id === +id)
  //finds ArtistID from Artists then matches any item that has the same value from the Releases array
  const releaseList = releases.filter((b) => b.artistID === artist.artistID)
  const { singleimageURL, name, soundcloud, bio } = artist

  return (
    <Wrapper>

              {name}

              {bio}

            Listen to {name}'s Soundcloud

        <Link className='link-back' to="/artists"> Back To Artists</Link>

 Releases by {name}

        {releaseList.map(release => {
          const { imageURL, name, id, buy } = release;
          return (

          )
        })}

    </Wrapper>
  )
}

A: The way I understand your question, you simply want to find a list of releases that an artist is featured in on the single artist page. This line should do the trick:

let releases = [{
"id": 9,
"artistID": "SU",
"featuredartist": "ES, FG",
},{
"id": 3,
"artistID": "ED",
"featuredartist": "SU, FG",
}]

const featuredList = releases.filter(release => release.featuredartist.split(", ").includes("SU"));

console.log(featuredList);

You can insert this directly below the line where you set releaseList. It is basically the same idea. This line filters the releases again, and then splits the featuredartists string into an array of strings. Then, if the array includes the artist's id, you return it.


text:
Q: Hidden Youtube autoplay on click image Need some help please,
I am making an unordered list with once an image once an embed iframe from youtube,
when clicking on the image it replaces the image with the hidden iframe from above using the .replace and .prev function of jquery
I was wondering if after clicking on the image the youtube video could autoplay, when adding autoplay to the parameters of youtube itself, it starts on page load, even when being set to display none.
I am doing this with using only classes, because the list will get big and I don't want to add for every separate id some jquery. I am not sure if this is even possible by only using classes.
Could someone guide me a little.
this is what I came up so far:
javascript:
$('.coverimageforplayer').click(function () {
    $(this).replaceWith($(this).prev('li.showme').show());
});

html:

thank you very much

A: I would ditch the showme list item as this adds unnecerary html and makes your code too complex in the long run.
I've written a small fiddle to demonstrate a more elegant approach, stash the video url in a data attribute on the list image, then insert a iframe on click and voila!
Here's the fiddle: http://jsfiddle.net/TxbHx/1/
The html:

autoplays:

Does not autoplay:

The javascript:
$('.coverimageforplayer').on('click', function() {
    var element = $(this); // reuse variables for best practice. http://code.tutsplus.com/tutorials/quick-tip-jquery-newbs-stop-jumping-in-the-pool--net-22142
    var videoSRC = element.attr('data-videoSRC'); // Get the video URL from the data attribute
    var iframe = ''; // create the iframe string
    element.html(iframe); // insert the iframe
});


text:
Q: How to use Ajax call correctly to send form data to Webserver? I am trying to implement a form containing a list of cities, using a JSON array and an autocomplete function.
My ajax call is successful and gives the expected success alert, but I'm still not getting the JSON array data.
The problem is that my suggest_json_application function is failing at the 'if form.has_key('term')' statement and giving the message "form has no key".
How can I pass the form data to the function properly through the ajax call, with the key term?
HTML form
</head>
<body>
<form>
  <fieldset><legend>Cities</legend>
  <input type='text' name='term' id='term'>
</form>

JQuery
$('document').ready(function() {

    var term = $('#term').val();

    $.ajax({
        url: "/suggestjson",
        type: "POST",
        dataType: "json",
        data: JSON.stringify({'term': term}),
        success: function (data) {
            alert('success');
            console.log( data );
        }
    });
});

Webserver
cities = ['New York', 'London', 'Los Angeles',
          'Paris', 'San Francisco', 'Adelaide']

if environ['PATH_INFO'] == "/suggestjson":
    return suggest_json_application(environ, start_response)

def suggest_json_application(environ, start_response):
    //Return JSON array of completions for a city name

    form = cgi.FieldStorage(fp=environ['wsgi.input'], environ=environ)

    if form.has_key('term'):
        print "form has key"
        q = form.getvalue("term", "")
        matches = [c for c in cities if c.lower().startswith(q.lower())]
    else:
        print "form has no key"
        matches = []

    return json.dumps(matches)

A: Currently you are sending whole html element to server. Invoke val() function to get the value of element,
Also use id selector for easy access to element,
like this:
var term = $('#term').val();

A: Use val() :- see details here
    var term = $('#term').val();

and also data parameter in ajax it should be
    data : {term: term}

A: please try to change "data" option to a object in the ajax call as follow
$('document').ready(function() {

  var term = $('input[name=city]');

  $.ajax({
    url: "/suggestjson",
    type: "GET",
    dataType: "json",
    data: {'term': term},
    success: function (data) {
        alert('success');
        console.log( data );

    }
  });
});


text: Q: How to suppress iPad's Previous/next buttons from on screen keyboard in PhoneGap I am using PhoneGap to make an iPad app. When the user has an external keyboard and types in a field, most the on screen keyboard stays hidden. There are no key caps visible but the band at the top of the keyboard which has two buttons "Previous" and "Next" still appears. I would like to prevent that from showing up. It does disappear when the text field loses focus but I'd like it to not even show up at all. Is there something I can call either via PhoneGap or in Xcode which will prevent any part of the on screen keyboard from ever appearing?


text:
Q: Using (*) in Where command in PowerShell I am Using this command to get a Local User in Administrators group, and it works
Get-WmiObject -Class Win32_Groupuser -ComputerName $computer |? {$_.groupcomponent -like '*"Administrators"' -and $_.Partcomponent -like '*"User"'}|ft groupcomponent,Partcomponent

But now i want to use variable like this
 $Group="Administrators"
   $Account="users"
Get-WmiObject -Class Win32_Groupuser -ComputerName $computer |? {$_.groupcomponent -like *$Group -and $_.Partcomponent -like *$Account}|ft groupcomponent,Partcomponent

but i get nothing back

A: If the group name is "Administrators" you do not need to use a wildcard. The asterisk will match one or more characters. For example:
"Administrator*" matches Administrator, Administators, "Administrator
   Groups", etc
"*Administrators" matches Administrators, "Windows Administrators", etc
"*Administrator*" matches Administrators, "Administrator Groups", "Windows Administrators", etc
For the second command you can use a sub-expression to expand the variable.
Where-Object { $_.groupcomponent -like "*$($Group)*" }

A: This is a working example:
$Group = '"Administrators"'
Get-WmiObject -Class Win32_Groupuser -ComputerName $computer |? {$_.groupcomponent -like "*$Group"}

The same can be adapted for $_.partcomponent.


text:
Q: Globally Fix Font Size for System Fonts in iOS 14+ I want to use system fonts in my SwiftUI text, but these fonts automatically scale with the user's accessibility settings.
Text("abc").font(.system(size: 12))

Non-system fonts have this fixedSize initializer which allows it to not adjust to user settings, but there's no equivalent version for system fonts.
Text("abc").font(.custom("Arial", fixedSize: 12))

Another answer on here proposes using the environment to fix the font size, but unfortunately this doesn't apply to sheets. (This might be a bug similar to the one with environment objects not being passed into sheets). So I have to add this line for every view that is presented modally, plus the root view of my app.
var body: some View {
    VStack {
        ...
    }
    .environment(\.sizeCategory, .large)
}

Is there a more elegant way to globally fix the font sizes for my app, rather than setting the environment key for every possible view that could be presented modally?


text:
Q: Cassandra: Which schema for table-like mappings? I have tried different approaches but I can't find a solution to my problem:
My data is table-like, meaning I have one data point (float) for each combination of inputs from a set of Strings:
(a mapping of S × S → ℝ )

I want to model the schema so that I can do the following lookups:

*

*all pairs of strings with a value in a certain range

*for a given input String, all Strings for which the mapped value is in certain range

*for a given combination of input Strings the mapped value

Since the mapping is symmetrical (m(x,y) == m(y,x) ), it would be great if I only had to store the
n*(n+1) / 2 unique values instead of the n^2 total mappings.
What I have tried so far:

*

*S1+" "+S2 as row key and the value as column name

*S1 as row key and a Composite key of [S2:value] as column name

*S1 as row key, S2 as column name, value as column value.

but unfortunately, all these approaches don't let me do all the queries I need.
Is this even possible in Cassandra?

A: Cassandra does not support your first query --- all pairs of strings with a value in a certain range --- since currently, Cassandra only allows range queries with at least one EQ on the WHERE clause.  However, your second and third queries is doable :)

Example
Consider the following example:
cqlsh:so> desc table string_mappings;
CREATE TABLE string_mappings (
  s1 ascii,
  s2 ascii,
  value float,
  PRIMARY KEY (s1, s2, value)
)

and we have the following tuples:
cqlsh:so> select * from string_mappings;

 s1    | s2    | value
-------+-------+-------
 hello | hello |     1
 hello | world |   0.2
 stack | hello |     0
 stack | stack |     1
 stack | world |     0
 world | world |     1

Your first query does not work as Cassandra currently not support range queries without an EQ on the WHERE clause:
cqlsh:so> select * from string_mappings where value>0.5;
Bad Request: PRIMARY KEY part value cannot be restricted (preceding part s2 is either not restricted or by a non-EQ relation)

However, the following range query (your second query) is fine since it has an EQ:
cqlsh:so> select * from string_mappings where value > 0.5 and s2='hello' allow filtering;

 s1    | s2    | value
-------+-------+-------
 hello | hello |     1

and remember to put the ALLOW FILTERING keyword, or you will get the following error:
cqlsh:so> select * from string_mappings where value > 0.5 and s2='hello';
Bad Request: Cannot execute this query as it might involve data filtering and thus may have unpredictable performance. If you want to execute this query despite the performance unpredictability, use ALLOW FILTERING

Finally, your third query is also not a problem :)
cqlsh:so> select * from string_mappings where S1='hello' and S2='world';

 s1    | s2    | value
-------+-------+-------
 hello | world |   0.2


text:
Q: Unable to open port using boost asio I'm trying to send simple signal on port COM2 using boost asio library. The problem is with this code. I get the error message saying: : The system cannot find the file specified.
io_service io;
serial_port port( io );
boost::system::error_code error;
if (!port.is_open()) {
    port.open("COM2", error);
    LOGI("Error: %s.", error.message().c_str());
}

What might be wrong? I have no device on this port and I don't really have any idea how all of this works. I had a task to send a simple 7-bit signal to COM2 port. But I am unable to go past opening port stage.
I'm on Windows 8.1 64-bit running VS2012.


text:
Q: Why isn't the paintComponent method being called? The messages that ought to be printed in the printComponent method are not printed. I am having the impression that the paint method is not called. If not, why not?
import java.util.*;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.*;
import javax.swing.*;
import javax.imageio.*;

public class Main extends JFrame{
    CustomComponent cc;

    public static void main(String[] args) {
        Main m = new Main();
    }

    public Main(){
        setTitle( "Diverse Testari 7");
        setLayout(null);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        setSize(600, 400);

        cc = new CustomComponent();
        cc.setImage("rgbcmy.jpg");

        add(cc);
        pack();
        setVisible( true );
    }
}

class CustomComponent extends JPanel{
    BufferedImage img = null;
    public void setImage( String str ){
    try {
        img = ImageIO.read( new File( str ) );
        System.out.println("SUCCESS!");

    } catch (IOException e) {
        e.printStackTrace();
    }
    }

    @Override
    protected void paintComponent(Graphics g) {
        // TODO Auto-generated method stub
        System.out.println("altceva");
        super.paintComponent(g);
        System.out.println("ceva");
    }
}

A: Add this code in your Main constructor:
new Thread(new Runnable() {
    public void run() {
        repaint();
        try {
            Thread.sleep(20);
        } catch (InterruptedException e) {}
    }
}).start();

paintComponent will only be called when you repaint();.
Also, NEVER NEVER NEVER use setLayout(null);. See here.
This code will continually repaint the panel, so it will continually call paintComponent. This is good because it will always keep the panel updated. You could also just call repaint(); when you change what's in the panel.


text:
Q: .Net not finding referenced dependency required by Nuget package We recently setup a local nuget server to improve our handling of dependencies within our projects. To package and push our libraries, we use the "new" project format in Visual Studio and a marketplace addon called NuPack-Nuget Packager.
Workflow for development is then to create a new project and pull the required dependencies.
Now we got a strange behavior on all workplaces.
Eg. we have 2 libraries: LibA (Version 1.1.0) and LibB (Version 2.5.0)
where LibB depends on LibA and references it as a project reference.
I have my project referencing LibB (Version 2.5.0) via Nuget.
When I change LibB (now Version 2.5.1) and push it  to our Nuget and update the reference in my project everything appears to work fine, the project builds and has no errors, but at runtime, once code is executed that references LibA (still Version 1.1.0, no changes made) I get a FileNotFound Exception: Assembly LibA, AssemblyVersion 1.1.0 could not be found.
The only workaround for now is to package a new LibA as Version 1.1.1 (no code changes) and push it to the nuget server and update the reference in my project to Version 1.1.1 .
Does anyone know a cause / a solution to this?
EDIT Things that do not solve the problem:

*

*Clean / Rebuild the solution (neither Dependencies nor Project)

*Update-Package -reinstall in package manager commandline

*Clearing Nuget caches and restoring all dependencies

*Removing and readding nuget reference in project by hand

EDIT Exact error message (Assembly name changed)

System.IO.FileNotFoundException: 'Could not load file or assembly 'Lib.A.Namespace.1.1, Version=1.1.7, Culture=neutral, PublicKeyToken=null'. Das System kann die angegebene Datei nicht finden.'

Translation of the last part: "File could not be found"
EDIT All dependencies are compiled as AnyCPU for NetStandard2.0

A: Problem has been identified.
NuPack-Nuget Packager is 'at fault' here.
For anyone stumbling upon this in the future:
Our problem was the way the NuPack-Nuget Packager works.
While the workflow seems to be handy (set Assemblyversion, set output dir, set nuget server, finished), the project will not be build for the package deployment and thus relies on the previous build, which internally still holds the previous AssemblyVersion.
We finally got to the solution after finding out we were pulling obsolete references (found in the User/.Nuget/Packages folder).
We did not come up with a final, one step solution for build, package and deploy yet.


text:
Q: How to write a function in javascript to match two words I am new in coding. I was working on a typing website which match the word in text field to the word shown in the website. How to write the function in Javascript. Here is what I have tried.

let displayWord = document.getElementById('word').innerHTML
let displayMessage = document.getElementById('message')
let inpWord = document.getElementById('input').value

function matchWords() {
    if(displayWord === inpWord){
        console.log('words matching')
    }
}
<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">

Typing test

Type The Given Text

Hello

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

A: The issue is, that you grab the value when the document is loaded but at this point the value is empty.
If you change your code to this it should be updating the h4 field while you type.

let displayWord = document.getElementById("word").innerHTML;
let displayMessage = document.getElementById("message");
let inpWord = document.getElementById("input");

function matchWords() {
  if (displayWord === inpWord.value) {
    displayMessage.innerText = "words matching";
  }
}

input.addEventListener("keyup", matchWords);

A: your script looks good by far, you just need to set an event handler to your input to trigger your function when user types in it.
below your code refactored with some suggestions:

*

*use const instead of let when variable is not going to change.

*is it better to store the HTML element that way you'll be able to do more with it.
in this case I use the input element to change its outline color and also change the message
const word = document.getElementById('word')
const message = document.getElementById('message')
const inputText = document.getElementById('input')

function matchWords() {
    if(word.innerHTML === inputText.value){
      message.innerHTML = "It does match!"
      inputText.style.outline = "1px solid green"
    } else {
      message.innerHTML = "It does not match!"
      inputText.style.outline = "1px solid red"
    }
}

inputText.onkeyup = () => matchWords()


text:
Q: Pandas read_csv can't find file When I tried to read a csv into a dataframe in Pandas
it can't find my file what are some possible solutions?
Here is the error:
*FileNotFoundError                         Traceback (most recent call last)
<ipython-input-2-0c537d0c5b39> in <module>
----> 1 data = pd.read_csv('1.01. Simple linear regression.csv')

C:\ProgramData\Anaconda3\lib\site-packages\pandas\io\parsers.py in parser_f(filepath_or_buffer, sep, delimiter, header, names, index_col, usecols, squeeze, prefix, mangle_dupe_cols, dtype, engine, converters, true_values, false_values, skipinitialspace, skiprows, skipfooter, nrows, na_values, keep_default_na, na_filter, verbose, skip_blank_lines, parse_dates, infer_datetime_format, keep_date_col, date_parser, dayfirst, cache_dates, iterator, chunksize, compression, thousands, decimal, lineterminator, quotechar, quoting, doublequote, escapechar, comment, encoding, dialect, error_bad_lines, warn_bad_lines, delim_whitespace, low_memory, memory_map, float_precision)

A: Make sure you are in the correct directory
Pandas.read_csv, Python will always look in your "current working directory"
data = pd.read_csv('1.01. Simple linear regression.csv')
data.head()

You can always a give a full path
Pandas.read_csv, Python can also look in a specified folder "current working directory"
I have to do by directory path most of the time myself and set my encoding and add a r before also.
data = pd.read_csv(r'C:\Users\path\to\your\file\mess.csv', encoding='utf8')
data.head()

you can also rename the file name to keep it simple
1.01. Simple linear regression.csv

into
1_01_Simple_linear_regression.csv

 data = pd.read_csv('C:\Users\path\to\your\file\1_01_Simple_linear_regression.csv')
 data.head()

Sometimes you also need to double \ in the path
data = pd.read_csv("C:\\Users\\path\\1_01_Simple_linear_regression.csv")


text:
Q: Kafka - Confluent Cloud - what is the status and limitations? Did anyone used Confluent Cloud in Production?
What is the status of it?
I heard that it allows replication without renaming the topic and offsets to be consistent in replicas.
Is that true?
Also - can NPI data be used for it?


text:
Q: Why does using pseudo-labeling non-trivially affect the results? I've been looking into semi-supervised learning methods, and have come across the concept of "pseudo-labeling".
As I understand it, with pseudo-labeling you have a set of labeled data as well as a set of unlabeled data. You first train a model on only the labeled data. You then use that initial data to classify (attach provisional labels to) the unlabeled data. You then feed both the labeled and unlabeled data back into your model training, (re-)fitting to both the known labels and the predicted labels. (Iterate this process, re-labeling with the updated model.)
The claimed benefits are that you can use the information about the structure of the unlabeled data to improve the model. A variation of the following figure is often shown, "demonstrating" that the process can make a more complex decision boundary based on where the (unlabeled) data lies.

Image from Wikimedia Commons by Techerin CC BY-SA 3.0
However, I'm not quite buying that simplistic explanation. Naively, if the original labeled-only training result was the upper decision boundary, the pseudo-labels would be assigned based on that decision boundary. Which is to say that the left hand of the upper curve would be pseudo-labeled white and the right hand of the lower curve would be pseudo-labeled black. You wouldn't get the nice curving decision boundary after retraining, as the new pseudo-labels would simply reinforce the current decision boundary.
Or to put it another way, the current labeled-only decision boundary would have perfect prediction accuracy for the unlabeled data (as that's what we used to make them). There's no driving force (no gradient) which would cause us to change the location of that decision boundary simply by adding in the pseudo-labeled data.
Am I correct in thinking that the explanation embodied by the diagram is lacking? Or is there something I'm missing? If not, what is the benefit of pseudo-labels, given the pre-retraining decision boundary has perfect accuracy over the pseudo-labels?

A: What you may be overlooking in how self-training works is that:

*

*It's iterative, not one-shot.

*You use a classifier that returns probabilistic values. At each iteration, you only add psuedo-labels for the cases your algorithm is most certain about.
In your example, perhaps the first iteration is only confident enough to label one or two points very near each of the labeled points. In the next iteration the boundary will rotate slightly to accommodate these four to six labeled points, and if it's non-linear may also begin to bend slightly. Repeat.
It's not guaranteed to work. It depends on your base classifier, your algorithm (how certain you have to be in order to assign a pseudo-label, etc), your data, and so on.
There are also other algorithms that are more powerful if you can use them. What I believe you're describing is self-training, which is easy to code up, but you're using a single classifier that's looking at the same information repeatedly. Co-training uses multiple classifiers that are each looking at different information for each point. (This is somewhat analogous to Random Forests.) There are also other semi-supervised techniques -- such as those that explicitly cluster -- though no overall "this always works and this is the winner".
IN RESPONSE to the comment: I'm not an expert in this field. We see it as very applicable to what we typically do with clients, so I'm learning and don't have all the answers.
The top hit when I search for semi-supervised learning overviews is:
Semi-Supervised Learning Literature Survey, from 2008. That's ages ago, computer-wise, but it talks about the things I've mentioned here.
I hear you that a classifier could rate unlabeled points that are  farthest from the labeled nodes with the most certainty. On the other hand, our intuitions may fool us. For example, let's consider the graphic you got from Wikipedia with the black, white, and gray nodes.
First, this is in 2D and most realistic problems will be in higher dimensions, where our intuition often misleads us. High-dimensional space acts differently in many ways -- some negative and some actually helpful.
Second, we might guess that in the first iteration the two right-most, lower-most gray points would be labeled as black, since the black labeled point is closer to them than the white labeled point. But if that happened on both sides, the vertical decision boundary would still tilt and no longer be vertical. At least in my imagination, if it were a straight line it would go down the diagonal empty space between the two originally-labeled points. It would still split the two crescents incorrectly, but it would be more aligned to the data now. Continued iteration -- particularly with a non-linear decision boundary -- might yield a better answer than we anticipate.
Third, I'm not sure that once-labeled, always-labeled is how it should actually work. Depending on how you do it and how the algorithm works, you might end up first tilting the boundary while bending it (assuming non-linear), and then some of the misclassified parts of the crescents might shift their labels.
My gut is that those three points, combined with appropriate (probably higher-dimensional) data, and appropriate classifiers can do better than a straight-up supervised with a very small number of training (labeled) samples. No guarantees, and in my experiments I've found -- I blame it on datasets that are too simple -- that semi-supervised may only marginally improve over supervised and may at times fail badly. Then again, I'm playing with two algorithms that I've created that may or may not actually be good.

A: Pseudo-labeling doesn't work on the given toy problem
Oliver et al. (2018) evaluated different semi-supervised learning algorithms. Their first figure shows how pseudo-labeling (and other methods) perform on the same toy problem as in your question (called the 'two-moons' dataset):

The plot shows the labeled and unlabeled datapoints, and the decision boundaries obtained after training a neural net using different semi-supervised learning methods. As you suspected, pseudo-labeling doesn't work well in this situation. They say that pseudo-labeling "is a simple heuristic which is widely used in practice, likely because of its simplicity and generality". But: "While intuitive, it can nevertheless produce incorrect results when the prediction function produces unhelpful targets for [the unlabeled data], as shown in fig. 1."
Why and when does pseudo-labeling work?
Pseudo-labeling was introduced by Lee (2013), so you can find more details there.
The cluster assumption
The theoretical justification Lee gave for pseudo-labeling is that it's similar to entropy regularization. Entropy regularization (Grandvalet and Bengio 2005) is another semi-supervised learning technique, which encourages the classifier to make confident predictions on unlabeled data. For example, we'd prefer an unlabeled point to be assigned a high probability of being in a particular class, rather than diffuse probabilities spread over multiple classes. The purpose is to take advantage the assumption that the data are clustered according to class (called the "cluster assumption" in semi-supervised learning). So, nearby points have the same class, and points in different classes are more widely separated, such that the true decision boundaries run through low density regions of input space.
Why pseudo-labeling might fail
Given the above, it would seem reasonable to guess that the cluster assumption is a necessary condition for pseudo-labeling to work. But, clearly it's not sufficient, as the two-moons problem above does satisfy the cluster assumption, but pseudo-labeling doesn't work. In this case, I suspect the problem is that there are very few labeled points, and the proper cluster structure can't be identified from these points. So, as Oliver et al. describe (and as you point out in your question), the resulting pseudo-labels guide the classifier toward the wrong decision boundary. Perhaps it would work given more labeled data. For example, contrast this to the MNIST case described below, where pseudo-labeling does work.
Where it works
Lee (2013) showed that pseudo-labeling can help on the MNIST dataset (with 100-3000 labeled examples). In fig. 1 of that paper, you can see that a neural net trained on 600 labeled examples (without any semi-supervised learning) can already recover cluster structure among classes. It seems that pseudo-labeling then helps refine the structure. Note that this is unlike the two-moons example, where several labeled points were not enough to learn the proper clusters.
The paper also mentions that results were unstable with only 100 labeled examples. This again supports the idea that pseudo-labeling is sensitive to the initial predictions, and that good initial predictions require a sufficient number of labeled points.
Lee also showed that unsupervised pre-training using denoising autoencoders helps further, but this appears to be a separate way of exploiting structure in the unlabeled data; unfortunately, there was no comparison to unsupervised pre-training alone (without pseudo-labeling).
Grandvalet and Bengio (2005) reported that pseudo-labeling beats supervised learning on the CIFAR-10 and SVHN datasets (with 4000 and 1000 labeled examples, respectively). As above, this is much more labeled data than the 6 labeled points in the two-moons problem.
References

*

*Grandvalet and Bengio (2005). Semi-supervised learning by entropy minimization.

*Lee (2013). Pseudo-Label: The Simple and Efficient Semi-Supervised Learning Method for Deep Neural Networks.

*Oliver et al. (2018). Realistic Evaluation of Semi-Supervised Learning Algorithms.

A: Warning, I am not an expert on this procedure. My failure to produce good results is not proof that the technique cannot be made to work. Furthermore, your image has the general description of "semi-supervised" learning, which is a broad area with a variety of techniques.
I agree with your intuition, I'm not seeing how a technique like this could work out of the box. In other words, I think you'd need a lot of effort to make it work well for a specific application, and that effort would not necessarily be helpful in other applications.
I tried two different instances, one with a banana-shaped dataset like the one in the example image, and another easier dataset with two simple normal distributed clusters. In both cases I could not improve on the initial classifier.
As a small attempt to encourage things, I added noise to all predicted probabilities with the hope that this would cause better outcomes.
The first example I re-created the above image as faithfully as I could. I don't think psuedo-labeling will be able to help at all here.

The second example is much easier, but even here it fails to improve on the initial classifier. I specifically chose the one labeled point from the center of the left class, and the right side of the right class hoping it would shift in the correct direction, no such luck.

Code for example 1 (example 2 is similar enough that I won't duplicate here):
import numpy as np
from sklearn.ensemble import RandomForestClassifier
import matplotlib.pyplot as plt
import seaborn

np.random.seed(2018-10-1)
N = 1000

_x = np.linspace(0, np.pi, num=N)
x0 = np.array([_x, np.sin(_x)]).T
x1 = -1 * x0 + [np.pi / 2, 0]

scale = 0.15
x0 += np.random.normal(scale=scale, size=(N, 2))
x1 += np.random.normal(scale=scale, size=(N, 2))

X = np.vstack([x0, x1])

proto_0 = np.array([[0], [0]]).T # the single "labeled" 0
proto_1 = np.array([[np.pi / 2], [0]]).T # the single "labeled" 1

model = RandomForestClassifier()
model.fit(np.vstack([proto_0, proto_1]), np.array([0, 1]))
for itercount in range(100):
    labels = model.predict_proba(X)[:, 0]
    labels += (np.random.random(labels.size) - 0.5) / 10 # add some noise
    labels = labels > 0.5
    model = RandomForestClassifier()
    model.fit(X, labels)

f, axs = plt.subplots(1, 2, squeeze=True, figsize=(10, 5))

axs[0].plot(x0[:, 0], x0[:, 1], '.', alpha=0.25, label='unlabeled x0')
axs[0].plot(proto_0[:, 0], proto_0[:, 1], 'o', color='royalblue', markersize=10, label='labeled x0')
axs[0].plot(x1[:, 0], x1[:, 1], '.', alpha=0.25, label='unlabeled x1')
axs[0].plot(proto_1[:, 0], proto_1[:, 1], 'o', color='coral', markersize=10, label='labeled x1')
axs[0].legend()

axs[1].plot(X[~labels, 0], X[~labels, 1], '.', alpha=0.25, label='predicted class 0')
axs[1].plot(X[labels, 0], X[labels, 1], '.', alpha=0.25, label='predicted class 1')
axs[1].plot([np.pi / 4] * 2, [-1.5, 1.5], 'k--', label='halfway between labeled data')
axs[1].legend()
plt.show()

A: Here is my guess (I do not know much about this topic either, just wanted to add my two cents to this discussion).
I think that you're right, there's no point in training a classical model and using its predictions as data, because as you say, there's no incentive to the optimiser to do any better. I would guess that randomised-starting algorithms are more likely to find the same optimum  because they'd be "more sure" that the previously found optimum is correct, due to the larger data set, but this is irrelevant.
That said, the first answer you received has a point - that example on Wikipedia talks about clustering, and I think that makes all the difference. When you've got unlabelled data, you essentially have a bunch of unlabelled points lying on some shared "latent feature space" as the other labelled ones. You can only really do better than a classification algorithm trained on the labelled data, if you can uncover the fact that the unlabelled points can be separated and then classified based on what class the labelled points belong to, on this latent feature space.
What I mean is, you need to do this:
$$labelled\;data \rightarrow clustering \rightarrow classification$$
... and then repeat with unlabelled data. Here, the learned cluster boundaries will not be the same, because clustering doesn't care for class labels, all it accounts for is transforming the feature space. The clustering generates a latent feature space, on which the classification boundary is learned, and this depends only on labelled data.
Algorithms that do not perform any sort of clustering, I believe, will not be able to change their optimum based on the unlabelled data set.
By the way, the image that you linked does a fair job I think of explaining what's going on here; a decision boundary is learned based solely on the clustering algorithm. You have no idea what the correct classes are here - it may be the case that they're all random - we don't know. All we can now is that there seems to be some structure in the feature space, and there seems to be some mapping from the feature space to the class labels.
Don't really have references but on this Reddit post, as I understand it, there's a discussion about a GAN performing semi-supervised learning. It is a hunch of mine that it implicitly performs a clustering, followed by classification.


text:
Q: JBoss EAP 6.2 - JSF2.1 - Error reading faces-config.xml file from jars I am trying to run JSF2.1 Web Application with JBoss EAP 6.2. But in logs i am getting below error due to which JSF annotations(ex @ManagedBean, JSF Converters, JSF Validators) in jars are not working.
Unable to process annotations for url,
vfs:/jboss-eap-6.2/standalone/deployments/my_appl.war/WEB-INF/lib/primefaces-3.5.jar/META-INF/faces-config.xml.
Reason: java.util.zip.ZipException: error in opening zip file

I have below structure in my application.
WebApp

*

*JSF Managed Beans - (They are working with annotations)

*WEB-INF/faces-config.xml

*my_jar.jar

*
*

*JSF Managed Beans - (They are not working with annotations)

*
*

*META-INF/faces-config.xml

Will really appreciate any help on this.
Things which I have tried so far
Adding below in my web.xml
<context-param>
     <param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name>
     <param-value>true</param-value>
</context-param>

Running my application in JBoss EAP 6.1


text:
Q: Angular >2 Dynamic object key causing template parse error When trying to place a value for a key, with a variable inside of my event binding expression, I am given a template parse error: Parser Error: Unexpected token [, expected identifier, keyword, or string at column...
my expression is:
(ngModelChange)="action.emit({type: 'CACHE_SELECTED_COMPANY', payload: { [selectedCompany.id]:{selected: true, details: false}}})"
I thought that providing a variable name for a key in [square brackets] was allowed, and my question is, should I be able to provide a variable as a key in an Angular 2 template's, event binding expression?

A: Computed properties are currently not supported in templates.
Template may be refactored to not use computed properties:
(ngModelChange)="action.emit({type: 'CACHE_SELECTED_COMPANY', payload: getPayload(selectedCompany.id})"

Or entire action.emit(...) may be moved to model change callback.


text:
Q: Make an image fit specific dimensions OK, what I need should be pretty easy for anyone having played with that before, so here we are :

*

*I have images of various dimensions

*The images resolution is high

*I want to make them "fit" into - e.g. 150x200px - blocks (of specific dimensions)

*The images should not : be stretched, leave white margins around the image (in case of resizing etc)

So, basically, I'm looking for a plugin (preferably jquery), to automatically resize images (based on some class?) and do the trick.
Any ideas?

A: NailThumb is what you need buddy
http://www.garralab.com/nailthumb.php
Happy Coding :)

A: Show it as a background-image and include this in your CSS style sheet:
 background-size: contain;

https://developer.mozilla.org/en-US/docs/CSS/Scaling_background_images
Although it is CSS3, It would be the option I would go with.
http://www.w3schools.com/cssref/css3_pr_background-size.asp

A: Just for fun, as I'm learning JS, I thought I'd see if I could write some code for this. It seems to work, no matter what the dimensions of the div. Not sure how good the JS is, but I thought I'd post it anyhow:
<!DOCTYPE html>

<meta charset="utf-8">


text:
Q: Skip the last data in a php if statement I want to print and add a character between them (e.g. *) if the id is a specific one (e.g. 3) but I don't want it to be added after the last data.
I have this code:
<?php
foreach ($attribute_group['attribute'] as $attribute) {

if ($attribute_group['attribute_group_id'] == '3') {

    echo implode(' * ', $attribute['name'] . $attribute['text']);
    }

    else

    echo ($attribute['name'] . $attribute['text']);
    }

?>
The out put now comes as follows:
Attribute 1 * Attribute 2 * Attribute 3 *

I want it like:
Attribute 1 * Attribute 2 * Attribute 3

A: Just remove the last character:
$string = "Attribute 1 * Attribute 2 * Attribute 3 *";
echo rtrim($string, "*");

A: You also can try like this by rtrim():
Demo : https://eval.in/103723
$data =  array(
        '1' => 'Attribute 1',
        '2' => 'Attribute 2',
        '3' => 'Attribute 3',
        '4' => 'Attribute 4',
        '5' => 'Attribute 5'
    );

    $strOutput="";
    foreach ($data as $d){
     $strOutput .= $d." * ";

    }

    echo rtrim($strOutput," * ");


text:
Q: Totally Blank Unity / Microsoft Store Build fails WACK tests I have been trying to get a successful build for my game in Unity 2018.2.1f1 and Visual Studio 2017 15.8.0.
After trying unsuccessfully to get a successful build / package / WACK for the windows store with all/every different configuration,  I tried a totally blank default Unity, UWP platform app, generated a visual studio project. generated some icons, associated it with an app I had in the store. Built it, packaged it and run the WACK tests.

FAILED
Supported APIs
Error Found: The supported APIs test detected the following errors:
          API ExecuteAssembly in uwphost.dll is not supported for this application type. WinTest2.exe calls this API.
          API DllGetActivationFactory in uwphost.dll is not supported for this application type. WinTest2.exe has an export that forwards to this API.
      Impact if not fixed: Using an API that is not part of the Windows SDK for Microsoft Store apps violates the Microsoft Store certification requirements.
      How to fix: Review the error messages to identify the API that is not part of the Windows SDK for Microsoft Store apps. Please note, apps that are built in a debug configuration or without .NET Native enabled (where applicable) can fail this test as these environments may pull in unsupported APIs. Retest your app in a release configuration, and with .NET Native enabled if applicable. See the link below for more information:

What do I have to do to make a successful app build that I can actually get into the store. (What configuration, what unity / visual studio versions.) I have tried later versions of unity 2018.2.1 and 2018.2.2 (i think) and could not get a successful build out of them.
A while ago, i could not get a successful build out of Unity, so I reinstalled Win 10 Pro, Unity and Visual Studio. Still problems persist.

A: Thanks to StormBringerStudios I received an answer that works.

"Just Got Visual Studio 2017 15.7.6 version. works like a charm.
So here is my Solution is anyone will search this kind of problem DONT USE VS 2017 15.8.X.
Downgrade to 15.7.6 and you will be good :)
Microsoft certification also passed."


text:
Q: Can a file both be an executable (EXE) and a dynamic-link library (DLL) at the same time? Is it possible for a file to be both an executable (EXE) and a dynamic-link library (DLL) at the same time?
(I.e. it can be executed as an EXE and loaded at run-time as a shared library.)
I can't see why it shouldn't be possible, but maybe someone can give an explanation?

A: From LoadLibrary documentation:

The name of the module. This can be either a library module (a .dll file) or an executable module (an .exe file). The name specified is the file name of the module and is not related to the name stored in the library module itself, as specified by the LIBRARY keyword in the module-definition (.def) file.

EDIT: I expected downvotes when I wrote this answer. I know many people think it is not possible (SO questions and answers from comments confirm it). But for those who are interested I can provide POC (or simply look at well known "process explorer" sources)
Note that if you need to export symbols from module you need to use those EXPORT statements in .def file. Then you can use GetProcAddress
Actually, I see that this SO question, also mentioned in comments, has answer that points to article "Load EXE as DLL: Mission Possible", which I also was going to quote. That answer is not accepted, accepted answer says "no" and even is taken as community wiki. Well "SO doesn't claim to be (in part) a library reference"

A: In the official PE documentation, IMAGE_FILE_EXECUTABLE_IMAGE (0x002) and IMAGE_FILE_DLL (0x2000) are both flags of the Characteristics field of the PE-header.
As seen in the IMAGE_FILE_DLL (0x2000):

The image file is a dynamic-link library (DLL). Such files are
  considered executable files for almost all purposes, although they
  cannot be directly run.

However, for IMAGE_FILE_EXECUTABLE_IMAGE (0x002):

Image only. This indicates that the image file is valid and can be
  run. If this flag is not set, it indicates a linker error.

Since, the DLL cannot be directly run, it may not have the IMAGE_FILE_EXECUTABLE_IMAGE (0x002) flag set.
I guess, that these flags OR'd toghether would result in an error at load time, but I'm not sure.


text:
Q: How to log out user and How to check user verify mail I got the following problem.
When user register he will be on a page, where I show a message like check your Email account. And when user check his account and confirm his mail he automatically get to homepage. So far so good. But when user press register button an get mail and reload the page he get also inside homepage without confirm his mail.
I trie this
Future<String> signIN(String email, String password) async {

    try {

      UserCredential result =await FirebaseAuth.instance.signInWithEmailAndPassword(
        email: email.trim(),
        password: password,
      );
      User user = result.user;

      if(user.emailVerified){
        return user.uid;
      }

    } on FirebaseAuthException catch (e) {

but not working.
here's my verify email page
import 'dart:async';

import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:projectandroidstudiodenya/seitenleiste/homepage.dart';

class VerifyScreen extends StatefulWidget {
  @override
  _VerifyScreenState createState() => _VerifyScreenState();
}

class _VerifyScreenState extends State<VerifyScreen> {
  final auth= FirebaseAuth.instance;
  User user;
  Timer timer;

  @override
  void initState() {
    user= auth.currentUser;
    user.sendEmailVerification();
    timer= Timer.periodic(Duration(seconds: 5), (timer) {
      checkEmailverifyed();

    });
    super.initState();
  }
  @override
  void dispose() {
timer.cancel();
super.dispose();
  }

  @override
  Widget build(BuildContext context) {

    return Scaffold(
      body:Center(

      )
    );
  }

  Future<void> checkEmailverifyed() async{
    user=auth.currentUser;
    await user.reload();
    if(user.emailVerified){
      timer.cancel();
      Navigator.of(context).
      pushReplacement(MaterialPageRoute(builder:(context)=> Homepage()));
    }

  }
}

Maybe anyone can help.
And also when user press logout button  nothing happened. but when user restart the app he logged out.
here's my logout pressed method:
  onPressed: ()  {
                              FirebaseAuth.instance.signOut();
                              FirebaseAuth.instance.signOut();Navigator.pushNamedAndRemoveUntil(context, LoginScreen.route, (route) => false);

Heres the error of the sign out:
D/FirebaseAuth(26776): Notifying id token listeners about a sign-out event.
D/FirebaseAuth(26776): Notifying auth state listeners about a sign-out event.
E/flutter (26776): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: Could not find a generator for route RouteSettings("SignIn", null) in the _WidgetsAppState.
E/flutter (26776): Make sure your root app widget has provided a way to generate
E/flutter (26776): this route.
E/flutter (26776): Generators for routes are searched for in the following order:
E/flutter (26776):  1. For the "/" route, the "home" property, if non-null, is used.
E/flutter (26776):  2. Otherwise, the "routes" table is used, if it has an entry for the route.
E/flutter (26776):  3. Otherwise, onGenerateRoute is called. It should return a non-null value for any valid route not handled by "home" and "routes".
E/flutter (26776):  4. Finally if all else fails onUnknownRoute is called.
E/flutter (26776): Unfortunately, onUnknownRoute was not set.
E/flutter (26776): #0      _WidgetsAppState._onUnknownRoute.<anonymous closure> (package:flutter/src/widgets/app.dart:1219:9)
E/flutter (26776): #1      _WidgetsAppState._onUnknownRoute (package:flutter/src/widgets/app.dart:1234:6)
E/flutter (26776): #2      NavigatorState._routeNamed (package:flutter/src/widgets/navigator.dart:4148:37)
E/flutter (26776): #3      NavigatorState.pushNamedAndRemoveUntil (package:flutter/src/widgets/navigator.dart:4391:34)
E/flutter (26776): #4      Navigator.pushNamedAndRemoveUntil (package:flutter/src/widgets/navigator.dart:2042:34)
E/flutter (26776): #5      _openSignOutDrawer.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:projectandroidstudiodenya/seitenleiste/seitenleiste.dart:188:90)
E/flutter (26776): #6      _rootRunUnary (dart:async/zone.dart:1362:47)
E/flutter (26776): #7      _CustomZone.runUnary (dart:async/zone.dart:1265:19)
E/flutter (26776): <asynchronous suspension>
E/flutter (26776):

And the error of the sig in:
E/flutter (26776): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: NoSuchMethodError: The getter 'emailVerified' was called on null.
E/flutter (26776): Receiver: null
E/flutter (26776): Tried calling: emailVerified
E/flutter (26776): #0      Object.noSuchMethod (dart:core-patch/object_patch.dart:54:5)
E/flutter (26776): #1      AuthService.signIN (package:projectandroidstudiodenya/services/auth.dart:44:44)
E/flutter (26776): #2      _LoginScreenState._buildLoginBtn.<anonymous closure> (package:projectandroidstudiodenya/authenticate/signin.dart:170:48)
E/flutter (26776): #3      _LoginScreenState._buildLoginBtn.<anonymous closure> (package:projectandroidstudiodenya/authenticate/signin.dart:168:24)
E/flutter (26776): #4      _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:994:20)
E/flutter (26776): #5      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:182:24)
E/flutter (26776): #6      TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:607:11)
E/flutter (26776): #7      BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:296:5)
E/flutter (26776): #8      BaseTapGestureRecognizer.acceptGesture (package:flutter/src/gestures/tap.dart:267:7)
E/flutter (26776): #9      GestureArenaManager.sweep (package:flutter/src/gestures/arena.dart:157:27)
E/flutter (26776): #10     GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:443:20)
E/flutter (26776): #11     GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:419:22)
E/flutter (26776): #12     RendererBinding.dispatchEvent (package:flutter/src/rendering/binding.dart:288:11)
E/flutter (26776): #13     GestureBinding._handlePointerEventImmediately (package:flutter/src/gestures/binding.dart:374:7)
E/flutter (26776): #14     GestureBinding.handlePointerEvent (package:flutter/src/gestures/binding.dart:338:5)
E/flutter (26776): #15     GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:296:7)
E/flutter (26776): #16     GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:279:7)
E/flutter (26776): #17     _rootRunUnary (dart:async/zone.dart:1370:13)
E/flutter (26776): #18     _CustomZone.runUnary (dart:async/zone.dart:1265:19)
E/flutter (26776): #19     _CustomZone.runUnaryGuarded (dart:async/zone.dart:1170:7)
E/flutter (26776): #20     _invoke1 (dart:ui/hooks.dart:186:10)
E/flutter (26776): #21     PlatformDispatcher._dispatchPointerDataPacket (dart:ui/platform_dispatcher.dart:282:7)
E/flutter (26776): #22     _dispatchPointerDataPacket (dart:ui/hooks.dart:96:31)
E/flutter (26776):

My sig in method looks like that:
Future<String> signIN(String email, String password) async {

 try {
      if(FirebaseAuth.instance.currentUser.emailVerified) {
        ( await _auth.signInWithEmailAndPassword(
          email: email.trim(), password: password,)).user;

        // User user = result.user;
      }

    } on FirebaseAuthException catch (e) {
      switch (e.code) {
        case 'invalid-email':
          {
            return 'Email is not valid';
          }
        case 'user-disabled':
          {
            return 'Account is not active';
          }
        case 'user-not-found':
          {
            return 'No user found';
          }
        case 'wrong-password':
          {
            return 'wrong password';
          }
        default:
          {
            return 'Unexpected error!';
          }
      }
    }
    return null;

  }

It looks different because I changed it like it was before that so I can check if maybe it was on the changes it do because it runs at this point.

A: You should check email verification within you're sign-in method, and if the email was verified then return instance.signInWithEmailAndPassword.
full code:
Future<String> signIN(String email, String password) async {

 try {
      if(FirebaseAuth.instance.currentUser.emailVerified) {
        ( await _auth.signInWithEmailAndPassword(
          email: email.trim(), password: password,)).user;
        return "success";
        // User user = result.user;
      }

    } on FirebaseAuthException catch (e) {
      switch (e.code) {
        case 'invalid-email':
          {
            return 'Email is not valid';
          }
        case 'user-disabled':
          {
            return 'Account is not active';
          }
        case 'user-not-found':
          {
            return 'No user found';
          }
        case 'wrong-password':
          {
            return 'wrong password';
          }
        default:
          {
            return 'Unexpected error!';
          }
      }
    }
    return return "error";;

  }

so every moment when signIN calling it would check email verification and if it verified it would work if it isn't it will return "error" or other problem variants, and you can listen to response so when it gives you an error you should return a snackBar, if it returns "success" then you would navigate.
Solution of logout issue:
onPressed: ()  {
 FirebaseAuth.instance.signOut().then((){
   Navigator.pushNamedAndRemoveUntil(context, LoginScreen.route (route) => false);
});


text:
Q: Can't convert HttpResponseMessage with UTF8 encoding I'm struggling with the usual conversion issue, but unfortunately I haven't been able to find anything for my specific problem.
My app is receiving a System.Net.Http.HttpResponseMessage, from a php server, UTF8 encoded, containing some characters like \u00c3\u00a0 (à) and I'm not able to convert them.
string message = await result.Content.ReadAsStringAsync();
byte[] messageBytes = Encoding.UTF8.GetBytes(message);
string newmessage = Encoding.UTF8.GetString(messageBytes, 0, messageBytes.Length);

This is just one of my try, but nothing happens, the resultring string still has the \u00c3\u00a0 characters.
I have also read some answers like How to convert a UTF-8 string into Unicode? but this solution doesn't work for me. This is the solution code:
public static string DecodeFromUtf8(this string utf8String)
{
   // copy the string as UTF-8 bytes.
   byte[] utf8Bytes = new byte[utf8String.Length];
   for (int i=0;i<utf8String.Length;++i) {
      //Debug.Assert( 0 <= utf8String[i] && utf8String[i] <= 255, "the char must be in byte's range");
      utf8Bytes[i] = (byte)utf8String[i];
   }

   return Encoding.UTF8.GetString(utf8Bytes,0,utf8Bytes.Length);
}

DecodeFromUtf8("d\u00C3\u00A9j\u00C3\u00A0"); // déjà

I have noticed that when I try the above solution with a simple string like
string str = "Comunit\u00c3\u00a0"

the DecodeFromUtf8 method works perfectly, the problem is when I use my response message.
Any advice would be very appreciated

A: I've solved this problem by myself. I've discovered that the server response was a ISO string of a utf-8 json, so I had to remove the json escape characters and then convert the iso into a utf8
So I had to do the following:
private async Task<string> ResponseMessageAsync(HttpResponseMessage result)
{
    string message = await result.Content.ReadAsStringAsync();
    string parsedString = Regex.Unescape(message);
    byte[] isoBites = Encoding.GetEncoding("ISO-8859-1").GetBytes(parsedString);
    return Encoding.UTF8.GetString(isoBites, 0, isoBites.Length);
 }

A: for me works change from:
string message = await result.Content.ReadAsStringAsync();
byte[] messageBytes = Encoding.UTF8.GetBytes(message);
string newmessage = Encoding.UTF8.GetString(messageBytes, 0, messageBytes.Length);

to:
byte[] bytes = await result.Content.ReadAsByteArrayAsync();
Encoding utf8 = Encoding.UTF8;
string newmessage = utf8.GetString(bytes);


text:
Q: Event Handlers SP 2007 I am trying to add an event receiver for a custom list(sp 2007) using WSP Builder and VS 2008.
Are there any links which will guide me mapping the event handler to the specific list!.
I can  add event hanlder but I do not know how to map the event handler to a list in SP 2007.
Thank you

A: Checkout this post: Registering an event handler for a single list
It has several good examples of registering an event handler on a specific list.

A: There are a lot of options.
Are you creating a custom content type for some related purpose? You can specify an event receiver to operate on your custom content type while you're making the definition.
Are you creating a custom list template instance? You can give the type a custom id and bind your event receiver to lists of that id.
A feature receiver can execute code for you when you Activate or Deactivate the feature. You can pick the list (based on name, type, url, whatever) at this time. Use the web.config to hold values if necessary.
Use any of the tools mentioned in the related post pointed out by KodeKreacher which range from custom console app to available tools you can get from the web. Keep in mind all of these tools (that I can see) require the code to be run on the SharePoint server. Your admin might want a heads up on what you plan to do so s/he can appropriately try to roadblock you.


text:
Q: Font with an ant as a symbol Do you know of some font which has an ant as a character?  (I need it in a document I'm preparing in plain tex that is to be processed by pdftex.)

A: It's not the answer about the ant font, but how to load the external image with \pdfximage, query its dimensions with \pdfrefximage and use it finally with \pdflastximage, all in a box, then unbox it (see pdftex manual for this)
\setbox0=\hbox{\pdfximage{beeduck.jpg}\pdfrefximage\pdflastximage}
\unhbox0
\bye


text:
Q: Unable to run Headless Chrome Browser on Linux Machine using Selenium Webdriver java Used Selenium Webdriver(V2.29), selenium-api version(3.4.0), Chrome
Version (62.0.3202.94) 64 bit and tried to run chrome browser in linux machine with the below code.
    WebDriver driver;
    String chromeBinaryPath = "/data/Package/CHROME_NEW";
    String driverPath = "/data/Package/Selenium/WebDrivers/ChromeDrivers/chromedriver_linux32/chromedriver";

    System.setProperty("webdriver.chrome.driver", driverPath);
    System.setProperty("webdriver.chrome.verboseLogging","true");
    System.setProperty("webdriver.chrome.logfile","/data/Package/log/chromedriver.log");

    ChromeOptions optionsLinux64 = new ChromeOptions();

    optionsLinux64.setBinary(chromeBinaryPath);
    optionsLinux64.addArguments("--headless");
    optionsLinux64.addArguments("--no-sandbox");
    optionsLinux64.addArguments("--disable-gpu");
    optionsLinux64.addArguments("--headless");

    driver = new ChromeDriver(optionsLinux64);

When tried to create a chrome session, getting below exception:

unknown error: Chrome failed to start: exited abnormally (Driver info: chromedriver=2.29.461571 (8a88bbe0775e2a23afda0ceaf2ef7ee74e822cc5),platform=Linux 3.10.0-693.5.2.el7.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 60.10 seconds Build info: version: '3.4.0', revision: 'unknown', time: 'unknown' System info: host: 'el4014.bc', ip: '10.120.94.70', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-693.5.2.el7.x86_64', java.version: '1.8.0_151' Driver info: driver.version: ChromeDriver

Installed Chrome at /data/Package/CHROME_NEW folder using rpm file.
Message in chromedriver.log:

[0.204][DEBUG]: DevTools request: http://localhost:12111/json/version
  LaunchProcess: failed to execvp:
  /data/Package/CHROME_NEW/
  [0.379][DEBUG]: DevTools request failed

Can anyone help me in resolving with the above issue.

A: This should be work:
ChromeOptions options = new ChromeOptions();
options.setHeadless(true);

A: Try adding window size
    optionsLinux64.addArguments("window-size=1024x780");


text:
Q: File type icon in a visual studio tab? Is there a way to view file type icons in a visual studio tab?  It displays them in the little drop down menu (upper right arrow of an editor), but not in the tabs.  Is this a feature?
Personally I would hide the extension and show the icon.

A: I don't think this possible with the normal install but there is a tabs groups add-on called Tabs Studio which provides extra functionality.


text:
Q: What is androidx.browser and how to resolve this error Task :app:checkDebugAarMetadata FAILED? Configuration on demand is an incubating feature.

Task :app:checkDebugAarMetadata FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.7.1/userguide/command_line_interface.html#sec:command_line_warnings
43 actionable tasks: 2 executed, 41 up-to-date
FAILURE: Build failed with an exception.

*

*What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.

A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
The minCompileSdk (33) specified in a
dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
is greater than this module's compileSdkVersion (android-31).
Dependency: androidx.browser:browser:1.5.0-alpha01.
AAR metadata file: C:\Users\akshay.patel.gradle\caches\transforms-2\files-2.1\41677513f37fd3ff659f9e9ccebf1218\browser-1.5.0-alpha01\META-INF\com\android\build\gradle\aar-metadata.properties.

*

*Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

*Get more help at https://help.gradle.org
BUILD FAILED in 28s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8088
FAILURE: Build failed with an exception.

*

*What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.

A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
The minCompileSdk (33) specified in a
dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
is greater than this module's compileSdkVersion (android-31).
Dependency: androidx.browser:browser:1.5.0-alpha01.
AAR metadata file: C:\Users\akshay.patel.gradle\caches\transforms-2\files-2.1\41677513f37fd3ff659f9e9ccebf1218\browser-1.5.0-alpha01\META-INF\com\android\build\gradle\aar-metadata.properties.

*

*Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

*Get more help at https://help.gradle.org
BUILD FAILED in 28s
at makeError (D:\User\mobile\node_modules\execa\index.js:174:9)
at D:\User\mobile\node_modules\execa\index.js:278:16
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async runOnAllDevices (D:\\mobile\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
at async Command.handleAction (D:\User\mobile\node_modules\react-native\node_modules\@react-native-community\cli\build\index.js:142:9)

info Run CLI with --verbose flag for more details.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! xyz@0.0.1 dev-local: npx react-native run-android --port=8088
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the xyz@0.0.1 dev-local script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\akshay.patel\AppData\Roaming\npm-cache_logs\2022-11-03T08_05_27_690Z-debug.log
Yes I tried updating my build.gradle by
android {
    compileSdk = "33"

    defaultConfig {
        targetSdk = "33"
    }
}

but I still get the same error
please help Thanks in advance

A: I got the root cause of the above problem that androidx.browser so I have resolved this by adding the below code snippet in android/app/build.gradle file
configurations.all {
        resolutionStrategy { force 'androidx.browser:browser:1.4.0' }
    }


text:
Q: MapView not showing - Objective C I'm trying to get the map view in my app by creating it dynamically but the map view is just showing the pale yellow coloured view. I imported the MKMapView and CoreLocation frameworks. Here is my code, please help me to solve this issue. Thanks in Advance!!
MKMapView *map_view;
    map_view = [[MKMapView alloc] initWithFrame:frame];
    map_view.showsUserLocation = YES;
    map_view.mapType = MKMapTypeHybrid;
map_view.delegate = self;
    [_scrollView addSubview:map_view];

A: I think you are not friendly with MkMapView, How to use MkMapView

A: in .h file you can insert following
@interface YourViewController : UIViewController <MKMapViewDelegate>
{

    IBOutlet MKMapView *mapview;
}

@property(nonatomic, retain) IBOutlet MKMapView *mapview;

in .m file you can insert following
@implementation YourViewController

@synthesize mapview;

-(void)ViewDidLoad
{
    mapview.mapType=MKMapTypeStandard;
    mapview.showsUserLocation = YES;
    mapview.delegate=self;
}


text:
Q: Firefox Addon: Sending data from main.js to dev tool tab I am trying to implement an addon that will intercept the HTTP response and then log it on to dev tool tab similar to the way XHRs are logged into web console.
Addon code has following files:
data/index.html
lib/main.js

I have defined devtoolTabDefinition :
devtoolTabDefinition = {
    id: "logger",
    ordinal: 3,
    icon: "chrome://browser/skin/devtools/inspector-icon.png",
    url: self.data.url("index.html"),
    label: "HRRL",
    tooltip: "HTTP Request Response Logger",
    // Rest of the code

I have registered an observer,HttpResponseListener from Ci.nsIObserverService to observe "http-on-examine-response". HttpResponseListener intercepts the responses and I get the response string in it's onDataAvailable method.
I need to send rather add this response string to the dev tool tab's index.html.
AFAIK I don't have to use content script because I have nothing to do with the main page window. I just need to intercept the response and log it in dev tool tab.
Thanks in advance.

A: If you look at the example, the communications channel is set up in the build method, which you don't show in your code. You can see a working example of this approach here:
https://github.com/canuckistani/jetpack-devtools-template/blob/master/lib/main.js#L42-L51
*Aside: starting with Firefox 34 (now in nightly) there will be new devtools apis to make this all easier, for a really simple example see here.


text: Q: Oculus Quest: Recording Video within the Oculus Quest I'm working on a VR application (in Unity) for the Quest that one of its features is to be able to record yourself from a camera. I have tried some assets like VR capture (by RockVR), but they only work on certain platforms such as Windows or macOS. I have also tried capturing frames and then converting them to a .gif or .mp4 file but that also requires a platform-specific library. Does anyone have a solution?


text:
Q: retweeting by twitter.com/intent/retweet vs twitter4j I want to add retweet button to my website and I have two option:
I can create application in twitter and go through all steps and when user click retweet he should first authorize my app then after his authorization I can use twitter4j to retweet on his account
BUT:
the simpler way is to use this the following:
<a href='https://twitter.com/intent/retweet?tweet_id=111111111<

which works perfectly. the thing that I am wondering now what is the different between the two. When I can use the second approach which is easier why should I use the first  approach? is there any advantage that the first approach  has and the second does not have?

A: Difference is in User Interaction:
API:
Retweet is an important feature, so it will be there in API. Applications built based on twitter API NEED this.
Once user authorizes the app, you can write a function which automates retweeting when the tweet contains certain words, etc. It needs no user interaction.
URL:
https://twitter.com/intent/retweet?tweet_id=111111111
https://dev.twitter.com/docs/intents#retweet-intent
This needs user interaction. Clicking this link opens a popup where user HAVE to click a button to do the required action.


text:
Q: Node.js unique identifier for client for reconnections I'm trying to build in a reconnection procedure for clients that lose connection. In the client js I can detect when connection is lost and periodically attempt to reconnect to the server. When I reconnect though the server will be using a new socket.
On the client this is my reconnect logic
var socket = io.connect(ip, {
  'reconnect': true, //will create a new socket on the server
  'reconnection delay': options.retryInterval,
  'max reconnection attempts': 10
});

socket.on("disconnect", function() {
   this.connected = false;
   this.autoretry();
});

//establish the connection - similiar to the reconnect method
socket.emit("connect", this.options);

//....
autoretry: function() {
    if(this.connected) {return;};
    var next = this.__retry *= this.options.retryScalar;
    this.socket.emit("retry", this.connect.options);
    return _.delay(this.autoretry, next, this);
}

The problem is each client has it's own tls connection to an external server and I would like to hold this connection open for a brief period; waiting to see if the client reconnects.
Is there a good way to uniquely identify the client in node or should I create the identifier on the client and pass it to the server?

A: For identifying clients you,should make socket.io work with expressjs Sessions, each session has a unique id, and uses many additional methods to identify itself to server-side, (cookies,headers..)
http://howtonode.org/socket-io-auth
also sockets have a unique id by default when the socket object is passed to callback io.on('connection',function(socket) , access by socket.id property
For identifying a client that lost connection, and script tries to reconnect, try listening for reconnect,reconnecting,reconnect_failed events.
https://github.com/LearnBoost/socket.io/wiki/Exposed-events


text: Q: How can i prevent webpack from adding source code in the sourcemap? How can i prevent webpack from adding source code in the sourcemap? I would like to be able to use a browser (for eg chrome) to specify the location of source files and souremap should just contain mapping from compiled code to source code.


text:
Q: get the size of heap array in c++ Code1:
int * a;
a=new int[222];
cout<<"the size of a is "<<sizeof(a)<<endl;

Output1:
the size of a is 8

Code2:
int * a;
a=new int[222];
cout<<"the size of a is "<<a.length()<<endl;

Output2:
error: member reference base type 'int *' is not a structure or
  union

How to get the size of a heap array? Thanks..

A: The short answer is, it can't be done, at least not in a portable manner.  You'll need to keep track of the array's size separately somehow (e.g. in an integer variable or similar).

A: Use a container instead of a raw pointer:
std::vector<int> a(222);
cout << "the size of a is " << a.size(); << endl;


text:
Q: Importing an Android phone image to an emulator Is there a way to take an image of an android system running on phone and run it on emulator?
I have a client with a certain bug on his phone and I want to be able to take a snapshot or an image of the Android and run it on the emulator to debug it freely without the need to take the phone from the client cause the problem seems to happen only on his phone.

A: You can't do what you want for a couple reasons. For one, getting the ROM image off the phone wouldn't be a trivial matter. In fact, I can't really think of a way to do it at all. Unless this is a Nexus phone or something where the manufacturer has made the images available for download, manufacturers generally don't want you mucking about with system images.
The more important reason is that the software running on a phone expects to be conntected to the physical hardware of the phone: the processor and chipset, the GPU, all the input and output devices, sensors, and so forth. The ROM image has device drivers that talk to all of that. For that image to work in an emulator, the emulator would have to emulate all of those devices well enough to fool the device drivers, which is a very complex thing, and that environment doesn't exist anywhere -- even manufacturers don't emulate their hardware to that extent when developing it. Much of that hardware and device driver environment is manufacturer-proprietary, so it would be impossible (or legally difficult) for someone other than the manufacturer to make that possible.
The Android emulator has a specific kernel image with device drivers tuned to its software emulation environment; what it's got is designed specifically for that environment. The other side of the equation is also true: you couldn't take an emulator system image and get it running on a physical device.

A: In your case, I would suggest you to upload your apk file to testfairy, then you can have the option to trace user's activity with your app, and it also have an error log that might even more useful.


text:
Q: CSS remove table tr space or margin I can't make it to 0 margin/padding.
This is the pic:

You can see the red oval is the problem.
I want to make it to 0 margin but I don't know where is the problem.
This is my HTML CODE:

This is my CSS:
.content { position: absolute; top: 0; left: 0; right: 0; }
.share table { width: 100%; border-collapse: separate; border-spacing: 0; }
.share table td { padding: 0; margin: 0; width: 25%; }

I've tried with border-collapse: collapse but didn't work as well.
And also with ul li, but gives me the same problem maybe worst.


text:
Q: Modifying HTTP Call for Scheduler to Upload Dashboard Images I have created the HTTP method using this post. But I'm unsure of how to test it out. Say if I run this in the Developer Console for testing how Can I link it to taking the image out of the Salesforce Dashboard and uploading it into the Document Folder so that the Image can be send upload else where?

I already have the URL to those Dashboard images that I want to upload

How do I link this to getting a image from Salesforce Dashboard and uploading it into the Document Folder?

Codes
public class testFBInt {

public void exInt() {

  HttpRequest req = new HttpRequest();
    req.setEndpoint('https://test.salesforce.com/services/oauth2/token');
    req.setMethod('POST');
    req.setBody(buildHttpQuery(new Map<String, String> {
        'grant_type' => 'password',
        'username' => 'username',
        'password' => 'password',
        'client_id' => 'Consumer_id',
        'client_secret' => 'Consumer_key'
         }));

 }

  static String buildHttpQuery(Map<String, String> queryParams) {
    if (queryParams.isEmpty()) {
        return '';
    }

    String[] params = new String[] {};
    for (String k : queryParams.keySet()) {
        String v = EncodingUtil.urlEncode(queryParams.get(k), 'UTF-8');

        params.add(String.format('{0}={1}', new String[] { k, v }));
    }

    return String.join(params, '&');
 }

}

A: Based on your statement

I already have the URL to those Dashboard images that I want to upload

From here, there are 3 task you talked about. All these can be done in a scheduler job.
One: Fetching the image body as base64data.
Get the access token first. Reference: Alan's answer here
Lets say your URL is in variable - dashboardImageURL.
String base64Data;
httprequest req = new httprequest();
req.setEndpoint(dashboardImageURL);
req.setmethod('GET');
req.setHeader('Authorization', 'OAuth ' + access_token);
http http = new http();
httpresponse res = http.send(req);
Blob image = res.getBodyAsBlob();
base64Data =  EncodingUtil.base64Encode(image);

Two: Saving the image as Document in current org.
Document docatt = new Document();
docatt.Name = 'Chart 1.jpg';
docatt.Body = EncodingUtil.base64Decode(base64Data);
docatt.FOLDERID = '00l6F231005tqGi'; //Your folder id
docatt.IsPublic = true;

insert docatt;

You can have a scheduler job to run at any specific time with these 2 snippets to save the image from the URL.
Three: Sending the image to Facebook.
For this you will need to make another callout to facebook with the image body set in the httprequest body. This is not a part of the question, so I am just over-lining it. You can write it in a separate scheduler if you want to send it at a different time or in the same scheduler job.


text:
Q: Hover on 1 child - hide other parents which are inside other divs - Jquery When I hover 1 child, I try to hide other parents div ( child including ) except the child hovered and its parent.

I found this very similar, but reversed, and can't find a way to make it work.
Hover on 1 child - hide other children which are inside other divs, css only
$('.dep').hover(function() {
  $(this).parent().children().not(this).find('.dim').css({'opacity' : '1'})
}, function() {
  $('.dim').css({'opacity' : '0'})
})

A: What you want to do is once you've found the .parent(), simply hide the .siblings() by setting their opacity to 0. You'll also want to show the one you're hovering over by setting the opacity to 1, as can be seen in the following:

$('.child').hover(function() {
  $(this).parent().siblings().css({
    'opacity': '0'
  })
}, function() {
  $('.parent').css({
    'opacity': '1'
  })
})

Child 1

Child 2

Child 3

Child 4