text:
Q: Error when running GWT in intellij I am trying to run a GWT on a Tomcat server my build framework is Maven. However I keep getting the following error
 java: Unable to find RequestFactory built-in type. Is requestfactory-[client|server].jar on the classpath?

Any idea why this is happening?
Thanks

A: Reading this error, it seems a lib is missing. Check if request-factory-server is in your pom.xml and if your config is okay.
I am also working with maven and GWT-requestfactory. Here is a sample of my working maven config:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
<!-- -->
    </parent>
    <artifactId>docentryeditor</artifactId>
    <packaging>war</packaging>

    <name>doc-entry-editor</name>

    <properties>
        <!-- Convenience property to set the GWT version -->
        <gwtVersion>2.5.1</gwtVersion>
        <webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    </properties>

    <url>http://maven.apache.org</url>
    <repositories>
        <repository>
            <id>gwt-maven</id>
            <url>http://gwt-maven.googlecode.com/svn/trunk/mavenrepo/</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-servlet</artifactId>
            <version>${gwtVersion}</version>
        </dependency>
        <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-dev</artifactId>
            <version>${gwtVersion}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-user</artifactId>
            <version>${gwtVersion}</version>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <groupId>javax.validation</groupId>
                    <artifactId>validation-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.google.web.bindery</groupId>
            <artifactId>requestfactory-server</artifactId>
            <version>${gwtVersion}</version>
        </dependency>
        <dependency>
            <groupId>com.google.web.bindery</groupId>
            <artifactId>requestfactory-apt</artifactId>
            <version>${gwtVersion}</version>
        </dependency>
        <dependency>
            <groupId>aopalliance</groupId>
            <artifactId>aopalliance</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>com.google.gwt.inject</groupId>
            <artifactId>gin</artifactId>
            <version>1.5.0</version>
        </dependency>
        <dependency>
            <groupId>com.google.inject</groupId>
            <artifactId>guice</artifactId>
            <version>3.0</version>
        </dependency>
        <dependency>
            <groupId>com.google.inject.extensions</groupId>
            <artifactId>guice-servlet</artifactId>
            <version>3.0</version>
        </dependency>
        <dependency>
            <groupId>com.google.inject.extensions</groupId>
            <artifactId>guice-assistedinject</artifactId>
            <version>3.0</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>4.1.0.Final</version>
        </dependency>
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>1.0.0.GA</version>
        </dependency>
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>1.0.0.GA</version>
            <classifier>sources</classifier>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.7</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.7.7</version>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>

    </dependencies>
    <build>
        <finalName>docentryeditor</finalName>
        <outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>
        <!-- Generate compiled stuff in the folder used for developing mode -->
        <!--<outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>-->
        <plugins>
            <!-- GWT Maven Plugin-->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>gwt-maven-plugin</artifactId>
                <version>${gwtVersion}</version>
                <dependencies>
                    <dependency>
                        <groupId>com.google.gwt</groupId>
                        <artifactId>gwt-user</artifactId>
                        <version>${gwtVersion}</version>
                    </dependency>
                    <dependency>
                        <groupId>com.google.gwt</groupId>
                        <artifactId>gwt-dev</artifactId>
                        <version>${gwtVersion}</version>
                    </dependency>
                    <dependency>
                        <groupId>com.google.gwt</groupId>
                        <artifactId>gwt-servlet</artifactId>
                        <version>${gwtVersion}</version>
                    </dependency>
                </dependencies>
                <!-- JS is only needed in the package phase, this speeds up testing -->
                <executions>
                    <execution>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                </executions>
                <!-- Plugin configuration. There are many available options,
                     see gwt-maven-plugin documentation at codehaus.org -->
                <configuration>
                    <!-- URL that should be automatically opened in the GWT shell (gwt:run). -->
                    <runTarget>XDS-MetadataEditor.html</runTarget>
                    <!-- Ask GWT to create the Story of Your Compile (SOYC) (gwt:compile) -->
                    <compileReport>true</compileReport>
                    <module>edu.tn.xds.metadata.editor</module>
                    <hostedWebapp>${webappDirectory}</hostedWebapp><!--makes file download work in dev mode-->
                    <logLevel>INFO</logLevel>
                    <style>${gwtVersion}</style>

                    <copyWebapp>true</copyWebapp>
                </configuration>
            </plugin>

            <!-- Maven WAR plugin -->
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.4</version>
                <configuration>
                    <!-- configured to be the same as for the gwt plugin -->
                    <webappDirectory>${webappDirectory}</webappDirectory>
                </configuration>
                <executions>
                    <execution>
                        <phase>compile</phase>
                        <goals>
                            <!-- create an exploded version of the war in webappDirectory. Ideal
                                for development -->
                            <goal>exploded</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- Copy static web files before executing gwt:run -->
            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <version>2.4.2</version>
                <executions>
                    <execution>
                        <phase>compile</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${webappDirectory}/WEB-INF/</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>src/main/webapp</directory>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <!-- RequestFactory Validation jar -->
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.5.1</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                    <annotationProcessors>
                        <annotationProcessor>com.google.web.bindery.requestfactory.apt.RfValidator</annotationProcessor>
                    </annotationProcessors>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>com.google.web.bindery</groupId>
                        <artifactId>requestfactory-apt</artifactId>
                        <version>${gwtVersion}</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
            <!--This plugin's configuration is used to store Eclipse m2e settings
                                only. It has no influence on the Maven build itself. -->

        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>org.codehaus.mojo</groupId>
                                        <artifactId>
                                            gwt-maven-plugin
                                        </artifactId>
                                        <versionRange>
                                            [2.5.1,)
                                        </versionRange>
                                        <goals>
                                            <goal>i18n</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>

    </build>
</project>

If you have any question or if there is anything you don't understand don't hesitate.
Otherwise, if you really don't manage to do it, give me your maven config and I will have a look at it and try to tell you what is wrong.
Please note that my config doesn't have the tomcat config as I don't need it, but I really don't think this can be your problem.


text:
Q: you will be able to get treatment / This, shouldn't have been passive voice? the expression below on the picture

Also, make sure that you travel with proper medical insurance so that
  if you are sick or injured while traveling you will be able to get
  treatment.

Shouldn't have been passive voice? but treatment is not past participle

A: Your example sentence:

Also, make sure that you travel with proper medical insurance so that if you are sick or injured while traveling you will be able to get treatment.

No, you don't need any past participles, passive-voice constructions or anything like that. The sentence is absolutely fine as it stands. You're just failing to fully grasp the semantics of it. The word treatment there is a noun (a mass noun, to be more precise) which is basically just a short form of medical treatment (medical care given to a patient for an illness or injury). And the verb to get is used to mean to receive. So, we could actually paraphrase your sentence in the following way and it would mean exactly the same thing:

Also, make sure that you travel with proper medical insurance so that if you are sick or injured while traveling you will be able to receive medical treatment.

If you want the word treat to be used as a past participle, then the full expression would be something like this: to get treated for something. Where something specifies what you want to be treated for. But I don't think it will work as well as the way the sentence is originally written:

Also, make sure that you travel with proper medical insurance so that if you are sick or injured while traveling you will be able to get treated for your injuries.

I hope things make sense to you now. If you still have any questions, please don't hesitate to ask.

redpajama_set_name: RedPajamaStackExchange


text:
Q: PHPMailer EHLO Error I have a problem for a couple of days ago me going crazy, I have a script that sends mails using phpMailer and arsys.
The fact is that the overnight stops working, check the code and seems fine, it's more, it works correctly if I run it from the test server that comes through another IP.
I found that the server was not on any spam blackList and found the reference to be to a PBL, me worry about removing it from there.
Anyway, I still can not send mail from that server and both my other test script I programmed work correctly on development server but not on the production server.
The error that is specifically this
SMTP -> ERROR: EHLO not accepted from server:
SMTP -> ERROR: HELO not accepted from server: 220 ESMTP Postfix smtp-04.servidoresdns.net
SMTP -> ERROR: AUTH not accepted from server: 250-250-llsg993-a04.servidoresdns.net PIPELINING 250-SIZE 51200000 250-ETRN 250-250-STARTTLS AUTH DIGEST-MD5 CRAM-MD5 LOGIN PLAIN 250-AUTH = DIGEST MD5 CRAM-MD5 LOGIN PLAIN 250-250 8BITMIME ENHANCEDSTATUSCODES

It says it can not authenticate the credentials are fine but since the same script from another server goes perfectly.
Also came through a tcptraceroute to port 25 SMTP server.
Only strange thing I see is that when running
tcptraceroute p 25 smtp.miservidor.com

He says:
Sorry, Local Requested port is already in use. Use P, instead of p, to override.
But after using P instead of p and functions
Anyone shed me some light on this?
Who may be filtering my IP address ??

A: It's very common for ISPs to block outbound connections to port 25 by default. Try using SMTPSecure = 'tls' and Port = 587 - that server definitely responds on that port.
Connection problems are covered in the PHPMailer docs.

A: I noticed that never answered this question, the problem was the time, the function did not have enough time to contact with server. I increased the time in phpMailer class and everything went back to work.


text:
Q: Creating a array of promises with .map will call the promise? I have the following
const ingredientsPromises = ingredients.map(ingredient =>
    // Is this .map calling the api?
    axios.post('/api/ingredient', ingredient)
)
await Promise.all(ingredientsPromises)
    .then(consoleThen)
    .catch(consoleCatch)

I'm making multiple calls to an api, but what I'm not sure is that when the promise will run, will it run inside .map or only in Promise.all?

A: Promise will run individually. It is up to you when do you want to do something with it.
If you want to do something after each individual request is completed then you can just use
const ingredientsPromises = ingredients.map(ingredient =>
    // Is this .map calling the api?
    axios.post('/api/ingredient', ingredient)
    .then(function (response) {
      console.log(response);
    })
   .catch(function (error) {
      console.log(error);
    });

)

Otherwise you can use the promise returned by 'all' function like this. If you want to do something after all promises are resolved.
const ingredientsPromises = ingredients.map(ingredient =>
    // Is this .map calling the api?
    axios.post('/api/ingredient', ingredient)
)
await Promise.all(ingredientsPromises)
    .then(function (response) {
      console.log(response);
    })
   .catch(function (error) {
      console.log(error);
    });

Also await won't do anything here so you can remove it.

A: const ingredientsPromises = ingredients.map(ingredient =>
    // Is this .map calling the api?
    axios.post('/api/ingredient', ingredient)
)

Yes, this is initiating your API request(s).

A promise will always return a promise.

Lets see what's happening here,
First of all, ingredientsPromises is initialized with array of promises (each promise representing your API request in pending state).
At this point of time, all of your requests had been initiated.
from the docs,

The Promise.all() method returns a single Promise that resolves when all of the promises passed as an iterable have resolved or when the iterable contains no promises. It rejects with the reason of the first promise that rejects.

So, with Promise.all(ingredientsPromises) you are resolving all these pending promises, which returns another promise (which means you have received the API response) either in fulfilled state (in case no error occurs), or in rejected state (in case one or more requests fail)

A: I use bluebird map function for this
  await bluebird.map(ingredients, (i) => axios.post('/api/ingredient', i))


text:
Q: C++ Exception to Exception-less I am looking to compile some C++ code that makes heavy usage of exceptions into a wasm target. Unfortunately, most browsers don't have Webassembly Exception Handling turned on (I believe only Chrome supports it behind the flag chrome://flags#enable-webassembly), and there's a tremendous performance hit in how emscripten wraps exceptions into a javascript try/catch. We've noticed about a 2x performance hit when the flag is turned on or off.
I believe the short-answer to this is 'no', but I was wondering if there are known approaches to translate C++ code-with-exceptions to C++ code that doesn't use exceptions at all (not even in a parent wrapper) without manually translating it.

A: The only thing that Exceptions have in common with Return values is that it's a form of error handling, code-wise, they are entirely two different things.
Barring any existing infrastructure where you can disable exceptions such as #define BOOST_NO_EXCEPTIONS in Boost, and disabling exception support with a compiler flag like -fno-exceptions (which will also make std near impossibe to use).. The only way is to manually edit... However, it is possible to return an error object, or throw it, which can make it easier to gradually introduce return values.

A: UseNoexceptFalse:
Use UseNoexceptFalse option to false.
Enabled by default, When you disable it, it will replace throw with noexcept
Example:
void foo() throw(int) {}

struct bar {
  void foobar() throw(int);
  void operator delete(void *ptr) throw(int);
  void operator delete[](void *ptr) throw(int);
  ~bar() throw(int);
}

Transformed Example:
void foo() {}

struct bar {
  void foobar();
  void operator delete(void *ptr) noexcept(false);
  void operator delete[](void *ptr) noexcept(false);
  ~bar() noexcept(false);
}

For further clarification:
modernize-use-noexcept

A: I think that the exceptions in the browsers will be optimized with time. I also think that the exceptions MUST (RFC 2119) not be used for a base of a computation, but only for events that SHOULD NOT (RFC 2119) happen.
Clearly "should" is relative and varies from person to person (project to project), but a disk error is clearly an event that should not happen (except, in the case when your program works with broken disks, and a disk error is a normal event). When the performance is an issue, changing the code seems to be the best solution.
An automatic translation sounds better, but when I think how often the standards are changing 11, 17, 20... I do not think that such a translation system will be managing to keep up, because its use cases would not be that much (personal opinion), that it might not worth developing it in the first place.
Anyway, a quick solution would be to wrap each exported function in a new catch-friendly one, that catches the exceptions and turns them into return values (or stores this information into thread-local variables), distinguishable from the normal return value, if any. That way at least the exceptions would not propagate to the JS side.

A: Well, in your code you can change every function to return std::variant<OkResult, ERROR> if it ever throw exception, but using almost every third-party library (including STL) would be impossible or painful.


text:
Q: The definition of convex hull: Is each element of a convex hull a convex combination of a finite number of elements? In the definition of the convex hull of a set $A$, does it matter if each element of the convex hull is a convex combination of finite number of elements of $A$ or an infinite number?
I am trying to prove that the convex hull of a bounded set is bounded. So, I take an element of $co(A)$ (the notation I use for convex hull) and apply the Triangle Inequality.
$$\|x\|=\|\sum_{i=1}^n\alpha_iy_i\|$$
where $y_i\in A$ and $\alpha_i\in[0,1]$ and $\sum_{i=1}^n\alpha_i=1$ for some finite $n$.
$$\leq \sum_{i=1}^n\alpha_i \| y_i\| < r$$
where $r$ is the radius of the ball that contains the bounded set $A$.
Now, if $n$ is infinite then I'm not sure if I can still apply the Triangle Inequality and, hence, my question.
P.S. I'm using the following definition of convex hull:
$$co(A)=\{ x\in X| x=\sum_{i=1}^n t_iy_i \textrm{ for some } n\geq 1, \textrm{ where } t_i\in[0,1], \sum_{i=1}^n t_i=1, \ y_i\in A \}$$
where $X$ is a normed vector space.


text:
Q: Master page url is appended as prefix to anchor href in sharepoint 2013 I've a master page (.html) file in SharePoint 2013. Inside this, I am generating global navigation. So, I have the HTML written and an Angular controller which fetches data from a list and binds it to this HTML to generate the navigation.
The issue is:
The master page library URL is prefixed before the actual URL. So instead of http://sitecollectionurl/Pages/MyPage.aspx, the URL is generated as: http://sitecollectionurl/_catalogs/masterpage/branding/http://sitecollectionurl/Pages/MyPage.aspx
Any ideas for this issue? Thanks in advance.

A: I guess you could always use a site collection token in your URL.
~sitecollection

URLs and tokens in SharePoint 2013
If that don't work out for you, this blog post has a lot of great examples when working with masterpages and references. Use Site Url in SharePoint

A: maybe you need this?
<SharePoint:CssRegistration name="<% $SPUrl:~sitecollection/_catalogs/masterpage/css/style.css %>" runat="server"  />


text:
Q: PHP help: Follow System in Microblogging I'm making a site similar to Instagram.  I am very new to php.  I created a follow button in the user's profile.
How do you make the follow button disappear when you already followed the user?
How do you replace it with unfollow button?
// my php code for following
if (isset($_POST['addfriend'])){

    $fromuser = $user;
    $touser = $username;

    if($fromuser == $username){
        $Msg = "You cannot follow yourself
";
    }
    else
    {
        $getID= mysql_query("SELECT userID FROM user WHERE username='$user'");
        $get_ID_row = mysql_fetch_assoc($getID);
        $ID_db = $get_ID_row['userID'];

        $sql = "insert into following (userID, fromUser, toUser)
        values ('$ID_db','$fromuser', '$touser')";

        $result = mysql_query($sql);

         $Msg= "Success!
";

    }
}
else{
    //Do nothing
}

//my code for the follow button
                        <form action="<?php $user;?>" method ="POST">
                        <?php echo $Msg; ?>
                        <input type = "submit" name ="addfriend" value = "Follow"/>
                        </form>

A: Would be easier with OO PHP. However, if you chose procedural, let's assume we have a table of friends. Which keeps the id of each of my friends.
e.g.: Smith follows John

Then you do something like
    $following = mysql_query("SELECT COUNT(*) FROM followers WHERE followerid = ".$_SESSION['id']." AND followeeid = ".$username);
Check if You follow the person already:
if($following){//$following == true
}

A: On the page where you are going to show the Follow or Unfollow button, first run a MySQL query to find out if you are already following the person:
$sql = "select * from following
        where userID = $user
        and   fromUser = $fromUser
        and   toUser = $toUser";
$result = mysql_query($sql);

if( $result) {
    if( mysql_num_rows($result) > 0) {
        // if we get here we know we are already following that person
        ....[see below]

Now dynamically create whichever button you need:-
    if( mysql_num_rows($result) > 0) {
        // if we get here we know we are already following that person
        echo '<input type = "submit" name ="removefriend" value = "Un-follow"/>';
    }
    else
    {
        echo '<input type = "submit" name ="addfriend" value = "Follow"/>';
    }

And on the following page where you are getting the form results, check for both buttons:
if (isset($_POST['addfriend'])) {
    ...[do what you already have]
}
else
if (isset($_POST['removefriend'])) {
    ...[do SQL to remove the record from the following table]
}

Please be aware also that as of PHP v5.5 this style of MySQL is deprecated. At some stage in the future you will have to convert your programs to the MySQLi or PDO_MySQL extensions, before they eventually discontinue support. See the PHP manual about this at eg http://php.net/manual/en/mysqlinfo.api.choosing.php.


text:
Q: Persistent data structure for this application? I have a question for your help with. My title of this question may not be to the point, or exactly reflects the problem I want to solve. But this is want I want to achieve in the problem:
I have a list of entities, i.e. a list of persons, each with a same set of attributes. I need to process them individually and sequentially. For instance, for each person, I need to send an email to him/her and the email will be sent at a fixed time (i.e. 12 PM every Wednesday) on a weekly basis. The logic roughly looks like this:
[code]
 Person[] persons = new Person[10];

 // In this week, I will take the first person and send an email to him
 int i =0;
 sendEmail(persons[i]);

 // Then next week, it will send email to the next person
 sendEmail(person[i++]);

 [/code]

The problem is that the application isn't supposed to be running all the time(24/7). It may shut down anytime this week and next week. How can the problem resume to run from the state of the time when it was shut down last time?
Using database might be one option, but that will be too heavy for my task. Is there  a type of "persistent"  data structure or algorithm that can help do this?
I know this might be silly but if anyone can share some experiences or ideas, I would really appreciate!

A: The simplest form of persistent data is files. You could write the value of i to the file after sending the email and read it on start up. This looks like a decent java file I/O tutorial.


text:
Q: SharePoint 2010 issue - can I create a bullet list that isn't double spaced? I have some pages being created in SharePoint 2010 (we are migrating to 2016 next year, so skipping 2013 completely).
I can copy and paste bullet lists into the page, or create my own, but they all seem to double space.  Is there a way to fix this?
I have tried shift-enter, but that removes the bullets, and when attempting to put them back in via the bullet list on the page editor, they come out off tab, and wrong sized.  (No matter what I try).
Is there a work around, or am I stuck with double-spacing for this?  (The HTML editor is horrific and everything is jumbled into one big mess when I try to look at it.)
Thanks!


text:
Q: Short question about cin and input buffer So, after learning a bit about the input stream and how the extraction operator works, is it basically okay to say this about the following code?
string a;
cin >> a;

This will basically extract whatever there is in the input stream, but if the stream is empty it basically asks the user to input something? Like is that right?
I used to think cin gives access to the input stream and the user can just types whatever and that gets extracted, but now that I understand it a bit more, is what I said true? It tries to extract something from the stream, but if it sees nothing there then it'll ask the user for input?

A: The cin has a buffer (input stream).  The operator>> will extract from the stream until the requirements are satisfied.  If more input is required, cin will wait for the User to input more data (into the stream).

A: std::cin is an object instance of the std::istream class, which has a std::streambuf object associated with it.
std::streambuf contains a memory buffer inside of it.
By default, std::cin uses an implementation of std::streambuf that reads from the calling process's STDIN stream.
When operator>> reads from std::cin, std::cin then reads data from its streambuf, which in turn reads from its memory buffer.
If that memory buffer does not contain enough data to satisfy the read, std::streambuf will read from its own input stream, placing new data into its memory buffer, repeating as needed until the requested read is satisfied.  In your example, it will read from STDIN.
If that input stream does not have enough data to satisfy the read, it will wait for data to arrive, ie when the user types something into the console terminal. Or, if STDIN is redirected, when data arrives on the assigned pipe, or the pipe is closed.


text:
Q: Conformal map from unit disk to strip I have the following question:
Write down the solution $u(x, y)$ to the Dirichlet problem for the following region and boundary conditions:
$U = \{x + iy : 0\le y\le1\}; u(x, 0) = 0, u(x, 1) = 1$.
Hence use appropriate conformal maps to find to a solution  in the following region and with the following boundary conditions:
$A = \{z : \lvert z \lvert \le 1\}, u(z)=0$ when $\lvert z \lvert=1$ and $Im(z)<0, u(z)=0$ when $\lvert z \lvert=1$ and $Im(z)>0$.
In the region $U$ I have the solution $u(x,y)=y$. Now I need to find a conformal map, but I am struggling to get one that gives the right boundary conditions. Something like $(4i/\pi)arctan(z)$ maps the region correctly but does not give the right conditions for the answer.
I think the solution may have something to do with mapping the lower half of the disk to $\{x + iy : -1 \le y\le 0\}$ and the upper half to $\{x + iy : 0 \le y \le 1\}$ and then adjusting appropriately, but I can't see how to do this. Any help would be appreciated.

A: We know that the exponential function gives a biholomorphism between an open strip parallel to the real axis with a width $\leqslant 2\pi$ and an angular sector. One angular sector that is particularly easy to handle, especially considering we want to reach the unit disk, is the upper half plane. We need a width of $\pi$ for that, so
$$f_1(z) = e^{\pi z}$$
gives a conformal mapping of $U$ to the upper half plane, and it maps the $y = 0$ part of the boundary to the positive half-axis, and the $y = 1$ part to the negative half-axis.
That looks promising, now we need a biholomorphic map between the upper half-plane and the unit disk that maps the positive half-axis to the part of the unit circle in the lower half-plane, and the negative half-axis to the part in the upper half-plane. That means it must map $\{0,\infty\}$, the remaining part of the boundary of the upper half-plane, to $\{-1,1\}$, the remaining part of the boundary of the unit disk. With the boundaries properly oriented, both regions lie to the left of their respective boundaries, so when the positive half-axis is traversed from $0$ to $\infty$, the lower unit semicircle is traversed from $-1$ to $1$, hence the biholomorphism must map $0 \mapsto -1$ and $\infty \mapsto 1$. The Möbius transformation
$$f_2(z) = \frac{z-i}{z+i}$$
is easily seen to be the solution to that problem.
We need to compose with $f_1^{-1} \circ f_2^{-1}$, so let's compute the inverses and compose:
$$f(z) = \frac{1}{\pi} \log \left(i\frac{1+z}{1-z}\right)$$
biholomorphically maps the unit disk to the strip $0 < \operatorname{Im} z < 1$, mapping the unit semicircle in the lower half plane to the real axis, and the upper unit semicircle to the line $\operatorname{Im} z = 1$.


text:
Q: Discord API messaging when another function returns a value I am using python discord API https://discordpy.readthedocs.io/en/latest/api.html and I would like to have a forever loop(like a while loop) That checks with function whether on the site is a new content(I have already wrote a scraper). In other words: if scraper sees a new post it will return a value(link). I want to connect it with discord and when there is an output of that function, it will be sent to the text channel. I have completely no clue how to do that. The scraper function is asynchronous. All that comes to my mind is to make a second thread and log in and then message manually through selenium

A: Use webhooks.
Create a webhook then whenever your scraper gets new data, submit a POST request to the webhook url you created with the content parameter set to your data.
Example:
import requests

WEBHOOK_URL = "https://discordapp.com/api/webhooks/123456789/qWerRYtyuqwfq" # Example webhook url

def sendToDiscord(webhookUrl, data):
    return requests.post(webhookUrl, json={'content': data})

data = myScraper.get_data() # Whenever there is data from your scraper
sendToDiscord(WEBHOOK_URL, data) # Send it to Discord

Note: You can format your message, add images etc... by using the appropriate params


text:
Q: convert datetime from mysql to human readable string I have a datetime that I get from a mysql table and I would like to display it as a string.It looks like the following and I would like it to look like July 14th 2016 at 5:00 PM.
2016-07-14 17:00:00

I tried formatting like the following, but it didn't work. How do i get it how I want?
    date_format($date, 'g:ia \o\n l jS F Y');

A: You just have to convert the $date to Timestamp using something like strtotime() perhaps and then pass this as the second argument to PHP's date() function. The First Argument would be the Format for the Date. This below illustrates it....
<?php
    $date   = "2016-07-14 17:00:00";
    $date   =  date('g:ia \o\n l jS F Y', strtotime($date));

    var_dump($date);
    // PRODUCES: '5:00pm on Thursday 14th July 2016'  (length=33);

A: You can use PHP's date_format, but it expects a date object rather than a string.

date_format ( DateTimeInterface $object , string $format )

Here's an example using the procedural style:
$date_string="2016-07-14 17:00:00";
$date_object=date_create($date_string);
echo date_format($date_object, 'g:ia \o\n l jS F Y');

Here's an example using the object oriented style:
$date_string="2016-07-14 17:00:00";
$date_object=new Datetime($date_string);
echo $date_object->format('g:ia \o\n l jS F Y');

Output:

5:00pm on Thursday 14th July 2016

A: $date=date_create("2016-07-14 17:00:00");
echo date_format($date,'jS F Y \a\t g:ia');

Output :
14th July 2016 at 5:00pm

A: Use DateTime
<?php
    $datetime = "2016-07-14 17:00:00";

    $dt = new DateTime($datetime);
    echo $dt->format('F jS Y \a\t g:ia');
?>

Output: July 14th 2016 at 5:00pm

A: Simple:
$mysqlDate = "2016-07-14 17:00:00";
$formatted = date('F dS Y \a\t H:iA', strtotime($mysqlDate));

Will display: July 14th 2016 at 5:00PM
Edit: i have forgotten to add the "at"


text:
Q: Help understanding a construction of the lift of an analytic map between complex tori I'm trying understand the construction of the lift of an analytic map
$$f:\mathbb{C}/\Lambda_1\to \mathbb{C}/\Lambda_2$$ (with $\Lambda_i$ lattices in the complex plane) to a map $$F:\mathbb{C}\to \mathbb{C}$$ with $\pi_2\circ F=f\circ \pi_1$ with $\pi_i$ the projections $\mathbb{C}\to \mathbb{C}/\Lambda_i$.
The construction given does this by choosing $\mu\in\mathbb{C}$ s.t $\pi_2(\mu)=f(\pi_1(0))$ and then for any $z\in\mathbb{C}$ choosing path in $\mathbb{C}$ from $0$ to $z$. From here we uniquely lift the path $f\pi_1\gamma$ in $\mathbb{C}/\Lambda_2$ to $\mathbb{C}$ s.t $\tilde\gamma(0)=\mu$ and then define $F(z)=\tilde\gamma(1)$.
I'm struggling to see why $F(z)$ doesn't depend on the choice of $\gamma$, I thought about trying to apply the Monodromy theorem but I don't see how to do that. Any help would be great!

A: You can use compactness.
Look at an arbitrary $z\in\mathbb{C}$. Now do the following. Translate $\Lambda_1$ so that $z$ is in the interior of one of the $\Lambda_1$ parallelograms, then translate $\Lambda_2$ so that the points on $\mathbb{C}$ corresponding to $f(z+\Lambda_1)$ are also the interior of the $\Lambda_2$ parallelograms.
There will then be an open neighbourhood  $B$ of $z$ such that $B$ is likewise in the interior of the $\Lambda_1$ parallelograms and $f(B+\Lambda_1)$ is in the interior of the $\Lambda_2$ parallelograms.
How many such open sets $B$ do we need to cover a closed $\Lambda_1$ parallelogram in $\mathbb{C}$? Of course finitely many will do, because the parallelogram is compact.
We now have a finite cover $B_1,\ldots,B_n$. On each $B_i$, if we fix the value of $F(z_i)$ for some $z_i\in B_i$, then there is a unique way of extending $F$ to the whole of $B_i$ so as to agree with $f$. That is because for this $z_i$, we fix the domain $B_i$ and range $F(B_i)$ as being contained in their respective parallelograms.
Now, fix some $z_1$, and use the overlaps between the $B_i$ to fix $F$ on the whole $\Lambda_1$ parallelogram in $\mathbb{C}$. We can do this because the parallelogram is connected. We now have enough information to fix $F$ on neighbouring $\Lambda_1$ parallelograms, and eventually on all $\Lambda_1$ parallelograms, meaning on the whole domain $\mathbb{C}$.


text:
Q: Reordering the rows of a table using pgfplotstable I have a table in a file called dummy.txt which contains the following data:
value1  value2  value3
1   11  2.13652246624232
2   12  0.513442717554625
3   13  1.69712766271722
4   14  -1.57360405275275
5   15  0.784061900065905

I can print the table via
\pgfplotstabletypeset[
  col sep=tab,
  columns={value2,value1}
  ]{dummy.txt}

Is there a similarly easy way to select the order and the actual selection for the rows, as there is for the columns?
I had a look at the manual, and the only thing which came close was the row predicate argument, which seemed a bit too powerful for my goal of selecting row number 2,3 and 5. And I don't know how to work with logical predicates in TeX.

A: "Reordering" sounds a lot like sorting. In fact, you can sort the table according to your desired order - you only need a further (temporary) column with the order values. Of course, sorting does not filter. But you can easily use skip rows between index to filter the sorted result since the unwanted entries can easily be sorted to the end:
\documentclass{standalone}

\usepackage{pgfplotstable}

\begin{document}
\pgfplotstabletypeset[
  columns={value2,value1},
  sort,sort key=sort order,
  create on use/sort order/.style={
    create col/set list={100,1,2,100,0},
  },
  skip rows between index={3}{100},
  ]{
value1  value2  value3
1   11  2.13652246624232
2   12  0.513442717554625
3   13  1.69712766271722
4   14  -1.57360405275275
5   15  0.784061900065905
}
\end{document}

this code sorts according to the values in column sort order. This column does not exist, it will be created according to the create on use/sort order specification -- and that contains an explicit list of 5 values, one for each row. The row with value1=5 receives 0, the row with value1=2 receives 1, and the row with value1=3 receives 2 - all other ones get an 100. You can easily add columns={value2,value1,sort order} to see the results.
You mention that this is "just an example table". If you have a huge table, this create on use stuff can easily become tedious. In this case, you should probably add a "real" column sort order to your tables.


text:
Q: convert screen recoding video chunks blob in to multipart for sending in Api as a multipart I am new in angular 8  please suggest me how to convert screen recorded video chucks or blog in to a multipart  for sending file in API (API accept only multipart) thanks in advance

A: fileupload.component.ts
let chunks=[];
mediaRecorder.ondataavailable = function(e) {
   chunks.push(e.data);
}

onuploadevent
 uploadVideo(){
    let blob = new Blob(chunks, { type : chunks[0].type });
    const formData = new FormData();
    formData.append('video', blob);
    // post request
 }


text:
Q: Python program to write data in csv depends on column existence I am trying to append values in csv(already exist) with python programming, if the column already exists, it should be replaced or if the data is new I need to append it in the same file
What I tried so far:
csv data:
 SnapshotId,promotion level
 1.9.0.0,Tested
 2.0.0.1,Unit tested

Initial just appending (it works):
 with codecs.open('sample.csv','a',encoding='utf8') as newFile:
 newFileWriter = csv.writer(newFile)
 newFileWriter.writerow([str(snapshot_id),str(unitTest)])

So later my requirement changes like if incoming data like snapshotid already exist I should update the respective row value with promotion level, if snapshot id is unique and doesn't exist, I should then append a new row with snapshot id and promotion level.
I just tried like this with pandas
import pandas as pd
import os,sys
snapID = sys.argv[1]
promLevel = sys.argv[2]
df = pd.read_csv('sample.csv')
def update_table(snapID, promLevel):

if snapID in df['SnapshotId']:
    print("Updating promotion level")
    df.loc[df['SnapshotId'] == snapID, ['promotion_level']] = promLevel
else:
    print("Adding new snapshot")
    return df.append({'SnapshotId': snapID, 'promotion_level': promLevel}, ignore_index=True)
return df

   dd = update_table(str(snapID),promLevel)
   print(dd)

I can able to locate the index but am not sure how to check if column already exists and replace the whole row with new values in csv any insights would be great help

A: The code below reads a csv file, looks for a snapshotId. If it exists, the promotion level is replaced with the new value, otherwise a new row is appended:
def update_table(snapID, promLevel):

    # Reading file
    df = pd.read_csv('file.csv')

    if df['SnapshotId'].str.contains(snapID).any():
        # Updating promotion level
        df.loc[df['SnapshotId'] == snapID, ['Promotion_Level']] = promLevel
        return df
    else:
        # Adding new snapshot
        return df.append({'SnapshotId': snapID, 'Promotion_Level': promLevel}, ignore_index=True)

# Updating original file
update_table('id01', 'P10').to_csv('file.csv')

A working example:
import pandas as pd

data = {
    'SnapshotId': [1,2,3,4,5],
    'Promotion_Level': ['P1','P2','P3','P4','P5']
}
df = pd.DataFrame(data)

def update_table(snapID, promLevel):

    #df = pd.read_csv('file.csv')

    if df['SnapshotId'].str.contains(snapID).any():
        # Updating promotion level
        df.loc[df['SnapshotId'] == snapID, ['Promotion_Level']] = promLevel
        return df
    else:
        # Adding new snapshot
        return df.append({'SnapshotId': snapID, 'Promotion_Level': promLevel}, ignore_index=True)

# Original df
0           1              P1
1           2              P2
2           3              P3
3           4              P4
4           5              P5

> print(update_table(1, 'a'))
0           1               a
1           2              P2
2           3              P3
3           4              P4
4           5              P5

> print(update_table(10, 'a'))
0           1              P1
1           2              P2
2           3              P3
3           4              P4
4           5              P5
5          10               a


text:
Q: Ember complains about undefined namespace I get this error:
Uncaught Error: assertion failed: You are looking for a edit controller in the Node namespace, but the namespace could not be found

But if I inspect the objects (Chrome developer tools), I confirm that:

*

*App.NodeEditController is defined

*Ember.TEMPLATES['node/edit'] is defined (I am using pre-compiled templates)

*The model App.Node is defined

What could be causing this problem? What else could I verify? What is this namespace thing? I have not used it before, and my application was working.
The only changes I have performed are related to reorganization of my code base: I have split templates/controllers/models/views into files - but they are concatenatted again with a grunt task, so that no real changes should be present (appart from the fact that I am using now pre-compiled templates)
I have also verified SettingsApp.Router.router.recognizer.names:

A: this solves the problem, at least you can navigate to the edit route again
change this:
SettingsApp.NodeController = Ember.ObjectController.extend({
    isEditing: false,
    needs: [node/edit]
    ...

to this (remove the needs)
SettingsApp.NodeController = Ember.ObjectController.extend({
isEditing: false
...

hope it helps ...


text:
Q: Construction of the exterior derivative - Proof in EGA I have a question about the proof of the existence of the exterior derivative that is found in Grothendieck's EGA IV.16.6. Let me say that I know how to construct it (there is an excellent answer in this question: The algebraic de Rham complex) but I don't understand the construction in EGA.
Let $A$ be a ring and $B$ an $A$-algebra. The existence of the exterior derivative follows if I can construct an $A$-linear homomorphism of modules
$$ u : \Omega_{B/A}^1 \rightarrow \Omega_{B/A}^2 $$
such that $u(g\cdot df) = dg \wedge df$.
EGA then claims (this is the problematic part) that it suffices to construct an $A$-linear homomorphism
$$ v : B \otimes_A \Omega_{B/A}^1 \rightarrow \Omega_{B/A}^2 $$
such that $ v(g \cdot \omega) = dg \wedge \omega$, where $g \in B$ and $\omega \in \Omega_{B/A}^1$.
The rest of the argument is clear, however I don't see how contructing $v$ implies the existence of $u$. Furthermore, it looks like $v$ is missing a term. I would expect that
$$ v(g \cdot \omega) = dg \wedge \omega + g \cdot d\omega.$$
If you want to see the original then here is an English translation: https://fppf.site/ega/ega4-auto.pdf page 27, equation (16.6.2.4).
Any help is very appreciated.


text:
Q: Is there any way to display calendar of last month by default?

Date: <input type="text" id="datepicker">

I want to get the last month calendar by default.While using     <input    type="text"> it show the current date so is there any way to do it.
 Can any one help me ?

A: Using Jquery you can display like following way.
HTML:

Date: <input type="text" id="datepicker">

JQuery
$(function() {
        var date = new Date();
    date.setMonth(date.getMonth() - 1, 1);
    $('#datepicker').datepicker({defaultDate: date});
  });

Check Fiddle


text:
Q: How to make the script work with different files? I have 2 scripts. First, start.sh has these lines:
echo "-----------RUN copy mta-------------"
bash copy_file.sh mta $today_without_dash
echo "-----------RUN copy rcr-------------"
bash copy_file.sh rcr $today_without_dash
echo "-----------RUN copy sub-------------"
bash copy_file.sh sub $today_without_dash

Which starts copy_file.sh:
echo "remove old files "${1}
hadoop fs -rm -skipTrash /apps/hive/warehouse/database.db/project/file_${1}/*

for i in `hadoop fs -ls /user/files/${2}_C | egrep ${1}.gz | awk -F " " '{print $8}'`
do
    hadoop fs -cp $i /apps/hive/warehouse/database.db/project/file_${1}
    echo "copy file - "${i}
done

for i in `hadoop fs -ls /user/files/${2}_B | egrep ${1}.gz | awk -F " " '{print $8}'`
do
    hadoop fs -cp $i /apps/hive/warehouse/database.db/project/file_${1}
    echo "copy file - "${i}
done

The problem is, I have a lot of these ${2}_C type of folders, that each end with different letter. Like ${2}_P, ${2}_F, ${2}_L and so on. I wondered if there is a way of going through every folder in one loop, instead of writing a loop for every folder. Because the code is getting too bulky.

A: Instead of one loop per /user/files/${2}_SOMELETTER,
you could use one loop with all the directories in the parameter list, for example:
dirs=(/user/files/${2}_C /user/files/${2}_B)

for i in $(hadoop fs -ls "${dirs[@]}" | egrep ${1}.gz | awk -F " " '{print $8}')
do
    hadoop fs -cp $i /apps/hive/warehouse/database.db/project/file_${1}
    echo "copy file - "${i}
done

Note that instead of writing the directory parameters in the for statement,
I put them into an array.
This will be more readable if you have many directories.
I also replaced the obsolete `...` syntax with the modern $(...).


text:
Q: Finding minimum $\frac{x+y}{z}+\frac{x+z}{y}+\frac{y+z}{x}$ I would appreciate if somebody could help me with the following problem
Q. Finding maximum minimum
$$\frac{x+y}{z}+\frac{x+z}{y}+\frac{y+z}{x}(\text{where} ~~x,y,z>0)$$

A: $$\frac{x+y}{z}+\frac{x+z}{y}+\frac{y+z}{x}(\text{where} ~~x,y,z>0)$$
Consider the following :
$a , \frac{1}{a}$ we know that $A.M. \geq G.M.$
$\therefore \frac{a+ \frac{1}{a}}{2} \geq \sqrt{a . \frac{1}{a}}$
$\Rightarrow \frac{a^2+1}{2a} \geq 1 $
$\Rightarrow a^2 + 1 \geq 2a $
$\Rightarrow (a-1)^2 \geq 0$
$\Rightarrow a \geq 1$
$\therefore $ the expression has only minimum value which is 1 and no maximum value.
The expression $$\frac{x+y}{z}+\frac{x+z}{y}+\frac{y+z}{x}(\text{where} ~~x,y,z>0)$$
has minimum value of 1 + 1 +1 +1 +1 +1+1 = 6

A: By letting $u = \frac xy$ , $v = \frac yz$, and $w = \frac zx$ , our expression becomes $(u + \frac1u) + (v + \frac1v) + (w + \frac1w)$ , whose minimum is thrice that of $f(t) = t + \frac1t$ , which is to be found among the roots of its first order derivative: $f'(t) = 1 - \frac1{t^2}$ , which vanishes for $t = \pm1$ . Since t is positive, the only viable solution thus becomes $t = 1$ , for which $f(t) = 1 + \frac11 = 2$ , which yields a minimum value of $3\cdot2 = 6$.

A: A more formal proof that there is no maximum follows from taking the first derivatives and comparing to zero, showing that if $(x_0, y_0, z_0)$ is a maximum / minimum, it satisfies: $$x_0 = y_0 = z_0$$
This means that you can calculate the Hessian by only doing two calculations to determine $f_{xx}$ and $f_{xy}$, showing that at the maximum, say $(x_0,x_0,x_0)$:
$$H=\frac{2}{x_0^2}\left(\begin{matrix} 2 & 1 & 1\\
1 & 2 & 1 \\ 1& 1 & 2 \end{matrix}\right)$$
Since $H$ is clearly positive definite, the function has no maximum.

A: Note that if $F(x,y,z) = \frac{x+y}{z}+\frac{x+z}{y} + \frac{y+z}{x}$, then $F(kx,ky,kz)=F(x,y,z),\ k>0$. So we will use
Lagrange multiplier method. Let $g(x,y,z)=x+y+z$. Constraint is $x+y+z=1$.
$$\nabla F = (\frac{1}{z}+\frac{1}{y} - \frac{y+z}{x^2},\frac{1}{z}+\frac{1}{x} - \frac{x+z}{y^2},\frac{1}{y}+\frac{1}{x} - \frac{x+y}{z^2} ) =\lambda \nabla g$$
So $$ \frac{x^2(z+y) -(z+y)^2}{x^2yz}=\frac{z^2(x+y) -(x+y)^2}{xyz^2}=  \frac{y^2(z+x) -(z+x)^2}{xy^2z} =\lambda $$
$$ \frac{x^2(1-x) -(1-x)^2}{x^2yz}=\frac{z^2(1-z) -(1-z)^2}{xyz^2}=  \frac{y^2(1-y) -(1-y)^2}{xy^2z} =\lambda $$
Note that $\lambda\neq 0$ by computation.
Hence we have $$ (xz-xyz-1)(x-z)=(xy-xyz-1)(x-y)=(yz-xyz-1)(y-z)=0$$
$x=z\neq y$ implies that $2x^3-3x^2+x-1=0$. But it has only one solution larger than $1$.
If $x,\ y,\ z$ are distinct, $xz=xy=yz$. Contradiction.
So $x=y=z$. $F(1/3,1/3,1/3)=6$ is minimum.


text:
Q: How can I remove all NA rows in the column headings (diff lwr upr p adj) after performing TukeyHSD? I did a two way ANOVA and TukeyHSD and the interaction gave many NA rows. When plotting, all the NA rows are shown as white space and the information is very small to read. How can I remove the NA rows to create a better plot?
Plot with all NA rows showing
I have tried na.omit(TukeyHSD(intercation, conf.level = .95), but a plus sign appeared in the console and I was not sure what to add additionally


text:
Q: Birthday Date Auto generate year for 18 years old My question is how to automatically set the date range for 18 years old, like for example today is 2015, so the date range must be 1935-1997, don't mind the 1935. Because the date range is for 18 years old and above, so when it come to 2016 the date range will automatically set to 1935-1998 then so on so forth as the year comes by.
Here's the current code with javascript on it

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>jQuery UI Datepicker - Select a Date Range</title>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
  <script src="//code.jquery.com/jquery-1.10.2.js"></script>
  <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
  <link rel="stylesheet" href="/resources/demos/style.css">
  <script>
  $(function() {
    $( "#from2" ).datepicker({
      defaultDate: "+1w",
      changeMonth: true,
   changeYear: true,
      numberOfMonths: 1,
      yearRange: '1935:1997',
      onClose: function( selectedDate ) {
        $( "#to2" ).datepicker( "option", "minDate", selectedDate );
      }
    });
    $( "#to2" ).datepicker({
      defaultDate: "+1w",
      changeMonth: true,
   changeYear: true,
      numberOfMonths: 1,
      yearRange: '1935:1997' ,
      onClose: function( selectedDate ) {
        $( "#from2" ).datepicker( "option", "maxDate", selectedDate );
      }
    });
  });
  </script>
</head>
<body>

<label for="birthday">Birthday</label>
<input type="text" id="from2" name="from">

</body>
</html>

Well as you can see you in my javascript function the range function is hardcoded. :(

A: Get the range:
var startDate = "1935";
var endDate = new Date().getFullYear() - 18;
var interval = startDate + ":" + endDate;

Set the range to the DatePicker:
yearRange: interval

Fiddle


text:
Q: Can you get a table to auto format numbers to show parentheses on negative figures? In this answer to my connected question, where I had negatives figures shown in parentheses it was necessary in the answer to add them as pre and post text. My question resulting from this solution now is it possible if I put a negative figure in a table can latex format it to show in parentheses. So in the MWE below instead of typing {(}50000{)} I can type -50000 and the output will be (50000).
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{booktabs}
\usepackage{siunitx}
\sisetup{group-separator={,}}

\begin{document}

\section*{Income \& Expenditure Account}
\begin{table}[htb]
\centering
\begin{tabular}{
  p{7.5cm}
  c
  *2{S[table-format=6.0, table-space-text-pre=(, table-space-text-post=)]}
}
& \textbf{Note} & {\textbf{2016}} & {\textbf{2015}} \\
\midrule
Income & 1 & 100000 & 102000 \\
\cmidrule{3-4}\\
Cost of Sales & 2 & {(}50000{)} & {(}45000{)} \\
\cmidrule{3-4}
Gross Profit & & 50000 & 57000 \\
\end{tabular}
\end{table}
\end{document}

A: While re-inventing the wheel was fun, I decided to use the xstring and siunitx packages instead.
The macros \acount and \bcount are used to format numbers using (positive) for negative terms. \bcount will convert integers to decimals.
The second step is to create new column types A and B which automatically expands these macro.  Note the use of \multicolumn in the top row to handle text.
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{booktabs}
\usepackage{collcell}
\usepackage{xstring}
\usepackage{siunitx}

\newcommand{\acount}[1]% #1 = number
{\IfBeginWith{#1}{-}{\StrBehind{#1}{-}[\temp](\num[group-separator={,}]{\temp}\rlap{)}}%
   {\num[group-separator={,}]{#1}}}

\newcommand{\bcount}[1]% #1 = decimal number
{\IfBeginWith{#1}{-}{\StrBehind{#1}{-}[\temp]%
     (\num[group-separator={,},round-mode=places,round-precision=2,round-integer-to-decimal]{\temp}\rlap{)}}%
   {\num[group-separator={,},round-mode=places,round-precision=2,round-integer-to-decimal]{#1}}}

\newcolumntype{A}{>{\collectcell\acount}r<{\endcollectcell}}
\newcolumntype{B}{>{\collectcell\bcount}r<{\endcollectcell}}

\begin{document}

\section*{Income \& Expenditure Account}
\begin{table}[htb]
\centering
\begin{tabular}{p{8.25cm}cAA}
& \textbf{Note} & \multicolumn{1}{r}{\textbf{2016}} & \multicolumn{1}{r}{\textbf{2015}} \\ \hline\\
Income & 1 & 100000 & 102000 \\ \cline{3-4}\\
Cost of Sales & 2 & -50000 & -45000 \\ \cline{3-4}
Gross Profit & & 50000 & 57000 \\
\end{tabular}
\end{table}

\section*{Income \& Expenditure Account}
\begin{table}[htb]
\centering
\begin{tabular}{p{8.25cm}cBB}
& \textbf{Note} & \multicolumn{1}{r}{\textbf{2016}} & \multicolumn{1}{r}{\textbf{2015}} \\ \hline\\
Income & 1 & 100000 & 102000 \\ \cline{3-4}\\
Cost of Sales & 2 & -50000 & -45000 \\ \cline{3-4}
Gross Profit & & 50000 & 57000 \\
\end{tabular}
\end{table}

\end{document}


text:
Q: PyAudio does not work and breaks sound on ubuntu Ok, so I installed pyaudio from the package python-pyaudio using apt-get , now when I Import and Invoke as follows:
Python 2.7.3 (default, Sep 26 2012, 21:53:58)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyaudio
>>> p= pyaudio.PyAudio()
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_params.c:2162:(snd1_pcm_hw_refine_slave) Slave PCM not usable
ALSA lib pcm_params.c:2162:(snd1_pcm_hw_refine_slave) Slave PCM not usable
ALSA lib pcm_params.c:2162:(snd1_pcm_hw_refine_slave) Slave PCM not usable
ALSA lib pcm_dmix.c:957:(snd_pcm_dmix_open) The dmix plugin supports only playback stream
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started

It spits out those error messages. After some researching, I found this question:

PyAudio working, but spits out error messages each
  time

And in the answers it is mentioned that they are just warnings
But for me, the audio actually does not work and breaks audio on my system, making the Sound applet show all blanks and no audio outs work
Before:

After:

Is this a problem that I can fix?

A: You need to configure alsa properly, make sure that arecord works and default device properly records sound. If fixed it should start to work.
It is better to recompile PyAudio(Portaudio) without Jack and Alsa with Pulseaudio support.
Pulseaudio is a default sound framework in Ubuntu and should work without issues.

A: You need the JACK daemon to which it's trying to connect:
jack server is not running or cannot be started

It should come with most of the major Linux distributions if it isn't installed already. You should probably take a look on their page and decide which audio architecture you need (probably ALSA) and at what rate you want it to run. I can also recommend running a GUI interface such as QJackCtl on top of it, since JACK sometimes needs some configuring depending on your sound card.


text:
Q: How to submit a Oracle Java Change Request? I'd like to submit a Java8 LocalDate API change request (RFE) to Oracle. Unfortunately, the one and only form I could find (http://bugreport.java.com/bugreport/) does not provide the fields (Category, Sub-Category, ) I would need to specify me request correctly.
Is there any other way of filing correct and thorough Java change request to Oracle?

A: Does this link help you? Anyway, you will need an account at Oracle.
The categories are "core-libs" (components) and "java.time" (subcomponent). Am just curious, what would you like to change?
UPDATE: I have now got a closer look. It seems the bug report website is not quite uptodate with Java 8, missing the possibility to specify the java.time-package. So I would instead try to choose the subcategory "java.util.*" or "JDK/JRE documentation, API, tutorials (doc)" dependent on the kind of your RFE. The categoriy should probably be "Java Platform Standard Edition (JDK/JRE)".
And notice that you can only file bug reports or RFEs, but not request for changing the API in a backwards incompatible manner.
Bug: A behavior that violates the specification.
RFE: A feature that should be added to the product.

Another idea:
You can try to send an issue on Threeten/Github.


text:
Q: How do I write an awk program that matches #ifdef...#else...#endif C pre-processor macros? I have a large corpus of C programs that have the following code blocks.
100. #ifdef DEBUG1
    .
    .
    .
102. #else
    .
    .
    .
105. #endif

or,
200. #ifdef DEBUG2
    .
    .
    .
206. #endif

Moreover, a single file may contain multiple #DEBUG macros. I want to extract the line numbers corresponding to the macros. Assuming the numbers in the code snippet are the line numbers in the source file, I want the output to be in the following format:
FILE - MACRO_NAME - IFDEF - ELIF - ENDIF
----------------------------------------
prog.c - DEBUG1   -  100  -  102  -  105
prog.c - DEBUG2   -  200  -   X   -  206

How can I write an awk program to achieve the same? If awk is not the appropriate tool, what tool can I use?

A: Awk actually has associative arrays so the approach I would take would be:

*

*For each #ifdef (or equivalent such as #if 1), increment a variable then use that to store the if line number, setting the else and endif line numbers to -1.

*For an #else line, use the current variable to set  the else line number.

*For an #endif, output whatever details you have for the line numbers then decrement the variable.

*For an #elif, you need to combine #else and #if actions and ensure that the relevant #end closes off all the #if/#elif lines.
For example, here's a self-contained bash script showing how it could work:
#!/usr/bin/env bash

# Use this script as input file as well, luckily C preprocessor
# macros look like bash comments.

#ifdef XYZZY
    # Some text inside the first ifdef
    #if 0
        # This is the inner bit.
    #endif
    #if 1
        # blah blah blah
    #elif defined TWISTY
        # yada yada yada
    #elif defined PASSAGES
        # run out of phrases
    #else
        # still got nothing
    #endif
#else
    #ifdef PLUGH
        # This is the plugh stuff
    #else
        # This is the anti-plugh stuff
    #endif
#endif

awk <$0 '
    $1 == "#ifdef" || $1 == "#if" {
        level++
        line_mac[level] = $0
        gsub(/^[ \t]+/, "", line_mac[level])
        line_if[level] = NR
        line_else[level] = "X"
        line_end[level] = "X"
        typ_elif[level] = 0
        next
    }
    $1 == "#elif" {
        line_else[level] = NR
        level++
        line_mac[level] = $0
        gsub(/^[ \t]+/, "", line_mac[level])
        line_if[level] = NR
        line_else[level] = "X"
        line_end[level] = "X"
        typ_elif[level] = 1
        next
    }
    $1 == "#else" {
        line_else[level] = NR
        next
    }
    $1 == "#endif" {
        while (typ_elif[level] == 1) {
            printf "if-line %-4s, else-line %-4s, endif-line %-4s, macro '%s'\n", line_if[level], line_else[level], NR, line_mac[level]
            level--
        }
        printf "if-line %-4s, else-line %-4s, endif-line %-4s, macro '%s'\n", line_if[level], line_else[level], NR, line_mac[level]
        level--
    }
    '

The output of that (with numbered lines from the file for checking) is:
 1: #!/usr/bin/env bash
 2:
 3: # Use this script as input file as well, luckily C preprocessor
 4: # macros look like bash comments.
 5:
 6: #ifdef XYZZY
 7:     # Some text inside the first ifdef
 8:     #if 0
 9:         # This is the inner bit.
10:     #endif
11:     #if 1
12:         # blah blah blah
13:     #elif defined TWISTY
14:         # yada yada yada
15:     #elif defined PASSAGES
16:         # run out of phrases
17:     #else
18:         # still got nothing
19:     #endif
20: #else
21:     #ifdef PLUGH
22:         # This is the plugh stuff
23:     #else
24:         # This is the anti-plugh stuff
25:     #endif
26: #endif

if-line 8   , else-line X   , endif-line 10  , macro #if 0
if-line 15  , else-line 17  , endif-line 19  , macro #elif defined PASSAGES
if-line 13  , else-line 15  , endif-line 19  , macro #elif defined TWISTY
if-line 11  , else-line 13  , endif-line 19  , macro #if 1
if-line 21  , else-line 23  , endif-line 25  , macro #ifdef PLUGH
if-line 6   , else-line 20  , endif-line 26  , macro #ifdef XYZZY

A: Given your comment something like this should be all you need (using GNU awk for ENDFILE and ARGIND):
awk '
{ hit = 0 }
$1 == "#ifdef" {
    macroname = $2
    count[macroname]++
    hit = 1
}
$1 ~ /#(else|endif)$/ { hit = 1 }
hit { fnr[macroname,count[macroname],$1] = FNR; hit = 0 }
ENDFILE {
    if (ARGIND == 1) {
        print "FILE", "MACRO_NAME", "IFDEF", "ELIF", "ENDIF"
    }
    for (macroname in count) {
        for (i=1; i<=count[macroname]; i++) {
            print FILENAME, macroname, fnr[macroname,i,"#ifdef"]+0, fnr[macroname,i,"#elif"]+0, fnr[macroname,i,"#endif"]+0
        }
    }
    delete count
    delete fnr
}
' *.c

It's untested of course since you didn't provide an example we could test against. Set OFS or use printf or pipe to column to get differently formatted output if you care.

A: To expand on @paxdiablo's answer. If you have gawk and are using multiple files as input, you could take advantage of the BEGINFILE and ENDFILE rules to print the macros from each file.
Note, unlike the BEGIN/END blocks, which only run once at the beginning and end of all input, these are run at the beginning/end of each file (unsuprisingly).
So, a simplified script, ignoring #else etc., for which you could just add additional rules, an awk script like the following might be useful for multiple input files,
#!/usr/bin/awk -f

BEGIN {
    printf "%-10s | %-10s | %-5s | %-5s\n", "FILE", "MACRO", "IFDEF", "ENDIF";
    print "----------------------------------------"
}

BEGINFILE {
    delete macros;
    delete locs;
    i = 0;
}

/^[ \t]*#ifdef[\t ]+([^ \t])+/ {
    macros[i++] = $2;
    locs[i]["start"] = FNR;
}

/^[ \t]*#endif/ {
    locs[--i]["end"] = FNR;
}

ENDFILE {
    for (i = 0; i < length(macros); i++) {
        printf "%-10s - %-10s - %-4d - %-4d\n",
            FILENAME, macros[i], locs[i]["start"], locs[i]["end"];
    }
}

Which should output something like the following,
$ ./defs.awk tst.h tst2.h

FILE       | MACRO      | IFDEF | ENDIF
----------------------------------------
tst.h      - DEBUG1     - 0    - 5
tst.h      - INNER1     - 1    - 4
tst2.h     - DEBUG2     - 0    - 3


text:
Q: Zlib version used in openjdk 11 I am trying to check what zlib version is used for an specific version of openjdk 11 but I can't find it anywhere.
I was googling it but can't find it anywhere. I can just find some tickets in which it's informed that it has been updated.

A: The code is here:
https://github.com/openjdk/jdk11u/tree/master/src/java.base/share/native/libzip
and current version should be 1.2.11


text:
Q: PHP image manipulation wrapping image on of another image I'm working on a PHP project where the user can upload an image and preview that image on a product (Ex. mug, pillow). I have done almost all that is required to implement this except wrapping the uploaded image around the product image. I have done extensive search on that, but could not find any help. Could anyone show me the way please ?
At the moment I am using the GD library.
Best example for what I need is : http://www.zazzle.com/polyester_throw_pillow_16_x_16-189271445174968378
I am not sure how they are doing that.
EDIT :
My area of interest is how they are blending the image according the product shape

A: I think it's answered here: Merge two PNG images with PHP GD library
Just make sure that the image uploaded by the client is smaller than your product image


text:
Q: Qt QTcpSocket readAll fuction not reading whole data from socket I got super simple code.
QTcpSocket* sock = new QTcpSocket();
connect(sock - readyread) and other signals
sock->connectToHost();
sock->write();

//readyread
qDebug() << "available" <<  sock->bytesAvailable();
QByteArray a = sock->readAll
qDebug() << "readed"  << a.size()

and as output i got:
available - 4677
readed - 681
available - 8760
readed - 114
available - 10899
readed - 59

A: The problem was with multiple connect to ReadyRead signal in my concrete realization of networking.
(in parent and in child class)
My bad


text:
Q: How to move cells between table sections with realm? In my project I am using tableView with two sections. I need to move cells within one section or between sections using the method - moveRowAt. Then I write it in Realm.
In my code cells move between sections but in one section I can't swap them.
override func tableView(\_ tableView: UITableView, moveRowAt sourceIndexPath: IndexPath, to destinationIndexPath: IndexPath) {
    let task = sourceIndexPath.section == 0 ? importantTask[sourceIndexPath.row] : currentTask[sourceIndexPath.row] //choose from which section the task will be taken

    let type = destinationIndexPath.section == 0 ? TaskPriority.important : TaskPriority.normal // change the type of the task (it depends in which section the task will be located)

    let realm = try! Realm()
    try! realm.write {
    task.type = type // change task type to new type
   }

    tableView.reloadData()
}


text:
Q: SQL Script to generate query from stored description I have a data table in the following:
Name              Expression
FirstName           NULL
LastName            NULL
FullName          CONCAT(FirstName,LastName)
Gender              NULL
FullNameWGender   CONCAT(FullName,Gender)

How do I use SQL statement to produce the following data taken from the table:
FirstName, LastName, CONCAT(FirstName,LastName) AS FullName, Gender, CONCAT(CONCAT(FirstName,LastName),Gender) AS FullNameWGender

I am using MySQL.
I do not expect a complete code but at least a starting point since I have no idea how to ensure that once I reach the data in expression column that has CONCAT and process it.
Like in the above example, in the table it is CONCAT(FullName,...). But with my SQL, I have to extract that and process it to display asCONCAT(CONCAT(FirstName,LastName),....)...
Any help would be great!

A: What you can do for FullNameWGender is CONCAT(FirstName, LastName, Gender).
Select FirstName, LastName, CONCAT(FirstName,LastName) AS FullName, Gender, CONCAT(FirstName, LastName,Gender) AS FullNameWGender

CONCAT can be used for more than two strings.
dev.mysql.com

A: Well, I have the code in the form of cursor (I have no other choice)
Using the same table as above but with more data:
ID    NAME                      EXPRESSION
1      FirstName,                   NULL
2      LastName,                    NULL
3      FullName,                  CONCAT( FirstName, LastName)
4      Gender,                      NULL
5      FullNameWGender,           CONCAT( FullName, Gender)
6      Income,                      NULL
7      Expense,                     NULL
8      Savings,                   ( Income,- Savings,)
9      FullNameWSavings,          CONCAT( FullName, Savings,)
10     Month,                       NULL
11     FullNameWSavingsByMonth,   CONCAT( FullNameWSavings, Month,)

To get the updated table as below:
ID    Name                      Expression
1      FirstName,                   NULL
2      LastName,                    NULL
3      FullName,                  CONCAT( FirstName, LastName)
4      Gender,                      NULL
5      FullNameWGender,           CONCAT(CONCAT( FirstName, LastName) Gender)
6      Income,                      NULL
7      Expense,                     NULL
8      Savings,                   ( Income,- Savings,)
9      FullNameWSavings,          CONCAT(CONCAT( FirstName, LastName)( Income,-    Savings,))
10     Month,                       NULL
11     FullNameWSavingsByMonth,   CONCAT(CONCAT(CONCAT( FirstName, LastName)( Income,- Savings,)) Month,)

Just for the reference of anyone (hopefully it can be helpful (thanks a lot @Nappa The Saiyan for your answer), the following is the code:
DECLARE @id_name INT
DECLARE @id_expression INT
DECLARE @expression NVARCHAR (MAX)
DECLARE @cutExpression NVARCHAR (100)
DECLARE @name NVARCHAR (100)
DECLARE @newExpression NVARCHAR (MAX)
DECLARE @temp NVARCHAR (MAX)

DECLARE @rowNumExp INT
DECLARE @rowNumName INT
DECLARE @rowNum INT
SET @rowNum = 0
SET @rowNumExp = 0
SET @rowNumName = 0

DECLARE expressionList CURSOR FOR
SELECT ID, EXPRESSION FROM table1
OPEN expressionList
FETCH NEXT FROM expressionList
    INTO @id_expression, @expression

WHILE @@FETCH_STATUS = 0
BEGIN
    SET @rowNumExp = @rowNumExp + 1
        IF (@expression IS NOT NULL)
        BEGIN
            DECLARE nameList CURSOR FOR
            SELET ID, NAME FROM table1
            OPEN nameList
            FETCH NEXT FROM nameList
                INTO @id_name, @name

            WHILE @@FETCH_STATUS = 0
            BEGIN
                IF(CHARINDEX(@name,@expression)>0)
                BEGIN
                    SET @cutExpression = SUBSTRING(@expression,
                                                   CHARINDEX(@name,@expression),
                                                   LEN(@name))
                    SET @temp = (SELECT EXPRESSION FROM table1 WHERE ID = @id_name)
                    IF(@temp IS NOT NULL)
                    BEGIN
                        SET @newExpression = REPLACE (@expression, @name, @temp)
                        UPDATE table1
                            SET EXPRESSION = @newExpression
                            WHERE ID = @id_expression
                        SET @expression = @newExpression

                        CLOSE nameList
                        DEALLOCATE nameList

                        DECLARE nameList CURSOR FOR
                        SELECT ID, NAME FROM table1
                        OPEN nameList
                        FETCH NEXT FROM nameList
                            INTO @id_name, @name
                    END
                END
                SET @rowNumName = @rowNumName + 1
                FETCH NEXT FROM nameList
                    INTO @id_name, @name
            END
            CLOSE nameList
            DEALLOCATE nameList
        END
        FETCH NEXT FROM expressionList
            INTO @id_expression, @expression
END
CLOSE expressionList
DEALLOCATE expressionList

Limitations:

*

*Starting character for the Name column has to be a space

*Last character for the Name column has to be a ',' Eg in name column: "
FirstName," and not "FirstName,"

*All names in the expression has to be followed by a "," eg in expression column:
"CONCAT(FullName,Savings,)" and not "CONCAT(FullName,Savings)"

Regardless of the number of "Name" available in the Expression which does not have NULL as its own Expression, the thing will format everything out as the 2nd table above.


text:
Q: Write to Public calendar in 365 from SQL Server 2016 We are hoping to write to a public calendar within our Office 365 tenant the operating hours of our business. The hours are originated within SQL Server (now updated to 2016). I am hoping we can do this with the Graph API but haven't seen explicit docs on PUT endpoints for the shared calendar objects.
Are these resources readily available or is this a roadblock issue?

A: This is work in progress, and we will update this thread when access to calendars other than the signed-in user's calendars is available through Microsoft Graph.


text:
Q: Connect Spark streaming to a SDN I am new in world of network. I would like to know how can I connect spark streaming to SDN network to monitor the network. I want to use mininet and POX as a SDN controller to simulating a SDN network. I have already installed spark and scala(and python) on my mininet VM. However I could not find any good tutorial or documentation based on both SDN and Spark. Please let me know what should I do. (Even by a link)

A: The question is a little general. However you should capture the packets using tcpdump or tcpprobe, then try to analyze them using spark in streaming way. For example predicting something. After that use your result in any part of your controller you want like like Pox.


text:
Q: How do I count the number of image request made by one particular site to my site I have uploaded a image to my server and it is being used requested by many other multiple websites. I want to track the number of image request made by a particular site along with the ip address of the user who views the image. Is this possible? If yes, How can I do so ?

A: The solution is to let them access the image through a PHP script rather then giving them direct access to the file.
This way your can have the images in a directory that is not accessible to the clients.
Your script would be called like: image.php?file=image.jpg
Pseudo code of image.php:
$filename = $_GET['file'];

get_user_info_and_push_to_database();  // see $_SERVER['REMOTE_ADDR']

load_file_and_send_file_to_user();   // see header() and readfile()


text:
Q: .bashrc error bash: /home/jason/.bashrc: line 115: syntax error: unexpected end of file Here is the error that appears at the top of the screen when I start a new terminal:

bash: /home/jason/.bashrc: line 115: syntax error: unexpected end of file

I went to said file and and tried commenting out the following lines (The final line of this code is line 115.) of code which solved the problem in a very sloppy way:
#if ! shopt -oq posix; then
  #if [ -f /usr/share/bash-completion/bash_completion ]; then
    #. /usr/share/bash-completion/bash_completion
  #elif [ -f /etc/bash_completion ]; then
    #. /etc/bash_completion
  #fi
#fi

I am not familiar with this code, and would appreciate a solution, or even a suggestion on how to format this question better.

A: Turns out when I went into my .bash_aliases file and commented out piece by piece my aliases the following alias was the culprit.
alias fi='firefox'

The reason this is faulty is because fi is the end of an if statement, and the way this went into bash script it was read as ending the if, rather than as the name of the desired alias. Resulting in a error.
Her is the fixed line.
alias fir='firefox'

Moral of the story is don't use fi as an alias because it is read as the end to an if statement in bash script.


text:
Q: How do I view source in Outlook 2010? This question has already been asked here; but the answer only gives advice on how to view the email header not the actual html source of the email.
There is another question here, which I think may be caused by the same issue as mine, but does not have a satisfactory answer (the answer does not work for the person who posted the question)
If I right click on the bottom of an email I can see the option to 'view source' but when I select it nothing happens.
I have done a bit of research and came across a post for a much earlier version of Outlook that suggested adding something into the registry. I applied this advice, but it made no difference; but I'm pretty sure that applying this solution correctly for my circumstances will do the trick. When I first received this machine it had a demo version of UltraEdit installed. I uninstalled UltraEdit and installed Notepad++ instead. I am convinced that there is a registry entry that is pointing to UltraEdit as the default view for 'view source' in my email and I need to replace this entry with a reference to Notepad or Notepad++, but I don't know how to do this.
Any suggestions?

A: Open the email on the Message Ribbon and go to Move > Actions > Other Actions > View Source

It invokes Notepad and shows the full html source.

A: Double click on the mail, this will open it in a new window.
After that, then click on File > Properties.  You will be able to see the header information from there.
For the "view source", right clicking on mails that have a source will by default open it in notepad.
For mails that aren't formatted (in HTML etc), the "view source" option will be greyed out.

A: In 2010 you do the following: (step ONE is very important)

*

*Open the email...
( do NOT try to add the command at the top level of outlook, it will NOT show "view Source")

*Right Click the ribbon -> Customize Ribbon

*Select All Commands (since you are on an email, the "view source" will show)

*Select "View Source" in and drop it in a new Group.

A: I have this issue also. I am sure headers and source were available for most (if not all) messages I received when running Outlook 2007, now it seems to be the exception to the rule.
I have found http://email.about.com/od/outlooktips/qt/How_to_View_the_Complete_Message_Source_in_Outlook.htm that I have only just implemented, so can't say for sure if it will solve the issue for new e-mails.
There is also this interesting article, that while I also haven't been able to verify, might help someone else finding this page. It seems that depending on where you right click in message contents (A method in 2010 to view the source) matters as to whether you get the option to view source, in HTML messages - http://www.outlook-tips.net/tips/view-message-source-outlook/

A: I am using Outlook 2010 for MAC and right clicking (or control clicking) on the email from the inbox list (not the actual email itself) gives me a view source option

A: Best option if you need to do this more then once.
Click File > Options > Quick Access Toolbar > Choose commands from "All Commands",
In the list, find View Source, Add it and click OK
Now you have an icon to always view the source no matter what kind of email.
If the icon is grey-ed out, it means the email type is txt and has no source.
Found in http://www.outlook-tips.net/tips/view-message-source-outlook/

A: Be sure to double click on the message to open it separately and that you are not looking at it in the preview pane. If you single click and the message shows below or to the right of the email list you are in the preview pane. You cannot select view source in the preview pane. Once you have opened it separately, you should be able to select view source. I had this problem and solved by opening the email and not just previewing it.

A: In the latest version of Outlook you right click in the email and choose: view source.

A: For plain text mail, it is impossible to "view source" and hence view source option is greyed out.
To get full header and source for plain text mail, convert to eml file by using third-party tools such as Super User: OutlookMessagesExportEML.

A: The easiest & ONLY way for me on my #Mac using #Outlook.
Right Click on the Email Directly in the middle column.
This is the only location I found it, there is no option menu to add or select from.  I am also unable to customize the ribbon.
I hope this helps.

A: There is a command view source... in outlook 2010 (office home and business) version 14.0.61.49.
Click the ribbon --> add commands ---> more commands --> all commands --> view source...


text:
Q: How to define custom block in Twig form theme used application-wide? I would like to create a custom block in my application-wide form theme :
config.yml :
  twig:
     form_themes:
        - 'MyAdminBundle::bootstrap_3_layout_custom.html.twig'

in bootstrap_3_layout_custom.html.twig :
{%- block test_block -%}
    test
{%- endblock test_block -%}

It also contains several overloads for for_row, form_widgets.. and others, which are working fine on my child twigs.
But when I try to do :
{{ block('test_block') }}, I get a Block "test_block" on template "@MyBundle/base.admin.html.twig" does not exist.
I presume I should register a 'test_block' function in a Twig extension, but I can't find how to do so?
Other question : if above assert is true (have to define Twig function) is there a way to do it "widely", or should I register block functions one by one?
Thanks

A: Most likely this is not in the normal twig. you would need to write some extension or download it. i pressume someone has done this before so look it up or stay with the normal cms rules.
hope this helps and good luck further on


text:
Q: Regex who allows aphanumeric and space. Using UTF8 I want a regex who allows aphanumeric and space. UTF8
Example:
é, á, a, A, 1 and space.
What the problem of anothers aswers like that: Regex for allowing alphanumeric,-,_ and space
Because it does not work using UTF8 like ( Á, ô).

A: it seems to already work...

var regex = /é/;
console.log(regex.test('é'));//true

A: To match [\p{L}\p{Nd} ] in JavaScript you can use:
[\u0020\u0030-\u0039\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376-\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u0660-\u0669\u066E-\u066F\u0671-\u06D3\u06D5\u06E5-\u06E6\u06EE-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4-\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0966-\u096F\u0971-\u0980\u0985-\u098C\u098F-\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC-\u09DD\u09DF-\u09E1\u09E6-\u09F1\u0A05-\u0A0A\u0A0F-\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32-\u0A33\u0A35-\u0A36\u0A38-\u0A39\u0A59-\u0A5C\u0A5E\u0A66-\u0A6F\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2-\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0-\u0AE1\u0AE6-\u0AEF\u0AF9\u0B05-\u0B0C\u0B0F-\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32-\u0B33\u0B35-\u0B39\u0B3D\u0B5C-\u0B5D\u0B5F-\u0B61\u0B66-\u0B6F\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99-\u0B9A\u0B9C\u0B9E-\u0B9F\u0BA3-\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0BE6-\u0BEF\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60-\u0C61\u0C66-\u0C6F\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0-\u0CE1\u0CE6-\u0CEF\u0CF1-\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D66-\u0D6F\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DE6-\u0DEF\u0E01-\u0E30\u0E32-\u0E33\u0E40-\u0E46\u0E50-\u0E59\u0E81-\u0E82\u0E84\u0E87-\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA-\u0EAB\u0EAD-\u0EB0\u0EB2-\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F20-\u0F29\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F-\u1049\u1050-\u1055\u105A-\u105D\u1061\u1065-\u1066\u106E-\u1070\u1075-\u1081\u108E\u1090-\u1099\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u17E0-\u17E9\u1810-\u1819\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A16\u1A20-\u1A54\u1A80-\u1A89\u1A90-\u1A99\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B50-\u1B59\u1B83-\u1BA0\u1BAE-\u1BE5\u1C00-\u1C23\u1C40-\u1C49\u1C4D-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5-\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183-\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3006\u3031-\u3035\u303B-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8D0-\uA8D9\uA8F2-\uA8F7\uA8FB\uA8FD\uA900-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF-\uA9D9\uA9E0-\uA9E4\uA9E6-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5-\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40-\uFB41\uFB43-\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]


text:
Q: How to access Safari browser Reader Mode content from my Safari Extension? Background
I am developing a Safari Web Extension and need to do following (simplified):

*

*Initiate action from extension popup.

*Extract main text from the opened web page.

*Process the text in the cloud.

*Update DOM with processed text.

Current Situation
The Extension uses https://github.com/mozilla/readability, directly from its content.js, to extract the main text from the page and that works fine in most cases, and I can proceed with steps 2 and 3.
However, I noticed that Safari Reader View produces good results, arguably better than Readability. So I want to try and replace Readability with Safari Reader View for this text extraction.
Problem
How can I access Safari Reader View content/text directly from content.js of my Extension?
One possible approach (that I haven't tested) would be something like this:

*

*Initiate action from Extension popup.

*Send a message to Extension's macOS app.

*In macOS app initiate SFSafariViewController with entersReaderIfAvailable: true in its Configuration.

*In macOS extract text from that Reader View. (not sure if this is possible, but I assume it is).

*Two alternatives here (not really important for the question):

*

*Send back that text to Web Extension and continue cloud processing from there (as done before).

*Initiate cloud processing from macOS app and send only result to the Web Extension.

Ultimately, I might try that, but first I would like to avoid involving macOS app part of this Extension.


text:
Q: MVC Return Content vs Return View How can I encapsulate the following code and incorporate it into my view?
public ActionResult Index()
    {
        string restURL = "http://loripsum.net/api/3/medium/";
        using (var client = new WebClient())
        {
            var data = client.DownloadString(restURL);
            return Content(data, "application/json");
        }

    }

As you can see, I'm not accessing my view page at all, and I'm not sure how to insert this code into the view I have. Can I turn this into a function and then call it with return View(foo)?
Thanks! Sorry, It's been years since I've used mvc

A: So if I get your meaning, you're wanting to embed "data" within a view you already have - so depending on what "data" is, you should create a ViewModel (just a standard C# class) with a property in it - lets assume data is a string since you're retrieving it as a string.  Set the property's value to data, then return your View from this method, and pass in your new ViewModel.
public class MyViewModel
{
    public string LoremContent { get; set; }
}

...
public ActionResult Index()
{
    string restURL = "http://loripsum.net/api/3/medium/";
    using (var client = new WebClient())
    {
        var data = client.DownloadString(restURL);
        MyViewModel model = new MyViewModel() { LoremContent = data };
        return View(model);
    }
}

Then in your view you can refer to @Model.LoremContent - if it's HTML you can just use @Html.Raw(Model.LoremContent) to render it.   Be sure to validate the content if you're going to do this, otherwise you're making yourself vulnerable to a script attack.


text:
Q: Why does ArcGIS Desktop 10 say "ArcInfo is not authorized" after saying "your software has been authorized"? Here is my sequence of actions:

*

*Install ArcGIS Desktop 10.0.0.2414

*Start ArcGIS Administrator application

*Click "Desktop"

*"ArcInfo (Single Use)" option is automatically chosen and I am unable to change it to ArcView or ArcEditor. My code is supposed to be for Basic version though.

*Click "Authorize Now..."

*Select "I have installed my software and need to authorize it"

*Select "Authorize with ESRI now using the Internet"

*Enter address; organization, industry, specialization

*Enter authorization number into ArcInfo Single Use field (ESUXXXXXXXXX).

*Select "I do not want to authorize extensions at this time."

*See "Authorizing software..." progress bar

*See success message:
"Congratulations, your software has been authorized and is now ready for use."

Then I try to launch ArcInfo, ArcMap, ArcGlobe, ArcCatalog or ArcScene and all give me the following error: "ArcInfo is not authorized for use."

Do you know why this happening?
And what would you recommend me to do?


text:
Q: Modulo product when the divisor is greater than both large factors In my C++ code I have three uint64_tvariables:
uint64_t a =  7940678747;
uint64_t b = 59182917008;
uint64_t c = 73624982323;

I need to find (a * b) % c. If I directly multiply a and b, it will cause overflow. However, I can't apply the formula (a * b) % c = ((a % c) * (b % c)) % c, because c > a, c > b and, consequently, a % c = a, a % c = b and I will end up multiplying a and b again, which again will result in overflow.
How can I compute (a * b) % c for these values (and such cases in general) of the variables without overflow?

A: A simple solution is to define x = 2^32 = 4.29... 10^9
and then to represent a and b as:
a = ka * x + a1 with ka, a1 < x
b = kb * x + b1 with kb, b1 < x

Then
a*b = (ka * x + a1) * (kb * x + b1) = ((ka * kb) * x) * x
      + x * (b1 * ka) + x * (a1 * kb) + a1 * b1

All these operations can be performed without the need of a larger type, assuming that all the operations are performed in Z/cZ, i.e. assuming that % c operation is performed after each operation (* or +)

A: There are more elegant solutions than this, but an easy one would be looking into a library that deals with larger numbers.  It will handle numbers that are too large for the largest of normal types for you.  Check this one out: https://gmplib.org/

A: Create a class or struct to deal with numbers in parts.
Example PsuedoCode
// operation enum to know how to construct a large number
enum operation {
    case add;
    case sub;
    case mult;
    case divide;
}
class bigNumber {
    //the two parts of the number
    int partA;
    int partB;

    bigNumber(int numA, int numB, operation op) {
        if(op == operation.mult) {
            // place each digit of numA into an integer array
            // palce each digit of numB into an integer array
            // Iteratively place the first half of digits into the partA member
            // Iteratively place the second half of digits into the partB member
        } else if //cases for construction from other operations
    }

    // Create operator functions so you can perform arithmetic with this class
}

uint64_t a =  7940678747;
uint64_t b = 59182917008;
uint64_t c = 73624982323;

bigNumber bigNum = bigNumber(a, b, .mult);
uint64_t result = bigNum % c;
print(result);

Keep in mind that you may want to make result of type bigNumber if the value of c is very small.  Basically this was just sort of an outline, make sure if you use a type that it won't overflow.