switch block try/catch exception

Question: I have a switch statement with 5 integer options and a default message. I am trying to get it to work so that if anything other than the choice numbers is chosen, an "Invalid Input" message will show up. It currently works for numbers, but if anything else is entered, I get the following exception:

Exception in thread "main" java.util.InputMismatchException

I tried to add a try/catch statement, but it doesn't seem to be working; I keep getting the same error message.
public static void main(String[] args) throws IOException {
    int menuItem = -1;
    while (menuItem != 0) {
        menuItem = menu();
        try {
            switch (menuItem) {
                case 1:
                    showTaskList();
                    break;
                case 2:
                    addTask();
                    break;
                case 3:
                    sortList();
                    break;
                case 4:
                    deleteTasks();
                    break;
                case 0:
                    break;
                default:
                    System.out.println("Invalid Input");
                    break;
            }
        }
        catch (java.util.InputMismatchException err) {
            System.out.println("\nINVALID INPUT!");
        }
    }
}

Comment: Please post a [mcve] and read [ask]. We can't help otherwise.
Comment: I would assume that `menuItem = menu();` is the on taking the input and throwing the error so this is the one you need the try/catch around.
Answer: If your program terminates with a java.util.InputMismatchException then it follows that that exception was not thrown from within the try block you presented.  Inasmuch as that exception is associated with entering input in an unexpected form, and inasmuch as an attempt to convert the input to a number evidently has already been performed in method menu(), before entering the try block, it seems reasonable to conclude that the exception is thrown from method menu().  The stack trace accompanying the exception would have told you this directly, and more precisely than I can from what you presented.
Based on the nature of the task and the type of exception you received, I speculate that you are using a Scanner to read user input, and specifically that you are invoking Scanner.nextInt().  This method will throw an exception of the type you specified if invoked when the next token cannot be interpreted as a Java int.
Only you can decide how best to deal with that, but one possibility is to move invocation of the menu() method inside your try block:
    // ...
    while (menuItem != 0) {
        try {
            menuItem = menu();
            switch (menuItem) {
            // ...

Comment: Thanks, this was the problem!  Makes a lot more sense now.

switch block try/catch exception


What's the purpose of "was" in "Hast du schon was vor?"?

Question: Hast du schon was vor?
Duo said this is translated as "Do you have plans yet?" But I'm not sure what "was" adds to it?  "Do you have something planned?"  Is that it?  I've seen it in another sentence too.  Hast du noch was Geld "Do you still have something money?"  but "was" is a shortened form of etwas meaning "something".  Help me bitte!  And please help me understand the reasoning for using "was".
Answer:
Hast du schon (et)was vor?

The relevant verb phrase is etwas vorhaben — to have something on, to be up to something. So it means

Are you up to something yet?

That "something" etwas may be shortened to was in colloquial German.

Hast du noch etwas Geld?

This one is entirely different. You can't shorten the etwas to was in this phrase as this etwas doesn't mean something but some. It would be wrong even in colloquial German. So it means

Do you still have some money?
Comment: It would be nice to mention that shortening "etwas" to "was" is somewhat colloquial and likely most used in spoken, not written language. (And "Hast du noch was Geld" is entirely colloquial - I actually do hear that frequently.)
Comment: I suggest to add the conclusion to the second part that *Hast du noch was Geld* is colloquial at best (if not outright wrong) and can't be recommended for use.
Comment: Thank you!  You guys are amazing!  I love this platform and I got help so quick!.  And such great answers!!  Thanks


Teacher license laws

Question: As a teacher, am I bound to a 30-day notice if I never have signed a contract for the past 3 years for the position I am currently working? I have another job offer which requires me to give a 2-week notice. My current school district says I must give a 30-day notice or lose my license to teach. Was hired July 2016 (no contract). I requested a contract July 2018 and was never given one.
Comment: You definitely need to edit your question or the tags to add a jurisdiction.
Answer: This is correct. See this page from the NC Board of Education, listing the 9 grounds for revocation of a license.

resignation from employment with a LEA without thirty work days' notice, except with the prior consent of the local superintendent;

A written contract is not required. I assume you were in fact working without a written contract in the prior year, that is, you were an employee.
Comment: Are we an Employment at Will state?
Comment: Yes, all states besides Montana are. That means they can fire you at will. They lists the recocations, and there are 3 prior cases of revocation for resignation.
Comment: Thank you for the clarification. So a district can revoke a license when an employee is NOT under contract. That's NC for you!

Teacher license laws


How do you integrate $\int_{0}^\infty \frac{\log(x)^2}{(1-x^2)^2}$ using contour integration?

Question: I have tried using the standard keyhole integral, and looking at$\ \log(x)^3 $, but because the poles lie on the real axis, when I expand the integrand $\ \frac{(\log(x) + 2\pi i)^3}{(1-x^2)^2} $ I get integrals which do not converge. Am I approaching this problem wrong? When the poles are first order on the real axis, or the poles do not lie on the axis at all, contour integration seems much simpler.
Answer: This integral may be evaluated using the residue theorem.  That said, the evaluation is very subtle and requires a bit of carrying around diverging quantities that cancel.  Also, the contour of integration in this case should have a detour around the removable singularity.  We proceed as follows.
Consider the contour integral
$$\oint_C dz \frac{\log^3{z}}{(z^2-1)^2} $$
where $C$ is the following contour:

where the bumps about the removable singularity at $z=1$ are semicircles of radius $\epsilon$ and the outer circle has a radius $R$.  We parametrize the contour to evaluate the contour integral; accordingly, the contour integral is equal to
$$\int_{\epsilon}^{1-\epsilon} dx \frac{\log^3{x}}{(1-x^2)^2} + i \epsilon \int_{\pi}^0 d\phi \, e^{i \phi} \frac{\log^3{\left (1+\epsilon e^{i \phi} \right )}}{\left ( \left (1+\epsilon e^{i \phi} \right )^2-1 \right )^2} \\ + \int_{1+\epsilon}^{R} dx \frac{\log^3{x}}{(x^2-1)^2} + i R \int_0^{2 \pi} d\theta \, e^{i \theta} \frac{\log^3{\left ( R e^{i \theta} \right )}}{\left ( R^2 e^{i 2 \theta} \right )}\\ + \int_R^{1+\epsilon} dx \frac{\left (\log{x}+i 2 \pi \right)^3}{(x^2-1)^2}+ i \epsilon \int_{2 \pi}^{\pi} d\phi \, e^{i \phi} \frac{\left (\log{\left (1+\epsilon e^{i \phi} \right )}+i 2 \pi \right )^3}{\left ( \left (1+\epsilon e^{i \phi} \right )^2-1 \right )^2} \\+ \int_{1-\epsilon}^{\epsilon} dx \frac{(\log{x}+i 2 \pi)^3}{(1-x^2)^2} + i \epsilon \int_{2 \pi}^0 d\phi\, e^{i \phi} \frac{\log^3{\left ( \epsilon e^{i \phi} \right )}}{\left ( \epsilon^2 e^{i 2 \phi} \right )}$$
As $R \to \infty$, the fourth integral vanishes.  As $\epsilon \to 0$, the second and eighth integrals vanish.  In this  limit, however, note that the second integrals opposite number, the sixth integral, does not vanish in this limit.  Rather, the logs on the branch below the positive real axis have an $i 2 \pi$ added to them.  This includes the log attached to the bump below the positive real axis, i.e., the sixth integral.  This integral evaluates as follows for small $\epsilon$:
$$i \epsilon \int_{2 \pi}^{\pi} d\phi \, e^{i \phi} \frac{\left (\log{\left (1+\epsilon e^{i \phi} \right )}+i 2 \pi \right )^3}{\left ( \left (1+\epsilon e^{i \phi} \right )^2-1 \right )^2} = -i \frac{4 \pi^3}{\epsilon} + (2 \pi^4 + i 3 \pi^3 ) + O(\epsilon)$$
Note that in the limit as $\epsilon \to 0$, the integral leave us with a diverging term and a constant term.  We will need these.
The first, third, fifth, and seventh integrals (those integrals above and below the real axis) combine to form the following:
$$-i 6 \pi \int_0^{\infty} dx \frac{\log^2{x}}{(1-x^2)^2} + 12 \pi^2 PV  \int_0^{\infty} dx \frac{\log{x}}{(1-x^2)^2} \\ + i 8 \pi^3 \left [\int_0^{1-\epsilon} \frac{dx}{(1-x^2)^2} + \int_{1+\epsilon}^{\infty} \frac{dx}{(x^2-1)^2} \right ]$$
In the second integral above, the $PV$ denotes a Cauchy principal value of the integral, which has a simple pole in its integrand.  For the last pair of integrals, we arrange them as we would a Cauchy principal value while acknowledging that the Cauchy P.V. does not exist because of the double pole at $x=1$.  We will evaluate this pair of integrals in the limit as $\epsilon \to 0$ and will produce another singularity.
$$\begin{align} \int_0^{1-\epsilon} \frac{dx}{(1-x^2)^2} &= \int_0^{\arcsin{(1-\epsilon)}} d\theta \, \sec^3{\theta} \\ &= \left [ \frac12 \sec{\theta} \tan{\theta} + \frac12 \log{(\sec{\theta} + \tan{\theta})} \right ]_0^{\arcsin{(1-\epsilon)}} \\ &= \frac12 \frac{1-\epsilon}{\epsilon (2-\epsilon)} + \frac14 \log{\left ( \frac{2-\epsilon}{\epsilon} \right )} \end{align} $$
Similarly, the reader should be able to show that
$$\int_{1+\epsilon}^{\infty} \frac{dx}{(x^2-1)^2} = \frac12 \frac{1+\epsilon}{\epsilon (2+\epsilon)} - \frac14 \log{\left ( \frac{2+\epsilon}{\epsilon} \right )}$$
Adding these two pieces and expanding about $\epsilon = 0$, we get an asymptotic expression for the pair of integrals that is not quite a Cauchy principal value:
$$\int_0^{1-\epsilon} \frac{dx}{(1-x^2)^2} + \int_{1+\epsilon}^{\infty} \frac{dx}{(x^2-1)^2} = \frac1{2 \epsilon} + O(\epsilon) $$
That is, there is no constant term in the above expression; rather, there is only a divergent term and vanishing terms.
Putting this all together, we get an expression for the contour integral as $\epsilon \to 0$ and $R \to \infty$:
$$\oint_C dz \frac{\log^3{z}}{(z^2-1)^2} = -i 6 \pi \int_0^{\infty} dx \frac{\log^2{x}}{(1-x^2)^2} + 12 \pi^2 PV  \int_0^{\infty} dx \frac{\log{x}}{(1-x^2)^2} \\ + i \frac{4 \pi^3}{\epsilon} -i \frac{4 \pi^3}{\epsilon} + (2 \pi^4 + i 3 \pi^3 ) + O(\epsilon)$$
The divergent terms cancel and we finally get, for the contour integral,
$$\oint_C dz \frac{\log^3{z}}{(z^2-1)^2} = -i 6 \pi \int_0^{\infty} dx \frac{\log^2{x}}{(1-x^2)^2} + 12 \pi^2 PV  \int_0^{\infty} dx \frac{\log{x}}{(1-x^2)^2} + (2 \pi^4 + i 3 \pi^3 )$$
Now, by the residue theorem, the contour integral is also equal to $i 2 \pi$ times the residue at the pole $z=-1=e^{i \pi}$.  I will leave the evaluation of this residue to the reader; keep in mind that there is a double pole at $z=e^{i \pi}$.  Thus, by the residue theorem,
$$-i 6 \pi \int_0^{\infty} dx \frac{\log^2{x}}{(1-x^2)^2} + 12 \pi^2 PV  \int_0^{\infty} dx \frac{\log{x}}{(1-x^2)^2} + (2 \pi^4 + i 3 \pi^3 ) = \frac{\pi^4}{2} + i \frac{3 \pi^3}{2}$$
Equating real and imaginary parts, we finally get the result for the integral we seek, plus a bonus:

$$\int_0^{\infty} dx \frac{\log^2{x}}{(1-x^2)^2} = \frac{\pi^2}{4}$$
$$PV  \int_0^{\infty} dx \frac{\log{x}}{(1-x^2)^2} = -\frac{\pi^2}{8}$$

So while this was a bit involved, I hope the reader gets all of the subtleties in evaluating integrals with removable singularities and higher powers of log.
Comment: very nice! would you be able to give more details on how you obtained the asymptotic expansion of integral 6?
Comment: @JunKurosu: Thank you.  To get the expansion of the sixth integral, expand both numerator and denominator of the integrated out to two terms each and then Taylor expand about $\epsilon=0$ To get an expansion of a constant term and a term linear in $\epsilon$.  You will be left with two integrations over the angle $\phi$, both trivial but nonzero.
Answer: $$\int_{1}^{+\infty}\frac{\log^2(x)}{(1-x^2)^2}\,dx = \int_{0}^{1}\frac{\log^2(x)}{x^2\left(1-\frac{1}{x^2}\right)^2}\,dx=\int_{0}^{1}\frac{x^2\log^2(x)}{(1-x^2)^2}\,dx $$
so the original integral equals
$$ \int_{0}^{1}\frac{1+x^2}{(1-x^2)^2}\log^2(x)\,dx $$
where
$$ \frac{1+z}{(1-z)^2}=\sum_{n\geq 0}(2n+1)z^n\qquad \text{and}\qquad \int_{0}^{1}x^{2n}\log^2(x)\,dx =\frac{2}{(2n+1)^3}$$
lead to
$$ \int_{0}^{+\infty}\frac{\log^2(x)\,dx}{(1-x^2)^2} = 2 \sum_{n\geq 0}\frac{1}{(2n+1)^2}=2\left[\zeta(2)-\frac{1}{4}\zeta(2)\right]=\frac{3}{2}\zeta(2)=\color{red}{\frac{\pi^2}{4}}. $$
For the evaluation of $\zeta(2)$ through contour integration, you may refer to this post.
Answer: Using the principal branch of the logarithm, let's integrate the function $$f(z) = \frac{\log^{2}(z)}{(1-z^{2})^{2}} $$ around an infinitely large wedge-shaped contour that makes an angle of $\frac{\pi}{2}$ with the positive real axis and is indented at the origin.
(The same contour was used here to evaluate $\int_{0}^{\infty} \frac{\log (x)}{x^{2}-1} \, \mathrm dx$.)
Integrating around the contour, we get $$\int_{0}^{\infty} \frac{\log^{2}(x)}{(1-x^{2})^{2}} \, \mathrm dx + \int_{\infty}^{0} \frac{\left(\log(x) + \frac{i \pi}{2} \right)^{2}}{(1-(it)^{2})^{2}} \, i \,  \mathrm dt =0. $$
Then equating the real parts on both sides of the equation, we get $$\int_{0}^{\infty} \frac{\log^{2}(x)}{(1-x^{2})^{2}} \, \mathrm dx = - \pi \int_{0}^{\infty}\frac{\log (t)}{(1+t^{2})^{2}} \, \mathrm d t. $$
See the answers to this question for ways to show that $$\int_{0}^{\infty} \frac{\log (t)}{(1+t^{2})^{2}} \, \mathrm dt = - \frac{\pi}{4}. $$
Answer: Alternatively
\begin{align}
&\int_{0}^\infty \frac{\ln^2 x}{(1-x^2)^2}\overset{x\to 1/x}{dx} \\
=& \ \frac12 \int_{0}^\infty \frac{(1+x^2)\ln^2 x}{(1-x^2)^2}\ {dx}
= \frac12 \int_{0}^\infty \ln^2x\ d\left( \frac{x}{1-x^2}\right)\\
\overset{ibp}=& \int_{0}^\infty \frac{\ln x}{x^2-1}dx
= \int_0^\infty\int_0^1 \frac y{1+(x^2-1)y^2}dy \ dx\\
=& \int_0^1 \frac1{\sqrt{1-y^2}}dy=\frac{\pi^2}4
\end{align}


Is there any way to prevent yourself from being in a populated list for Facebook invites?

Question: I may play one at the most two games in Facebook. I really do not like getting those notifications that are invites for all those games I'll never play. I know the inviting is based on a populated list of one's friends that you can check/uncheck a checkbox. Is there any way to disable the ability to be seen in some/all game invites on facebook?
Answer: You can make yourself disappear from invite list by blocking the game http://www.facebook.com/settings?tab=blocking
Block specific apps for which you don't want invites or if you have a SuperGamer friend on Facebook you can block them from sending you app invites.


Having some trouble with UV mapping distortion

Question: Basically I'm working on a model of window/window frame and I'm lost when it comes to the uv mapping. It's essentially crown molding. The flat parts map fine but any kind of curve is distorted. I've tried adjusting the individual vertices of the map by hand but even though it does look more correct there is still some distortion. I feel like there's something obvious that I'm not doing, maybe something related to my seams.
Answer: Hey I think you have multiple choices.
You could use follow active quads on the "troublesome" areas of the UV only.
https://www.youtube.com/watch?v=ScRIlkmNTfw
essentially you unwrap a single quad which is a square then select all the additional parts of the UV that are connected to this quad you want to unwrap and press unwrap -> follow active quads. This may "square off" the areas you think are uneven.
Alternatively you could add additional seam cut to cut you square into a line down, by adding a new seem cut down one of the corner edges.
I hope this helps.


How to seek in ogg vorbis file without loading all file into memory?

Question: I'm trying to find a way to move to required position in the track without loading all file into memory. And without using vorbisfile, because the file  is stored in the remote server. I read the paragraph in documentation about seeking but couldn't understand it.
Answer: If the remote server lets you use HTTP GET's with Range headers, you can "fake" the file access by sending a bunch of requests for the different parts just like you would for a local file...
ASSUMING: The file is Ogg-encapsulated and ONLY has the Vorbis stream in it...

Do an HTTP HEAD request to get the total length of the file
GET the first 4KB of the file and "sync" the Vorbis headers.  You might need to get more data to complete this.
GET the last 4KB of the file and "sync" the last Ogg page header to get the total sample count
Do the spec-described bi-section search, substituting HTTP GET w/ Range in place of fseek / fread

If you do it right, seeking should transfer less than 100KB in most cases.
UPDATE:
The bi-section search is a bit non-intuitive...  The idea is to jump around in the file looking for the correct page, but every jump is "informed" by the previous jumps and the current page... An example is probably best:
To seek to sample 300,000 in a file having 1,000,000 samples (I'm assuming we're on step 4 above):

Seek physical file to {fileStream.Length * .3}
Read forward until you find an Ogg Page
Check that the page is part of the Vorbis stream in question
If not, go to next Ogg Page & go to step 3
Check the granule position
If not the right page, seek physical file to {current position + ((300000 - granule position) / 1000000) * fileStream.Length} & go to step 2
You've found the right page, but may need to move back a page to get the "pre-roll"... Vorbis requires 1 packet to be decoded before the desired packet.

There are probably better algorithms for this, but that's the basic idea.
Remember, granule position is the sample count at the END of the page, so when you find the correct page its granule position will be slightly larger than your target.
Comment: I have API like read(), seek(), write() so I can work with remote file like I would work with a file on my computer. The problem is that I just don't understand how bi-section search in ogg vorbis works. How can I move to a certain page if ogg pages can have different sizes?
Answer: Seeking ogg files is hard.
List of things to understand

When ogg_page_packets(&og) > 0, the ogg_page is an end page
When ogg_page_granulepos(&og) > 0, the page has the last time stamp within the stream of packets
When ogg_page_peek(&oy,&og) == 1, a complete page is popped out.
When ogg_page_peek(&oy,&og) == 0, the page is incomplete
When ogg_page_peek(&oy,&og) == -1, the libogg function did not find the beginning of the page
vorbis_granule_time(&vd, ogg_page_granulepos(&og)) prints out the time in seconds

You will need this function
int buffer_data(){
//oy is an ogg_sync_state https://xiph.org/ogg/doc/libogg/ogg_sync_state.html
//in is just a file
  char *buffer=ogg_sync_buffer(&oy,4096);
  int bytes=fread(buffer,1,4096,&in);
  ogg_sync_wrote(&oy,bytes);
  return(bytes);
}

In my code below, I will add another layer which is essentially the file buffer in addition to the ogg page and ogg packet. Essentially, my code only bisects the first synced end page of each file buffer.
When I cannot find a ogg_page_sync, my code creates a second block cursor to load the next 4k file buffer until I either find the page sync or surpasses the boundaries.
#include <unordered_map>
struct _page_info {
    size_t block_number;
    double_t time;
    ogg_int64_t granulepos;
};

struct _page_info left_page = { .time = 0, .block_number = 0, .granulepos = 0 };
struct _page_info mid_page = { .time = 0, .block_number = 0, .granulepos = 0 };
struct _page_info right_page = { .time = DBL_MAX, .block_number = 0x7FFFFFFFFFFFFFFF, .granulepos = 0x7FFFFFFFFFFFFFFF };
unordered_map<int, double> block_time;
unordered_map<ogg_int64_t, _page_info> page_info_table;
ogg_page og;

while (left <= right) {
    //Seek to block
    size_t mid_block = left + (right - left) / 2;
    int block = mid_block;

    if (block_time.has(block)) {
        //Check whether this block has been visited
        break;
    }

    //clear the sync state
    ogg_sync_reset(&oy);
    file.seek(block * buffer_size);
    buffer_data();

    bool next_midpoint = true;
    while (true) {
        //keep syncing until a page is found. Buffer is only 4k while ogg pages can be up to 65k in size
        int ogg_page_sync_state = ogg_sync_pageout(&oy, &og);
        if (ogg_page_sync_state == -1) {
            //Give up when the file advances past the right boundary
            if (buffer_data() == 0) {
                right = mid_block;
                break;
            } else {
                //increment block size we buffered the next block
                block++;
            }
        } else {
            if (ogg_page_sync_state == 0) {
                //Check if I reached the end of the file
                if (buffer_data() == 0) {
                    right = mid_block;
                    break;
                } else {
                    block++;
                }
            } else {
                //Only pages with a end packet have granulepos. Check the stream
                if (ogg_page_packets(&og) > 0 && ogg_page_serialno(&og) == vo.serialno) {
                    next_midpoint = false;
                    break;
                }
            }
        }
    }
    if (next_midpoint)
        continue;

    ogg_int64_t granulepos = ogg_page_granulepos(&og);
    ogg_int64_t page_number = ogg_page_pageno(&og);
    struct _page_info pg_info = { .time = vorbis_granule_time(vd, granulepos), .block_number = mid_block, .granulepos = granulepos };
    page_info_table[page_number] = pg_info;
    block_time[mid_block] = pg_info.time;
    mid_page = pg_info;

    //I can finally implement the binary search comparisons
    if (abs(p_time - pg_info.time) < .001) {
        //The video managed to be equal
        right_page = pg_info;
        break;
    }
    if (pg_info.time > p_time) {
        if (pg_info.granulepos < right_page.granulepos)
            right_page = pg_info;
        right = mid_block;
    } else {
        if (pg_info.granulepos > left_page.granulepos)
            left_page = pg_info;
        left = mid_block;
    }
}

When you are done, you essentially backtrack the ogg_pages until you find the desired ogg_packet.
Here is a trick to calculate the timestamp with serially incremented packets
 while(ogg_sync_pageout(&oy, &og) > 0)
    ogg_stream_pagein(&vo, &og);
    ogg_int64_t last_granule = ogg_page_granulepos(&og);
    ogg_int64_t total_granule = ogg_page_packets(&og));
    while(ogg_stream_packetout(&vo, &op) > 0 ) {
         double time = vorbis_granule_time(&vd, last_granule - total_granule--);
    }

https://xiph.org/ogg/doc/libogg/reference.html
https://github.com/xiph/theora/blob/master/examples/player_example.c
https://xiph.org/vorbis/doc/libvorbis/reference.html
https://xkcd.com/979/
https://xiph.org/oggz/doc/group__basics.html


If justification is an event, when does it happen?

Question: Lutherans, Methodists, and Calvinists believe that justification is an event (as opposed to the Roman Catholic church and the Orthodox church who believe it is a process). If justification is an event, when does it happen? Is it at the moment of conversion, at baptism, or at some other time?
Answer: According to most independent, fundamentalist Baptists, (and to the best of my knowledge, the groups that you mentioned) justification is a one-time event that happens at the moment of conversion, when a sinner repents on his or her sins and puts their faith in Christ for salvation.
This would be in line with a Calvinist view.  Justification is a result of salvation, and is something granted freely as the gift of salvation, apart from any works of man.
The very same Wikipedia article that you linked to outlines the relationship between Justification and Sola Fide, for those denominations that subscribe to the view that salvation is by faith alone.
This article covers more groups independently, rather than lumping protestants entirely into a group, and may provide more clarity on how different denominations view the topic.
Comment: No mention of it happening on the cross? Do the fu. Fundamentalist Baptists you mention think it is an event triggered by repentance or the cause of repentance or no connection?
Comment: To us, it is a gift freely given at the time that we repent of our sins and turn to Christ for salvation.  We do not believe in "total depravity".  We believe that God calls us, but also in the free will to reject His call.  However, we do not claim any credit for obedience.  There is nothing we can do to add to His free gift.  We are simply accepting what He has offered, and justification is a result of saving Grace.
Comment: I would expect answers from groups that believe in Total Depravity to answer as well, or have different viewpoints as well.  My answer is specifically geared toward a particular group's view on the matter.
Answer: Lutherans who hold to their confessions [ http://bookofconcord.org/ ] believe that justification, faith, and baptism go together.  A baptized infant believes the Gospel at its baptism.  An adult who falls away from faith in Christ which has been given in Baptism and is converted is returning to the promise of the Gospel which has been applied to him in Baptism.
Lutherans believe that faith in Christ is the work of the Holy Spirit alone.  Human will is bound and unable to assist with conversion.  The Holy Spirit works faith through the external Word--that is, the preached Gospel, the written or read Scriptures.
At the same time, faith worked in Christ by the preached Word leads to Baptism, which is "the washing of regeneration and renewal in the Holy Spirit" (Titus 3).  Rather than looking for or to an experience of conversion, Lutherans look to God's works and promises.  Rather than looking to his feeling of faith, or his conversion experience, decision, or sanctified life, a Lutheran will look to the forgiveness of sins promised in the Gospel to all sinners on account of Christ's propitiatory death, and he will look to the promise of God in Baptism (as well as absolution, and the sacrament of Christ's body and blood) that Christ's merits have been given to him.
In Luther's sermon on Matthew 8:1-13 in his 1525 "Church Postil" [ http://www.lutherdansk.dk/Web-Fastepostillen%20AM/index.htm ] he talks about the faith of infants in Baptism.  Another key writing is the Large Catechism's section on Baptism, where Luther has a section dealing specifically with Anabaptist arguments against infant baptism and infant faith.  The Large Catechism can be found at the Book of Concord website linked above.
Some excerpts from the sermon on Matthew I've found helpful:

First we must let the foundation stand firm and sure, that nobody will be saved by the faith or righteousness of another, but only by his own; and on the other hand nobody will be condemned for the unbelief or sins of another, but for his own unbelief; as the Gospel says clearly and distinctly in Mk 16,16: "He that believeth and is baptized shall be saved; but he that disbelieveth shall be condemned." And Rom 1, 17: "The righteous shall live by faith." And Jn 3, 16-18: "Whosoever believeth on him should not perish, but have eternal life. He that believeth on him is not judged: he that believeth not hath been judged already." These are clear, public words, that every one must believe for himself, and nobody can help himself by the faith of others, without his own faith. From these passages we dare not depart and we must not deny them, let them strike where they may, and we ought rather let the world perish than change this divine truth. And if any plausible argument is made against it, that you are not able to refute, you must confess that you do not understand the matter and commit it to God, rather than admit anything contrary to these clear statements. Whatever may become of the heathen, Jews, Turks, little children and everything that exists, these words must be right and true.
Now the question is, what becomes of the young children, seeing that they have not yet reason and are not able to believe for themselves, because it is written in Rom 10, 17: "Belief cometh of hearing, and hearing by the word of Christ." Little children neither hear nor understand the Word of God, and therefore they can have no faith of their own.
If now we cannot give a better answer to this question and prove that the little children themselves believe and have their own faith, my sincere counsel and judgment is, that we abstain altogether and the sooner the better, and never baptize a child, so that we may not mock and blaspheme the adorable majesty of God by such trifling and juggling with nothing in it. Therefore we here conclude and declare that in baptism the children themselves believe and have their own faith, which God effects in them through the sponsors, when in the faith of the Christian church they intercede for them and bring them to baptism....
So here we also say, that children are not baptized in the faith of the sponsors or of the church; but the faith of sponsors and of the church prays and gains faith for them, in which they are baptized and believe for themselves. For this we have strong and firm Scripture proof, Mt 19,13-15; Mk 10, 13-16; Lk 18, 15-16. When some brought little children to the Lord Jesus that he should touch them, and the disciples forbade them, he rebuked the disciples, and embraced the children, and laid his hands upon them and blessed them, and said: "To such belongeth the kingdom of God" etc. These passages nobody will take from us, nor refute with good proof. For here is written: Christ will permit no one to forbid that little children should be brought to him; nay, be bids them to be brought to him, and blesses them and gives to them the kingdom of heaven. Let us give due heed to this Scripture.
This is undoubtedly written of natural children. The interpretation of Christ's words, as if he had meant only spiritual children, who are small in humility, will not stand. For they were small children as to their bodies, which Luke calls infants. His blessing is placed upon these, and of these he says that the kingdom of heaven is theirs. Will we say they were without faith of their own? Then the passages quoted above are untrue: "He that disbelieveth shall be condemned." Then Christ also speaks falsely or feigns, when he says the kingdom of heaven is theirs, and is not really speaking of the true kingdom of heaven. Interpret these words of Christ as you please, we have it that children are to be brought to Christ and not to be forbidden to be brought: and when they are brought to Christ, he here compels us to believe that he blesses them and gives to them the kingdom of heaven, as he does with these children. And it is in no way proper for us to act and believe otherwise as long as the words stand: "Suffer the little children to come unto me, and forbid them not." Not less is it proper for us to believe that when they are brought to him he embraces them, blesses them, and bestows upon them heaven, as long as the text stands that he blessed the children which were brought to him and gave heaven to them. Who can ignore this text? Who will be so bold as not to suffer little children to come to baptism, or not to believe that Christ blesses them when they come?
Answer: In the Methodist tradition, a person is justified when they accept the grace God has given them, and make a decision to follow his will rather than their own.
Though justification by itself is not a process, it is the beginning of the process of sanctification, in which we work with God to transform us into the people God intended us to be. This is, as far as I understand, similar to the Catholic and Orthodox concept of theosis.
Answer: Justification, if it is an event, probably happened that weekend when Jesus was crucified, died and was buried.
However, since God exists outside of time, from His perspective there may not be a "moment" when justification happened.
I think the better question is why does it matter when justification happened?
Comment: Justification refers to the moment of personal acceptance of that great weekend. Theologically speaking it has a very precise definition.
Comment: I think in order to provide the best answer, then there needs to be an agreed upon definition of justification.  If you can provide such a definition for all of us to use that would be helpful, since I think differing definitions would result in different answers.


how can i park a domain on a centOS

Question: how can i park a domain on CentOS based VPS without any Cpanel(cPanel,plesk or ...) and using shh?
Comment: It depends on the DNS and HTTP servers you use. (Assuming that by 'park' you mean 'host a single webpage')
Answer: You can edit httpd.conf and where it says the ServerName part under the virtual hosts section, you can add your domain there. If your DNS isnt pointing to your web server, you will need to do that too (this is one of the advantages of cpanel etc it does it for you but then at the same time, leaves you wondering what it did)
Something like
<VirtualHost *:80>
    ServerAdmin email@example.com
    DocumentRoot /www/docs/dummy-host.example.com
    ServerName dummy-host.example.com
    ServerName test.com
    ErrorLog logs/dummy-host.example.com-error_log
    CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>

Answer: I assume you have DNS (ie. Godaddy's, or you get one with your VPS).
Edit you file /etc/httpd/conf/httpd.conf
Add this at the bottom (use your domain name as ServerName and your folder as DocumentRoot):
<VirtualHost *:80>
ServerAdmin root@localhost
DocumentRoot /home/examplecom/www/
ServerAlias example.com
ServerName www.example.com
ErrorLog logs/www.example.com-error_log
CustomLog logs/www.example.com-access_log common
    <Directory /home/examplecom/www/>
            Options FollowSymLinks
            AllowOverride All
    </Directory>
</VirtualHost>

Directory is optional, but this works for me.
Than go to SSH as a "root" and reset Apache server:
service httpd restart

how can i park a domain on a centOS


How do I find the average acceleration and instantaneous acceleration using derivatives and limits?

Question: I have completed parts $a$, $b$, and $c$ of the attached problem. However, I am having trouble with parts $d$ and $e$. Can anyone check to see if I am on the right track and how do I solve for parts $d$ and $e$?
Comment: Instantaneous velocity is $ds/dt=6t^2$. Instantaneous acceleration is $d^2s/dt^2=12t$. The acceleration at time $t=0$ is $d^2s/dt^2(0)=0$ and at time $t=3$ is $d^2s/dt^2(3)=36$. Therefore, the mean acceleration is $(36-0)/(3-0)=12$.
Comment: Check your work: in part b) you decided that the average velocity is 18 ly/second, but in part a) you say that while traveling at this average velocity for 3 seconds the saucer travels 64 ly.
Comment: yes, I corrected that and I got 54 ly/ second for part a
Answer: You are given the equation for position ($s = 2t^3 + 10$) and need to get equations for velocity and acceleration.  Velocity is the derivative of position, which it looks like you found ($v = 6t^2$).  The equation for acceleration is just another derivative ($a = 12t$).
Average acceleration is total change in velocity divided by total change in time.  So for average acceleration, use the start time (0) and the end time (3).  So you would evaluate the velocity equation at both points.
$$\frac{6(3)^2 - 6(0)^2}{3 - 0} = \frac{6\cdot 9 - 0}{3} = \frac{54}{3} = 18$$
For instantaneous acceleration, use the second derivative:
$$a = 12t = 12(3) = 36$$
Comment: Can you confirm that a, b, and c are correct?
Comment: (a) is wrong.  The equation is for distance *from*, but the question is about distance *travelled*.  To find that, subtract initial from final.  (b) looks correct.  (c) looks correct.
Comment: So it would actually be 54?


Run app on X11 on server without forwarding

Question: The problem
I am using an application that is computationally intensive and requires X11 to run. I want to run it on a remote server (that is obviously running X11).
I don't need to forward X11, I just need it to run on the server.
More details
If I run the application from the server (i.e. I use the keyboard that is physically connected to the machine), then everything works fine. My problem is that I want to start this application remotely (from an SSH connection) because I cannot always access the server physically.
I am not completely sure how it works, but when I run the following command from the machine (i.e. using its keyboard):
$ xhost +

then I can run my app ($ DISPLAY=:0 ./run-my-app) without problem from SSH. Now, I cannot run xhost + from SSH, and anyway it sounds like a bad idea in terms of security.
If I don't run xhost +, I get the following output:

No protocol specified
xauth: (argv):1:  unable to open display ":0".

In conclusion, it looks like there is some security feature (access control) that prevents me from running the app on X11 remotely. But the point is that I don't want to have more than what happens when I start the app from the server (with the keyboard connected to the physical machine); I just want to start/stop it remotely, without any forwarding.
Is there a way to do that?
Similar questions
It looks similar to X11 on server without forwarding and How can I run Firefox on Linux headlessly (i.e. without requiring libgtk-x11-2.0.so.0)?, but in these situations they can use a virtual server like Xvfb, which does not work in my case. Moreover, I do have an X server running on the server, and I do need it.
Answer: steal a copy of the enviroment of the running session
pid="`pgrep process_name\$ -U $USER`"
env `tr '\0' ' ' < "/proc/$pid/environ"` program_name

for a suitable value of process_name: something that you know is running in your X11 environment
Comment: The full command was not working for some reason, so I copied the output of `tr '\0' ' ' < /proc/$pid/environ` and ran `env "" `, but I still get the same xauth error =(.
Comment: maybe try this instead `tr ' \t\0' '__ ' `  or try snooping on a different process,


Could a Race of small but agile aliens be able to conquer and fight effectively?

Question: Think yoda. Small. Agile. Powerful. Think Hutts. Big. Slow. Powerful.
Is this realistic? I was thinking about making a race of small (yoda sized) species that had a lot of power in the galaxy. I mean, for them to be powerful, they would likely need to have weapons, or an army of some kind. But if they are some small or so big, would they be able to fight effectively? The aliens in my story are about the size of yoda, and have high tech technology. They have a large fleet of ships and they are incredibly advanced. They are not the strongest, but they are very agile.
Thanks
Comment: Telling us a bit more about your aliens (what defines which are big and which are small? What's the proportion between big and small variants? Are the big ones meant to be just as fast and agile as the small ones and the small ones as strong as the big ones? What kind of weapons and technology they have available to make this alien army? ) would be a lot of help both to allow us to answer your question in a satisfying way as well as to make is less opinion based, since right now the answer will most likely be "sure, if you want them to".
Comment: This is really broad. There are infinite combinations of attributes we could use to pit the small/agile aliens up against and to be a major power they would need to be able defeat most of them. Giving us a direct matchup and asking us how they could reliably win or what attributes they would need to continuously win is more on topic.
Comment: If the Daleks can conquer the universe, or a close approximation, then yes. Daleks aren't even agile. There is a question here about pixie weapons if you're looking at a lower tech base https://worldbuilding.stackexchange.com/questions/134582/what-kind-of-weapons-would-a-much-smaller-species-use-to-fight-humans
Comment: There seems an assumption here that the Wee Conquerors are going to come off their ships, fight fair against the full organized strength of the target planet, that they want the planet reasonably undamaged, and that they want the target population alive. I don't see anything in the Question to justify it. I think the Wee Conquerors will stand off in space, annihilate the defenders with massive bombardment, and then build habitats in orbit of the new planetary wasteland. Generations later, they come down and enslave the couple nomad tribes of survivors scrabbling out a living in the waste.
Comment: In fiction, think primitive Ewoks vs. the Empire in one of the Star Wars movies.
Answer: So the answer is a flat YES OBVIOUSLY
It's a sci-fi setting, and your small race has made it to space.  Once you're there, you're golden.  Heck, even a small species with modern-day technology is going to be fine against larger-bodied technological peers.  Indeed, I would argue a small species would have huge advantages over larger ones in a gunpowder-or-later competition against peer competitors.  Though the advantage dissipates the more sci-fi you get. For sci-fi though there are three areas they'd excel in.
Numbers: Now it's not a guarantee, but generally speaking smaller beings have shorter lives but more offspring than larger beings.  At the very least your small race will be able to have more beings for X area of land or Y amount of resources than a larger species.  That means more brains, more chances of spawning an Einstein or a Rommel or just having more views with which to look at any given problem.  At the very lowest setting it means you can field more guys with lasers than the big dudes, and that's an advantage all its own.
Void Warfare Space is BIG and COLD and DANGEROUS.  Ships that go through space must be as efficient as possible, to conserve energy, maneuver more effectively, and generally just be smaller targets.  A Small species requires less air to breathe, food to eat, room to stand in, etc etc.  All this means more efficient ships.  For X mass and Y energy I can carry a lot more tiny colonists, or have a smaller physical bridge to be hit, or have more nimble fighters, or have more room for weapons, or haul a larger percentage of trade goods.  If your ships need a pilot/captain, a weapon's officer, and an engineer, and each of those guys is 1,000 kilos, you're wasting 3,000 kilos of engine power to move them.  Meanwhile if those same guys are 20 kilos each, it's only 60 kilos of power.  Scale that to warships that may need hundreds or thousands of crew, and it matters even more.
On the Ground Your tiny soldiers have several distinct advantages over their larger foes.  They're smaller targets, and they have better reflexes.  Meanwhile even with modern-day weapons the size discrepancy isn't so great that your tiny soldier is incapable of fielding a big-guy killing weapon.  Add in phasers or what have you and there's no advantage at all in being bigger.  You're never gonna wrestle a guy with a blaster often enough for it to matter in a war!
TL/DR
There is no possible disadvantage a yoda-sized being would have versus a 1,000 kilo being when both are armed with modern+ technology.  Indeed it's the big guy that would be somewhat disadvantaged.
Now of course you can add in Dune-esque shields so hand-to-hand fighting is still very important or some other handwavium to make your little guys have a tougher time of it.  But in general there's no reason to be concerned.
Comment: I agree with your overall answer, but have to disagree about gunpowder weapons. Yoda is 66 cm tall. A 2 year human is on average 86cm tall. An M-16 is  just over 1m. A weapon tiny enough to be a yoda handgun would be less powerful than a cap gun. A human sized rifle is *twice* Yoda's size. To have equivalent weapons, each soldier would have to be carrying around a cannon. If they aren't, their armor penetration or their range will suffer greatly. These aren't insurmountable problems, mind you.
Comment: Thor says hi. No, not the one with the muscles and the hair. The short grey dude with the armada of high tech warships.
Answer: IMHO opinion a species of small agile people could conquer the galaxy as easy as a species of large strong people.
It doesn't take a lot of physical strength to press the firing buttons as your fleet of thousands of space battleships vaporizes an enemy fleet of hundreds of space battleships.
And if the question is about small agile people fighting outdoors on the surface of a planet, think back to reading The Hobbit, The Lord of the Rings, and The Sillarmilion and the dreaded armies of evil in those stories.
Who were the main members of the dreaded armies of evil in those stories?  Orcs (called goblins in The Hobbit).  And how large were Orcs?  They came in several sizes, but only the exceptionally large orcs were described as being the size of men.  Most orcs might have been the size of dwarves or even of hobbits.
And what type of weapons were used in battles in Middle-earth?  Swords, spears, battle axes, battle hammers, bows and arrows, etc.  Those weapons needed a lot more physical strength to operate than modern weapons.  And yet Orcs were still capable of fighting against larger and (possibly) stronger foes.
After guns were invented, physical strength was a lot less necessary for a soldier to use weapons.  Thus there were of stories about children using guns in combat.  For example, in 1863 John Lincoln Clem of the 23rd Michigan was 12 years old and very small for his age, about four feet tall.  He had a musket cut down to his size and shot a rebel at the Battle of Chickamauga.
And in the 20th century lightweight assault rifles were invented, guns so powerful and light that they could be used by children as easily as men could use muskets a century earlier.   Thus recruiting children - sometimes by force - to serve in guerrilla and rebel forces became extremely common.
And in a science fiction story set in a technologically advanced future, weapons like Star Trek  hand phasers and phaser rifles might become available.  Such weapons could be used effectively by much younger and smaller human children that the kids who use assault rifles today, or by alien space infantry the size of those children.
This reminds be of H. P. Somtow's Inquestor stories, set in an interstellar society where apparently "all" children are drafted into the space infantry and are turned into cyborgs with deadly lasers in their eyes for the duration of their service in various space wars.  I'm not certain that drafting "all" children and sending them away on centuries long relativistic voyages for the wars would work.  It seems to me that would result in rapidly declining populations. But that is the set up in the stories.
And if the aliens use powered suits to multiply the physical strength they can apply, they might be a small as human children and be able to use the strength of elephants when using their powered suits.
So tiny aliens can make good space infantry or space marines as well as making good space battleship crews.
You might want to take a look at answers and comments at the question:
In a Gunpowder Fantasy world, would shorter/taller races be able to use muskets just as effectively as a Human? 1
Comment: Reminds me of the Arquillians. They look like this: https://external-preview.redd.it/cSYvYPBiFQAdNePFzUopk_8Y7ckSngcXWrNGY8h5NC4.jpg?auto=webp&s=ae6a80216c64a1ed3b254b06a47c97c3b054987a but build things like this: https://yarn.co/yarn-clip/28a6ae4d-2f52-497a-806b-bb4361bc2343
Answer: Which species is dominant on earth? Humans? or Elephants? How about blue whales? Giraffes? Obviously it's humans.
Size can determine dominance among intellectual peers. A rhino can dominate a cat, a cat can dominate a cockroach.
Three things can change this balance. Weight of numbers, cunning strategy, or research.
1 million cockroaches can overwhelm a housecat. 10 dogs hunting in a pack with a good strategy can overwhelm 10 rhinos, especially if they can get one at a time. And a human whose researched gunpowder can pick up a machine gun and mow down everything.
So, give your aliens massive numbers, or the ability to plan and strategise, or research into super weapons, and they can dominate anything.
Any interaction with other high-tech races would be a comparison of these 3 things: Massive numbers, Better plans, Better research.
Comment: I'm not sure ten dogs can defeat a rhino, other than a young one. Poachers, yes https://www.bbc.com/news/world-africa-35264270
 Otherwise I agree.
Answer: Given better technology, it doesn't matter if they are the size of a blue whale or a locust. They will build war machines that can crush the opposition, whatever size that is.
The big red nuclear button can be scaled down to any size you like.


Redis usecase for notification system

Question: Does anyone know the usecases for notification system (redis).
I tried many patterns, but not satisfied.
Answer: I would think using a List to create a queue would be the best approach. You can push a JSON document or some other serialized data representing the notice onto the list then pop them off as they are delivered (or keep them in the list depending upon your need). Using things like LRANGE you can easily paginate to handle any number of notices.
Answer: Take a look at Staircar: Redis-powered notifications. Tumblr team actually uses Redis SortedSet for notifications:
Redis Sorted Sets fit the characteristics of notifications perfectly, without the I/O and concurrency pitfalls of implementing a similar structure in MySQL. Sorted sets in Redis are ordered by a score (unix timestamp in our case), contain unique elements (non-repeating collections of strings in redis speak), can be trimmed or appended to cheaply, and are keyed off, well, a key (user in our case)
Comment: I already seen Tumblr link, but not helpful.  can u provide me source code link
Answer: Take a look at Thoonk. It produces like pub/sub events that correspond to publish/edit/retract/resorts on higher level objects called feeds. It works well for notification inboxes and application state changes.
The contract/schema https://github.com/andyet/thoonk.js/blob/master/contract.txt provides a lot of recipes that you may be interested in.
Comment: Your link is broken (404).

Redis usecase for notification system


Integrating jQuery Auto Height with Views Infinite Scroll

Question: I have a views block with an infinite scroll (using Views Bootstrap and Views Infinite Scroll modules). The block displays cards and I want them to have the same height. jQuery Auto Height does that well. However, it only happens for the initial load. Auto Height has no way of knowing to fire on subsequent Ajax calls. What is the best way to integrate them so that Auto Height is called on each infinite scroll Ajax call?
Answer: If you take a look at the source for the jQuery Auto height module, there appears to be an AutoHeight() method that you can call on a given jQuery object.
$(drupalSettings.auto_height.selectors).AutoHeight();

And in the source for Views Infinite Scroll, we can see that an event, scroll.views_infinite_scroll, is available to listen in on. The portion of Views Infinite Scroll's code that invokes this event is:
$window.on(scrollEvent, debounce(function () {
  if (isLoadNeeded()) {
    $pager.find('[rel=next]').click();
    $window.off(scrollEvent);
  }
}, 200));

Using the above as a template, I think you could invoke the AutoHeight() method every time a new view is added.


VS2010: Why do my custom Toolbox tabs and contained controls keep disappearing?

Question: This is how I expected the toolbox to work:
Let's say I add a custom Tab to the Toolbox called "Ajaxtoolkit." To add controls to the new tab, I right mouse click and select "Choose Items" and browse to a file, Ajaxtoolkit.dll, that is of a particular version number.
I would expect that when I save and reopen the solution, that the Ajax Toolkit custom tab would still be in my Toolbox and that it would contain the same controls that were there last time, the controls that were in the dll that I referenced when the controls were added.
If I created a brand new web app, I (possibly) wouldn't expect to see the same Ajax Toolkit custom tab. However, I could perform the same steps as above and add a "Ajax Toolkit" tab and perhaps, this time, select a DIFFERENT VERSION of the tookit, and the state of the toolkit would be retained with each solution file.
Another possibility would be for the original Ajaxtoolkit to be retained when the 2nd web solution is created, and perhaps, if I wanted to mix versions of the toolkit across diffreent web sites in my solution, I should start naming my custom toolkit tabs with version specific names like "Ajaxtoolkit 4.0," etc.
...But instead, the Ajaxtoolkit tab disappears when I close VS2010 and reopen it.
Why? Is this desirable behavior or a bug?
Answer: You know VS2010 is a fully customizable IDE, may be these features conflicts your toolbox customization.


Customize color of internal links orgmode

Question: It's probably possible, but couldn't find a reference.
How can I define a different color to internal links than external ones through my .emacs file?
Comment: did you have a look a `M-x customize-group RET org-faces` (see http://orgmode.org/worg/org-tutorials/org-appearance.html#sec-1-1)?
Answer: The following code will display internal links (those beginning with "file:") in turquoise, instead of blue :
  (defface org-link-internal
     '((((class color) (background light)) (:foreground "turquoise1" :underline t))
      (((class color) (background dark)) (:foreground "turquoise1" :underline t))
      (t (:underline t)))
  "Face for internal links."
  :group 'org-faces)

  (org-link-set-parameters "file"
               :face 'org-link-internal)

Notes:

You'll need M-x org-mode-restart to see the changes in your org file ;
A face can only be set once (with defface), so if you want to change an already defined face, either change its name or relaunch Emacs ;
Already available faces can be seen with M-x list-faces-display;
Available colors for your font can be chosen with M-x list-colors-display;
You can set a different face for other links. For instance I chose to have all links executing elisp code, to be displayed in red (the last link in the below screenshot) :
Answer: Ancient question, but since it pops up in searches... Org 9 has a revamped system for defining links, using the org-link-parameters variable.  Typically, you modify this through the function ´org-set-link-parameters`, see the org documentation, or the examples here: https://kitchingroup.cheme.cmu.edu/blog/2016/11/04/New-link-features-in-org-9/


Exercise 4.7.8 Dixon-Mortimer "Permutation groups".

Question: Suppose that $m$>$1$ is an integer, and $p$ and $r$ are primes such that $r$
divides $p^{m}-1$ but $r$ does not divide $p^k-1$ for $1$$\leq$ $k$ <$m$. Show that $GL_m$$($$p$$)$ has an irreducible cyclic subgroup of order $r$. (A theorem of K. Zsigmondy shows that a prime $r$ satisfying these conditions exists
for all $p$ and $m$ except for $p$ = $3$ and $m$ = $2$). I don't have any idea  how to solve this exercise. Any kind of suggestion is appreciated. Thanks to everyone for the help.
Answer: $\newcommand{\Size}[1]{\left\lvert #1 \right\rvert}$$\DeclareMathOperator{\GL}{GL}$Let $E$ be the field with $p^{m}$ elements. This can be regarded as an $m$-dimensional vector space over the field $F$ with $p$ elements.
The multiplicative group of $E$ is cyclic, of order $p^{m} - 1$. Since $r \mid p^{m} - 1$, there is an element $\alpha$ of multiplicative order $r$ in $E$. This induces by multiplication on $E$ an element of $\GL(m, p)$ of order $r$.
Note that $\alpha$ sends $0$ to $0$, and induces cycles of length $r$ on the non-zero elements of $E$, as it acts by multiplication.
To show that $\langle \alpha \rangle$ is irreducible, assume by way of contradiction that there is a subspace $U \subseteq E$ of dimension $k < m$ on which $\alpha$ acts. Then $\alpha$ induces an element of order $r$ of $\GL(k, p)$.
But
$$
\Size{\GL(k, p) }
=
(p^{k} - 1) (p^{k} - p) \cdots (p^{k} - p^{k-1})
=
p^{\text{something}} (p^{k} - 1) (p^{k-1} - 1) \cdots (p - 1).
$$
This is impossible, as by assumption $r$ does not divide any of these factors.
Comment: Thanks you very much, @Andreas. Thank you for the help!


What is the category name for words like notwithstanding, forthwith, etc...?

Question: These words all have something in common: heretofore, forthwith, notwithstanding, therefore, etc... what are these kinds of words called? And where can I find a list of them?
Comment: This is a heterogeneous group. You'll have to be more specific.
Comment: generally, compound words made up of 'here' 'to' 'fore' 'with' 'forth' 'not' 'withstanding' 'there' 'at'... i don't know what to call it, which is why I'm asking for help on how to identify them. Essentially it's "words that sound like that", to me, at this point..
Comment: are you looking for a part of speech?
Comment: more examples: hitherto, erewhile, erstwhile, theretofore, herebefore, erenow, hithertofore... kind of, words implying a going to or coming from, either physically or with ideas..
Comment: How about 'nevertheless', 'moreover', 'nonetheless', 'wherefore', 'whence', 'however'?
Comment: Nice question + 1, but please deselect you main answer. The words in your group are not all adverbs - by any stretch of the imagination.
Comment: The only term that will encompass all these words is **compound** or **compound containing one or more prepositions** (though that's just a description, not a term). They have nothing else in common.
Comment: [Related](https://english.stackexchange.com/q/603965/2085).
Answer: Because I had a similar question to this, I stumbled upon yours, and I apologize for "necro-bumping" this thread, but I feel that I should help because I have found an answer myself. They are called pronominal adverbs. Here's the definition from wiktionary:
"A type of adverb occurring in a number of Germanic languages, formed in replacement of a preposition and a pronoun by turning the latter into a locative adverb and the former into a prepositional adverb and joining them in reverse order."
Here is a link to a good list of them:
http://en.wiktionary.org/wiki/Category:English_pronominal_adverbs
Here's the list directly:
H:
hereabout,
hereabouts,
hereafter,
hereat,
hereby,
herein,
hereinafter,
hereinbefore,
hereinto,
hereof,
hereon,
hereto,
heretofore,
hereunder,
hereunto,
hereupon,
herewith,
herewithin;
T:
thereabout,
thereafter,
thereagainst,
therearound,
thereat,
therebeyond,
thereby,
therefor,
therefore,
therefrom,
therein,
thereinafter,
thereof,
thereon,
thereover,
therethrough,
therethroughout,
thereto,
theretofore,
thereunder,
thereunto,
thereupon,
therewith,
therewithal,
therewithin;
and
W:
whereabout,
whereabouts,
whereafter,
whereas,
whereat,
whereby,
wherefore,
wherefrom,
wherein,
whereinto,
whereof,
whereon,
whereover,
wherethrough,
whereto,
whereunder,
whereupon,
wherever,
wherewith,
wherewithal,
wherewithin,
wherewithout.
Comment: "`forwhy`" and "`hitherto`" as well.
Comment: It's better to edit your post and add some more detail from the link you've included, so that in case the content of the link changes, we'll still have the answer on this website. (:
Comment: This is definitely the closest. All these terms match what I was thinking of, and it's a long list of them! I wonder though where something like "forthwith" would fit in - why is forthwith not a pronomial adverb? Or is it, but it just wasn't added in the wiktionary yet?
Comment: @Claudiu There is no pronoun or locative there.
Comment: I wonder if there's any book reference we could find on this that specifically compares stuff like pronomial adverbs and whatever category something like "forthwith" falls in
Comment: And Aforementioned
Answer: I'd call them compound prepositions. Linguistically speaking, compounds are "composite words" made up from more than one component - in OP's examples the components are words (mostly prepositions themselves), and the resulting compound is also usually a preposition.
Just because some sound formal or archaic doesn't mean they all are. For example, within, without, toward, underneath, throughout, etc., are all in the same general class of words.
OP is particularly interested in prepositions of location - spatial, temporal, or metaphorical (as in "location within a logical framework"). Typical examples such as whereat, hereinafter, thereupon, etc. often occur in legal wordings or complex scholarly arguments, where the "location" is actually some other part of the text. That's why they seem strange (archaic, even, since styles of discursive argument have changed over the centuries). But even many of these, such as upon, therefore, outside, instead, are unexceptional in everyday contexts today.
I don't want to get bogged down in the question of which of OP's words are adverbs and which are prepositions, because I find that distinction is often vague, depends on context, and means little.
Comment: +1 How come you were so up on your prepositions in 2012? Today you'd say they're all adverbs! ;-)
Comment: @Araucaria: I don't think I was ever that interested in "The Naming of the Parts". Yesterday, I guessed correctly that a new question about compound forms like this would have been asked previously, so I found it and closevoted. But only your comment brought me here today, where I see that I had actually answered the original myself. (Which is by way of admitting that I really can't remember how I thought at the time! :) But I'm gonna guess my main intention wasn't to *name* them, but to point out that they're not all "formal, legalistic", and that they're often used *metaphorically*.
Answer: These are all adverbs and compound words. However, there are numerous adverbs and compound words, and most are not as "fancy". These words do not have a category unto themselves.
Of the ones that I just looked up, they appear to derive from Middle or Old English. They are often found in pre-Victorian literature (e.g., any Austen novels).
In today's society, these words (except therefore) are usually (but not exclusively) found within legal documents. Therefore, if I had to give them a name, it would be legalese, but I think this narrows the scope too much.
As for lists, here's a good starting point: http://www.wordnik.com/words/heretofore.
Comment: How about [Class II Adverbial Subordinating Conjunctions and Conjunction Phrases](http://www.umich.edu/~jlawler/subordinatingconjunctions.pdf)?
Comment: Most are adverbs, but *notwithstanding* is a preposition (albeit one that sometimes follows its object).
Comment: This answer is not legalese. Therefore, it's an exception as far as *therefore* is concerned.:)
Comment: @Henly proposed the following comment to edit this Answer, (part two)
"I would add that in addition to "legalese," you might also define these words as key elements of "legal boilerplate" language. Boilerplate essentially means the type of language used in standard forms, which is essentially what many contracts are, with just the specific proper names, places, values and measures added."

See this link:https://en.wikipedia.org/wiki/Boilerplate_(text)
Comment: @Henly proposed the following comment to edit this Answer.(part one)

"I should add that the words we are concerned with are not the nitty gritty legal terms themselves, but the referential words, in other words referring to things that have already been stated, but without going to the effort of stipulating exactly what that  is. In other words boilerplate is a sort of legal shorthand. I would highlight: hereinafter, thereof, in witness whereof etc.

As for lists, here's a good starting point: http://www.wordnik.com/words/heretofore."
Answer: I think these are mostly considered archaic terms. A more wordy description of things that are  described in simpler terms now. Searching for "archaic terms" comes up with several results including http://phrontistery.info/archaic.html
Comment: *Archaic* might apply to *notwithstanding* and *forthwith*, but you could hardly say that about *whenever, anyway*, etc., which are functionally/structurally similar.
Comment: @FumbleFingers: But the OP didn't ask about those. I think formal/old-fashioned/archaic is what he is looking for.
Comment: @Cerberus: He asked about words *like* his two examples. You choose to see that as likeness in the sense of being formal/old-fashioned/archaic, I choose to see it as being compounds formed primarily from prepositions (so we're both right, and I don't think you can argue different! :)
Comment: @FumbleFingers: Perhaps I can't; but I wasn't trying to: I was just commenting on your complaint that Geo's answer would not apply to those terms you mentioned. You can't argue that he is wrong based on that.
Comment: @Cerberus: *Touché*. I shall reverse my downvote!
Comment: @FumbleFingers: *Merci bien*!
Answer: Pronominal prepositions is perfect - I was searching for polysyllabic terms that contained modern prepositions like "with", "in", "to", and the French pronom for pronoun confirms this is the correct term as well.
Answer: Transitional adverbs, denoting subordinate or otherwise relationships between ideas and antecedent or referent things.  They indicate kinds of causality or consequence.
Answer: Such words might also be regarded as conjunctions I suppose as they serve similarly to known conjunctions like "nevertheless", "in spite of" etc..
Answer: The Dutch language is full of these words. We call words like 'daarvoor' (='therefore), hiervoor (= 'herefore) en hierbij (hereby) 'prenominal adverbs'.
Answer: You have to invent a term of your own for these adverbs. I use the term Satzeinleitung (sentence introduction), eg first of all, actually, to be honest, in any case, and Satzüberleitung (possible translation: sentence transition) such as whereafter, whereby etc.
With your type of adverbs you begin a new sentence or a new idea and refer to the preceding sentence.


How to kill /re-start a long running task

Question: Is there a way to kill / re-start a long running task in AWS SWF? Sometimes some of our tasks run for a longer duration and we would like to manually kill a certain task (either via UI or programmatically) and re-start the task if possible. How to achieve this?
Answer: Console is option to manually kill workflow.
You can also set timeouts to whole workflow execution time or to individual activities. This can be set when you register your activity or when you start your activity (defaultTaskStartToCloseTimeoutSecond).
It's not clear what language you're using.
If you're using java, then you should look into Exponential Retry in Flow Framework. This make SDK restart your activity if it fails.
Answer: Long running activity is expected to heartbeat using RecordActivityTaskHeartbeat. It leads to timeout failure after short hearbeat interval instead of long task execution timeout if the activity process hangs or crashes.
The workflow code (decider) can always request activity cancellation through RequestCancelActivityTask decision. The cancellation request is returned as output of the RecordActivityTaskHeartbeat call. Activity implementation should cancel itself and report back to the service using RespondActivityTaskCanceled API call.
See Error Handling section of AWS Flow Framework Developer Guide for the AWS Flow Framework way of cancelling activities.
Sometimes activity implementation cannot support heartbeating and self cancellation. The solution is to execute another kill activity that terminates the first activity execution. For example under Unix such kill activity could emit "kill -9" command for the process that implements the first one.


Do Animals breed?

Question: In Banished you can build pastures that hold either chicken, cows or sheep. If you have 2 or more of one of those animals, will they breed on their own, or is the only way to get more animals through the merchant?
Answer: Animals will reproduce, although they won't actually "breed". You can actually get away with only buying one animal from a trader, and your herd will grow anyway (although this is a little bit of a risk)
Comment: I mean, you don't need two animals: one will reproduce by itself. Perhaps through mitosis.
Comment: Take heed of the risk of buying just 1 .... I bought 3 cattle. The count went up to 4. Then gradually down to 1 :o I thought I would have to wait a few more years for the trader to return, but luckily it started increasing again.
Comment: How are we differentiating breeding and reproducing?

Do Animals breed?


Fallout Tactics character stuck

Question: I'm currently on the first level of Fallout Tactics.  I generally move my characters in sneak mode where possible.  I've also got turn based set to individual.  When my characters move over some sort of obstacle, e.g. a barrel, crate or tank trap, they finish their move there even though they have action points remaining.  When the character is stuck you can click on them to move them and an animation plays as though they're going to move but they don't actually move.  While stuck the character can perform other actions such as changing pose.  The only way to get a character unstuck is to end their turn.  I've just downloaded Fallout Tactics from GOG so hopefully I have the latest version (file date is 28/11/2008).  Does anybody know how to resolve this issue?
Answer: It turns out there's a setting in the game that limits the number of moves you can make so you always have action points available to fire.  I think pressing either Ctrl or Shift on the keyboard toggles between the modes.  I just happened to be near an obstacle when I stopped moving so that was a red herring.

Fallout Tactics character stuck


Indentation (and wrap-indentation) of debug strings output by printf()/fprintf() in C program

Question: I'm using a debug output using printf() in my functions, but the output goes to the console starting at the 1st columns. I'd like to distinguish the nesting level of functions by indenting their output strings each time I dive into the function (it's implemented easily having a static int indentlevel; variable, which is incremented at the beginning of a function, used as a space-filler-count and decremented at the end). But the flaw is that once the output line becomes too long to be wrapped at the console edge, lines' wrapped parts start at column 1 of the console. Should I take care about this, since once the output is redirected to a file, lines are, say, one-line-length, and widths of the lines depend only on the text file viewer settings?
Comment: But the width of the line isn't also configurable by the console's settings?
Comment: By resizing the console window? It's still limited to maximum screen width.
Comment: No.It is usually in the buffer width.If you increase that the lines are longer.
Answer: If you are using gcc you can use the -finstrument-functions compiler option to cause an instrumentation function to be called at the entry and exit of each function.
      void __cyg_profile_func_enter (void *this_fn,
                                     void *call_site);
      void __cyg_profile_func_exit  (void *this_fn,
                                     void *call_site);

You can define these functions to keep track of the nesting level.
WARNING: I haven't actually tried this (yet another of those things I haven't quite got around to!). One obvious GOTHCA - don't instrument the instrumentation functions!!!
http://gcc.gnu.org/onlinedocs/gcc-4.3.2/gcc/Code-Gen-Options.html
Answer: Since you are writing to a text file, you shouldn't take care of line wrapping and let the text viewer decide.
An approach that I've used is to write to HTML - then the browser takes care of line wrapping. The only gotcha is that you need to watch out that the open/end tags are properly balanced, but you would also need that for your indentlevel variable.


How do I manually edit table mappings in ADO.NET in Visual Studio 2010?

Question: I can't seem to find the answer to what I think is an easy question.  I have a Entity model I just created and I want to set the name of the table and the columns by hand.  I can see the "mapping details," but how do I edit them or add to them?
Answer: It appears the answer is, you can't without going into the XML.  You can use the Entity Framework Power Pack to customize the templates for generation, but there's no direct GUI for editing the mappings.
Answer: I open the folder where edmx file in, look into all files in it, and find a possible solution.

I advice install the notepad++ first, then right click on the Edmx File in  file explorer, and click Edit with Notepad++ then the xml file content will show,  or you can directly open the Edmx file by notepad.exe
You'll see something like this on the top part of the file:
<EntityType Name="DataTableName">
  <Key>
    <PropertyRef Name="id" />
  </Key>
  <Property Name="DataColumn1" Type="bigint" Nullable="false" />
  <Property Name="DataColumn2" Type="datetime" Nullable="false" />
  <Property Name="DataColumn3" Type="nvarchar" MaxLength="255" />
  <Property Name="DataColumn4" Type="nvarchar" MaxLength="255" />

</EntityType>

What I want to do is remove DataColumn4, I first open the Edmx File in VS and directly click on the column name in the VS UI and press Delete on the keyboard, and you'll find that in the Mapping Detail Window, the right side of  DataColumn4 property will be empty, but in the left side the DataColumn4  still exist.
Then, Open the edmx file using Step 1, remove the property in the Step 2 and save the file.
Remove-->   <Property Name="DataColumn4" Type="nvarchar" MaxLength="255" />
Restart visual studio, and open the edmx again you'll find DataColumn4 disappear, and I try connect to DB and manipulate Data, works fine.
Answer: If you have your .edmx file open in Visual Studio, you should be able to simply right-click on a table or a column in the table and choose 'rename'.  Once you change the name it will be reflected in the Mapping Details window.
Comment: Problem is that's editing the entity names and properties, not the underlying SQL tables and columns.  Sorry if my question was a little unclear.  Maybe what I'm doing doesn't even make sense.
Answer: You can edit the names easily... just click on the name (when the item is already selected) in the 'class diagram' or the table representation in the edmx file and type the new name. If the text does not become selected and editable when you click on it, you can press F2, the standard Windows key to raname an object. Note: you cannot edit the name in the mapping window.
After editing the names, you can right click on the entity and select 'Generate Database from Model...' option to update the names in the database.
Also, see this post for more information.
Comment: This does not edit the mappings it just changes the navigation property name.
Answer: Here a solution that works on VS 2010. If you Rename an entry, afterwards run "Generate Database from Model..." two times. IN the first run, the mapping is adjusted but you still get a (let me say "compiler") error. In the second run, everything is fine.
I just tested it two times. Worked perfectly.


Why do du -sh and the file manager disagree?

Question: I would like to know why the directory sizes I get when I execute du -sh disagree from the ones the file manager shows. What do they do differently and how big is my data really? I am not so much interested in the size it takes on the disk (because of blocks and stuff), I just want to know how big the actual data is.
Answer: Short answer: The file manager calculates with units based on 1000, du calculates per default with units based on 1024. Because of this, the file manager views a file of 1024 bytes as "1.024 kB", while du views it as "1.000 kiB". This (literally) multiplies if you think of larger files, for example Megabyte (1000 * 1000) vs. Mibibyte (1024 * 1024) or Gigabyte (1000 * 1000 * 1000) vs. Gibibyte (1024 * 1024 * 1024).
Long answer: The difference stems from the different ways computers and humans count. Most current human societies do their math with the decimal system, on the base of 10. Not all cultures in history did, that's why, for example, we divide the day into 24 hours. But with most things, we use 10, or multiples of 10, or 10 to the n-th power. This is evident in the International system of Units (SI), which uses prefixes to mark 10 ^ 3 = 1000. 1000 gram equals 1 *kilo*gram, the 1000th part of 1 meter equals 1 *milli*meter and so fort. Technical, 1000 kilogram would be 1 "megagram", but traditionally, we use a different word for it, "ton". Still, it is based on 1000.
On the other hand, computers calculate not based on 10, but based on 2 - on/off, power/no power, true/false. Therefore, computers use multiplies and powers of 2 instead of multiplies of 10: 2, 4, 8, 16, 32, 64 and so fort. The power of 2 which is nearest to 1000 is 1024. Because of this, "1 kilobyte" was defined originally not as "1000 byte" as most other units would have been, but as "1024 byte". In the same way, "1 megabyte" originally was "1024 * 1024 byte", "1 gigabyte" originally was "1024 * 1024 * 1024 byte" and so forth.
"Back then", most people who used computers knew about this, and in the order of scales that were used in those days, it didn't make munch of a difference. Whether a file is 1000 bytes "large" or 1024 bytes, doesn't really matter in most cases. But time went on, computers became omnipresent, and the numbers became larger. Today, many computer users don't know about 1000 vs. 1024, or they don't care. It doesn't make too much sense to explain to "Joe Everbody", that with almost everything, "kilo" means "1000 of it", but with computers, it's different. Additionally, the difference starts to get significant. If you compare a "Gigabyte" based on 1000 to a "Gigabyte" based on 1024, the difference is roughly 10%. With "Terabyte" and larger, the difference is an even larger fraction.
Therefore, over the last years many countries decided to differentiate between those two calculation systems. The classical prefixes kilo-, mega-, giga-, tera- etc. are today almost always used based on 1000. So, a file with 1024 bytes would no longer be "1.000 kilobyte", but "1.024 kilobyte". The units based on 1024 got new prefixes, with the first syllable of the "old one" followed by "bi": Kilo -> kibi, mega -> mibi, tera -> tebi and so forth. The symbols are KiB, MiB, TiB and so forth.
Nautilus, Ubuntu's file manager, calculates based on 1000. So it shows your file sizes in kilobytes, megabytes etc. du on the other hand still calculates based on 1024. So with du you see your file sizes in kibibytes, mebibytes etc. And as said above, once we are in the tera- vs. tebi- range and up, it starts to show ;)
du offers the --si switch. It works like -h, but calculates with SI units instead of based on 1024. So
du --si -s my_files/

would give you a size in KB, MB, GB etc., while
du -sh my_files/

would give you a size in KiB, MiB, GiB etc.
Comment: Is there a way to make file manager GUI count in 1024s instead? After all who uses 1000s to count filesizes...
Comment: @SOFe No, [there's no way](https://askubuntu.com/questions/897292/how-to-make-the-file-manager-show-file-sizes-in-gib-mib-kib), on purpose. And regarding "who uses base-10 to count filesizes" - that's the official and "proper" way, and has been for years. The base-2 units like KiB, MiB etc. are basically legacy. They have been useful for a long time, but they're no longer "state of the art".
Answer: The right way to find out the right disk space usage is using du command (du -sh). That's because your file manager (like Nautilus) doesn't take into account hidden files.
Or you can use the Disk Usage Analyzer. Use the following command to start it from terminal:
baobab

See also: How to find - Size of a directory & Free disk space.
Comment: ok, what kind of hidden files are going to be in directories where i don't expect them? Also, baobab and du -sh disagree slightly as well, is there any explanation why that is?
Comment: If i uncheck "allocated space" in baobab, it says the same thing as the file manager. Do i draw he right conclusion that du -sh actually shows me the "space occupied on disk" rather than "size of the actual data"?
Comment: If you use Nautilus, press Ctrl+H when you are in Nautilus and you will see what hidden files do you have. Also you can use `ls -a` command in terminal to see them.
Comment: `du -sh` return the result in MiB (mebibytes)/GiB/KiB and boabab show this values in MB (megabytes)/GB/KB. So, baobab and `du -sh` disagree only from this point of view. See here what's the differences: http://wiki.answers.com/Q/Difference_between_megabyte_mebibyte . If you want to see the same results, use: `du -s --si` instead of  `du -sh`. See also `man du`.
Answer: I guess you use Nautilus as the file manager: hidden files are not taken into account. That's a known bug since 2006.


opcv videowriter, i don't know why it does'nt work

Question: I've just written a first program for videocaptur and videowriter. I copied the source from the wiki and changed the only video file name, but it made error.
Here is the source from the wiki.
The opencv is 2.1 and the compiler is visual c++ 2008 express.
#include "cv.h"
#include "highgui.h"

using namespace cv;

int main(int, char**)

{

        VideoCapture capture(1); // open the default camera

        if( !capture.isOpened() )  {

                printf("Camera failed to open!\n");

                return -1;
        }

        Mat frame;

        capture >> frame; // get first frame for size

        // record video

        VideoWriter record("RobotVideo.avi", CV_FOURCC('D','I','V','X'), 30, frame.size(), true);

        if( !record.isOpened() ) {

                printf("VideoWriter failed to open!\n");

                return -1;

        }

        namedWindow("video",1);

        for(;;)

        {
                // get a new frame from camera

                capture >> frame;

                // show frame on screen

                imshow("video", frame);

                // add frame to recorded video

                record << frame;

                if(waitKey(30) >= 0) break;

        }

        // the camera will be deinitialized automatically in VideoCapture destructor
        // the recorded video will be closed automatically in the VideoWriter destructor

        return 0;
}

With the source, I changed 2 parts. One is for VideoCapture. (I don't have tunercard or camera.) The source is
    VideoCapture capture(1); // open the default camera

and changed to
 VideoCapture capture("C:/Users/Public/Videos/Sample Videos/WildlifeTest.wmv");

And the other is for VideoWriter:
   // record video

    VideoWriter record("RobotVideo.avi", CV_FOURCC('D','I','V','X'), 30, frame.size(), true);

and changed to
  VideoWriter record("C:/Users/Public/Videos/Sample Videos/WildlifeRec.wmv",
                      CV_FOURCC('W','M','V','1'), 30,frame.size(), true);

and the part of error is:
        // add frame to recorded video

        record << frame;

Please show me what is my mistake!
P.S.
when I delete the line record << frame;, it works well. I think the error caused at the line.
And I found that even if without change, the wiki source program make same error.
Answer: The first error that i see is the file paths. You have to give them like this : C:\\Users\\....
Answer: please make sure you opencv_ffmpegXXX.dll work right


Unable to execute Phalcon project

Question: I have installed Phalcon for PHP 5.6 and I have installed developer tools also. I created a project saying "hello!" from controller. while executing in browser Im unable to get the output. I am just getting the directories and files in that path. Help me out. Thanks in Advance :)
Answer: you need to have a .htaccess file.
in phalcon u need to reference as this docs said https://docs.phalconphp.com/el/3.2/webserver-setup.
if u created a project using developer tools.
u will see .htaccess file and shouldn't getting this error.

Unable to execute Phalcon project


Android: How to detect a directory in the assets folder?

Question: I'm retrieving files like this
String[] files = assetFiles.list("EngagiaDroid");

How can we know whether it is a file or is a directory?
I want to loop through the directories in the assets folder then copy all of its contents.
Answer: I think a more general solution (in case you have subfolders etc.) would be something like this (based on the solution you linked to, I've added it there too):
...
copyFileOrDir("myrootdir");

...
private void copyFileOrDir(String path) {
    AssetManager assetManager = this.getAssets();
    String assets[] = null;
    try {
        assets = assetManager.list(path);
        if (assets.length == 0) {
            copyFile(path);
        } else {
            String fullPath = "/data/data/" + this.getPackageName() + "/" + path;
            File dir = new File(fullPath);
            if (!dir.exists())
                dir.mkdir();
            for (int i = 0; i < assets.length; ++i) {
                copyFileOrDir(path + "/" + assets[i]);
            }
        }
    } catch (IOException ex) {
        Log.e("tag", "I/O Exception", ex);
    }
}

private void copyFile(String filename) {
    AssetManager assetManager = this.getAssets();

    InputStream in = null;
    OutputStream out = null;
    try {
        in = assetManager.open(filename);
        String newFileName = "/data/data/" + this.getPackageName() + "/" + filename;
        out = new FileOutputStream(newFileName);

        byte[] buffer = new byte[1024];
        int read;
        while ((read = in.read(buffer)) != -1) {
            out.write(buffer, 0, read);
        }
        in.close();
        in = null;
        out.flush();
        out.close();
        out = null;
    } catch (Exception e) {
        Log.e("tag", e.getMessage());
    }

}

Answer: You may use list method of AssetManager.
Any directory in asset should have one file at least, empty directory will be ignored when building your application.
So, to determine if some path is directory, use like this:
AssetManager manager = activity.getAssets();
try {
    String[] files = manager.list(path);
    if (files.length > 0) {
        //directory
    } else {
        //file
    }
} catch (Exception e) {
    //not exists.
}

Answer: I've discovered this variant:
try {
    AssetFileDescriptor desc = getAssets().openFd(path);  // Always throws exception: for directories and for files
    desc.close();  // Never executes
} catch (Exception e) {
    exception_message = e.toString();
}

if (exception_message.endsWith(path)) {  // Exception for directory and for file has different message
    // Directory
} else {
    // File
}

It's a more faster as .list()
Comment: This will not throw for uncompressed files, so it will not always throw. But this can be easily fixed. On the other hand, relying on exception messages doesn't look nice to me. They could possibly change.
Answer: The appalling truth is that despite being asked nearly 10 years ago, no simple, elegant, roundly applauded method of determining whether an element in the array returned by AssetManager.list() is a file or a directory has been offered by any answer to date.
So, for example, if an asset directory contains a thousand elements, then seemingly a thousand I/O operations are necessary to isolate the directories.
Nor, for any element, does any native method exist for obtaining its parent directory - vital for something complex like an assets Browser / Picker - where you could end up looking at some seriously ugly code.
boolean isAssetDirectory = !elementName.contains(".");

The lateral approach that worked for me was to assume that any element without a dot (.) in its name was a directory. If the assumption is later proved wrong it can be easily rectified.
Asset files generally exist because you put them there. Deploy naming conventions that distinguish between directories and files.
Answer: Another way relying on exceptions:
private void checkAssets(String path, AssetManager assetManager) {
    String TAG = "CheckAssets";
    String[] fileList;
    String text = "";
    if (assetManager != null) {
        try {
            fileList = assetManager.list(path);
        } catch (IOException e) {
            Log.e(TAG, "Invalid directory path " + path);
            return;
        }
    } else {
        fileList = new File(path).list();
    }

    if (fileList != null && fileList.length > 0) {
        for (String pathInFolder : fileList) {
            File absolutePath = new File(path, pathInFolder);

            boolean isDirectory = true;
            try {
                if (assetManager.open(absolutePath.getPath()) != null) {
                    isDirectory = false;
                }
            } catch (IOException ioe) {
                isDirectory = true;
            }

            text = absolutePath.getAbsolutePath() + (isDirectory ? " is Dir" : " is File");
            Log.d(TAG, text);
            if (isDirectory) {
                checkAssets(absolutePath.getPath(), assetManager);
            }
        }
    } else {
        Log.e(TAG, "Invalid directory path " + path);
    }
}

and then just call checkAssets("someFolder", getAssets()); or checkAssets("", getAssets()); if you want to check the root assets folder. But be aware that the root assets folder contains also other directories/files (Eg. webkit, images, etc.)
Answer: In your particular case, since you retrieved the files through list, you already know that these names exist. This simplifies the problem a lot. You can simply use this:
public static boolean isAssetAFolder(AssetManager assetManager, String assetPath) throws IOException {

    // Attempt opening as a file,
    try {
        InputStream inputStream = assetManager.open(assetPath); inputStream.close();
        return false; // A file indeed.
    } catch (FileNotFoundException e) {
        // We already know this name exists. This is a folder.
        return true;
    }
}

On the other hand, if you need a generic solution to detect if a certain path both exists and is a folder, you can use this:
public static boolean isAssetAFolder(AssetManager assetManager, String assetPath) throws IOException {

    // Attempt opening as a file,
    try {
        InputStream inputStream = assetManager.open(assetPath); inputStream.close();
        return false; // A file indeed.
    } catch (FileNotFoundException e) {
        // This could be a folder, or this path doesn't exist at all. Further checking needed,
        return assetPathExists(assetManager, assetPath);
    }
}

// If you are checking a file name "icon.png" inside your assets folder, the assetPath should be "icon.png".
public static boolean assetPathExists(AssetManager assetManager, String assetPath) throws IOException {

    // Assume that "" exists by default,
    if (assetPath.isEmpty()) return true;

    // Reject paths that point outside the assets folder,
    if (assetPath.startsWith("..") || assetPath.startsWith("/")) return false;

    // For other file/folder paths, we'll search the parent folder,
    File fileOrFolder = new File(assetPath);
    String parent = ((parent=fileOrFolder.getParent()) != null) ? parent : ""; // Handle null parents.
    if (!Arrays.asList(assetManager.list(parent)).contains(fileOrFolder.getName())) return false;

    // Getting this far means that the specified assetPath indeed exists. However, we didn't handle files
    // with trailing "/". For instance, "icon.png/" shouldn't be considered existing although "icon.png"
    // does.

    // If the path doesn't end with a "/", we are safe,
    if (!assetPath.endsWith("/")) return true;

    // Remove the trailing slash,
    assetPath = assetPath.substring(0, assetPath.length()-1);

    // Attempt opening as a file,
    try {
        InputStream inputStream = assetManager.open(assetPath); inputStream.close();
        return false; // It's indeed a file (like "icon.png"). "icon.png/" shouldn't exist.
    } catch (FileNotFoundException e) {
        return true; // This is a folder that exists.
    }
}

I wrote these for a web server, so I couldn't make assumptions about the shape of the input path. But it can be simplified a bit if you have some rules set. This code returns immediately once it becomes certain of the type of the asset, to avoid the extra processing overhead.
Answer: You can also try this, it works for me, since you cannot rely solely on .list()
public static boolean isDirectory(Context context, String path) throws IOException {
    //If list returns any entries, than the path is a directory
    String[] files = context.getAssets().list(path);
    if (files != null && files.length > 0) {
        return true;
    } else {
        try {
            //If we can open a stream then the path leads to a file
            context.getAssets().open(path);
            return false;
        } catch (Exception ex) {
            //.open() throws exception if it's a directory that you're passing as a parameter
            return true;
        }
    }
}

Comment: While this is correct, it would be better if you could re-write it in Java so it is a more useful answer
Comment: Done, I converted the code to Java, hopefully the answer helps more people now.
Answer: You can start from Android File
Comment: thanks for your response. but i don't think some funcitons like isDirectory is not working in the assets folder
Answer: You can check if a File represents a directory using http://developer.android.com/reference/java/io/File.html#isDirectory(). Is that what you mean?
Comment: thanks for you response. Yes but when I tried it, it's not working when the file is in your assets folder. Maybe because files are included in the package.
Comment: I end up using [this code](http://stackoverflow.com/questions/4447477/android-how-to-copy-files-in-assets-to-sdcard). I execute this code times the number of my folders. :)
Comment: AssetManager does not return File objects, therefore the File API is not applicable.


How can I access hard drive in my laptop using live tails OS?

Question: I am using Ubuntu 14.04 LTS.I am also using live tails OS using USB pendrive.But when I use live OS I cann't access my hard drive's file which is saved in my laptop using primary OS(Ubuntu 14.04).It requires administrator password.I used my login password but not worked.What can I do?
Answer: You need to go to more options on the Tails Greeter menu and set an Administration Password, this password can then be used to mount and access internal disks.
Follow the guide in the Tails documentation.


adding textview and button in ExpandableListView

Question: how could we add TextView and button in Expandable List View.
Like explained
Root is Branch name
           first leaf is Address
           second leaf is Email
           third leaf is phone number.
           fourth leaf some details
I get branches and it gets loaded into ExpandableListView.
Expandable Listview should have many TextViews like Name, address, email and telephone number.
Next to Textview   of Email and Phone number there would be buttons. So as to make calls or to mail them.(next to every leaf there will be a button)
Please let me know any tutorial or examples on how to have many TextViews inside Expandable List View. I am getting ListViews data from database.
The Editable ListView grows dynamically.
Looking forward to your reply.
thanks.
Answer: You have to make your own custom expandable list..
Have a look at this link:
http://mylifewithandroid.blogspot.com/2010/12/expandable-list-and-checkboxes.html
It should help you through..


How can I have a view reset when an exposed title filter is emptied?

Question: I have a view that simply lists content. I have one exposed filter "Title" for users to filter content that "contains" and text they insert. I have set the exposed filter to Autosubmit as they type with ajax turned on. The problem is that if the user deletes what they have added to the exposed title filter, the view isn't reset. It stills shows the results of their previous submission. I can of course add a reset button but is there any way to have the view reset itself when the exposed title filter is emptied by the user?
Answer: You would need to add jQuery to listen on the textfield change event, or similar. If value is empty then set location to current path without querystring. YMMV


Help drying polyurethane sealent top coat

Question: I've used a polyurethane water sealant coating for concrete that is called (vulkem 951 part A ) and it was supposed to mixed with part b the catalyst that starts the drying process but do to a miscommunication it was not ....the people from the company that makes it said it has to be removed as it won't ever dry ...we've removed as much as possible and also tried rolling the catalyst or (part b ) on top but it seems to have done little to nothing as the area is still tacky and wet and it's been over a week since it's been rolled out ...imagine a gooey grey paint spread out over a whole balcony that just won't dry and apparently will never dry ....that's my problem any help would be great ...I was thinking maybe ferric chloride powder  or concrete dust and roll it in to the paint substance ? not sure how safe it is for me to personal use ferric chloride ....please help
Best regards
A nervous maintenance man
Answer: Disclaimer: Not a chemist, and I'm not familiar with the specific polyurethane you are using. Although I've worked with urethane and epoxies a bit, you should probably get a second & third opinion.
A careful application of heat should help soften the material, hopefully enough to mix with the catalyst.  It might not cure properly but it could at least clear up the sticky situation without resorting to throwing on more chemicals. I've had luck with applying a hair dryer to epoxy that was insufficiently catalyzed. A heat gun might be too hot and even a hair dryer should be kept back at least a few inches from the surface. For my application, the heat helped the process along, however, you must be careful not to burn it and wear a respirator rated for organic solvents because  it will almost certainly out-gas some pretty toxic fumes when you heat it up.