text:
Q: Does Find My Mac stop working after the system has been wiped?
Possible Duplicate:
If Macbook has been wiped, will "find my iPhone" still work?

I lost my Macbook Pro recently. I had activated iCloud on the computer, so Find My Mac is operable.
If the thief wipes the hard drive, and installs a fresh operating system, OSX Lion or Leopard, for example, then will I still be able to locate my device? In particular if the thief installs Leopard (which obviously doesn't support Find my Mac) will Find My Mac still work?

A: If the thief just wipes the harddrive, there is a slight chance that your device will still show up in Find My Mac as the association is saved in the NVRAM which persists even after a drive format.
However, if the thief or new owner clears the NVRAM in any way, or reconfigures iCloud with another account and enables Find My Mac for it, the association will be deleted or overwritten, and you will no longer be able to track your device.
See this question for more on the subject.

A: Just made a fresh test (with MacOS 10.14.4) where Find my Mac was activated. During the entire installation process I was able to send signals to the machine from iCloud.com. But at first startup/log in all connections were lost... I don't know if this is how it's supposed to work, but this is the reality. :(

A: The answer is no.  iCLoud will be deleted along with everything else.
Keep iCloud open on your current computer to make sure you get each location the device is located at.


text:
Q: p:selectonemenu onkeyup event to uppercase I am using p:selectOneMenu for displaying data. I am using filter="true" and filterMatchMode="startsWith" for filtering data:
<p:selectOneMenu id="mun" value="#{list}" converter="#{lookupConverter}"
                 filter="true" filterMatchMode="startsWith"
                 validator="#{validate}">
    <p:ajax listener="#{getAll}" update="plac"/>
    <f:selectItem itemLabel="#{msg['choose.value']}" itemValue="#{null}" noSelectionOption="true" />
    <f:selectItems value="#{municipalities}"
                   var="m"
                   itemValue="#{m}"
                   itemLabel="#{m.description}"/>
</p:selectOneMenu>

And I like when user start typing in textbox onkeyup event entered text to be upper case.
Edit:
When I say text box I mean on this red square:

A: When you inspect the page where the menu is placed, you can see that the input filter has more or less following id:
j_idt88:advanced_filter

Based on that and the fact that this input will be always suffixed with advanced_filter.. you can write your javascript code:
<script>
   document.addEventListener('DOMContentLoaded', function() {
       addAdvancedFilterActions();
   }, false);

   var addAdvancedFilterActions = function(){
         var elements = document.querySelectorAll('[id$=advanced_filter]');

        for (var key in addAdvancedFilterActions) {
           var input = addAdvancedFilterActions[key];
           input.addEventListener('keyup',function(){
                 upper(input);
              },false);
        }
   };

   var upper = function(input){
          var inputValue = input.value;
          document.writeIn(inputValue.toUpperCase())
   };

</script>

This will iterate through all inputs like this on the page and apply the upper function. Try it out

redpajama_set_name: RedPajamaStackExchange


text:
Q: Input value automatic submit in search box I have a table which i have made searchable from a JavaScript.
I have set the input valute to Stavanger, but when the page load i need to go to the input field and push enter on my keyboard to execute it.
How can the Stavanger value automaticly be executed when loading the page?
Here are an example to see my problem: https://fiddle.jshell.net/Lpn98e8f/
Regards

A: You may trigger keyup event using jQuery's trigger function:
Example:
$("#search").trigger("keyup")

Updated fiddle


text:
Q: Is there a way to make .search in tkinter not find words within words? I'm building a program which highlights certain words in the text widget as the user writes them.
Everything is working so far except that the program keeps highlighting words within words, and I don't know how to make it not do that.
from tkinter import *

root = Tk()
frame = Frame(root)
frame.grid(row=0, column=0, sticky="nsew")
root.grid_rowconfigure(0, weight=1)
root.grid_columnconfigure(0, weight=1)

textbox = Text(frame,width=100, height=10)
textbox.grid(row=1, column=7, columnspan=10)

textbox.tag_config("vegetables", foreground='green')
textbox.tag_config("fruits", foreground='red')

def search(textbox, keyword, tag):
    pos = '1.0'
    while True:
        idx = textbox.search(keyword, pos, END, nocase=True)
        if not idx:
            break
        pos = '{}+{}c'.format(idx, len(keyword))
        textbox.tag_add(tag, idx, pos)

def search2(event):
    for word in vegetables:
        search(textbox, word, "vegetables")
    for word in fruits:
        search(textbox, ordet, "fruits")

textbox.bind("<space>", search2)

frame.mainloop()

I'm using "vegetables" and "fruits" as examples here to make the function of the program more intuitive.
The problem I'm trying to fix can be illustrated by the following sentence, which shows how the program identifies a vegetable within another word which means something else:
"All I want is peace on earth"
Any help is appreciated!

A: Add the regexp=True option and use \y to match word boundaries.
def search(textbox, keyword, tag):
    pos = '1.0'
    while True:
        idx = textbox.search(fr'\y{keyword}\y', pos, END, nocase=True, regexp=True)
        if not idx:
            break
        pos = '{}+{}c'.format(idx, len(keyword))
        textbox.tag_add(tag, idx, pos)


text:
Q: now() function is not working with valueBlobFile in liquibase When insert data in mysql using liquibase insert tag like
    <insert tableName="image">
        <column name="body" valueBlobFile="image/logo.png" />
        <column name="createddt" valueDate="now()"/>
        <column name="updateddt" valueDate="now()" />
    </insert>

NULL is inserted in createddt and updateddt column. But if use same code without valueBlobFile, date is inserted properly.

A: For mysql you can use the following:
<insert tableName="image">
    <column name="body" value="LOAD_FILE(image/logo.png)" />
    <column name="createddt" value="now()"/>
    <column name="updateddt" value="now()" />
</insert>


text:
Q: Three.js move camera from a vector to another I have made a simple scene and referenced http://www.96methods.com/2011/12/three-js-moving-the-camera/ for moving a camera:
var timer = new Date().getTime() * 0.0005;
camera.position.x = Math.floor(Math.cos( timer ) * 200);
camera.position.z = Math.floor(Math.sin( timer ) * 200);

However, it only circle the camera and i found it difficult to move from one vector to another vector with a designated speed.
For example, camera point is (0,0,0), i want to move to (100,0,100), camera will face at that point and move to that point.
Any way to implement it by code or i just missed any official function? Thanks.

A: I think you'd find a lot of use here with tween.js:
new TWEEN.Tween( camera.position )
  .to( {
    x: position.x,
    y: position.y,
    z: position.z}, 2000 )
  .easing( TWEEN.Easing.Sinusoidal.EaseInOut)
  .start();

This example will move the camera to the position defined by x, y, z and take 2000 ms (2 seconds). There are a large number of transition effects included that will make your animation look very smooth.

A: Thanks for answer, in addition i found it can be solved by coding
camera.lookAt(new THREE.Vector3(moveVectors[currentIndex][0] * ((time - moveBaseTime+1)/100000) + camera.position.x * (1-((time - moveBaseTime+1)/100000)), moveVectors[currentIndex][1] * ((time - moveBaseTime+1)/100000) + camera.position.y * (1-((time - moveBaseTime+1)/100000)) , moveVectors[currentIndex][2] * ((time - moveBaseTime+1)/100000) + camera.position.z * (1-((time - moveBaseTime+1)/100000))));
camera.position.x = moveVectors[currentIndex][0] * ((time - moveBaseTime)/100000) + camera.position.x * (1-((time - moveBaseTime)/100000));
camera.position.y = moveVectors[currentIndex][1] * ((time - moveBaseTime)/100000) + camera.position.y * (1-((time - moveBaseTime)/100000));
camera.position.z = moveVectors[currentIndex][2] * ((time - moveBaseTime)/100000) + camera.position.z * (1-((time - moveBaseTime)/100000));

Where the theory is set the timer, by the time passing the timer will reach to 1. So, the equation should: CURRENT_POSITION*(1-timer) + TARGET_POSITION*timer ; as timer is increasing from 0 to 1, current position*(1-timer) will become zero, and target position*timer will be target position.


text:
Q: Show the inequality involving the product of distinct primes that divide $n$. Let $\displaystyle \omega (n)=\sum_{p\mid n} 1$ be the number of distinct primes dividing $n$. Show that
$\displaystyle \phi (n) \geq n \prod_{k=2}^{\omega (n) +1} (1 - \frac{1}{k}) = \frac{n}{\omega (n) +1}$ and that
$\displaystyle \phi (n) > \frac{cn}{\text{log } n}$ (hint: show that $2^{\omega (n)} \leq \tau (n) \leq n$.)
This is a problem on a practice sheet for a section in Leveque's Number Theory. I had another question from this sheet that said to use induction, but it turned out that the solution did not need induction. Is this problem manageable with just knowing the following? If so, I am not sure on where to start and proceed.
$\displaystyle \tau (n) = \sum_{d|n} 1$.
$\tau (p^e) = e+1$.
$\tau$ is multiplicative.
$\displaystyle \sigma (n) = \sum_{d|n} d$.
$\displaystyle \sigma (p^e) = 1+p+p^2+...+p^e = \frac{p^{e+1}-1}{p-1}$.
$\sigma$ is multiplicative.

A: First, suppose that $n = \prod\limits_{k = 1}^{ω(n)} p_k^{a_k}$, then\begin{align*}
\frac{φ(n)}{n} &= \prod_{k = 1}^{ω(n)} \left( 1 - \frac{1}{p_k} \right) \geqslant \prod_{k = 1}^{ω(n)} \left( 1 - \frac{1}{k + 1} \right) = \prod_{k = 2}^{ω(n) + 1} \left( 1 - \frac{1}{k} \right)\\
&= \prod_{k = 2}^{ω(n) + 1} \frac{k - 1}{k} = \frac{1}{ω(n) + 1},
\end{align*}
i.e.$$
φ(n) \geqslant n \prod_{k = 2}^{ω(n) + 1} \left( 1 - \frac{1}{k} \right) = \frac{n}{ω(n) + 1}.
$$
Now, because the positive divisors of $n$ are positive integers no greater than $n$, then $τ(n) \leqslant n$. Also,$$
τ(n) = \prod_{k = 1}^{ω(n)} (1 + a_k) \geqslant \prod_{k = 1}^{ω(n)} 2 = 2^{ω(n)}.
$$
Therefore,$$
φ(n) \geqslant \frac{n}{ω(n) + 1} \geqslant \frac{n}{\log_2 τ(n) + 1} \geqslant \frac{n}{\log_2 n + 1} > \frac{cn}{\ln n}.
$$


text:
Q: Prove $f$ is differentiable at $c=0$ Suppose that $|f(x)| \le x\sqrt{|x|}$  for all $x \in \mathbb{R}$.
Prove that $f$ is differentiable at $c=0$.
I believe I have to use the limit definition of a derivative but I am unsure of what f(x) is

A: You don't need to know the explicit form of $ f $. Simply observe that $ f(0) = 0 $ (which is a very direct consequence of your inequality) and that
\begin{align}
\forall h \in \mathbb{R} \setminus \{ 0 \}: \quad
      \left| \frac{f(0 + h) - f(0)}{h} \right|
& =   \left| \frac{f(h)}{h} \right| \\
&\leq \left| \frac{h \sqrt{|h|}}{h} \right| \\
& =   \sqrt{|h|}.
\end{align}
Then use the Squeeze Theorem as $ h \to 0 $.

A: We have that $f(0) = 0$ by the assumption. Then    $|\frac{f(t) - f(0)}{t}| = |\frac{f(t)}{t}| \leq |\frac{t\sqrt{|t}|}{t}| = |\sqrt{|t|}|$.  Now, the derivative is the limit as $t\to 0$, which exists.


text:
Q: PHP/MYSQL:Updated data isn't appearing on the table Using php, i created an edit option that basically lets u change the data in the record. However, after clicking on submit, the data doesn't get saved on the table nor do i get any errors.. I am quite confused. Here r my codes:

    <?php
      include('db.php');
      if (isset($_GET['Id'])) {
        $Id=$_GET['Id'];
        if (isset($_POST['submit'])) {
          $Fname=$_POST['Fname'];
          $Lname=$_POST['Lname'];
          $Age=$_POST['Age'];
          $Nationality=$_POST['Nationality'];
          $PhoneNumber=$_POST['PhoneNumber'];
          $Email=$_POST['Email'];

          $query3=mysql_query("UPDATE `students` SET `Fname`='$Fname',`Lname`='$Lname',`Age`='$Age',`Nationality`='$Nationality',`PhoneNumber`='$PhoneNumber',`Email`='$Email' WHERE `Id`='$Id'");
          if($query3) {
            header('location:index1.php');
          }
        }
        $query1=mysql_query("select * from students where Id='$Id'");
        $query2=mysql_fetch_array($query1);
      ?>
      <form method="post" action="">
        First Name:<input type="text" name="name" value="<?php echo $query2['Fname']; ?>" />

        Last Name:<input type="text" name="name" value="<?php echo $query2['Lname']; ?>" />

        Age:<input type="text" name="age" value="<?php echo $query2['Age']; ?>" />

        Nationality:<input type="text" name="name" value="<?php echo $query2['Nationality']; ?>" />

        Phone Number:<input type="text" name="name" value="<?php echo $query2['PhoneNumber']; ?>" />

        Email:<input type="text" name="name" value="<?php echo $query2['Email']; ?>" />

        <input type="submit" name="submit" value="update" />
      </form>
      <?php
    }
  ?>


text:
Q: How to replace h:commandButton with a div I want to replace all kind of buttons on my page with div as bellow:

save

I replace components onto h:commandLink and it work with most of them,
except those like this:
<h:form>
    <h:commandButton value="do it" action="#{myBean.myFirstAction()}" />
    <h:commandButton value="do that" action="#{myBean.mySecondAction()}" />
</h:form>

How to deal with it?
[edit]: a4j:commandButton is an example of component that work fine. The difference between those component is that h:commandButton ganerate input type="submit" and the rest generate input type="button".


text:
Q: Electrical conductivity of massless fermions in case of finite temperature I was asked to find conductivity $ \sigma (\omega, T) $ using methods of qft, or more exactly using Matsubara Green's function, for the following system:
qed with massless dirac fermions in case $ T \neq 0 $.
As I understand, coductivity is a linear response coefficient to applying electric field.
$$
j_i (t) = \int_0^{\infty} \sigma_{ij} (\tau, T) E_j (t - \tau) d \tau
$$
So I need to use Kubo formula:
$$
\sigma (\omega, T) = \frac{i}{\hbar} \int_{0}^{\infty} < [\hat{X}(t), \hat{Y}(0)] > e^{i \omega t} dt
$$
I think $ \hat{X} $ should be current operator:
$$
\hat{X_{\mu}} = e \bar{\psi} \gamma_{\mu} \psi
$$
I can write excitation to electromagnetic field as:
$$
\hat{H}_{ext} = i e \bar{\psi} A_{\mu} \gamma_{\mu} \psi
$$
But if I use this as $ \hat{Y} $, I will find linear response to the vector potential, not electric field. Maybe, it is still correct and I just need to recalculate conductivity from this linear response coefficient in someway? So that is the first question: what operator I should use as $ \hat{Y} $?
After that, I want to use Wick theorem to express $ <[\hat{X}(t), \hat{Y}(t)]> $ through Matsubara Green's function. Can I use free Green's function $ S(i\omega_n, p) = \frac{1}{i\omega_n \gamma_0 + \bar{p} \bar{\gamma} + i \epsilon} $, or I need to calculate first loop correction?

A: Conductivity can be written as polarization operator divided by frequency (what is known as Kubo formula). As soon as you calculate the polarization operator (one-loop diagram where the Matsubara green functions do enter) at finite T you obtain the conductivity.
Please have a look at the following papers where this very problem is solved for 2+1 dimensional fermions
https://arxiv.org/abs/1608.03261,
https://arxiv.org/abs/1111.3017
However, in the QED in 3+1 dimensions you will have infrared divergences in the calculation which have to handled somehow.
good luck,

A: This is not a simple task, and I am not certain that a complete calculation can be found in the literature.
The Kubo formula is well known (see Derivation of Ohm's Law ), and derivations can be found in many standard text books.
The retarded correlation function contains two fermion bi-linears $\bar\psi\gamma_\mu\psi$, so the leading order diagram is a one-loop graph. This graph corresponds to non-interacting electrons, and it does not contribute to the $\omega\to 0$ conductivity. Indeed, the calculation of the conductivity (even in weak coupling) requires the summation of an infinite number of diagrams, among them the set of all ladder diagrams with the (screened) Coulomb interaction.
In the case of the electron-phonon interaction the calculation can be found, for example, in Mahan's book (chapter 8 of D. Mahan, Many-Particle Physics).
In the case of a QED plasma the answer is known from solutions of the Boltzmann equation (the Boltzmann equation effectively sums an infinite set of diagrams), but I am not aware of an explicit calculation using the Kubo formula.
There are many approximate calculations using the Kubo formula. A common approximation is to compute the one-loop diagram with dressed electron propagators (which include a finite width in the fermion self energy). This will give a non-zero conductivity, controlled by the fermion quasi-particle lifetime.
P.S.: I think the calculation can be found in https://arxiv.org/abs/hep-ph/0209048


text:
Q: how to append query string based on referrer using htaccess rewrite rule Ok so i'm trying to come up with some rewrite rules in Iirf.ini and i can't quite get it.
I'm looking to check the referrer and then add something to the querystring of url you are hitting
1.so say i came from testing.lc and hit just the domain
domain.com/

2.or the domain with index.cfm
domain.com/index.cfm

3.or the domain with index.cfm and any number of query params
domain.com/index.cfm?key1=value1&key2=value2

4.or the domain with a shorturl
domain.com/login

5.or the domain with a shorturl and any number of query params
    domain.com/login?key1=value1

domain.com/page?key1=value1

So far i have something like this
RewriteCond %{HTTP_REFERER} ^http://testing\.lc/.*$
RewriteRule ^/([^?]+)(\?.*|/){0,1}$ /$1?newkey=newvalue [I,QSA]

Which appears to work on a few urls but not all of those listed above.
This rewrite cannot use [L] either as there are other matches after for the urls such as /login that need to pass the querystring.
Any help or advice greatly appreciated...


text:
Q: Perl: oo with use parent - checking if class has a parent I have some Perl objects which were built some time ago not with Moose,
but with bless, inheritance is implemented using the 'parent' pragma.
Now I would like to know whether there is a way to check whether a certain class has used 'parent' or not.
e.g. if I have two classes
package Animal;
sub new {
   my $class = shift;
   return bless {}, $class;
}
1;

and
package Cat;
use parent 'Animal';

sub new {
   my $class = shift;
   return bless {}, $class;
}
1;

would there be some check I could make to determine that the 'Cat' class
has a parent ( do not care which, but not itself ), and Animal does not, given a $foo which is either of them?

A: I can't picture why you'd ever want to know this, but it's possible using the following:
use mro;
my $inherits = @{ mro::get_linear_isa($class) } > 1;

or
my $isa = do { no strict 'refs'; \@{ $class . '::ISA' } };
my $inherits = @$isa;

Notes:

*

*All classes inherit from UNIVERSAL, but that's ignored unless a class explicitly declares it inherits from it.

*These methods don't care how the inheritance was declared (use parent or some other means).


text:
Q: What is difference in user timeline, home timeline and friends timeline in twitter4j while integration of twitter API? I was integrating twitter API in an android application and in that there is a requirement to fetch twitter timeline. So, i wanted to know about the twitter timelines.

A: Check out the Twitter API Docs. You must be using an old library though as the 'friends' timeline doesn't exist anymore; now there's home (your timeline as you see it on twitter.com) and user (the tweets on your profile).


text:
Q: I have 140 renderUI elements to create. Is there a more efficient way? I have a bit of renderUI code that created numeric input boxes and populates them from a list.
it looks like this:
  output$Small1A <- renderUI({
    numericInput("Small1A","",min = 0, max = 100, value = Reduction()$Reduction[Reduction()$Category == "Small1A"])
    })

Reduction() is a list that is preloaded with some default values or can be loaded from a file.
It looks like this
Category Reduction
Small1A  0.5
Small2A  0.5
...
Medium3D 0.5
...
Huge7E  7.4

there are 140 Elements (Small, Medium, Large, Huge) 1-7 and A-E
these are grouped on the UI as 5 collapsible boxes each with a 4x7 grid in.
 column(1, offset = 1, uiOutput("Small1A")),
 column(1, offset = 0, uiOutput("Small2A")),
(and so)

It seems like I should be able to replace the 140 renderUI statements with something neater, given the regularity of the source. How would you do this?

A: Here is an approach using lapply as suggestef in the comments. I am using some dummy data to show how you'd combine lapply with a custom numericInput function.
library(shiny)

some_values <- data.frame(Names = LETTERS[1:10], Values = seq(1, 100, 10))

make_num_in <- function(val) {
  numericInput(
    paste("in", val, sep = "_"),
    paste("in", val, sep = "_"),
    min = 0,
    max = 100,
    value = some_values[some_values$Names == val, "Values"]
  )
}

ui <- basicPage(
  column(5,
  actionButton("show1", "show 1"),
  uiOutput("box1"),
  actionButton("show2", "show 2"),
  uiOutput("box2")
  ),
  column(5,
        textOutput("input_A"),
        textOutput("input_F")
         )
)

server <- function(input, output, session) {
  observeEvent(input$show1, {
    output$box1 <-
      renderUI({
        tagList(lapply(LETTERS[1:5], make_num_in))
      })
  })

  observeEvent(input$show2, {
    output$box2 <-
      renderUI({
        tagList(lapply(LETTERS[6:10], make_num_in))
      })
  })

  output$input_A <- renderText(paste("input A is: ", input[["in_A"]]))
  output$input_F <- renderText(paste("input F is: ", input[["in_F"]]))

}

shinyApp(ui, server)


text:
Q: Star rating system : Works on only one instance I used a code for a star rating system using few bits from some sources online. The system works fine but I'm facing one issue. If there are more than one star rating instances in a page , when I click on a rating , the previous rating I set resets. It's like the CSS works only for one rating instance at a time. I want to rate multiple items but it lets me rate only one.
Here's the css:
.starRating{
  display        : inline-block;
  position       : relative;
  height         : 24px;
  background     : url('../images/stars.png') repeat-x 0 0;
  vertical-align : bottom;
}

.starRating div{
  float    : left;
  position : relative;
  height   : 24px;
}

.starRating input{
  position : relative;
  z-index  : 1;
  width    : 24px;
  height   : 24px;
  margin   : 0;
  padding  : 0;
  opacity  : 0;
}

.starRating label{
  position : absolute;
  top      : 0;
  left     : 0;
  width    : 100%;
  height   : 24px;
}

.starRating span{
  display : none;
}

.starRating       input:checked       + label,
.starRating:hover input:checked:hover + label{
  background : url('../images/stars.png') repeat-x 0 -24px;
}

.starRating:hover input:checked + label{
  background : transparent;
}

.starRating:hover input:hover + label{
  background : url('../images/stars.png') repeat-x 0 -48px;
}

And the html :

          <input id="rating1" type="radio" name="rating" value="1">
          1

        <input id="rating2" type="radio" name="rating" value="2">
        2

      <input id="rating3" type="radio" name="rating" value="3">
      3

    <input id="rating4" type="radio" name="rating" value="4">
    4

  <input id="rating5" type="radio" name="rating" value="5">
  5

A: If you are using that exact code but multiplied then its because you dont change the inputs name="" with each instance. You can only have one radio-button per name selected at the same time.
try somethin like this:

          <input id="rating1" type="radio" name="rating" value="1">
          1

        [...]

          <input id="rating1" type="radio" name="rating-two" value="1">
          1

        [...]


text:
Q: Why AsyncTask is freezing my UI? I am encoding a bitmap to base64.
after i pick the image from image picker, and set it to imageView, i convert it to base64. which i carry out on background thread.
It gives me the same feel as if i am carrying out the operation on UI thread itself. i.e. my UI freezes for 10-20 secs until the encoding is complete.
what can be done? so that my UI doesnt freezes.
where am i going wrong?
My function to display the chosen image in imageView
    private void showSelectedImage(Uri selectedImageUri) {
            blurred.setImageBitmap(null);
            imglocation = selectedImageUri.toString();
            Ion.with(this).load(selectedImageUri.toString()).asBitmap().setCallback(new FutureCallback<Bitmap>() {
                @Override
                public void onCompleted(Exception e, Bitmap result) {
                    if (e == null) {
                        blurred.setImageBitmap(result);
                        blurred.buildDrawingCache();
                        bitmap = blurred.getDrawingCache();
                        new Convert2base64().execute(bitmap);
                    }
                }
            });
    }

This is my AsyncTask
 private class Convert2base64 extends AsyncTask<Bitmap, Integer, String> {
            protected String doInBackground(Bitmap... urls) {
                ByteArrayOutputStream stream = new ByteArrayOutputStream();
                bitmap.compress(Bitmap.CompressFormat.PNG, 90, stream);
                byte[] image = stream.toByteArray();
                String img_str = Base64.encodeToString(image, 0);
                return img_str;
            }

            protected void onPostExecute(String result) {
                bio.setText("Base64 encoded String\n" + result);
            }
        }

EDIT
//blured is my imageView which is just a name rightnow. i am not carrying out the blurring task right now.
I set the image picked by image picker in the Imageview, Thats fine, in the main thread, next two lines, i.e. buildDrawingCache() and getDrawingCache() cannot be called in background thread and is only to be run in the UI thread, I dont get any error in the process, it works as intended. But since i carry the task on the background thread, i am expecting it not to freeze the UI when its converting the image in the background.

A: Remove the setText from postExecute method, if you are checking the result then rather check in logcat using Log.d("response",result);
The encoded text is a large amount of data, as Marcin correctly pointed out. That large amount you are loading back in the UI thread by calling setText. Thats what is freezing the UI and not the encoding process.

A: I don't know what the blurred view is, but I assume it's an ImageView that renders the image set to it as blurred. That blurring process is on your UI Thread, and thus causes the freeze.

A: Your code looks correct, you should profile it to find what takes so long. Ie. by using System.currentTimeMillis(). Actually, what looks strange to me is that you return this image as a string from doInBackground, this will be a very long string - and then you put it into a TextView. Maybe this is what takes so long. So first step is to comment out this setText line in onPostExecute and see if that helps.


text:
Q: Не работает класс VAO Я написал классы VAO и VBO для того, чтобы облегчить себе жизнь:
// VBO.h
class VBO
{
    GLuint id;
    GLsizeiptr size;
public:
    VBO(GLfloat* vertices, GLsizeiptr size);
    ~VBO();
    GLsizeiptr getSize();

    void bind();
    void unbind();
    void draw(GLenum mode);
};

// VBO.cpp
VBO::VBO(GLfloat* vertices, GLsizeiptr size)
{
    glGenBuffers(1, &id);
    glBindBuffer(GL_ARRAY_BUFFER, id);
    glBufferData(GL_ARRAY_BUFFER, size, vertices, GL_STATIC_DRAW);
    this->size = size;
}

GLsizeiptr VBO::getSize() {
    return size;
}

void VBO::bind() {
    glBindBuffer(GL_ARRAY_BUFFER, id);
}

void VBO::unbind() {
    glBindBuffer(GL_ARRAY_BUFFER, 0);
}

VBO::~VBO() {
    glDeleteBuffers(1, &id);
}

void VBO::draw(GLenum mode) {
    glDrawArrays(mode, 0, size);
}

// VAO.h
class VAO
{
    GLuint id;
public:
    VAO();
    ~VAO();

    void linkVBO(VBO vbo, GLuint* attrs);
    void bind();
    void unbind();
};

// VAO.cpp
VAO::VAO() {
    glGenVertexArrays(1, &id);
    bind();
}

void VAO::linkVBO(VBO vbo, GLuint* attrs)
{
    GLsizei stride = 0;
    for (GLint i = 0; attrs[i]; i++)
        stride += attrs[i];
    GLint offset = 0;
    for (GLint i = 0; attrs[i]; i++)
    {
        glVertexAttribPointer(i, attrs[i], GL_FLOAT, GL_FALSE, stride * sizeof(GLfloat), (GLvoid*)(offset * sizeof(GLfloat)));
        glEnableVertexAttribArray(i);
        offset += i;
    }
}

void VAO::bind() {
    glBindVertexArray(id);
}

void VAO::unbind() {
    glBindVertexArray(0);
}

VAO::~VAO() {
    glDeleteVertexArrays(1, &id);
}

При выполнении этого кода я получаю вращающийся квадрат:
#include <glad/glad.h>
#include "shader.h"
#include "vao.h"
#include "ebo.h"
#include "tools/stb_image.h"
#include "texture.h"
#include "window.h"
#include "camera.h"
#include <glm/gtc/matrix_transform.hpp>
#include <glm/glm.hpp>
#include <glm/gtc/type_ptr.hpp>

GLfloat vertices[] = {
        -1.0f,-1.0f, 0.0f, 0.0f, 0.0f,
        1.0f,-1.0f, 0.0f, 1.0f, 0.0f,
        -1.0f, 1.0f, 0.0f, 0.0f, 1.0f,

        1.0f,-1.0f, 0.0f, 1.0f, 0.0f,
        1.0f, 1.0f, 0.0f, 1.0f, 1.0f,
        -1.0f, 1.0f, 0.0f, 0.0f, 1.0f,
};

GLuint attrs[] = {
        3, 2, 0
};

int main()
{
    Window::init(800, 600, "Window");
    auto shader = Shader("main.vert", "main.frag");
    auto texture = Texture("img.png");
    auto camera = Camera(glm::vec3(0.0f, 0.0f, 4.0f), glm::radians(45.0f), 1000.0f);

    unsigned int vao;
    glGenVertexArrays(1, &vao);
    glBindVertexArray(vao);
    VBO vbo = VBO(vertices, sizeof(vertices));
    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (GLvoid*)(0 * sizeof(float)));
    glEnableVertexAttribArray(0);
    glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (GLvoid*)(3 * sizeof(float)));
    glEnableVertexAttribArray(1);
    vbo.unbind();
    glBindVertexArray(0);

    float rotation = 0.0f;
    double prevTime = glfwGetTime();

    glClearColor(0.07, 0.13, 0.17, 1.0);
    glEnable(GL_DEPTH_TEST);
    while (!Window::shouldClose())
    {
        Window::update();
        shader.use();

        double crntTime = glfwGetTime();
        if (crntTime - prevTime >= 1.0f / 60)
        {
            rotation += 0.5f;
            prevTime = crntTime;
        }

        shader.uniformMat4("view", camera.getView());
        shader.uniformMat4("proj", camera.getProj());
        glm::mat4 model = glm::mat4(1.0f);
        model = glm::rotate(model, glm::radians(rotation), glm::vec3(0.0f, 1.0f, 0.0f));
        shader.uniformMat4("model", model);

        texture.use(shader, "tex", 0);

        glBindVertexArray(vao);
        vbo.draw(GL_TRIANGLES);
        glBindVertexArray(0);
        Window::swapBuffers();
    }
    Window::destroy();
}

Но когда я хочу использовать класс VAO:
#include <glad/glad.h>
#include "shader.h"
#include "vao.h"
#include "ebo.h"
#include "tools/stb_image.h"
#include "texture.h"
#include "window.h"
#include "camera.h"
#include <glm/gtc/matrix_transform.hpp>
#include <glm/glm.hpp>
#include <glm/gtc/type_ptr.hpp>

GLfloat vertices[] = {
        -1.0f,-1.0f, 0.0f, 0.0f, 0.0f,
        1.0f,-1.0f, 0.0f, 1.0f, 0.0f,
        -1.0f, 1.0f, 0.0f, 0.0f, 1.0f,

        1.0f,-1.0f, 0.0f, 1.0f, 0.0f,
        1.0f, 1.0f, 0.0f, 1.0f, 1.0f,
        -1.0f, 1.0f, 0.0f, 0.0f, 1.0f,
};

GLuint attrs[] = {
        3, 2, 0
};

int main()
{
    Window::init(800, 600, "Window");
    auto shader = Shader("main.vert", "main.frag");
    auto texture = Texture("img.png");
    auto camera = Camera(glm::vec3(0.0f, 0.0f, 4.0f), glm::radians(45.0f), 1000.0f);

    VAO vao = VAO();
    VBO vbo = VBO(vertices, sizeof(vertices));
    vao.linkVBO(vbo, attrs);
    vao.unbind();
    vbo.unbind();

    float rotation = 0.0f;
    double prevTime = glfwGetTime();

    glClearColor(0.07, 0.13, 0.17, 1.0);
    glEnable(GL_DEPTH_TEST);
    while (!Window::shouldClose())
    {
        Window::update();
        shader.use();

        double crntTime = glfwGetTime();
        if (crntTime - prevTime >= 1.0f / 60)
        {
            rotation += 0.5f;
            prevTime = crntTime;
        }

        shader.uniformMat4("view", camera.getView());
        shader.uniformMat4("proj", camera.getProj());
        glm::mat4 model = glm::mat4(1.0f);
        model = glm::rotate(model, glm::radians(rotation), glm::vec3(0.0f, 1.0f, 0.0f));
        shader.uniformMat4("model", model);

        texture.use(shader, "tex", 0);
        vao.bind();
        vbo.draw(GL_TRIANGLES);
        vao.unbind();
        Window::swapBuffers();
    }
    Window::destroy();
}

Я получаю вот это:

Что я делаю не так?


text:
Q: Android apk install - Parsing package error and mount /data/data... path I am doing a small application for a private circulation so that I do not use google play to install and update the app.
In my MainActivity, I will check whether app updation found or not via an api. If any update found my app download the updated apk file into download folder on the SDCard and install by:
intent.setDataAndType(Uri.fromFile(new File(destination)), "application/vnd.android.package-archive");

it works fine, but my problem is users can get the apk file in the download folder. So that I decided to download the file into /data/data/com.xxx.aaa. This idea, download the file into the /data... path. But I could not be installed the apk file. I make sure the apk file is present into the download folder by the following code:
if(new File(destination).exists()){
  // apk file is present into download folder.
}

my method showing Parsing Error as below:

My Questions is:
How can I get install the updated apk file from the /data.... path?
I guess root privilege is the problem to install apk.
please help me.
Edited question:-
To get root access my application I run the following command:
try {
  Runtime.getRuntime().exec("su");
}

after executing this command I can list /data/data/com.xxx.aaa path. and I have verified my downloaded apk file is presented here.
To install the apk, as told in the comment I run mount command in various option but no luck. I get Parsing error as shown in the figure.
I have tried the  mount in the following ways:
1) mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
2) mount -o rw,remount -t yaffs2 /data/data.com.xxx.aaa/appinfo.apk
3) mount
4) mount /system

I do not know the right way to mount /data/data/.... path. How to mount the /data/data/.... path.
please help me.

A: To List Files From /data/app/
[1] su

[2] ls /data/app/

To get apk from "/data/app/" folder
# ls /data/app/

i am getting following apk list
com.android.vending-1.apk
com.google.android.gms-1.apk
com.noshufou.android.su-1.apk
com.corusen.accupedo.te-1.zip
com.microsoft.office.lync-1.apk
com.okythoos.android.tdmpro-1.apk
com.devindia.acr-1.apk
for example i want to get "com.android.vending-1.apk" out to /sdcard
[1] su

[2] cat /data/app/com.android.vending-1.apk > /sdcard/com.android.vending-1.apk

[3] adb pull /sdcard/com.android.vending-1.apk /path-to-your-folder/

To Run application as system app
[1] adb push your-app.apk /sdcard/

[2] adb shell

[3] su

[4] mount -o remount,rw /system

[5] cat /sdcard/your-app.apk > /system/app/your-app.apk

[6] chmod 0644 /system/app/your-app.apk

Run Command As Root User, From Your Android Code :
for example if you want to run command "chmod 0644 /system/app/your-app.apk" form root user
Example Steps :
[1] Execute From Computer
adb push your-app.apk /sdcard/

[2] Execute From Android Code
Exec_SU("mount -o remount,rw /system");
Exec_SU("cat /sdcard/your-app.apk > /system/app/your-app.apk");
Exec_SU("chmod 0644 /system/app/your-app.apk");

Here is implementation of above function "Exec_SU" :
    public static void Exec_SU(String str_command)
    {
        // working well
        Runtime runtime = Runtime.getRuntime();
        Process proc = null;
        OutputStreamWriter osw = null;
        StringBuilder sbstdOut = new StringBuilder();
        sbstdErr = new StringBuilder();

        String command=str_command;

        try {
            // Run Script
            proc = runtime.exec("su");
            osw = new OutputStreamWriter(proc.getOutputStream());
            osw.write(command);
            osw.flush();
            osw.close();
            } catch (IOException ex) {
                ex.printStackTrace();
                } finally {
                    if (osw != null) {
                        try {
                            osw.close();
                            } catch (IOException e) {
                                e.printStackTrace();
                                }
                            }
                    }
                try {
                    if (proc != null)
                        proc.waitFor();
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                        }

    }

i think this will helpful to you. Thanks.


text:
Q: How to send ctrl+d in Expect/Tcl? The following hangs after sending foo\r (ctrl+d is not triggered).
Edit: somehow, replacing \x04 by \x04\x04 works. Not sure why control character has to be sent twice…
expect {
  -re {Type foo and press enter, then ctrl\+d} {
    send "foo\r\x04"
  }
}


text:
Q: Is the conditional probability $P( S=a_i |\, T=a_i, X=x ) \le$ (or $\ge$) $ P( S=a_i |\, T=a_i )$? Let $Y$ be a positive continuous random variable (r.v.). We define $S$ as a variable that depends on the value of $Y$. If $Y \in [0,b_1]$, then $S=a_0$, If $Y \in [b_1,b_2]$, then $S=a_1$ and when $Y \in [b_2,\infty]$, then $S=a_2$. We suppose that $Y$ is a function of another r.v. $X$. We associate variable $T$ to $X$, as: If $X \in [0,b_1]$, then $T=a_0$, If $X \in [b_1,b_2]$, then $T=a_1$ and when $X \in [b_2,\infty]$, then $T=a_2$.
The conditional probability $P( S=a_i |\, T=a_i, X=x )$ represents the probability to get $S=a_i$ such that we know that $T=a_i$ and $X=x$; it's obvious that $x$ is in the interval that yields $T=a_i$.  On the other hand, $P( S=a_i |\, T=a_i )$ is the probability to get $S=a_i$ such that we (only) know that $T=a_i$.
Does the fact of knowing $X=x$ increase or decrease the probability ? In other words, is $P( S=a_i |\, T=a_i, X=x ) \le$ (or $\ge$) $ P( S=a_i |\, T=a_i )$, for $i=0,1,2$ ?

A: There's no way to tell without knowing the relationship between $X$ and $Y$. $P( S=a_i |\, T=a_i, X=x )$ is $0$ or $1$ depending on whether $X=x$ leads to $Y\in[b_1,b_2]$, whereas $P( S=a_i |\, T=a_i )$ could take some intermediate value, depending on the relationship between $X$ and $Y$.


text:
Q: Length contraction: Is it permanent? Lorentz contraction problem:
By Bertrand Boucquillon
Components of the problem:
- Bob (observer)
- 2 identical rods that both measure 1 meter. Let's call them rod X and rod Y
- Point A
- Point B
Scenario (step by step):
1) Bob is at point A, and is at rest with both rods in his hands
2) Bob throws rod X at 87% of the speed of light (.87c) at a target located at point B
3) rod X hits the target and is now at rest
4) Bob travels over to point B at walking speed, still holding rod Y in his hand
5) Bob is now at point B, at rest again, and grabs rod X from the target
6) Bob compares the length of rod X and rod Y
Question:
Is the length of rod X still the same as the length of rod Y? Please provide a detailed explanation of your answer and/or a source where the answer is explained properly.


text:
Q: Typo3 (8.7.30, composer) Extension Manager not showing up in backend I have a composer typo3 (8.7.30) project, but somehow the extension-manager does not show up.
I tried the following:

*

*./vendor/bin/typo3 extensionmanager:extension:install extensionmanager

*./vendor/bin/typo3cms extension:activate extensionmanager

*./vendor/bin/typo3cms extension:setup extensionmanager
My user has admin rights and I can see other admin tools. I also tried to create a new admin with the install tool and the new user had the same "problem".
Other modules - including custom ones - are showing up.
Any ideas on how to tackle this?
Edit: When I install the project step by step without generating the package state it's working fine, but the moment I generate package states the extension manager is missing - even though the entry in the PackageStates.php

A: One userTsConfig.ts disabled the module in the production context. I didn't check for it because the behavior was new for me. It was neither a typo3 or composer problem, just a configuration issue.

A: After installing from your composer.json, the extension manager is available.
I guess that your PackageStates.php just somehow misses the extensionmanager:
    'extensionmanager' => [
        'packagePath' => 'typo3/sysext/extensionmanager/',
    ],

If I manually remove that section, vendor/bin/typo3cms install:generatepackagestates (from the package helhum/typo3-console which you already have installed) would regenerate it.


text:
Q: 500 - Internal server error until someone logs into the server After my server boots I am unable to access any site until someone logs into the machine.  They can immediately log back out and it will continue to work until the machine is rebooted.
As a matter of fact I can't even hit the basic http://server/welcome.png until this has been done.  I cannot find any logs when this happens.


text:
Q: Symfony2 - Login check password I have a custom user provider in which I retrieve the password from a database. This password is based on a text+username.
In Symfony login_check process, I'd like that the password field equals to the input text in this password field + the input text in the username field, and not only based on the input text in the password field.
Is there a way to do that ?
In short, I'd like to force symfony to check if password defined in the User Provider equals to _password field + _username field

A: Todo that you will need to also right a custom authentication provider. You can look through the doc here to do that:
http://symfony.com/doc/current/security/custom_authentication_provider.html
Basically clone the default one and add your changes to the password checker.
You may also be able to accomplish it by doing as the custom user provider docs suggest:

If your external users have their passwords salted via a different method, then you'll need to do a bit more work so that Symfony properly encodes the password. That is beyond the scope of this entry, but would include sub-classing MessageDigestPasswordEncoder and overriding the mergePasswordAndSalt method.

http://symfony.com/doc/current/security/custom_provider.html
It seems like you may be using the username field as a salt of sorts so that may be simpler to accomplish then writing a full custom authentication


text:
Q: How do I do a "group by" in my .net DataTable I would like to implement a sql style group by for the columns in my datatabe is this possible?
c#, .net 2.0

A: Use the DataTableExtensions extension methods to convert the DataTable to an IEnumerable<DataRow>, then use the IEnumerable<T>.GroupBy() extension.
DataTable tbl = ..

var q = tbl.AsEnumerable().GroupBy( r => r.Field<string>("Company") )
                          .Select( g => new { Company = g.Key, TotalSales = g.Sum( s => s.Field<decimal>("Sales") ) } );


text:
Q: How to use two Twitter Bootstrap themes on one page? I'm developing a single page web application using HTML, CSS, and JavaScript (without iframes).
I have a slide out menu on the left, which I want to contain elements styled according to a dark Bootstrap theme (from Bootswatch).
On the main area of the app, however, I want to place elements styled using another, light, Bootstrap theme.
Is there a way I can do that?

A: I would suggest manually adding both themes into a CSS Scope using the > operator which is explained very well in this post.
For example, for bootstrap button class:
.light > // This is the Scope
    .btn {
        ...
    }
}

This way, you can use the following syntaxes:

    Light Themed Link

    Dark Themed Link

Since > means Direct Child, it only affects the childs inside the marked Scope Element. This means that you don't have to repeat class"light" or class="dark" in every element you want to stylize. Instead you select a Scope, it may be body, or a div, or even a span, and then you use bootstrap classes as usual.
You can do this manually but I'd suggest you using LESS which already comes integrated with latest bootstrap source code or SASS which you can find here.
Maybe there is a better option, but this is the only I can think about right now.


text:
Q: How to Split response from Json in android? I am developing an app in which I got response like "100.0" from server which I have to split to "100" and save in variable.How can I do that kindly tell me .

A: You can do it this way:
Integer value = jsonObject.getDouble("parameter").intValue();

A: Assuming that your problem is just to split the "Integer" and "Fraction" part of a "string" value you are getting from the server -
int decimalIdx = stringVal.indexOf('.');
if (decIdx != -1) {
  return stringVal.substring(0, decIdx);
}
return stringVal;

A: You can use this code to parse your JSON response. Store your wallet balance in a String, them trim the value as per your request
 JSONObject object =  new JSONObject(JsonResponseText);
 String walletBal = object.getString("wallet balance");
 String trimWalletBal = walletBal.subString(0,walletBal.indexOf('.'));


text:
Q: Extract ZIP's contents on screen but avoid extra information except of the file names I am looking for a command that will print all the contents of an archive (including sub-folders and it's files) without extracting the actual archive on the disk, but only on screen.
I achieve something using some other questions and answers from this site, and here is my command:
unzip -l test.zip | awk '/-----/ {p = ++p % 2; next} p {print $NF}'

The output:
0 04-11-2009 13:43 jodconverter-webapp-2.2.2/ 1815 04-11-2009 13:43 jodconverter-webapp-2.2.2/README.txt 0 04-11-2009 13:43 jodconverter-webapp-2.2.2/src/ 5349 04-11-2009 13:42 jodconverter-webapp-2.2.2/src/jodconverter-webapp-2.2.2-sources.jar 26436 04-11-2009 13:43 jodconverter-webapp-2.2.2/LICENSE.txt 3819 04-11-2009 13:43 jodconverter-webapp-2.2.2/ChangeLog.txt 3314202 04-11-2009 13:42 jodconverter-webapp-2.2.2/jodconverter-webapp-2.2.2.war

As you can see the output is one line, and includes some extra information that I don't really need.
I want an output of this kind:
jodconverter-webapp-2.2.2/
jodconverter-webapp-2.2.2/README.txt
jodconverter-webapp-2.2.2/src/
jodconverter-webapp-2.2.2/src/jodconverter-webapp-2.2.2-sources.jar
.
.
.

So not only I want to output the file names only (and their full path) and avoid any extra other information like time permissions and so on, but also I want to use something like break-line to distinguish different files.
Keep in mind that this command will run on a PHP file to get the contents of the file, so I don't know if this can help us to use the <br> to do the break lines.
Is that possible with a single command?

A: Well, I can't think a command that will return you back the output you need, but may someone else can know something more.
What I would do in your case is to split the line into array and play with it until you get what you want.
You actually have to find a pattern that will work for all cases.
With a brief look on the command's output I came with the following decisions:

*

*You splitting the line using as separator the space (i.e explode() )

*The pattern I can see is that there exist a time of the form xx:xx exactly before the actual file/directory ! So you can check if the current line is a valid 24-based time using a regular expression then that means if that is the case and you are in the $i position of the array the $i+1 is what you are looking for, and therefore you can copy that to a new array.

*Repeat

I think that is a bit pain, but at least is a solution.


text:
Q: Type checking forwardRef with ...rest property in React/Typescript I'm struggling to get type checking in Typescript to work for a React component which uses forwardRef and has a ...rest property.
Example:
import React from 'react'

interface InputWithLabelProps {
  label: string,
  [rest: string]: unknown,
}

const InputWithLabel = React.forwardRef<HTMLInputElement, InputWithLabelProps>(
  ({ label, ...rest }, ref) => (
    <>
      <label htmlFor="field">{label}</label>
      <input id="field" ref={ref} {...rest} />
    </>
  ),
)

export default InputWithLabel

This will give component the following signature:
(alias) const InputWithLabel: React.ForwardRefExoticComponent<Pick<InputWithLabelProps, keyof InputWithLabelProps> & React.RefAttributes<HTMLInputElement>>
import InputWithLabel

This will not give correct type checking for example it's not necessary to provide label property which should be required. If I remove either forwardRef or the ...rest property it works, but that is not an option.
How can I use forwardRef on a component which has ...rest property and at the same time have type checking?

A: Using [rest: string]: unknown you allow any string property to be passed to your input element which (for a reason I do not understand why) renders your other prop types useless. Assuming you want to type your component with a mandatory label and otherwise any props belonging to an <input>-element, you can extend this by using either:
interface InputWithLabelProps extends React.InputHTMLAttributes<HTMLInputElement> {
  label: string
}

or combining the types using:
type InputWithLabelProps = {
    label: string
} & React.HTMLProps<HTMLInputElement>


text:
Q: Avenir Font Doesn't show up properly on Web Page opened on Any Browsers on Windows OS I have used various Avenir Fonts on my website. It looks good on browser when opened in Linux, Mac, Ipad, Iphone, Andriod Phone. But when opened on any browser in Windows. Thus font doesn't look sharp and part of the text is not visible.
Below are two screenshot of how font renders on browsers in Windows OS:
Windows Screenshot 1 :

Windows Screenshot 2 :

Below are 2 screenshots showing how font renders on browser in Linux OS :
Linux Screenshot 1 :

Linux Screenshot 2 :

Below is the code for font-face CSS for all font.
@font-face {font-family: 'AvenirNext-Bold';
font-weight: normal;font-style: normal;
src: url('../fonts/AvenirNext-Bold/AvenirNext-Bold.eot');
src: url('../fonts/AvenirNext-Bold/AvenirNext-Bold.eot') format('embedded-opentype'),
    url('../fonts/AvenirNext-Bold/AvenirNext-Bold.woff2') format('woff2'),
    url('../fonts/AvenirNext-Bold/AvenirNext-Bold.woff') format('woff'),
    url('../fonts/AvenirNext-Bold/AvenirNext-Bold.ttf') format('truetype');}

@font-face {font-family: 'AvenirNext-BoldItalic';
font-weight: normal;font-style: normal;
src: url('../fonts/AvenirNext-BoldItalic/AvenirNext-BoldItalic.eot');
src: url('../fonts/AvenirNext-BoldItalic/AvenirNext-BoldItalic.eot') format('embedded-opentype'),
    url('../fonts/AvenirNext-BoldItalic/AvenirNext-BoldItalic.woff2') format('woff2'),
    url('../fonts/AvenirNext-BoldItalic/AvenirNext-BoldItalic.woff') format('woff'),
    url('../fonts/AvenirNext-BoldItalic/AvenirNext-BoldItalic.ttf') format('truetype');}

@font-face {font-family: 'AvenirNext-DemiBold';
font-weight: normal;font-style: normal;
src: url('../fonts/AvenirNext-DemiBold/AvenirNext-DemiBold.eot');
src: url('../fonts/AvenirNext-DemiBold/AvenirNext-DemiBold.eot') format('embedded-opentype'),
    url('../fonts/AvenirNext-DemiBold/AvenirNext-DemiBold.woff2') format('woff2'),
    url('../fonts/AvenirNext-DemiBold/AvenirNext-DemiBold.woff') format('woff'),
    url('../fonts/AvenirNext-DemiBold/AvenirNext-DemiBold.ttf') format('truetype');}

@font-face {font-family: 'AvenirNext-DemiBoldItalic';
font-weight: normal;font-style: normal;
src: url('../fonts/AvenirNext-DemiBoldItalic/AvenirNext-DemiBoldItalic.eot');
src: url('../fonts/AvenirNext-DemiBoldItalic/AvenirNext-DemiBoldItalic.eot') format('embedded-opentype'),
    url('../fonts/AvenirNext-DemiBoldItalic/AvenirNext-DemiBoldItalic.woff2') format('woff2'),
    url('../fonts/AvenirNext-DemiBoldItalic/AvenirNext-DemiBoldItalic.woff') format('woff'),
    url('../fonts/AvenirNext-DemiBoldItalic/AvenirNext-DemiBoldItalic.ttf') format('truetype');}

@font-face {font-family: 'AvenirNext-Heavy';
font-weight: normal;font-style: normal;
src: url('../fonts/AvenirNext-Heavy/AvenirNext-Heavy.eot');
src: url('../fonts/AvenirNext-Heavy/AvenirNext-Heavy.eot') format('embedded-opentype'),
    url('../fonts/AvenirNext-Heavy/AvenirNext-Heavy.woff2') format('woff2'),
    url('../fonts/AvenirNext-Heavy/AvenirNext-Heavy.woff') format('woff'),
    url('../fonts/AvenirNext-Heavy/AvenirNext-Heavy.ttf') format('truetype');}

@font-face {font-family: 'AvenirNext-HeavyItalic';
font-weight: normal;font-style: normal;
src: url('../fonts/AvenirNext-HeavyItalic/AvenirNext-HeavyItalic.eot');
src: url('../fonts/AvenirNext-HeavyItalic/AvenirNext-HeavyItalic.eot') format('embedded-opentype'),
    url('../fonts/AvenirNext-HeavyItalic/AvenirNext-HeavyItalic.woff2') format('woff2'),
    url('../fonts/AvenirNext-HeavyItalic/AvenirNext-HeavyItalic.woff') format('woff'),
    url('../fonts/AvenirNext-HeavyItalic/AvenirNext-HeavyItalic.ttf') format('truetype');}

@font-face {font-family: 'AvenirNext-Italic';
font-weight: normal;font-style: normal;
src: url('../fonts/AvenirNext-Italic/AvenirNext-Italic.eot');
src: url('../fonts/AvenirNext-Italic/AvenirNext-Italic.eot') format('embedded-opentype'),
    url('../fonts/AvenirNext-Italic/AvenirNext-Italic.woff2') format('woff2'),
    url('../fonts/AvenirNext-Italic/AvenirNext-Italic.woff') format('woff'),
    url('../fonts/AvenirNext-Italic/AvenirNext-Italic.ttf') format('truetype');}

@font-face {font-family: 'AvenirNext-Medium';
font-weight: normal;font-style: normal;
src: url('../fonts/AvenirNext-Medium/AvenirNext-Medium.eot');
src: url('../fonts/AvenirNext-Medium/AvenirNext-Medium.eot') format('embedded-opentype'),
    url('../fonts/AvenirNext-Medium/AvenirNext-Medium.woff2') format('woff2'),
    url('../fonts/AvenirNext-Medium/AvenirNext-Medium.woff') format('woff'),
    url('../fonts/AvenirNext-Medium/AvenirNext-Medium.ttf') format('truetype');}

@font-face {font-family: 'AvenirNext-MediumItalic';
font-weight: normal;font-style: normal;
src: url('../fonts/AvenirNext-Medium/AvenirNext-Medium.eot');
src: url('../fonts/AvenirNext-Medium/AvenirNext-Medium.eot') format('embedded-opentype'),
    url('../fonts/AvenirNext-Medium/AvenirNext-Medium.woff2') format('woff2'),
    url('../fonts/AvenirNext-Medium/AvenirNext-Medium.woff') format('woff'),
    url('../fonts/AvenirNext-Medium/AvenirNext-Medium.ttf') format('truetype');}

@font-face {font-family: 'AvenirNext-Regular';
font-weight: normal;font-style: normal;
src: url('../fonts/AvenirNext-Regular/AvenirNext-Regular.eot');
src: url('../fonts/AvenirNext-Regular/AvenirNext-Regular.eot') format('embedded-opentype'),
    url('../fonts/AvenirNext-Regular/AvenirNext-Regular.woff2') format('woff2'),
    url('../fonts/AvenirNext-Regular/AvenirNext-Regular.woff') format('woff'),
    url('../fonts/AvenirNext-Regular/AvenirNext-Regular.ttf') format('truetype');}

@font-face {font-family: 'AvenirNext-UltraLight';
font-weight: normal;font-style: normal;
src: url('../fonts/AvenirNext-UltraLight/AvenirNext-UltraLight.eot');
src: url('../fonts/AvenirNext-UltraLight/AvenirNext-UltraLight.eot') format('embedded-opentype'),
    url('../fonts/AvenirNext-UltraLight/AvenirNext-UltraLight.woff2') format('woff2'),
    url('../fonts/AvenirNext-UltraLight/AvenirNext-UltraLight.woff') format('woff'),
    url('../fonts/AvenirNext-UltraLight/AvenirNext-UltraLight.ttf') format('truetype');}

@font-face {font-family: 'AvenirNext-UltraLightItalic';
font-weight: normal;font-style: normal;
src: url('../fonts/AvenirNext-UltraLightItalic/AvenirNext-UltraLightItalic.eot');
src: url('../fonts/AvenirNext-UltraLightItalic/AvenirNext-UltraLightItalic.eot') format('embedded-opentype'),
    url('../fonts/AvenirNext-UltraLightItalic/AvenirNext-UltraLightItalic.woff2') format('woff2'),
    url('../fonts/AvenirNext-UltraLightItalic/AvenirNext-UltraLightItalic.woff') format('woff'),
    url('../fonts/AvenirNext-UltraLightItalic/AvenirNext-UltraLightItalic.ttf') format('truetype');}

CSS assigned to the above description is as follow :
.description{
    font-size: 22px;
    color: #000000;
    font-family: "AvenirNext-DemiBold";
}

Based on media query and device size the font size change from 13px to 22px

A: I had this same problem, where the font looked great on my Mac but didn't show up at all on a Windows device. It looks like the font just simply isn't licensed to be displayed on Windows devices. See more here: https://www.quora.com/Why-do-I-have-a-font-Avenir-on-my-Mac-but-not-on-my-PC-The-font-is-not-in-TypeKit-which-I-am-still-trying-o-figure-out-I-looked-online-and-its-250-to-350-Can-I-pop-it-into-Dropbox-and-add-it-to-my-PC-that-way
From that Quora answer: "The font family Avenir is licensed just like your operating system or your apps. Now, in this case, it is bundled with the operating system, so your macOS license also covers it. Monotype owns Avenir, and has licensed it to Apple, who have licensed it to you with macOS. That does not give you the right to copy it over to other computers that don't have it bundled."
The solution I used was to replace Avenir with Montserrat, which looks very similar. Link to Montserrat on Fontsource: https://fontsource.org/fonts/montserrat
You can also find other alternatives to Avenir here: https://learnui.design/blog/avenir-similar-fonts.html


text:
Q: Learning boost::regex, matching wildcards I've just started learning regex.
I need to match things like this:
hostname21.processName

The . is the anchor. Pre and post anchor are represented by [a-zA-Z0-9_] but I'm not sure how to match both of the conditions on either side of the anchor.
I'm using boost::regex if that helps.
EDIT
I tried Jerry's code with boost::regex reg("[a-zA-Z0-9_]+\\.[a-zA-Z0-9_]+"); and it worked. Thanks everyone.

A: I would use reg("(\w)+\\.(\w)+")


text:
Q: sed group out of string and put it into variable Can you make it work?
result=${docker ps | sed -r 's/(.*)\s.*$/\1/'} && echo $result

Just want to pass the result of the seed into a variable (and print it out for debugging)
The tricky thing is, that docker ps returns multiple lines!
Update:
I changed It due to an post farther down to
result=$(docker ps | sed -r 's/(.*)\s.*$/\1/'} && echo "$result"

But this is the result:
root@Synobaby916:/volume1/Synology-Infrastructure/sys_scripts# result=$(docker ps | sed -r 's/(.*)\s.*$/\1/'} && echo "$result"
>

Behind the > is just a blinking cursor ...

A: To expand a variable it should be enclosed with double quotes "$result" or embraced with {} ${result}:
result=$(docker ps | sed -r 's/(.)\s.$/\1/') && echo "$result"

Here's a simplified analogy:
result=$(echo "hello there" | sed -rn 's/^([a-z]).*/\1/p') && echo "$result"

It'll output:
h (the first character of the string)


text:
Q: UnicodeDecodeError installing EBookLib 0.15 for textract 1.6.1 I'm trying to install textract using the command of pip install textract and I'm getting the following error.
C:\Users\HP\PycharmProjects\CVParser\venv\Scripts>pip install textract
Collecting textract
Using cached https://files.pythonhosted.org/packages/e0/00/a9278b3672a31da06394eb588a16e96f8fce9f6ae0ed44cca18103d4aef5/textract-1.6.1.tar.gz
Collecting argcomplete==1.8.2 (from textract)
Using cached https://files.pythonhosted.org/packages/f0/0f/f965f1520e6ba24b63320919eecfbe3d03debd32402e0c61a08e8fa02d17/argcomplete-1.8.2-py2.py3-none-any.whl
Collecting chardet==2.3.0 (from textract)
Using cached https://files.pythonhosted.org/packages/7e/5c/605ca2daa5cf21c87690d8fe6ab05a6f2278c451f4ede6456dd26453f4bd/chardet-2.3.0-py2.py3-none-any.whl
Collecting python-pptx==0.6.5 (from textract)
Using cached https://files.pythonhosted.org/packages/f8/9c/30bc244cedc571307efe0780d8195ffed5b08f09c94d23f50d6d5144ebc7/python-pptx-0.6.5.tar.gz
Collecting docx2txt==0.6 (from textract)
Using cached https://files.pythonhosted.org/packages/aa/72/f02730ec3b0219d8f783a255416339b02ff8b6a300c817abf0505833212a/docx2txt-0.6.tar.gz
Collecting beautifulsoup4==4.5.3 (from textract)
Using cached https://files.pythonhosted.org/packages/af/a3/9e803f838b3eeb313d45d916d4387cda8572c92e1aafeb53fd43ddb5da2c/beautifulsoup4-4.5.3-py3-none-any.whl
Collecting xlrd==1.0.0 (from textract)
Using cached https://files.pythonhosted.org/packages/0c/b0/8946fe3f9c2690c164aaa88dfd43b56347d3cdeac34124b988acd1aaa151/xlrd-1.0.0-py3-none-any.whl
Collecting EbookLib==0.15 (from textract)
Using cached https://files.pythonhosted.org/packages/04/30/2cbf65fa9587a1ecc66a78eea91f9189ead8fdadd5e009115bce34529aa6/EbookLib-0.15.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\HP\AppData\Local\Temp\pip-install-lk9fc36f\EbookLib\setup.py", line 13, in <module>
    long_description = open('README.md').read(),
  File "C:\Program Files\Python37\lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x8d in position 1671: character maps to <undefined>

---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in C:\Users\HP\AppData\Local\Temp\pip-install-lk9fc36f\EbookLib\
You are using pip version 10.0.1, however version 18.0 is available. You
should consider upgrading via the 'python -m pip install --upgrade
pip' command.

As it mentioned here I successfully upgraded pip using python -m pip install --upgrade pip command and pip install --upgrade setuptools.
Also by going through this link I installed EbookLib 0.15 with this command pip install -Iv ebooklib==0.15. Then it gave me the following exception.
Command "python setup.py egg_info" failed with error code 1 in C:\Users\HP\AppData\Local\Temp\pip-install-0fyox_v9\ebooklib\
Exception information:
Traceback (most recent call last):
  File "c:\users\hp\pycharmprojects\cvparser\venv\lib\site-packages\pip-10.0.1-py3.7.egg\pip\_internal\basecommand.py", line 228, in main
    status = self.run(options, args)
  File "c:\users\hp\pycharmprojects\cvparser\venv\lib\site-packages\pip-10.0.1-py3.7.egg\pip\_internal\commands\install.py", line 291, in run
    resolver.resolve(requirement_set)
  File "c:\users\hp\pycharmprojects\cvparser\venv\lib\site-packages\pip-10.0.1-py3.7.egg\pip\_internal\resolve.py", line 103, in resolve
    self._resolve_one(requirement_set, req)
  File "c:\users\hp\pycharmprojects\cvparser\venv\lib\site-packages\pip-10.0.1-py3.7.egg\pip\_internal\resolve.py", line 257, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "c:\users\hp\pycharmprojects\cvparser\venv\lib\site-packages\pip-10.0.1-py3.7.egg\pip\_internal\resolve.py", line 210, in _get_abstract_dist_for
    self.require_hashes
  File "c:\users\hp\pycharmprojects\cvparser\venv\lib\site-packages\pip-10.0.1-py3.7.egg\pip\_internal\operations\prepare.py", line 324, in prepare_linked_requirement
    abstract_dist.prep_for_dist(finder, self.build_isolation)
  File "c:\users\hp\pycharmprojects\cvparser\venv\lib\site-packages\pip-10.0.1-py3.7.egg\pip\_internal\operations\prepare.py", line 154, in prep_for_dist
    self.req.run_egg_info()
  File "c:\users\hp\pycharmprojects\cvparser\venv\lib\site-packages\pip-10.0.1-py3.7.egg\pip\_internal\req\req_install.py", line 486, in run_egg_info
    command_desc='python setup.py egg_info')
  File "c:\users\hp\pycharmprojects\cvparser\venv\lib\site-packages\pip-10.0.1-py3.7.egg\pip\_internal\utils\misc.py", line 698, in call_subprocess
    % (command_desc, proc.returncode, cwd))
pip._internal.exceptions.InstallationError: Command "python setup.py egg_info" failed with error code 1 in C:\Users\HP\AppData\Local\Temp\pip-install-0fyox_v9\ebooklib\

I'm using python 3.7.0 and pip 18.0.
Is this a python version matter? Can any one help me to solve this please?

A: The version of textract on PyPi has EbookLib==0.15 as a requirement, so if you desperately want that version, then you will have to donwload the Ebooklib source from github
 and edit the README.md to not contain unicode characters anymore.
A simpler approach however would be to download the latest version of textract from its github page, since the requirement for Ebooklib has been changed to EbookLib==0.16 which solves the issue.
To do this, simply download the source code, chagne into the directory and run
pip install .

Note: Since you are using a venv, make sure, that you are running it with the corresponidng pip version


text:
Q: Identifying a connection after SNAT Hi I have a problem statement that I am trying to solve from quite a while now.
Problem Statement (This is a networking scenario):
Machine A and Machine B want to connect to Machine D, Machine C being a Load Balancer between them. At Machine D I want to determine which connection came from Machine A and which connection came from Machine B.
As the load balancer will use a single IP to SNAT all the connections coming from Machine A and Machine B.
Why I want to solve this ?
Consider that there is a Machine Z that is a malicious machine and it tries to connect to Machine D, I want to control all the incoming connections to this machine.
Essentially , there are to connections happening for every request from A to D.

*

*Machine A to Machine C

*Machine C to Machine D

Is there something common in the tcp/ip packets of these two connections that can be used as an identifier?

A: If you have a layer 7 load balancer, and the network traffic supports it, the load balancer can insert clues to the traffic about the source address (for example, HTTP reverse proxyes usually add the X-Forwarded-For header, which contains the original caller address).
On lower levels, you have no clue about the source of the package you got, since any kind of NAT modifies the IP header.
It might worth mentioning that in scenarios like yours, all filtering should be done on the load balancer, or before that, and not on the backend servers. The backend servers should not care about packet filtering and source identification (other than application-level purposes perhaps).

A: You could make it by inspecting IP packet fields. For example, you could change TTL or set DSCP at source machine and check it at destination.
There are some limitations here, though - TTL change would work if you know how far (in hops) your "valid" machines are.


text:
Q: ffdfappend from ffbase R friends.
Due to the size of my data i´m using the ff  and ffbase packages. My question is about the ffdfappend(). I have different ffsf files saved as .csv. What I need to do is load all the files and apply the ffdfd function in order to create just one big ffdf file. I do this as a loop:
files<-list.files()
for (i in 1:length(files)){
fdata = read.csv.ffdf(file=files[i], first.rows=400, colClasses=NA)
colnames(fdata)<-c('fecha','juliano','UTM_X','UTM_Y','temp','pp','f_ocur', 'altitud')
if (i == 1){data=fdata} else {data<-ffdfappend(data, fdata, adjustvmode=F)}
delete(fdata); rm(fdata)
}

I can read the files in the folder easily. The problem is when I want to "append" them in one ffdf object. R tells me this:
Error en sort.list(y) : 'x' must be atomic for 'sort.list'
Have you called 'sort' on a list?***

I don't understand what is telling me, so I´m unable to solve the problem.
str(files)
chr [1:6] "102c1b481014.csv" "102c2211788.csv" "102c32963052.csv" "102c32f1798.csv" "102c3a2517f1.csv" "102c4e7513f0.csv"

If anyone can help me understand or solve this problem I´d appreciate it

A: ffdfappend is basically for appending a data.frame to an ffdf. I don't know if this is an option, but loading each data.frame in RAM before appending to the ffdf will work, as is done below.
files<-list.files()
for (i in 1:length(files)){
  fdata = read.csv.ffdf(file=files[i], first.rows=400, colClasses=NA)
  colnames(fdata)<-c('fecha','juliano','UTM_X','UTM_Y','temp','pp','f_ocur', 'altitud')
  if (i == 1){data=fdata} else {data<-ffdfappend(data, fdata[,], adjustvmode=TRUE)}
  delete(fdata); rm(fdata)
}

Another option is to use the x argument of read.csv.ffdf. As shown below. But your data really needs to have the same structure.
files<-list.files()
fdata = read.csv.ffdf(file=files[1], first.rows=400, colClasses=NA)
for (i in 2:length(files)){
  fdata = read.csv.ffdf(x = fdata, file=files[i], first.rows=400, colClasses=NA)
}


text:
Q: Optimizing Group By and Date functions SELECT p.id_product
             FROM popularity p, products pr
             WHERE p.id_product = pr.id_product
               AND p.date >= (DATE_SUB(CURDATE(), INTERVAL 30 DAY))
               GROUP BY p.id_product order by count(p.id_product) desc LIMIT 0, 6

I'm wondering how to optimize my queries as much as possible. I'm trying to trim off the fat and this query in particular is giving me trouble because it is used everywhere. I have a table in which I store each instance of a product page being visited, and another table which has the products.
p.id_product is a non-unique key, whereas pr.id_product is the products' table primary key. I don't think I'm doing my query right as it seems like I'm doing a full index scan to do my join between both tables. And I'm not sure calling DATE_SUB in such a way is the best idea (I'm looking at the past month), or if my group/order is correct. My database's tables also run off InnoDB.
Is there any way I can make this faster? I've already set a limit to the query since I noticed the software never uses more than 6 results

A: Use show create table popularity and show create table products to determine your indexes already in place.
Indexes speed up performance but slow updates and inserts.
You need to find the right balance of indexes based on different ways of going after your data, so I am not one to say just pepper the tables with indexes.

A: You are doing virtually nothing with products pr, remove it from the query.  This will speed things up some.  (If you do need the table, then explain why.)
Then, adding this composite, covering, index to popularity will speed it up:
INDEX(date, id_product)


text:
Q: Android Facebook SDK: Check if the user is logged in or not I'm have a feature on my Android app where the user authorizes the app and shares a link.
I also need to give an option for the user to logout of facebook and I need to conditionally disable this button if the user is not logged int (or not authorized the app).
I can't seem to find the API call on the Android SDK that would let me ask FB if the user is logged in or not.
What I have found is getAccessExpires():

Retrieve the current session's expiration time (in milliseconds since
  Unix epoch), or 0 if the session doesn't expire or doesn't exist.

Will checking if the session equals 0 be the way to go? Or is there something I'm missing?

A: Note to readers: This is now deprecated in the new FB 3.0 SDK.
facebook.isSessionValid() returns true if user is logged in, false if not.

A: Facebook SDK 4.x versions have a different method now:
boolean loggedIn = AccessToken.getCurrentAccessToken() != null;

or
by using functions
boolean loggedIn;
//...
loggedIn = isFacebookLoggedIn();
//...
public boolean isFacebookLoggedIn(){
    return AccessToken.getCurrentAccessToken() != null;
}

Check this link for better reference https://developers.facebook.com/docs/facebook-login/android
check this heading too "Access Tokens and Profiles" it says "You can see if a person is already logged in by checking AccessToken.getCurrentAccessToken() and Profile.getCurrentProfile()

A: I struggled to find a simple answer to this in the FB docs. Using the Facebook SDK version 3.0 I think there are two ways to check if a user is logged in.
1) Use Session.isOpened()
To use this method you need to retrieve the active session with getActiveSession() and then (here's the confusing part) decipher if the session is in a state where the user is logged in or not. I think the only thing that matters for a logged in user is if the session isOpened(). So if the session is not null and it is open then the user is logged in. In all other cases the user is logged out (keep in mind Session can have states other than opened and closed).
public boolean isLoggedIn() {
    Session session = Session.getActiveSession();
    return (session != null && session.isOpened());
}

There's another way to write this function, detailed in this answer, but I'm not sure which approach is more clear or "best practice".
2) Constantly monitor status changes with Session.StatusCallback and UiLifecycleHelper
If you follow this tutorial you'll setup the UiLifecycleHelper and register a Session.StatusCallback object with it upon instantiation. There's a callback method, call(), which you override in Session.StatusCallback which will supposedly be called anytime the user logs in/out. Within that method maybe you can keep track of whether the user is logged in or not. Maybe something like this:
private boolean isLoggedIn = false; // by default assume not logged in

private Session.StatusCallback callback = new Session.StatusCallback() {
    @Override
    public void call(Session session, SessionState state, Exception exception) {
        if (state.isOpened()) { //note: I think session.isOpened() is the same
            isLoggedIn = true;
        } else if (state.isClosed()) {
            isLoggedIn = false;
        }
    }
};

public boolean isLoggedIn() {
    return isLoggedIn;
}

I think method 1 is simpler and probably the better choice.
As a side note can anyone shed light on why the tutorial likes to call state.isOpened() instead of session.isOpened() since both seem to be interchangeable (session.isOpened() seems to just call through to the state version anyway).

A: Session.getActiveSession().isOpened()

returns true if user is logged in, false if not

A: Android Studio with :
compile 'com.facebook.android:facebook-android-sdk:4.0.1'

then check login like as:
private void facebookPost() {
    //check login
    AccessToken accessToken = AccessToken.getCurrentAccessToken();
    if (accessToken == null) {
        Log.d(TAG, ">>>" + "Signed Out");
    } else {
        Log.d(TAG, ">>>" + "Signed In");
    }
}

A: @diljeet was right. https://stackoverflow.com/a/29375963/859330
In addition, use
return AccessToken.getAccessToken() != null && Profile.getCurrentProfile()!=null;
It always works this way.

A: For Facebook Android SDK 4.x you have to use the "AccessToken.getCurrentAccessToken()" as said by @Diljeet but his check didn't work for me, I finally checked it by doing:
Activity "onCreate":
facebookAccessToken = AccessToken.getCurrentAccessToken();

To check if the session is still active (I made it in the "onResume" method but do it where you need):
  if(facebookAccessToken != null){
        sessionExpired = facebookAccessToken.isExpired();
  }else{
        sessionExpired = true;
  }

More info in https://developers.facebook.com/docs/facebook-login/android

A: This seems to be working quite well with the new sdk.
private boolean isFacebookLoggedIn(){
    Session session = Session.getActiveSession();

    if (session != null) {
        //Session can be open, check for valid token
        if (!session.isClosed()) {
            if(!session.getAccessToken().equalsIgnoreCase("")){
                return true;
            }
        }
    }
    return false;
}

A: I had the same issue. Here is my solution using SDK 4.0:
First of all, in your activity dealing with login check, be sure to call this primary:
        FacebookSdk.sdkInitialize(this.getApplicationContext());

In your onCreate method put this :
updateWithToken(AccessToken.getCurrentAccessToken());

    new AccessTokenTracker() {
        @Override
        protected void onCurrentAccessTokenChanged(AccessToken oldAccessToken, AccessToken newAccessToken) {
            updateWithToken(newAccessToken, handler);
        }
    };

Then add the method called:
private void updateWithToken(AccessToken currentAccessToken) {
    if (currentAccessToken != null) {
        fillUIWithFacebookInfos(handler);
    } else {
        login();
    }
}

This way will handle the already logged in user and the newly logged in user.

A: I was using FB sdk for just for login..
Facebook developers reject my app, Because  whenever user login, I send logout.. I dont matter user profile data... I just use FB for  login..  FB tells if user login...  dont send lgout...
I find Hacking way...
Now my app doesnot send logout whenever user login.... Whatever user login with,Google,Facebook,or normal.. When they click logout... In this three condition
I use
 LoginManager.getInstance().logOut();
No matter which platform they use... There is no crash :)


text:
Q: how to modify my SharePoint2013 web URL?
I'm here again =)
I have the following url: http://servername:7050/site/subsite/Pages/default.aspx
I would remove the "Pages" and have a custom url like this: http://servername:7050/site/subsite/default.aspx
I searched some sites and I saw that in sharepoint 2013 is this possible, but I have not found where.
Can anyone help me?

A: your looking for term based navigation:
goto site settings -> look and feel -> click on navigation
for both global and current select managed navigation
now goto term store managment tool

1.From the site collection Home page, click Site Contents
2.On the Site Contents page, click Settings.
3.On the Site Settings page, in the Site Administration group, click Term store management.

click on the page you want ammending, image below is what you need todo to make it friendly! what your looking for is Term-driven pages :)

more info here:
https://habaneroconsulting.com/insights/Term-based-navigation-in-SharePoint-2013


text:
Q: Designing a class that can be tested in an if statement? I have my class, where I overloaded the ! operator:
class obj
{
public:

    bool operator!() const
    { return this->str.length() == 0; }

private:

    string str;

};

With the ! operator i want to check the obj validity, so:
obj o;

// if o is not a valid object
if(!o)
   cerr << "Error";

Now I want to have the possibility to do this:
// if o is a valid object
if(o)
   cout << "OK";

How can I do?

A: Using C++11, you can do this by having an explicit operator bool:
explicit operator bool() const {
    return !!*this;
}

This operator is called if you ever need to cast your object to a bool explicitly (which is done by the if statement automatically).  The implementation works by calling your operator ! on the receiver object, then returning the opposite result.
Hope this helps!

A: Based on your usage it looks like you need to overload the bool operator and not the ! operator.
class obj
{
public:

    operator bool() const
    { return this->str.length() == 0; }

private:

    string str;

};

EDIT
ildjarn provided a nice link in the comments to the dangers of doing a simple bool overload.  It's definitely worth the read
http://en.wikibooks.org/wiki/More_C%2B%2B_Idioms/Safe_bool


text:
Q: Datagridview not updating/refreshing I have a DataGridView made of a DataSet of a table from the DB. When I delete a row, it is updated in the database but it is not removed from the GridView.  Only when I restart the application does it get removed from the GridView.
Please help

A: This is a very simple process.

1.) Create a Binding Source
2.) Set the Datasource for this object to your Dataset Table.
3.) Set The datasource for your DatagridView as the Binding source Object.

Code Example:
Dataset ds = new Dataset();
BindingSource bs = new BindingSource()
bs.Datasource = ds.Table[0];
DatagridView.Datasource = bs;

Now, Any changes you make in the DataTable will ripple through to your GridView automatically.

A: You need to reset the binding on your bindingsource.
bindingSource.ResetBindings(false);

A: Hope this helps you?
if you are showing your table in dgv and for deleting something from that table you have a button on your win form. you chose let's say ID and click "delete" button for delting an item from db table. Here is that code:
private void btn_Delete_Click(object sender, EventArgs e)
        {
            int selectedCellCount = dgv.GetCellCount(DataGridViewElementStates.Selected);

            if (selectedCellCount > 0)
            {
                string selection;

                for (int i = 0; i < selectedCellCount; i++)
                {
                    selection = dgv.SelectedCells[i].Value.ToString();
                    string qs_delete = "DELETE FROM yor_table WHERE id = '" + selection + "';";
                    try
                    {
                        conn = new MySqlConnection(cs);
                        conn.Open();

                        cmd = new MySqlCommand();
                        cmd.Connection = conn;
                        cmd.CommandText = qs_delete;
                        cmd.ExecuteNonQuery();

                        conn.Close();
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.Message);
                        }
                        finally
                        {
                           if (conn != null) conn.Close();
                         }
                     }
                }

//don't forget to load your table again in dgv
            string qs_select = "SELECT * FROM your_table";

            System.Data.DataTable dataTable = new System.Data.DataTable();
            dataTable.Clear();
            dgv.DataSource = dataTable;

            try
            {
                conn = new MySqlConnection(cs);
                cmd = new MySqlCommand(qs_select, conn);
                conn.Open();

                da = new MySqlDataAdapter(cmd);
                da.Fill(dataTable);

                cb = new MySqlCommandBuilder(da);

                dgv.DataSource = dataTable;
                dgv.DataMember = dataTable.TableName;
                dgv.AutoResizeColumns();

                conn.Close();
            }
            catch (Exception ex)
            {
                 MessageBox.Show(ex.Message);
            }
            finally
            {
                if (conn != null) conn.Close();
            }
         }

You'll notice here that i have MySQL db but don't bother yourself with that.

A: If database is updated and you want to refresh DataGridView, call this:
this.<table name>TableAdapter.Fill(this.<DB name>DataSet.<table name>);

For example: Where is name of your table (for example Customers) and is name of your database (for example MyDB).
this.CustomersTableAdapter.Fill(this.MyDBDataSet.Customers);

A: You have to call this function after every deletion(Re-bind Grid).
void BindGrid()
{
YourDataGridView.DataSource = dataset;
YourDataGridView.DataBind();
}


text:
Q: "Further, ..." versus "Furthermore, ..." at the beginning of a sentence (meaning the same thing)? I am not a native speaker (my mother tongue is German).
In the context of a technical paper (computer science), is there a difference between starting a sentence with Further, ... and starting it with Furthermore, ... ? It is used in the context of continuing a sentence.
I wasn't sure, so I asked an American English native speaker. He said to change the "Further" to "Furthermore".
Is it correct that the two phrases are not interchangable? My guess is, it would be safe to change all "Further, ..." to "Furthermore, ...", but the opposite is not true?
Also, is there a difference between British English and American English between "Further" and "Furthermore"?

A: Furthermore is used to introduce a new argument.
Further states that something goes beyond what was already said.
These two are clearly related, but not the same, and not interchangeable.
Generally if you used further at the start of a statement where you should have used furthermore the reader will be left wondering "further to what?".

My guess is, it would be safe to change all "Further, ..." to "Furthermore, ...", but the opposite is not true?

No, they are not interchangeable in either direction.

Further to the above considerations...
*Furthermore to the above considerations...
Furthermore, our partners might object...
*Further, our partners might object...
Further Affiant Sayeth Not (a rather old-fashioned expression still found on affidavits and other legal documents, meaning the affiant has nothing else to add).
*Furthermore Affiant Sayeth Not.

In each of these, those marked with an asterisk are incorrect.
It's precisely because it's not safe to change all "Further,..." to "Furthermore,..." that you were advised to do so - in the case in question your colleague thought you meant furthermore when you used the completely different further.
That said, it's quite possible that all the other places where you have used further at the start of a sentence not only can, but should be changed to furthermore, because that's what you actually meant. Indeed, quite likely if you are asking this question.

A: "Further" is usually employed as an adjective that modifies a noun. For the most part, it is NOT used at the beginning of a sentence (e.g., "Without further delay."). It is synonymous with "additional." By contrast, "furthermore" is an adverb that doesn't modify anything. It is used to support or expand a prior statement. It IS generally used at the beginning of a sentence (e.g., "Furthermore, they allow pets."). It is synonymous with "in addition."

A: "Further" and "furthermore" are not interchangeable if you solely look at the dictionary. The definition for "furthermore" clearly concentrates on this usage, which is in contrast to the definition for "further". Merriam-Webster states this definition of "further" as definition 2 and compares it with "moreover". I criticize the dictionaries' lack of examples on words such as this. For example, if you click the link for "moreover", you will be shown that "besides" is a synonym. As a result, non-native English writers get in the habit of writing "Besides, ..." by itself. "Further" evolved to mean furthermore by people writing: "Further to this argument..." and now there is a situation where people think "Further, ...." and "Besides, ..." sound natural and acceptable to everyone. But just by looking at the differences of opinion here, they clearly don't. And if they did, there would be no need to have the word "furthermore".

A: I always thought "further" could not be used to start a sentence and besides, it seems lazy. But Garner's Modern English usage says although "furthermore" is proper, "further" or "moreover" is better. And Merriam-Webster gives both "further" and "furthermore" as synonyms for "moreover".  "Further" also has additional meanings referring to (often metaphorical) distance, according to Garner. So from this I would say that "further" can always be used in place of "furthermore" but not vice versa.

A: Further - to say if you want some thing more.
eg: clarification has been provided. Further you need any please contact in the below address.
Furthermore- same meaning of Besides.
eg: Please complete the open item today itself, further more kindly update in the tracker.


text:
Q: Getting the line numbers of all undefined variables in Jinja template I am working on a configuration validation tool, where the configuration files are Jinja templates. One part of validation is to validate that all template variables are defined.
It seems that the only way to get the line number for an undefined variable in a Jinja template is to pass the StrictUndefined to the Environment and then read the line number from the stack trace when the exception gets raised.
However, this approach has the unfortunate consequence of StructUndefined raising the exception is that the parsing gets aborted when the parser encounters the first undefined variable, which means that the validation tool is not capable of validating the whole configuration file when a variable is undefined.
Does anyone know of a way to get the information on line number without raising exceptions?


text:
Q: Validating ASP.NET FileUploader with CustomValidator I have a FileUpload control to upload a certificate file. The user has to upload the file the first time, in subsequent visits to the page, we display the certificate content on the page, so it's not necessary to upload a file again.
Now I want to validate that a certificate is uploaded at least at once. The rest of the page uses ASP.NET validation controls so I want to go ahead with the same.
I can't use a RequiredFieldValidator on the FileUpload, because then it will fire everytime I try to save the page, which is wrong.
I tried using a CustomValidator and used the serverside validation, but seems that too fires only if I click on the file uploader. If I just leave it alone, the server side validation is not triggered.
I can of course do the validation on the [Save] button click event, but is there a proper way to do that using the validator events themselves?
CustomValidator:
 <asp:CustomValidator ID="cusCertifacteExistanceValidator" runat="server"                                                      ValidationGroup="ConfigValidation" CssClass="errorMsg" ControlToValidate="fcertificate" Enabled="false"                                                            ErrorMessage="Certificate is not available" OnServerValidate="ValidateCertificateUpload">*</asp:CustomValidator>

CustomValidator Server side validation:
protected void ValidateCertificateUpload(object source, ServerValidateEventArgs args)
    {
        args.IsValid = false;

        var existingCertificate = string.Empty;
        if (ViewState["loginProviderProperties"] != null)
        {
            existingCertificate = ((List<Configuration>)ViewState["properties"]).Find(p => p.Name == "certificate").Value;
        }

        if (fX509Certificate.HasFile || existingCertificate != string.Empty)
        {
            args.IsValid = true;
        }
    }

A: It is very dificult to imagine without the code but My guess would be to add
ValidateEmptyText="true"

to custom validator.


text:
Q: Obscure systemd-logind message on Centos 7 running on OpenVZ 7 I am seeing the message below appear several times at random times on a Centos 7 64-bit virtual private server running on OpenVZ 7. I have no idea what it means, how to fix it or if it can be safely ignored. Any insights would be greatly appreciated. Thank you!
Jul  8 11:03:01 server dbus[129]: [system] Connection ":1.6086" (uid=0 pid=13457 comm="/usr/lib/systemd/systemd-logind ") has had Unix fds pending for too long (pending_fd_timeout=150000ms); tolerating it, because it has uid 0

My operating system details are below:
# uname -a
Linux server 3.10.0-862.20.2.vz7.73.29 #1 SMP Thu Feb 21 17:35:43 MSK 2019 x86_64 x86_64 x86_64 GNU/Linux

# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)


text:
Q: Jquery, resize data of an image I have a script for resize an image.
So, for begin, i have an image with : height=600px and width=500px
After I use my script, and a resize this image to to, for example : height=300px and width=250px.
I use :
$('#image').css("width", varvar);
$('#image').css("height", varvarvar);

But if i look my image with firebug, the data is always to the originale size (600 and 500), how can i resize the data (src) a my image with jquery ?

A: As thoroughly mentioned in the comments, there's no way to change the original size (as in, the amount of data) of an image with client-side scripting. The issue being that the image is hosted on the server-side and any javascript manipulation remains strictly client-side. If you want to commit some sort of data change, that would require server-side scripting, such as PHP (although there are many other alternatives..)
Basically, the idea is that the client sends a request for image manipulation to the server, who then runs some sort of script to alter the original image data and replaces the original file on the server. On page refresh, the image would have changed.

A: When you use .css you are changing the style attribute of the image. If you want to change its width and height attributes you have to do this like so:
var img = document.getElementById('image'), height = 25, width = 50;
    img.width = width;
    img.height = height;

Then when you inspect the element you will see its width and height attributes changed.
But this is only on the browser. It will not change its width and height permanently. You could however convert it to Base64 and send it to your server. But you would have to use HTML5 canvas. I can show you how to do that if needed.


text:
Q: Rails 4: Included CSS Files Not Working This may be a CSS, not a Rails issue.
I have added additional CSS files to app/assets/stylesheets, including one called buttons.css. The rules in buttons.css are not working. However, if I copy-paste those rules to custom.css, the rules work just fine.
Application.css contains:
*= require_self
 *= require_tree .

Generated HTML shows that the files are being included by Rails:
<link href="/assets/buttons.css?body=1" media="all" rel="stylesheet">
<link href="/assets/custom.css?body=1" media="all" rel="stylesheet">

There are many other added .css files in this folder as well, including others that affect the .button class and .button pseudo-classes. Is it possible that other rules are getting in the way?


text:
Q: vmware linux headers not found for ubuntu 10.10? I've installed Vmware 6.5 on Ubuntu 10.10...
when I start vmware player/workstation its asking for linux kernel header for some compilation but I'm not able to find the appropriate package, see the Image below....

 Update

after running following commands

sudo -s
cd /lib/modules/$(uname -r)/build/include/linux
ln -s ../generated/utsrelease.h
ln -s ../generated/autoconf.h

Error has been changed like below....
ERROR: modinfo: could not find module vmmon
ERROR: modinfo: could not find module vmnet
ERROR: modinfo: could not find module vmblock
ERROR: modinfo: could not find module vmci
ERROR: modinfo: could not find module vsock

Using 2.6.x kernel build system.
make: Entering directory /tmp/vmware-root/modules/vmmon-only'
make -C /lib/modules/2.6.35-22-generic/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. modules
make[1]: Entering directory/usr/src/linux-headers-2.6.35-22-generic'
  CC [M]  /tmp/vmware-root/modules/vmmon-only/linux/driver.o
In file included from /tmp/vmware-root/modules/vmmon-only/linux/driver.c:31:
/tmp/vmware-root/modules/vmmon-only/./include/compat_wait.h:78: error: conflicting types for 'poll_initwait'
include/linux/poll.h:72: note: previous declaration of 'poll_initwait' was here

A: Try the following:
sudo -s

cd /lib/modules/$(uname -r)/build/include/linux

ln -s ../generated/utsrelease.h

ln -s ../generated/autoconf.h

A: After using Greg Suarez's suggestion, tou will need to patch a few things to get this to work.  Taken (and corrected) from: http://blog.gnu-designs.com/solved-building-vmware-workstation-modules-on-linux-2-6-32
tar xvf /usr/lib/vmware/modules/source/vmnet.tar -C /tmp
tar xvf /usr/lib/vmware/modules/source/vmci.tar -C /tmp

cd /tmp

perl -pi -e 's,("vnetInt.h"),\1\n#include "compat_sched.h",' vmnet-only/vnetUserListener.c
perl -pi -e 's,("compat_page.h"),\1\n#include "compat_sched.h",' vmci-only/include/pgtbl.h

tar cvf /usr/lib/vmware/modules/source/vmnet.tar vmnet-only
tar cvf /usr/lib/vmware/modules/source/vmci.tar vmci-only

Now you should be able to continue on with installing vmplayer/workstation

A: Same here. The ln stuff is great, but it seems that the vmware modules are written for older kernels in general. After making sure autoconf.h and utsversion.h are where vmware expects them, I get the same conflicting types error in poll.h.
I can change the Makefile that the script uses to build the modules to use a -DVMW_HAVE_EPOLL, which fixes the problem, but then another error pops up. This module code just isn't make for Ubuntu, it seems.

A: Maybe that package isn't installed, try:
sudo apt-get install linux-headers-`uname -r`


text:
Q: Angular Universal - settimeout I understand that Settimeout won't work with angular universal but is there an alternate?
typingCallback(that, text, a, direction) {
    if (text.length > 0) {
      let total_length = text.length;
      let current_length = that.typewriter_display.length;
      if (direction == "forward") {
        if (current_length < total_length) {
          that.typewriter_display += text[current_length];
          setTimeout(that.typingCallback, 200, that, text, a, "forward");
        } else {
          //Trigger Remove

          setTimeout(that.typingCallback, 500, that, text, a, "backward");
        }
      } else {
        //Remove
        if (current_length >= total_length && current_length != 1) {
          var pos = text.lastIndexOf(text[current_length-1]);
          text = text.substring(0,pos) + '' + text.substring(pos+1)
          that.typewriter_display = text;
          setTimeout(that.typingCallback,50,that,text,a,"backward");
        } else {
          //Text Removed send forward
          that.typewriter_display = "";
          if (a < (that.dataText.length-1)) {
            a++;
            setTimeout(function() {
              that.typingCallback(that, that.dataText[a], a,"forward");
            },300)
          } else {
            a = 0;
            setTimeout(function() {
              that.typingCallback(that, that.dataText[a], a,"forward");
            }, 200)
          }
        }
      }
    }
    }

The above function display's a given text and then removes it before writing another one. I was wondering if there is an alternate to setTimeout so that I can still have the above feature in my website.

A: As far I know there is no alternate for this. setTimeout is window object. So, when you want to use Angular Universal, you need to wrap setTimeout function with isPlatformBrowser.
constructor(
@Inject(PLATFORM_ID) private platformId: Object) {}
if(isPlatformBrowser(this.platformId)) {
  setTimeout(()=>{
    const dismissRefundModal= document.getElementById('dismissRefundModal');
    dismissRefundModal.click();
  },1500);
}