text:
Q: Проблема с созданием массива c++/cli Я СОВСЕМ НАЧИНАЮЩИЙ ! (чтоб не сильно критиковали,а доступно объяснили)
Написал простенькую программу - захват видео через OpenCV и его воспроизведение на pictureBox1.
Пытаюсь сделать раскадровку - создаю массив и каждый кадр в цикле завожу в него. Пробую извлечь конкретный кадр из массива в pictureBox2 - изображение не получаю.Какая-то информация в элементе массива есть - pictureBox2 меняет цвет - но конкретной картинки конкретного кадра нет.Если вместо заведения кадра в массив использую SAVE в файл - кадр записывается и отображается,а через массив не хочет.Может кто подскажет в чем проблема или ошибка.Привожу код:
#pragma endregion

        array<Image^>^img;

        Bitmap^myBitmap;
      bool Pause;

    int i;
private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {

             img=gcnew array<Image^>(625);// определяю как i+1

                 CvCapture* capture;

      cvNamedWindow("original",CV_WINDOW_AUTOSIZE);

        capture = cvCreateFileCapture( "C:\\Users\\валера\\Downloads\\dance.mpg");

     while(true){

          if(Pause!=true)
          {
           // получаем следующий кадр

              frame = cvQueryFrame( capture );
                if( !frame ) {

                    break;

                }
                myBitmap = gcnew System::Drawing::Bitmap(frame->width,frame->height,frame->widthStep, System::Drawing::Imaging::PixelFormat::Format24bppRgb,(System::IntPtr)frame->imageData);
            pictureBox1->Image = myBitmap;
             img[i]= pictureBox1->Image;

             label2->Text = i.ToString(); // показываю количество кадров
        //if(i==3)
        //{
           // pictureBox1->Image->Save( "C:\\MyPics\\image11.bmp" );
        //}
            i++;

          }

                char c = cvWaitKey(40);
                if (c == 27) { // если нажата ESC - выходим
                        break;
                }
        }

     cvReleaseCapture( &capture );

       cvDestroyWindow("original");
             }

private: System::Void button2_Click(System::Object^  sender, System::EventArgs^  e) {
             Pause=!Pause;
         }
private: System::Void button3_Click(System::Object^  sender, System::EventArgs^  e) {

             pictureBox2->Image=img[10];// выбираю произвольный индекс из массива,который хочу отобразить

             //pictureBox2->Image=Image::FromFile("C:\\MyPics\\image11.bmp");
         }

A: Все,вопрос закрыт,разобрался. Ведь в массиве хранится не сам image,а лишь ссылка на него. Но создаваясь в цикле image нигде не сохраняется ! Т.е. я пытаюсь ссылаться на НЕСУЩЕСТВУЮШИЙ объект.


text:
Q: Adding Spring Cloud Config to boot app causes java.lang.NoSuchMethodError by adding unwanted jar to class path I have a working Spring boot app.  I changed the application to read its configuration from Spring Cloud Config server.  I added bootstrap.properties and the following dependencies to the pom:
<dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-config</artifactId>
</dependency>

<dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-bootstrap</artifactId>
</dependency>

<dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>

The version of spring cloud is 2020.0.4.  The app successfully retrieves its configuration from the config server.  However, the endpoints fail with the following error:
in context with path [] threw exception [Handler dispatch failed; nested exception is java.lang.NoSuchMethodError: 'void javax.ws.rs.core.MultivaluedMap.addAll(java.lang.Object, java.lang.Object[])'] with root cause
java.lang.NoSuchMethodError: 'void javax.ws.rs.core.MultivaluedMap.addAll(java.lang.Object, java.lang.Object[])'

I have run the boot application in debug mode to see what the Tomcat classpath is.  Prior to adding Spring Cloud Config , there was only
jakarta.ws.rs-api-2.1.6.jar
on the classpath.  However after adding the config server dependencies
jsr311-api-1.1.1.jar
is showing up on the Tomcat classpath before the Jakarta library and hence why this is happening.
I am not sure why the addition of Spring Cloud Config dependencies to my pom and adding a property file would cause this addition to the classpath.
I am running/building the app using mvn spring-boot:run.
How do I fix this issue?
Update:  it seems that the jsr311-api-1.1.1.jar gets pulled in by spring-cloud-starter-netflix-eureka-client
Thank you.

A: I have added the following to my pom.xml and I can reach my application endpoints successfully.
<dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
        <exclusions>
              <exclusion>
                    <groupId>javax.ws.rs</groupId>
                    <artifactId>jsr311-api</artifactId>
              </exclusion>
        </exclusions>
</dependency>

redpajama_set_name: RedPajamaStackExchange


text:
Q: Remove white bar in appendix when using mini-frames in metropolis theme Consider the following MWE:
\documentclass[10pt]{beamer}

\usepackage{appendixnumberbeamer}

\usetheme{metropolis}
\useoutertheme{miniframes}

\setbeamercolor{section in head/foot}{fg=white, bg=mDarkTeal}
\setbeamercolor{subsection in head/foot}{fg=white, bg=mDarkTeal}

\begin{document}

\section{Section}

\subsection{Subsection}

\begin{frame}{slide}
    Normal slide
\end{frame}

\appendix

\begin{frame}{Additional stuff}
    Additional stuff
\end{frame}

\end{document}

I use mini-frames in the metroplis theme to indicate the progress in the presentation. I also use appendixnumberbeamer package in order to separate backup slides from the rest of the presentation. In the slides in the appendix, the mini-frames are not visible any more - which is just fine. However, there is a white bar where the mini-frames were located before.

Is there any possibility to remove this bar completely in the appendix? It would be sufficient to change the outer theme in the appendix slides, but I don't think this is possible without any further ado.

A: You can simply shift the slides from the appendix by the height of the former navigation bar:
\documentclass[10pt]{beamer}

\usepackage{appendixnumberbeamer}

\usetheme{metropolis}
\useoutertheme{miniframes}

\setbeamercolor{section in head/foot}{fg=white, bg=mDarkTeal}
\setbeamercolor{subsection in head/foot}{fg=white, bg=mDarkTeal}

\begin{document}

\section{Section}

\subsection{Subsection}

\begin{frame}{slide}
    Normal slide
\end{frame}

\appendix

\setbeamertemplate{headline}{}
\addtobeamertemplate{frametitle}{\vspace*{-\headheight}}{}

\begin{frame}{Additional stuff}
    Additional stuff
\end{frame}

\begin{frame}[standout]
    \frametitle{~}
    \vspace*{-\headheight}
    Thank you very much!
\end{frame}

\end{document}


text:
Q: xamarin.android permgen space error I am creating an android app in Xamarin 3. The app runs perfectly but gives an error when i try to view the .axml designer. This is the error:

"The layout could not be loaded: PermGen space"

I know that it is a Java.Lang.OutofMemory error but not quite sure how to solve it in my xamarin project. I am also using Visual Studio with the Xamarin plugin. How do I get this to go away? I understand that increasing the size might be a solution, but not sure how to do that - as all the examples on the web are in Java with Eclipse. Thanks to all those that take the time to help.

A: I restarted Visual Studio and this error is gone for now.


text:
Q: create a Credential with access_token/refresh_token/expires_in parameters without the flow/installApp stuff The quick start sample project is loading the *.json credential file, do the authorization flow, save the tokens in another file, and then use the token to create a credential. My goal is to do them in separate steps:

*

*store the tokens in a DB after the exchange the authorization code for tokens

*retrieve the tokens from DB

*check the credential expiry and refresh token if needed and save it to DB again

*create a credential object (without doing the flow/authorizationInstalledApp stuff)

So I tried the following to create the credential with the token related pramameters:
TokenResponse tokens = new TokenResponse();
String token = "xxxxxxxxxxxxxxx$$$$$$$$$";
tokens.setAccessToken(token);
tokens.setTokenType("bearer");
tokens.setExpiresInSeconds(3500L);
Credential credential = new
Credential(BearerToken.authorizationHeaderAccessMethod()).setFromTokenResponse(tokens);

The credential was created but the API call failed with:

401 Unauthorized {   "code" : 401,   "errors" : [ {
      "domain" : "global",
      "location" : "Authorization",
      "locationType" : "header",
      "message" : "Invalid Credentials",
      "reason" : "authError"   } ],   "message" : "Invalid Credentials" }

I also tried another suggestion in the java doc:
public static Credential createCredentialWithRefreshToken(
      HttpTransport transport, JsonFactory jsonFactory, TokenResponse tokenResponse) {
    return new Credential.Builder(BearerToken.authorizationHeaderAccessMethod()).setTransport(
    transport)
    .setJsonFactory(jsonFactory)
    .setTokenServerUrl(
        new GenericUrl("https://server.example.com/token"))
    .setClientAuthentication(new BasicAuthentication("s6BhdRkqt3", "7Fjfp0ZBr1KtDRbnfVdmIw"))
    .build()
    .setFromTokenResponse(tokenResponse);
 }

That also did not work for me. So my questions are:

*

*can we just create a very simple credential object with access_token, refresh_token, expires?

*why do we have to hook up with the GoogleAuthorizationCodeFlow?

*what's the minimum required parameters for a valid credential object based on Java client library (OAuth 2.0).

Thanks a lot for any ideas/input.


text:
Q: Calculating the result of a formula by matching the numbers I have two data frames as follows:
a1 <- data.frame(ID = c(1:4), type = c(463,479, 5357,4771), amount = c(110,95,2100,23))
a2 <- data.frame(AltID = c(101:103), Calculation = c('[479]+[4771]','[5357]/([479]*[463])','([463]-[4771])/[5357]'))

> str(a1)
'data.frame':   4 obs. of  3 variables:
 $ ID    : int  1 2 3 4
 $ type  : num  463 479 5357 4771
 $ amount: num  110 95 2100 23

> str(a2)
'data.frame':   3 obs. of  2 variables:
 $ AltID      : int  101 102 103
 $ Calculation: Factor w/ 3 levels "([463]-[4771])/[5357]",..: 2 3 1

The numbers in "BRACKET" that appear in "Calculation" column in "a2" are all available in the column "type" in "a1", which has the corresponding value in the "amount" column in "a1".
The goal is to add a column to "a2" that uses the "Calculation" formula in each row of "a2", match the numbers with a1$type, and use the proper arithmetic operations to generate a single number that corresponds to each "AltID" row in "a2".
For the example above,
a2$result <- rep(0,3)

and I would like to get:
a2$result[1] = 95+23
a2$result[2] = 2100/(95*110)
a2$result[3] = (110-23)/2100

I was wondering if there is a smart way for doing this.
Thanks in Advance

A: I think there's probably a better way to do whatever you're doing but I would need to know a lot more about your real starting point and end goals.
Here's how I would go about your problem as stated:
First I'm going to replace your type numbers in a1 with valid variable names by pasting x on the front. Then I stick them in their own environment so that we can use these variables later without cluttering up the workspace:
a1$var = paste0("x", a1$type) # make variable names
a1_env = new.env()            # create new environment
                              # fill new environment:
mapply(FUN = assign, x = a1$var, value = a1$amount, MoreArgs = list(envir = a1_env))

Now we're going to replace the bracketed numbers in a2 with the same variable names. This means we delete the close brackets ] and replace the open brackets with "x" to match the variable names created in a1_env:
a2$Calculation = gsub(pattern = "\\[", replacement = "x", x = a2$Calculation)
a2$Calculation = gsub(pattern = "\\]", replacement = "", x = a2$Calculation)

a2
#   AltID        Calculation
# 1   101         x479+x4771
# 2   102  x5357/(x479*x463)
# 3   103 (x463-x4771)/x5357

Last, we just need to parse and evaluate the calculation column in the environment we created where these variables are defined:
a2$Result = sapply(a2$Calculation, FUN = function(x) {
     eval(parse(text = x), envir = a1_env)
})

a2
#   AltID        Calculation       Result
# 1   101         x479+x4771 118.00000000
# 2   102  x5357/(x479*x463)   0.20095694
# 3   103 (x463-x4771)/x5357   0.04142857

This answer comes with an obligatory warning:
> fortunes::fortune(106)
If the answer is parse() you should usually rethink the question.
   -- Thomas Lumley
      R-help (February 2005)

A: library(stringr)
for(i in 1:nrow(a1)) {
  a2$Calculation <- str_replace_all(a2$Calculation, as.character(a1$type[i]), as.character(a1$amount[i]))}
a2$Calculation <- gsub("\\[|\\]", "", a2$Calculation)
a2$Total <- sapply(a2$Calculation, function(x) eval(parse(text=x)))
a2
#  AltID   Calculation        Total
#1   101         95+23 118.00000000
#2   102 2100/(95*110)   0.20095694
#3   103 (110-23)/2100   0.04142857

In this case, a for loop works because it saves the last replacement and uses it for the next iteration. We replace each value step by step with str_replace_all. Next we eliminate the brackets with gsub. And lastly we use eval(parse(text=x)) to go from a text string of the operations to the actual values.
Follow Gregor's general caution with regard to text parsing. Usually when someone needs it for a function call, somewhere in the pipeline they backed themselves into a programming corner that could have been avoided.


text:
Q: return angular promise at client side. without server round-trip i m using angular xeditable for my project.
i m using angular xeditable row component for my grid.
as i know
if i use
   return  $http.post('api/students',model).sucess(function(data) {

 })
.error(function(data) {
 }) ;

as i know, what happens - above code will call students CONTROLLER post method web api...  if it returns OK,  success will be executed n returned else error will be executed n returned ......
but my question is - can i call  .error  call from javascript itself....
lets say
 if( textbox == "")

       return $http.post().error().......

  else

        return $http.post().sucess()....

why i want something like this???
because  for single textbox i have to make server trip to check whether it is empty or not.  if it is not empty,  i return OK() else i return (lets say)  NotFound()...
OK  will execute success  call
NotFound will execute error call...
so at js side if i check whether string is empty or not.
if empty forcefully (without server trip)  i want to 'return'   .error callback....
is it possible????????????
$http.post will make server trip.  i know that.  but what at client side if i want to return error promise forcefully?

A: If you don't want to make a HTTP request without valid input simply check the input before you do anything. Like so:
if(<valid input>) {
  return  $http.post('api/students',model)
  .success(function(data) {

  })
  .error(function(data) {

  }) ;
} else {
  // don't do request
}

A: You can use the $q library to rejected promise.
To return an error promise:
angular.module(....)
  .service('myService', ['$q', '$http', ....,
     function($q, $http, ....) {
        ...
        this.myFunction = function(data) {

          if (isValid(data)) {
            return $http.post(....);
          } else {
            return $q.reject("rejection message");
          }

        };
        ...
     }]);


text:
Q: IPTABLES not working, fail2ban still notifying me of instrusions from those ips I added 200 hundred iptable rules like these:
iptables -A INPUT -s 108.62.150.0/24 -j DROP
iptables -A INPUT -s 109.108.64.0/19 -j DROP
iptables -A INPUT -s 109.110.32.0/19 -j DROP

to block russian and eastern europe ips from my server.
However, my fail2ban is still going off for many of the ips which fall within those ranges.
The begining of my rule set looks like so:
Chain INPUT (policy DROP)
target     prot opt source               destination
DROP       tcp  --  0.0.0.0/0            127.0.0.0/8
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0            state RELATED,ESTABLISHED
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0
DROP       all  --  224.0.0.0/4          0.0.0.0/0
PUB_IN     all  --  0.0.0.0/0            0.0.0.0/0
PUB_IN     all  --  0.0.0.0/0            0.0.0.0/0
PUB_IN     all  --  0.0.0.0/0            0.0.0.0/0
PUB_IN     all  --  0.0.0.0/0            0.0.0.0/0
PUB_IN     all  --  0.0.0.0/0            0.0.0.0/0
DROP       all  --  0.0.0.0/0            0.0.0.0/0
DROP       all  --  108.62.150.0/24      0.0.0.0/0
DROP       all  --  109.108.64.0/19      0.0.0.0/0
DROP       all  --  109.110.32.0/19      0.0.0.0/0
DROP       all  --  109.110.64.0/19      0.0.0.0/0
DROP       all  --  109.111.176.0/20     0.0.0.0/0

Why are they still getting through?
Is it the PUB_IN statements?? Should my block(DROP) rules appear before the PUB_IN rules?

A: The order of rules in Netfilter tables are important. You should move PUB_IN and ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0 rules after your DROP rules. The rule with state RELATED,ESTABLISHED should remain in place.
If the rules are matching complementary traffic, you should order them with bigger prefixes on top (e.g. /4 should be on top /32 on bottom). If they overlap (they could match same packet), reordering them will change the semantic, but if they are complementary, it is safe to reorder them.


text:
Q: How to parse Html to get the Image with HtmlAgilityPack I am using WebClient to download the html of a webpage. How to parse to get the Image Tag and the image's src so that I can download the image. Thanks for your help.

--- Update
I downlaoded the HtmlagilityPack. I got this error msg when I used Add reference in my windows phone project:
HtmlAgilityPAck is not built using windows phone runtime. Windows Project will work only with windows phone assemblies
How to solve this issue so I can use the webclient as follows? Thanks.

var client = new WebClient();
client.DownloadStringCompleted += client_DownloadStringCompleted;
client.DownloadStringAsync(new Uri(strUrl));

A: You'll need to grab the source code for HtmlAgilityPack and build the HAPPhone project. You can reference the resulting assembly in your WP7 project. More details.


text:
Q: Why does activating conda unload my .bashrc configurations? Ever since I added conda activate to my .bashrc file, opening up a new terminal on MacOS does seem to "unload" my .bashrc configuration. I have to manually call source ~/.bashrc every time.
Here is the content of my .bashrc file
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8

[ -f /usr/local/etc/profile.d/autojump.sh ] && . /usr/local/etc/profile.d/autojump.sh

. /usr/local/anaconda3/etc/profile.d/conda.sh
conda activate base
export GPG_TTY=$(tty)

If I want to use the j command now, I first have to source the .bashrc file again.
Anybody know what is causing this and how to fix it?

A: So after some digging, I found out that activating conda starts bash with .bash_profile, so I copied my .bashrc contents into .bash_profile and now everything works smoothly again.


text:
Q: Is this the shortest proof of Fermat's last theorem for exponent 3? To begin with, here we only consider the case of $n^3 + (n+1)^3 = (n+2)^3$, that is the case of consecutive integers $(x,y,z)$ in the well known equation. The general case $x^3 + y^3 = z^3$ is much more difficult to prove (and the work is yet to be done with the method outlined below).
Here we use the integer representation of a cube $n^3$ as a sequence of consecutive odd numbers. We get the sequence by writing $n^3=n\cdot n^2$. This means that we need $n$ terms with an average value of $n^2$ to represent the cube $n^3$. This representation has a big advantage over other possible representations and it is that consecutive cubes $n^3$, $(n+1)^3$, and $(n+2)^3$ have a representation that ends when the next one starts (that is they do not share any term).
For example $2^3=2\cdot 2^2= 3+5$ and $3^3=3\cdot 3^2=7+9+11$. This is a well known property of cubes when represented as a sequence of consecutive odd integers (https://en.wikipedia.org/wiki/Cube_(algebra)). This means that we can concatenate the left hand side of the equation to form a new sequence. And we need to figure out what integer this concatenated sequence represents.
It was not really difficult to do that.
So we gave an example and show why the left hand side cannot represent a cube whose value is  the right hand side of the equation.
$$6^3 + 7^3 = 8^3.$$
We write down the representation of each sequence:
$$6^3 = 6\cdot 6^2 = 31 + 33 + 35 + 37 + 39 + 41,$$ that is 6 terms with average value of $6^2=36$.
We do the same for $7^3$.
$$7^3 = 7\cdot7^2 = 43 + 45 + 47 + 49 + 51 + 53 + 55,$$ that is 7 terms with average value of $7^2=49$.
When we concatenate the two sequences into one we will call lhs, we get:
$$\text{lhs} = 31 + 33 + 35 + 37 + 39 + 41 + 43 + 45 + 47 + 49 + 51 + 53 + 55.$$
This sequence has $(6+7)=13$ terms with average $(n^2 + (n+1)^2 +1)/2$. In our case, the lhs is therefore a sequence with 13 terms with average 43 which represents the integer $m=13\cdot 43=559=13\cdot43$.
The right hand side is $\text{rhs}=8^3=8\cdot8^2$, so it will have 8 terms with an average of $64$. $$\text{rhs} = 57 + 59 + 61 + 63 + 65 + 67 + 69 + 71.$$ So looking at the result, we see that $\text{lhs}=13\cdot 43$ cannot be equal to $\text{rhs}=8^3$. That is  $(2n+1)\cdot (n^2 + (n+1)^2 +1)/2$ cannot be equal to $(n+2)^3$.
I am not sure if this method can be extended to the general case where $x,y$ and $z$ can take any value (not necessarily consecutive). But I think it's worth looking into it because of the simplicity of the method.

A: No.
The presumably shortest proof for the case you consider is this
Assume $$n^3+(n+1)^3=(n+2)^3. $$
Then
$$ 0=n^3+(n+1)^3-(n+2)^3= n^3-3n^2-9n-7=(n^2-3n-9)\cdot n-7.$$
We conclude that $n\mid 7$, but neither $1^3+2^3=3^3$, nor $7^3+8^3=9^3$. $\square$

A: $n^3 + (n+1)^2 = (n+2)^3 \implies $
$(m-1)^3 +m^3=(m+1)^3; m=n+1$
$2m^3-3m^2+3m-1=m^3+3m^2+3m+1$
$m^3=6m^2+2$
$m=6 + 2/m^2$ so $m^2|2$ and $m > 6$.  So $m=1>6$.  Clearly impossible.
Of course, the shortest proof would be "this is a single cubic equation with one variable and can easily be confirmed to have no integer solution".
This is simply far too specific a case to be of any significance.


text:
Q: Play 2.6 CORS filter not working Following documentation at https://www.playframework.com/documentation/2.6.x/CorsFilter I have added below configuration in my application.
play.filters.enabled += "play.filters.cors.CORSFilter"

play.filters.cors {
  exposedHeaders = ["Access-Control-Allow-Origin"]
}

GET    /v1/user/:username  controllers.MyController.user(username)

I'm using Play 2.6 (scala). I want to keep rest of setting values as default in reference.conf With this configuration, I'm not seeing Access-Control-Allow-Origin header coming from server. What am I missing here?


text:
Q: Spring WebClient: Retry with WebFlux.fn + reactor-addons I'm trying to add a conditional Retry for WebClient with Kotlin Coroutines + WebFlux.fn + reactor-addons:
suspend fun ClientResponse.asResponse(): ServerResponse =
    status(statusCode())
        .headers { headerConsumer -> headerConsumer.addAll(headers().asHttpHeaders()) }
        .body(bodyToMono(DataBuffer::class.java), DataBuffer::class.java)
        .retryWhen {
            Retry.onlyIf { ctx: RetryContext<Throwable> -> (ctx.exception() as? WebClientResponseException)?.statusCode in retryableErrorCodes }
                .exponentialBackoff(ofSeconds(1), ofSeconds(5))
                .retryMax(3)
                .doOnRetry { log.error("Retry for {}", it.exception()) }
        )
        .awaitSingle()

also adding a condition before the retry
if (statusCode().isError) {
        body(
            BodyInserters.fromPublisher(
                Mono.error(StatusCodeError(status = statusCode())),
                StatusCodeException::class.java
            )
        )
    } else {
        body(bodyToMono(DataBuffer::class.java), DataBuffer::class.java)
    }

Call looks like:
suspend fun request(): ServerResponse =
           webClient/*...*/
                    .awaitExchange()
                    .asResponse()

A: This spring webclient: retry with backoff on specific error gave me the hint to answer the question:
.awaitExchange() returns the ClientResponse and not Mono<ClientReponse>
This means my retry was acting on bodyToMono instead of the operation of exchange().
The solution now looks like
suspend fun Mono<ClientResponse>.asResponse(): ServerResponse =
    flatMap {
        if (it.statusCode().isError) {
            Mono.error(StatusCodeException(status = it.statusCode()))
        } else {
            it.asResponse()
        }
    }.retryWhen(
        Retry.onlyIf { ctx: RetryContext<Throwable> ->
            (ctx.exception() as? StatusCodeException)?.shouldRetry() ?: false
        }
            .exponentialBackoff(ofSeconds(1), ofSeconds(5))
            .retryMax(3)
            .doOnRetry { log.error { it.exception() } }
    ).awaitSingle()

private fun ClientResponse.asResponse(): Mono<ServerResponse> =
    status(statusCode())
        .headers { headerConsumer -> headerConsumer.addAll(headers().asHttpHeaders()) }
        .body(bodyToMono(DataBuffer::class.java), DataBuffer::class.java)


text:
Q: DOMException Error when trying to play audio in Vue.JS App I want to play a music file with a click of a button, but I am thrown this error:
DOMException: Failed to load because no supported source was found.

This is the button that calls the play music function:
<button  v-on:click="playMusic()">Play Song</button>

This is my play music function:
playMusic: function() {
                var audio = new Audio("../../media/KR881.mp3");
                audio.play();
            },

How can I fix this error?

A: You should apply the rule to your webpack.config.js in order handle audio files by webpack

    module: {
        rules: [
            {
                test: /\.mp3$/,
        loader: 'file-loader',
                exclude: /node_modules(?!\/foundation-sites)|bower_components/,
                options: {
                name: '[path][name].[ext]'
            }
            }
        ]
    }


text:
Q: Camel testing - java.lang.IllegalArgumentException: defaultEndpoint must be specified I am trying to create testcases for my camel route using http://camel.apache.org/mock.html . I need to verify the the processors in the route. But the simple test is not working for me.
public class CamelRouteTest  extends CamelTestSupport {

  @Override
  public String isMockEndpointsAndSkip() {
    // override this method and return the pattern for which endpoints to mock,
    // and skip sending to the original endpoint.
    return "mock:result";
  }

  @Test
  public void verifyMessageCount() throws Exception {
    template.sendBody("Test");
    getMockEndpoint("mock:result").expectedMessageCount(1);
    assertMockEndpointsSatisfied();
  }

  @Override
  protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("direct:start").to("mock:result");
        }
    };
  }
}

Stacktrace:
java.lang.IllegalArgumentException: defaultEndpoint must be specified
    at org.apache.camel.util.ObjectHelper.notNull(ObjectHelper.java:308)
    at org.apache.camel.impl.DefaultProducerTemplate.getMandatoryDefaultEndpoint(DefaultProducerTemplate.java:506)
    at org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:370)

A: The template.sendBody("Test") try to send Test to the default endpoint. As in your code this is not configured it fails.
You could:

*

*specify which endpoint to use
template.sendBody("direct:start", "Test");

*get an endpoint from the context and set it as the default endpoint
Endpoint endpoint = context.getEndpoint("direct:start");
template.setDefaultEndpoint(endpoint);
template.sendBody("Test");


text:
Q: Redirecting RDP (port 3389) with iptables I have a Debian server with an IP 10.10.10.5 and a Windows computer with an IP 10.10.10.7. My plan is to make the Debian server forward all RDP traffic to the Windows computer with these iptables rules:
iptables -t nat -A PREROUTING -p tcp --dport 3389 -j DNAT --to-destination 10.10.10.7:3389
iptables -A FORWARD -p tcp --dport 3389 -j ACCEPT

But for some reason it does not work. I have set IPv4 forwarding to "1".
When I connect directly to the Windows computer from LAN it establishes the RDP connection, but doesn't work through the server. Nmap of 10.10.10.5 returns "filtered" for 3389, but nmap of 10.10.10.7 returns "open". What could be the problem?

A: As it seems that all machines are on the same subnet, the Windows computer will try to answer directly to the client without passing through the NAT box (layer 2).
You should SNAT reply packets also, adding :
iptables -t nat -A POSTROUTING -s 10.10.10.7 -p tcp --sport 3389 -j SNAT --to 10.10.10.5

A: In addition to SNAT, a MASQUERADE should also do and will make it a little easier. MASQUERADE is SNAT except instead of specifying an IP address you are specifying an interface; this means that you won't need to add POSTROUTING rules if for example you add more port forwards.
iptables -t nat -A POSTROUTING -o $out_interface -j MASQUERADE

In theory there shouldn't be any practical or performance difference except that the kernel needs to keep track of SNAT and it doesn't of MASQUERADE.


text:
Q: Apache2 + Ubuntu + Mono: Issue with System.Web.ActiveDirectoryProvider Apache2 + Ubuntu + Mono: Issue with System.Web.ActiveDirectoryProvider
When my web application trys to use Active Directory Authentication I get the following: Web Page Error
When I look at the logs under /var/log/apache2/error.log I have this:
[Fri Jan 27 10:14:31.160499 2017] [mpm_event:notice] [pid 17187:tid 140082060339072] AH00491: caught SIGTERM, shutting down
mod-mono-server received a shutdown message
Invalid type System.Net.Http.Formatting.MediaTypeFormatter for instance field System.Net.Http.Formatting.MediaTypeFormatterMatch:<Formatter>k__BackingField
Invalid type System.Web.Http.Controllers.HttpActionContext for instance field System.Web.Http.Filters.HttpActionExecutedContext:_actionContext
Invalid type System.Web.Http.Controllers.HttpActionDescriptor for instance field System.Web.Http.Controllers.HttpParameterDescriptor:_actionDescriptor
Invalid type System.Web.Http.Controllers.HttpActionContext for instance field System.Web.Http.Validation.ModelValidatedEventArgs:<ActionContext>k__BackingField
Invalid type System.Web.Http.Controllers.HttpActionContext for instance field System.Web.Http.Validation.ModelValidatingEventArgs:<ActionContext>k__BackingField
[Fri Jan 27 10:14:33.263821 2017] [so:warn] [pid 17361] AH01574: module mono_module is already loaded, skipping
[Fri Jan 27 10:14:33.268918 2017] [:error] [pid 17366:tid 140510323828608] Failed running '/usr/bin/mod-mono-server2 --filename /tmp/mod_mono_server_global --nonstop --master (null) (null) (null) (null) (null) (null) (null) (null)'. Reason: No such file or directory
[Fri Jan 27 10:14:33.272467 2017] [:error] [pid 17370:tid 140510323828608] Failed running '/usr/bin/mod-mono-server2 --filename /tmp/mod_mono_server_global --nonstop --master (null) (null) (null) (null) (null) (null) (null) (null)'. Reason: No such file or directory
[Fri Jan 27 10:14:33.273501 2017] [:error] [pid 17362:tid 140510323828608] Not running mod-mono-server.exe because no MonoApplications, MonoApplicationsConfigFile or MonoApplicationConfigDir specified.
[Fri Jan 27 10:14:33.274003 2017] [mpm_event:notice] [pid 17362:tid 140510323828608] AH00489: Apache/2.4.18 (Ubuntu) mod_mono/3.12 configured -- resuming normal operations
[Fri Jan 27 10:14:33.274016 2017] [core:notice] [pid 17362:tid 140510323828608] AH00094: Command line: '/usr/sbin/apache2'
Listening on: /tmp/mod_mono_server_beta.medialabstage.com
Root directory: /var/www/beta.medialabstage.com/
root@int-p-pdm1:/home/mladmin#

Any idea what is going on? I have used different DLLs for system.web.dll from .NET package and the windows Mono package.


text: Q: Quick Time screencast slows down my gameplay also size too big I recorded few of the videos in past with quicktime. Size of those videos is too big  (~5GB). I have a macbook pro 15-inch retina version. For cutting down the size I am using HandBrake. With that a 2 GB video would come up to 45MB but then video resolution goes really down. Is there any other recording software that can record videos at relatively smaller size?


text:
Q: Object of type 'TYPE' is not JSON serializable Django I'm using ReactJS and Graphql as frontend and django and graphene as backend.
In django I have code as follows:
company = Company.objects.get(pk=input.company.id)
###### Result is <Company: Company object (14)>
UserByManagerCreated.delay(company=company)

And in UserByManagerCreated I have :
@task
def UserByManagerCreated(company):
    #Send emails, ....
    pass

But I'm getting an error Object of type 'Company' is not JSON serializable
Any idea?

A: You can't send it to a celery task because it should be serializable, because the delayed task is stored in a queue (Redis or Rabbit) and it should be serializable. So you can pass all serializable types as arguments to a celery task.
What I suggest is to pass those values that you need to use in the task. Not the company itself, but only values you need. Or you can put them into a dictionaty and pass it instead.
   company = Company.objects.get(pk=input.company.id)
   company_data = {'id': company.id, 'your_field': company.your_field}
   UserByManagerCreated.delay(company=company_data)

And as AKX advised you can pass only id and retrieve your company right in the task. But if it's a sending mail task I think you can send only needed emails list as argument to be sent an email there.


text:
Q: Wifi Killer Wireless doesn't work P34G I cant make my wifi connection to work in xubuntu 14.04.
It cant even detect my wifi adapter.
More info:

*

*Laptop: Gigabyte P34G v5(skylake)

*Wifi: Killer Wireless

*OS: Xubuntu

*Kernel: 4.5

Any help would be great.
lspci -nnk | grep 0280 -A2:
04:00.0 Network controller [0280]: Qualcomm Atheros QCA6174 802.11ac Wireless Network Adapter [168c:003e] (rev 32)
    Subsystem: Bigfoot Networks, Inc. Device [1a56:1535]
    Kernel driver in use: ath10k_pci

dmesg | grep ath after installing the firmware:
[    1.906421] ath10k_pci 0000:04:00.0: enabling device (0000 -> 0002)
[    1.908195] ath10k_pci 0000:04:00.0: pci irq msi-x interrupts 8 irq_mode 0 reset_mode 0
[    2.153143] ath10k_pci 0000:04:00.0: Direct firmware load for ath10k/cal-pci-0000:04:00.0.bin failed with error -2
[    2.155968] ath10k_pci 0000:04:00.0: Direct firmware load for ath10k/QCA6174/hw3.0/firmware-5.bin failed with error -2
[    2.155972] ath10k_pci 0000:04:00.0: could not fetch firmware file 'ath10k/QCA6174/hw3.0/firmware-5.bin': -2
[    2.158712] ath10k_pci 0000:04:00.0: qca6174 hw3.2 target 0x05030000 chip_id 0x00340aff sub 1a56:1535
[    2.158714] ath10k_pci 0000:04:00.0: kconfig debug 0 debugfs 1 tracing 1 dfs 0 testmode 0
[    2.159174] ath10k_pci 0000:04:00.0: firmware ver WLAN.RM.2.0-00180-QCARMSWPZ-1 api 4 features wowlan,ignore-otp,no-4addr-pad crc32 75dee6c5
[    2.221246] ath10k_pci 0000:04:00.0: Direct firmware load for ath10k/QCA6174/hw3.0/board-2.bin failed with error -2
[    2.221482] ath10k_pci 0000:04:00.0: board_file api 1 bmi_id N/A crc32 ed5f849a
[    3.268382] Modules linked in: snd_hda_codec_hdmi cmac uvcvideo videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 videobuf2_core videodev hid_generic media usbhid btusb btrtl snd_hda_codec_realtek snd_hda_codec_generic snd_hda_intel snd_hda_codec snd_hda_core snd_hwdep mxm_wmi sparse_keymap joydev snd_pcm intel_rapl x86_pkg_temp_thermal rfcomm intel_powerclamp bnep snd_seq_midi coretemp snd_seq_midi_event snd_rawmidi kvm_intel snd_seq i915 kvm ath10k_pci irqbypass ath10k_core crct10dif_pclmul crc32_pclmul ath ghash_clmulni_intel drm_kms_helper snd_seq_device mac80211 drm aesni_intel aes_x86_64 lrw gf128mul glue_helper ablk_helper snd_timer cryptd snd rtsx_pci_ms input_leds i2c_algo_bit serio_raw soundcore memstick fb_sys_fops cfg80211 syscopyarea sysfillrect sysimgblt mei_me mei shpchp hci_uart btbcm btqca btintel bluetooth i2c_hid wmi video pinctrl_sunrisepoint pinctrl_intel hid intel_lpss_acpi acpi_als intel_lpss kfifo_buf industrialio acpi_pad mac_hid nls_iso8859_1 parport_pc ppdev lp parport uas usb_storage rtsx_pci_sdmmc psmouse ahci r8169 rtsx_pci libahci mii fjes
[    3.268401]  [<ffffffff81080e72>] warn_slowpath_common+0x82/0xc0
[    3.268402]  [<ffffffff81080f0c>] warn_slowpath_fmt+0x5c/0x80
[    4.340813] ath10k_pci 0000:04:00.0: htt-ver 3.26 wmi-op 4 htt-op 3 cal otp max-sta 32 raw 0 hwcrypto 1
[    7.340669] ath10k_pci 0000:04:00.0: could not suspend target (-11)
[    7.408216] ath: EEPROM regdomain: 0x6c
[    7.408218] ath: EEPROM indicates we should expect a direct regpair map
[    7.408220] ath: Country alpha2 being used: 00
[    7.408220] ath: Regpair used: 0x6c

A: You lack the needed firmware file to enable your card and driver to work properly. Please download this file on another computer and transfer it to the Ubuntu computer on a USB key or similar: http://mirrors.kernel.org/ubuntu/pool/main/l/linux-firmware/linux-firmware_1.157_all.deb
Drag and drop it to the desktop of the Ubuntu computer. Install it from the terminal with:
cd ~/Desktop
sudo dpkg -i linux*.deb

Reboot. Your wireless should be working. If not, please show us:
dmesg | grep ath

It appears that the firmware you installed is ineffective. Please try:
sudo rm /lib/firmware/ath10k/QCA6174/hw3.0/* 2> /dev/null
sudo wget -O /lib/firmware/ath10k/QCA6174/hw3.0/board.bin https://github.com/kvalo/ath10k-firmware/blob/master/QCA6174/hw3.0/board.bin?raw=true
sudo wget -O /lib/firmware/ath10k/QCA6174/hw3.0/board-2.bin https://github.com/kvalo/ath10k-firmware/blob/master/QCA6174/hw3.0/board-2.bin?raw=true
sudo wget -O /lib/firmware/ath10k/QCA6174/hw3.0/firmware-4.bin https://github.com/kvalo/ath10k-firmware/blob/master/QCA6174/hw3.0/firmware-4.bin_WLAN.RM.2.0-00180-QCARMSWPZ-1?raw=true

Reboot. Your wireless should be working. If not, please show us:
dmesg | grep ath

Reference: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1520343
Please try:
cd /lib/firmware/ath10k/QCA6174/hw3.0/
mv board.bin  board.bin.bak

Reboot and show us:
dmesg | grep ath

Let's try a further step:
cd /lib/firmware/ath10k/QCA6174/hw3.0/
mv board-2.bin  board.bin

Reboot and let us see:
dmesg | grep ath

A: I end up using file from killer website itself:
http://www.killernetworking.com/support/knowledge-base/17-linux/20-killer-wireless-ac-in-linux-ubuntu-debian
And follow "Steps to install ath10k Driver:"
Reboot.
My wifi works now.
Thank you for all help.


text:
Q: Native Ad API in Microsoft Advertising SDK for UWP not returning valid data in test mode I'm using the Microsoft Advertising SDK for UWP: https://marketplace.visualstudio.com/items?itemName=AdMediator.MicrosoftAdvertisingSDK and want to add native ads to my App
Here is code that demonstrates the issue:
auto NativeAdManager = ref new Microsoft::Advertising::WinRT::UI::NativeAdsManager("d25517cb-12d4-4699-8bdc-52040c712cab", "10043134");
NativeAdManager->AdReady += ref new Windows::Foundation::EventHandler<Platform::Object^>([](Platform::Object ^ s, Platform::Object ^ ad)
    {
        Platform::String^ Title = static_cast<Microsoft::Advertising::WinRT::UI::NativeAd^>(ad)->Title;
        Platform::String^ desc = static_cast<Microsoft::Advertising::WinRT::UI::NativeAd^>(ad)->Description;
        __debugbreak();
    });
NativeAdManager->ErrorOccurred += ref new Windows::Foundation::EventHandler<Microsoft::Advertising::WinRT::UI::AdErrorEventArgs^>([](Platform::Object^ sender, Microsoft::Advertising::WinRT::UI::AdErrorEventArgs^ e) {
        auto x = e->ErrorMessage;
        __debugbreak();
    });
    NativeAdManager->RequestAd();

Once RequestAd() get's called, the AdReady event handler run, as expected, but the problem is the ad data is nonsense. For example Title is nullptr, Description is an invalid String handle, AdIcon is an invalid image class, etc. The ErrorOccurred event never fires. There's also some weird output in Visual Studio's debug output window:
 info:get_AppId() invoked.  [Windows::ApplicationModel::Store::CurrentAppFactory::get_AppId]
The thread 0x3ce0 has exited with code 0 (0x0).
ERROR:ChkHr(spStoreCommerce->Initialize(HStringReference(wszCV).Get())) (0x803f6107)    [Windows::ApplicationModel::Store::CurrentAppFactory::GetStoreCommerce]
ERROR:ChkHr(GetStoreCommerce(&spStoreCommerce)) (0x803f6107)    [Windows::ApplicationModel::Store::CurrentAppFactory::get_AppId]
 info:GetAppReceiptAsync() invoked. [Windows::ApplicationModel::Store::CurrentAppFactory::GetAppReceiptAsync]
ERROR:ChkHr(spStoreCommerce->Initialize(HStringReference(wszCV).Get())) (0x803f6107)    [Windows::ApplicationModel::Store::CurrentAppFactory::GetStoreCommerce]
ERROR:ChkHr(GetStoreCommerce(&spStoreCommerce)) (0x803f6107)    [Windows::ApplicationModel::Store::CurrentAppFactory::GetAppReceiptAsync]
WLID Error: 80860003Exception thrown at 0x00007FFA59024008 in Advertising.exe: Microsoft C++ exception: Concurrency::task_canceled at memory location 0x00000064AFDFF228.

What am I doing wrong?


text:
Q: How to pass arguments from wrapper shell script to Java application? I want to run Java programs I am creating at on the command line (linux and mac).  I don't want to type "java" and arguments all the time, so I am thinking about creating wrapper scripts.  What's the best way to do this so that they work everywhere?  I want to be able to pass arguments, too.  I was thinking of using "shift" to do this (removing first argument).
Is there a better way to do this without using scripts at all?  Perhaps make an executable that doesn't require invocation through the "java" command?

A: You can create a shell script that accepts arguments. In your shell script, it will look something like this:-
java YourApp $1 $2

In this case, YourApp accepts two arguments. If your shell script is called app.sh, you can execute it like this:-
./app.sh FirstArgument SecondArgument

A: Assuming that you are using a shell that is compatible with the Bourne shell; e.g. sh, bash, ksh, etc, the following wrapper will pass all command line arguments to the java command:
#!/bin/sh
OPTS=...
java $OPTS com.example.YourApp "$@"

The $@ expands to the remaining arguments for the shell script, and putting quotes around it causes the arguments to be individually quoted, so that the following will pass a single argument to Java:
$ wrapper "/home/person/Stupid Directory Name/foo.txt"

Without the double quotes around "$@" in the wrapper script, Java would receive three arguments for the above.

Note that this does not work with "$*".  According to the bash manual entry:

"$*" is equivalent to "$1c$2c...", where c
                is the first character of the value of the IFS variable.

In other words, all shell arguments would be concatenated into a single command argument for your Java application, ignoring the original word boundaries.
Refer to the bash or sh manual ... or the POSIX shell spec ... for more information on how the shell handles quoting.


text:
Q: Behavior of difference of prime numbers when $n$ approaches infinity The following question is part of a question I had to solve for my masters exam.

Consider $S=\{s_n =p_{n+1}- p_n \mid n \in \mathbb{N}\}$. Prove that sup $S=\infty$.

Intutively I guessed it and Tried using prime number theorem and L Hopital rule but it comes out to be very lenghty and still indeterminant.
So, I am looking for altenative rigorious method.
Kindly tell how to prove it.
Thanks!!


text:
Q: SQL Server : delete trigger not working Below is table Country:
+------------------+-----------+
|   COLUMN_NAME    | DATA_TYPE |
+------------------+-----------+
| ID               | int       |
| Name             | varchar   |
| CapitalCity      | varchar   |
| Population       | int       |
| OfficialReligion | varchar   |
| OfficialLanguage | varchar   |
| DateEntered      | datetime  |
+------------------+-----------+

I then have another very similar table called CountryRecord which has the same columns and then two additional new ones:
+-------------------------+-----------+
|   COLUMN_NAME           | DATA_TYPE |
+-------------------------+-----------+
| ID                      | int       |
| OriginalID              | int       |
| Name                    | varchar   |
| CapitalCity             | varchar   |
| Population              | int       |
| OfficialReligion        | varchar   |
| OfficialLanguage        | varchar   |
| DateEntered             | datetime  |
| QueryType               | varchar   |
+-------------------------+-----------+

When inserting, updating or deleting data in Country, a trigger is called that will also insert rows into CountryRecord for the purpose of recording what query was made for what row of data. The trigger is as follows:
ALTER TRIGGER [dbo].[CountryRecord_Trigger]
ON [dbo].[Country]
AFTER UPDATE, INSERT, DELETE
AS
    DECLARE @CountryID INT, @queryType VARCHAR(20);

    --Update trigger
    IF EXISTS (SELECT * FROM inserted) AND EXISTS (SELECT * FROM deleted)
    BEGIN
        SET @queryType = 'UPDATE';

        SELECT @CountryID = ID FROM inserted i;

        INSERT INTO CountryRecord (OriginalID, Name, CapitalCity, Population, OfficialReligion, OfficialLanguage, DateEntered, QueryType)
            SELECT
                ID, Name, CapitalCity, Population, OfficialReligion,
                OfficialLanguage, DateEntered, @queryType
            FROM
                Country
            WHERE
                @CountryID = ID;
    END

    --Insert trigger
    IF EXISTS (SELECT * FROM inserted) AND NOT EXISTS (SELECT * FROM deleted)
    BEGIN
        SET @queryType = 'INSERT';

        SELECT @CountryID = ID FROM inserted i;

        INSERT INTO CountryRecord (OriginalID, Name, CapitalCity, Population, OfficialReligion, OfficialLanguage, DateEntered, QueryType)
            SELECT
                ID, Name, CapitalCity, Population, OfficialReligion,
                OfficialLanguage, DateEntered, @queryType
            FROM
                Country
            WHERE
                @CountryID = ID;
     END

     --Delete trigger
     IF NOT EXISTS (SELECT * FROM inserted) AND EXISTS (SELECT * FROM deleted)
     BEGIN
         SET @queryType = 'DELETE';

         SELECT @CountryID = ID FROM deleted d;

         INSERT INTO CountryRecord (OriginalID, Name, CapitalCity, Population, OfficialReligion, OfficialLanguage, DateEntered, QueryType)
             SELECT
                 ID, Name, CapitalCity, Population, OfficialReligion,
                 OfficialLanguage, DateEntered, @queryType
             FROM
                 Country
             WHERE
                 @CountryID = ID;
     END

However, while the Insert and Update triggers work, the Delete trigger does not. When I run a delete query, I pick only one row, so I'm fairly sure that the delete query is not selecting more than one row (instead, seems like it's selecting nothing, since doing a check of the current identity of CountryRecord after running the delete query shows it hasn't increased by one).
Update: Changing the delete trigger to use ELSE instead of meeting the condition set does not fix the issue. Instead, any update queries will call both the update and delete trigger, while delete queries still have no effect.
Update 2: Just to check that I was only affecting one row, I added in select queries for each trigger as well as a print of @CountryID - the select queries showed only 1 row, while @CountryID did not come up as null/blank. I also tried altering the columns thinking if the NOT NULL constraint had any effect, but it didn't.
Update 3: I have got Delete working now, although it only works for single row deletes. Multi row deletes do not work properly - if for example I delete two records, only one row goes into the audit table. I have also updated Insert and Update to use a similar code structure, so they also have the same multi row issue. Code snippet for the delete portion:
SET @queryType = 'DELETE';
SELECT CountryID = ID FROM deleted;
INSERT INTO CountryRecord (OriginalID, Name, CapitalCity, Population, OfficialReligion, OfficialLanguage, DateEntered, QueryType)
    SELECT ID, Name, CapitalCity, Population, OfficialReligion, OfficialLanguage, DateEntered, @queryType FROM deleted WHERE @CountryID = ID;
DECLARE @auditID int;
SET @auditID = SCOPE_IDENTITY();
UPDATE CountryRecord SET QueryType = @queryType WHERE ID = @auditID;

A: The reason your delete doesn't work is because the record has already been deleted from the country table. So you can't select it out of there.
You need to get it from the deleted table instead.
Your other two queries also refer to the Country tables in a trigger which is a bad idea. You shouldn't use the source table in your query - you should use inserted and deleted instead.
Have a think about how you could write one query from the inserted and deleted tables that does everything that you want, in one query, no matter how many records are in inserted and deleted. If you don't abandon this question (it happens a lot), I will add an example to this answer.
Here is a query that saves your inserts and updates in one go:
INSERT INTO CountryRecord (
 Name,
 CapitalCity,
 Population,
 OfficialReligion,
 OfficialLanguage,
 DateEntered,
 QueryType)
SELECT
 I.Name,
 I.CapitalCity,
 I.Population,
 I.OfficialReligion,
 I.OfficialLanguage,
 GETDATE() As DateEntered,
 CASE
   WHEN EXISTS(SELECT * FROM DELETED D WHERE D.ID = I.ID)
   THEN 'U' ELSE 'I'
 END As QueryType
 FROM INSERTED I

I have left out OriginalID because people you should not be updating the primary key and besides, its impossible to work out what was updated in this case. You can only do that in a BEFORE trigger
Here's one that captures your deletes. I've done these separately so they are easier to understand, and will probably perform better for large recordsets
INSERT INTO CountryRecord (
 Name,
 CapitalCity,
 Population,
 OfficialReligion,
 OfficialLanguage,
 DateEntered,
 QueryType)
SELECT
 D.Name,
 D.CapitalCity,
 D.Population,
 D.OfficialReligion,
 D.OfficialLanguage,
 GETDATE() As DateEntered,
 'D' As QueryType
 FROM DELETED D
 WHERE NOT EXISTS (SELECT * FROM INSERTED I WHERE I.ID = D.ID)

These will work regardless of how many rows have been altered
If you want to actually check which columns changed in an update, you can again compare them individually in the select statement, or you can use the UPDATED() function
Is this a school question? Because triggers are really a last resort, but people insist on teaching them in school still even though they are mostly irrelevant.
What is relevant is the set based solution I have posted here


text:
Q: How to access Label inside DataList which is inside another DataList There are 2 DataList DataList2 and DataList3
DataList2 has DataList3 and a Button and lblOrderID
DataList3 has lblQuantity
On Click of Button value of lblQuantity should be assigned to qty
When i debug this code it shows qty is null?
Error : Object reference not set to an instance of an object.

protected void bremove_Click(object sender, EventArgs e)
{
    Button remove = (Button)sender;
    DataListItem row = remove.NamingContainer as DataListItem;
    DataList dat = (DataList)row.FindControl("DataList3");
    Label qty = (Label)dat.FindControl("lblQuantity");
    Label id = (Label)row.FindControl("lblOrderID");
    string oid = id.Text;
    string oqty = qty.Text;
    sqlqueries.UpdateOrder(oid, oqty);
    int k = sqlqueries.CancelOrder(oid);
    if (k != 0)
    {
        Response.Redirect(Request.RawUrl);
    }
}

A: The problem is in this line:
Label qty = (Label)dat.FindControl("lblQuantity");

Although you use an individual DataListItem to find the nested DataList (with the NamingContainer), you then proceed to find a Label in DataList3 itself, not an Item in DataList3.
It should be
Label qty = (Label)dat.Items[row.ItemIndex].FindControl("lblQuantity");


text:
Q: Probability and the expected number with and without replacement from the box In a box, 3 red balls and 4 black balls.

A ball is drawn at random with
replacement until a red ball is observed.

With geometric distribution,
I tried to use it, still cannot find the expected number of balls drawn and the probability that more than two balls are drawn.

3 balls are drawn at random **without**
replacement until a black ball is drawn.

With geometric distribution,
I tried to use it, also still cannot find the expected number of black balls drawn

Can anyone solve them? I know it may be an easy question for you, but for the beginner, it is hard to clear the concept.

A: If we have a constant probablity of succeeding on each trail $p$ then the expected number of trails until success is $\frac{1}{p}$. In your first case the probability of pulling a red ball is $\frac{3}{7}$ and so the expected number of pulls until a red is $\frac{7}{3} = 2.333$
In the second case your question is ill defined. It is possible in $3$ draws to still have not seen a black ball so the idea of "3 balls are drawn at random without replacement until a black ball is observed." doesn't make sense. Maybe you mean $4$ balls?


text:
Q: Facebook login page showing blank page in IOS 9 I am using FBSDKCoreKit (4.12.0) FBSDKLoginKit (4.12.0)
first i am getting screen 1
This method is block is never called .
FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];
[login logInWithReadPermissions:@[@"email",@"public_profile"] fromViewController:self handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) {
    //never called
}];

getting this warning
 Warning: Attempt to present <FBSDKContainerViewController: 0x16570810> on <ViewController: 0x16528870> whose view is not in the window hierarchy!

Then i press ok button i am getting blank page without moving to any other page

Plist file i used is
For Transpost security
    <key>NSAppTransportSecurity</key>
        <dict>
            <key>NSAllowsArbitraryLoads</key>
            <true/>
            <key>NSExceptionDomains</key>
            <dict>
                <key>facebook.com</key>
                <dict>
                    <key>NSExceptionRequiresForwardSecrecy</key>
                    <false/>
                    <key>NSIncludesSubdomains</key>
                    <true/>
                </dict>
                <key>fbcdn.net</key>
                <dict>
                    <key>NSExceptionRequiresForwardSecrecy</key>
                    <false/>
                    <key>NSIncludesSubdomains</key>
                    <true/>
                </dict>
            </dict>
        </dict>

Query schems

    <key>LSApplicationQueriesSchemes</key>
        <array>
            <string>fbauth</string>
            <string>fbapi</string>
            <string>fb-messenger-api</string>
            <string>fbauth2</string>
            <string>fbshareextension</string>
            <string>fbapi20130214</string>
            <string>fbapi20130410</string>
            <string>fbapi20130702</string>
            <string>fbapi20131010</string>
            <string>fbapi20131219</string>
            <string>fbapi20131219</string>
            <string>fbapi20140410</string>
            <string>fbapi20140116</string>
            <string>fbapi20150313</string>
            <string>fbapi20150629</string>
            <string>fb-messenger-api20140430</string>
        </array>
        <key>CFBundleURLTypes</key>
        <array>
            <dict>
                <key>CFBundleURLSchemes</key>
                <array>
                    <string>fb268237443567174</string>
                </array>
            </dict>
        </array>
        <key>FacebookAppID</key>
        <string>268237443567174</string>
        <key>FacebookDisplayName</key>
        <string>MyAPP</string>

A: How i found solution for the above problem is
1)Earlier i have created a button and given FBLoginButton class and in action i wrote like
FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];
[login logInWithReadPermissions:@[@"email",@"public_profile"] fromViewController:self handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) {
    //never called
}];

Modification for solution: Removed the FBLoginButton class and put only UIButton
2)Use both ios 8 and ios 9 methods like below written in AppDelegate.
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString*, id> *)options {
    return [[FBSDKApplicationDelegate sharedInstance] application:app
                                                          openURL:url
                                                sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]
                                                       annotation:options[UIApplicationOpenURLOptionsAnnotationKey]];
}

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{

    return [[FBSDKApplicationDelegate sharedInstance] application:application
                                                          openURL:url
                                                sourceApplication:sourceApplication
                                                       annotation:annotation
            ];
}

A: I used did code to sign in Fabook, both work fine on iOS 8 and 9. Hope this helps you.
[[[FBSDKGraphRequest alloc] initWithGraphPath:@"me" parameters:@{@"fields": @"email,name,first_name,last_name"}] startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
        if (!error) {
           //Login success and callback here
        } else {
           //Login failed
        }
    }];


text:
Q: Unable to use PySpark with oozie I'm currently trying to trigger and schedule some PySpark jobs using Oozie. My cluster is using HDP 2.6 with Ambari.
I created my Workflow with SparkAction, but when try to run, I got the following error:
 Failing Oozie Launcher, Main class [org.apache.oozie.action.hadoop.SparkMain], main() threw exception, org/apache/spark/deploy/SparkSubmit
java.lang.NoClassDefFoundError: org/apache/spark/deploy/SparkSubmit
    at org.apache.oozie.action.hadoop.SparkMain.run(SparkMain.java:222)
    at org.apache.oozie.action.hadoop.LauncherMain.run(LauncherMain.java:58)
    at org.apache.oozie.action.hadoop.SparkMain.main(SparkMain.java:62)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.oozie.action.hadoop.LauncherMapper.map(LauncherMapper.java:237)
    at org.apache.hadoop.mapred.MapRunner.run(MapRunner.java:54)
    at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:453)
    at org.apache.hadoop.mapred.MapTask.run(MapTask.java:343)
    at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:170)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:422)
    at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1866)
    at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:164)
Caused by: java.lang.ClassNotFoundException: org.apache.spark.deploy.SparkSubmit
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 16 more

workflow.xml:
<workflow-app name="PySpark" xmlns="uri:oozie:workflow:0.5"> <global>
 <configuration>
    <property>
        <name>oozie.launcher.yarn.app.mapreduce.am.env</name>
        <value>PYSPARK_ARCHIVES_PATH=pyspark.zip</value>
     </property>
 </configuration> </global>
 <start to="spark-846b"/>
 <kill name="Kill">
     <message>Action failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
 </kill>
 <action name="spark-846b">
     <spark xmlns="uri:oozie:spark-action:0.1">
         <job-tracker>${jobTracker}</job-tracker>
         <name-node>${nameNode}</name-node>
         <master>${master}</master>
         <name>MyApp</name>
         <jar>${nameNode}/analysis/000001/oozie/dummy.py</jar>
         <spark-opts>--conf spark.driver.extraJavaOptions=-Dhdp.version=2.6.1.0-129 --conf spark.yarn.archive=hdfs://hadoop1.hadoopcwb:8020/hdp/apps/2.6.1.0-129/spark2/spark2-hdp-yarn-archive.tar.gz --py-files pyspark.zip,py4j-0.10.4-src.zip</spark-opts>
     </spark>
     <ok to="End"/>
     <error to="Kill"/>
 </action>
 <end name="End"/>
</workflow-app>

job.properties:
nameNode=hdfs://hadoop1.hadoopcwb:8020
jobTracker=hadoop1.hadoopcwb:8032
master=yarn-cluster
queueName=default
oozie.use.system.libpath=true
oozie.wf.application.path=${nameNode}/analysis/000001/oozie

job python
from pyspark import SparkConf, SparkContext
from operator import add

def main():
    conf = SparkConf().setAppName("MyApp")
    sc = SparkContext(conf=conf)
if __name__ == '__main__':
    main()


text:
Q: change permission to read write and execute How do I change the following folder shown below "manage" to read write and execute permission? What should I do?
drwxr-xr-x 2 root root 4096 May 22 08:15 /var/lib/iHRIS/sites/manage

I used the ls -ld to view the permission rights of the folder.

A: Run sudo chmod a+rwx /var/lib/iHRIS/sites/manage to give read, write and execute to all who wants to access it.
Note: a=All (u=User, g=Group) and rwx is Read, Write and eXecute. + means add permission, - means remove permission.


text:
Q: Regular expression find and replace terms in mysql I have to replace over 12000 image links that are ending with .gif with different .gif links.
For example 22_448_7.gif, 342_448_7.gif and I want to replace everything that's after
/wp-content/uploads/2015/09/86_448_7.gif
with
/wp-content/uploads/2015/09/image.gif

A: Switch to Plan B:  Replace them in your application code, not SQL.


text:
Q: How do you find dependencies when installing software? In software installation tutorials, they always have a long list of dependencies. How do they find those dependencies?
For example, I'm starting on a fresh Ubuntu server, following directions to install rvm. They provide something like:
sudo apt-get install git-core libreadline5 libncurses5-dev libreadline5-dev build-essential zlib1g-dev libssl-dev libpcre3-dev libxml2-dev libxslt-dev;

I just want to understand how they find all of those dependencies. Copy and pasting works, but I think it's more important to understand it.

A: Each package comes with a list of its own dependencies. For debs, which Ubuntu uses, you can do:-
[andys@daedalus ~]$ apt-cache depends git-core
git-core
  Depends: git

The dependencies for a package are specified when the package is built. Some of them are specified manually by the package maintainer (the person who's responsible for building the package), and some are automatically determined when the package is built. If you download a Debian source package, and look in the debian/control file, you'll see a number of lines like Depends:, Conflicts:, Replaces:, etc.
So, back to the example - git-core depends on only one package, which is git. git is probably a metapackage of some sort, which in turn has a whole raft of dependencies, to make sure all the packages neccessary to run git are installed - not just to satisfy the dependencies of one package. If we look at the git package:-
[andys@daedalus ~]$ apt-cache depends git
git
  Depends: libc6
  Depends: libcurl3-gnutls
  <...snip...>
  Suggests: git-cvs
  Suggests: git-svn
  Suggests: git-email
  <...snip...>
  Recommends: rsync
  <...snip...>
  Conflicts: git-core
  <...snip...>
  Breaks: stgit
  Breaks: stgit-contrib
  Replaces: <cogito>
  Replaces: git-core

...you'll see that git itself has further dependencies. To complicate things further, there's different kinds of dependency other than just requiring another package to be installed...

*

*Conflicts - this package conflicts with another package, and you probably won't be able to install the conflicting package without uninstalling this one, and vice versa. In this case, git conflicts with git-core. On my box here, the git-core package is marked as obsolete, which is probably why this is listed here.

*Breaks - this package breaks another package, and installing it - although perhaps not requiring you to uninstall the package that will be broken - will cause problems with the software installed by that package. Again, looking at our example, the stgit and stgit-contrib packages will be considered broken once git is installed.

*Replaces - this package replaces another package, meaning that the other package is obsolete and can probably be uninstalled. The git-core package shows up again here.

There are also 'soft' dependency types, such as Recommends and Suggests, which aren't required by the package you're installing, but are recommended or suggested, as the name suggests. Once again, looking at the example, the suggested and recommended packages are add-ons to git, or tools not directly related that will make using it easier.
Putting all this together, the package manager you use will start off with the package (or packages) you've asked it to install, and will look up the dependencies for it, and then any dependencies for those packages, and so on. It will also check for packages which conflict, break or replace the requested packages or their dependencies. Once it's happy that it's found a way it can satisfy your original request, it'll then go ahead with the install.
Different package managers have different ways of doing this dependency resolution. apt-get, aptitude and dselect, for example, all essentially do the same thing but the way they make their decision differs. You may find that aptitude and dselect will happily present you with a way to install a package whereas apt-get can't.
If you're interested in knowing more about Debian packages, have a look at the Debian New Maintainers' Guide, which goes over some of the guts of debs.

A: usually apt will do that for you. if you try to install a binary package that has unmet dependencies, apt will tell you which ones are missing and ask you for permission to install them as well.
most source distributions tell you in a README file what the -dev dependencies are.


text:
Q: CSS border not bind I'm trying to make the following menu bar

And the truth is that my result is as follows:

My main problem is I do not know how to make the side edge reaches the top of the layer, the CSS and HTML code I am using is as follows:
HTML

         Iniciar Sesión

CSS
.actions a:before{
content: "";
float: left;
width: 20px;
height: 19px;
margin: 0 5px 0 0;
background: url(../img/menu.png);
}

.history a:hover:before,
.history a:focus:before,
.history a:active:before {
    background-position: 40px -22px;
    }

.history a:before { background-position: 40px 0; }

.notifications a:hover:before,
.notifications a:focus:before,
.notifications a:active:before {
    background-position: 0 -22px;
    }

.notifications a:before { background-position: 0 0; }

.like a:hover:before,
.like a:focus:before,
.like a:active:before {
    background-position: 20px -22px;
    }

.like a:before { background-position: 20px 0; }

#header{
    border-bottom: 1px solid #999;
}

nav{
    padding-top: 10px;
}

nav li{
    list-style: none;
    display: inline;
}

li{
    border-right: 1px solid #999;
}

thanks for everything!

A: Make the following changes:
nav li {
list-style: none;
display: inline;
float: left;
padding: 10px;
height: 42x; // for 1px difference to the bottom
}

And this if you don't want so empty space to the left:
.row {
margin-left: -60px;
margin-right: -15px;
}


text:
Q: Jquery to toggle elements shows all children I have an html file that is generated from a database. I would like each ul/li section to be independently shown / hidden on click. Example of html.

Demo - Learning Spanish guitar

Demo - Playing techniques

  Demo - Listen to John Williams play and explain

  Demo - Download sheet music

  Demo - Record own playing

  Demo - Perform with tutorclass

Learn the fretboard

The code below shows / hides every sub-item.
$(document).ready(function(){

    $("li.goal-list").click(function(){
        $("li.task-list").toggle(1000);
        return false;
    });

    $("li.task-list").click(function(){
        $("li.resource-list").toggle(1000);
        return false;
    });

});

I believe I need to be more specific in finding the tags. I have tried
$(this).next("li.resource-list").toggle(1000);

$(this).children("li.resource-list").toggle(1000);

$(this).siblings("li.resource-list").toggle(1000);

However, all of these stop the toggle happening at all. Any suggestions please.
Thanks

A: You may use $(this).siblings('ul') to toggle the whole block.
See JSFiddle.

A: .children() doesn't return sub-children, i.e. children of children.
You need to use .find().
$(this).find(".resource-list").toggle(1000) should work.


text:
Q: LINK1104 cannot open boost static library using visual studio 2008 command prompt I'm trying to compile a cpp file which uses static boost libraries. I'm using the visual studio 2008 command prompt as I have not set up a VS project file.
The command I'm using is (run from the folder containing my source code):
cl /EHsc /I "C:\Program Files\boost\boost_1_53_0" Client.cpp
The error is:
LINK: fatal error LNK1104: cannot open file 'libboost_system-vc90-mt-s-1_53.lib'
However, the file 'libboost_system-vc90-mt-s-1_53.lib' can be found in "C:\Program Files\boost\boost_1_53_0\stage\lib" so my understanding is that I've installed boost properly and I'm just failing to link to it?
I've tried including it directly using
cl /EHsc /I"C:\Program Files\boost\boost_1_53_0" /I "C:\Program Files\boost\boost_1_53_0\stage\lib\" Client.cpp
which gives the same error.
I've also tried linking to it directly using /link as follows:
cl /EHsc /I"C:\Program Files\boost\boost_1_53_0" /link "C:\Program Files\boost\boost_1_53_0\stage\lib\libboost_system-vc90-mt-s-1_53.lib" Client.cpp
Which returns a different error:
cl : Command line error D8003 : missing source filename
I seem to be calling the compiler flags wrong? But I can't see where/how.
There is a similar question here,but the solution involves issues with how visual studio/ the project file is set up. Since I don't have a project file, is there an easy solution for the above that I can't see or would I need to set up a project?
Thanks for any help in advance!

A: The linker needs to be told where the library file is located. You were very close with the last command line, but the file name needs to precede the /link option. This should work:

cl /EHsc /I"C:\Program Files\boost\boost_1_53_0" Client.cpp /link "C:\Program Files\boost\boost_1_53_0\stage\lib\libboost_system-vc90-mt-s-1_53.lib"

Also, when linking to multiple libraries in the same directory, it is more concise to use the LIBPATH option to tell the linker where to look for .lib files.

cl /EHsc /I"C:\Program Files\boost\boost_1_53_0" Client.cpp /link "libboost_system-vc90-mt-s-1_53.lib" /LIBPATH:"C:\Program Files\boost\boost_1_53_0\stage\lib\"


text:
Q: What happens to a bounty given to an answer later unaccepted? What happens to a bounty if it's awarded to an accepted answer that is later unaccepted? Will the awarded value be reduced from the owner of that answer?

A: Bounties, once awarded, are not reduced or removed. Only developers can remove already awarded bounties (not even moderators can do this).
The answer being accepted has no influence here; at most the answerer will lose the 15 points that comes with an accept.

A: Bounties can never be rescinded once they've been awarded.  (Well, not by regular users anyway, a mod could remove it if it was used as a part of voting fraud.)  Only the 15 rep from the acceptance would be removed.

A: Nothing, bounty are completely different from reputation given by up/down votes and mark as answered. Here is the cite from the help page:

All bounties are paid for up front and non-refundable under any circumstances.

And if the answer is unmarked as accepted, then the author of the answer will lose 15 points (and acceptor will lose 2 points).


text:
Q: The values stored in the table of ms access are not storing in proper order I have made a project which is based on the Employee management system on the clicking on save button the values of fields Date of joining(doj) and personal name(p_name) are not storing in proper order, the value are showing like->
(doj) showing information of (p_name) and (p_name) showing the information of (doj).
     //   Save Personal Information of Employee Master

                  if(ae.getSource()==pi_save)
                 {
                    try
                    {
                            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

                            Connection con=DriverManager.getConnection
                            ("jdbc:odbc:Driver={Microsoft Access Driver
                             (*.mdb, *.accdb)};DBQ=C:\\Program
                             Files\\Java\\jdk1.7.0\\bin\\payroll.mdb;","","");

                            PreparedStatement psm=con.prepareStatement

                            ("insert into pinfo(eid,p_name,fname,doj,dob,desg,pre_add1,
                             pre_add2,pre_state,pre_pincode,pre_phno,per_add1,
                             per_add2,per_state,per_pincode,per_phno,mobno,sex,dept)
                             values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");

                            String psmd1=eid.getText();
                            String psmd3=name.getText();
                            String psmd2=doj.getText();

                            String psmd4=fname.getText();
                            String psmd5=dob.getText();
                            String psmd6=desg.getText();
                            String psmd7=pre_add1.getText();
                            String psmd8=pre_add2.getText();
                            String psmd9=pre_state.getText();
                            int psmd10=Integer.parseInt(pre_pincode.getText());
                            int psmd11=Integer.parseInt(pre_phno.getText());
                            String psmd12=per_add1.getText();
                            String psmd13=per_add2.getText();
                            String psmd14=per_state.getText();

                            int psmd15=Integer.parseInt(per_pincode.getText());
                            int psmd16=Integer.parseInt(per_phno.getText());
                            int psmd17=Integer.parseInt(mobno.getText());

                            String psmd18=jsex;
                            String psmd19=jdept;

                            psm.setString(1,psmd1);
                            psm.setString(3,psmd3);
                            psm.setString(2,psmd2);

                            psm.setString(4,psmd4);
                            psm.setString(5,psmd5);
                            psm.setString(6,psmd6);
                            psm.setString(7,psmd7);
                            psm.setString(8,psmd8);

                            psm.setString(9,psmd9);
                            psm.setInt(10,psmd10);
                            psm.setInt(11,psmd11);
                            psm.setString(12,psmd12);
                            psm.setString(13,psmd13);
                            psm.setString(14,psmd14);
                            psm.setInt(15,psmd15);
                            psm.setInt(16,psmd16);
                            psm.setInt(17,psmd17);
                            psm.setString(18,psmd18);
                            psm.setString(19,psmd19);

                            int a=psm.executeUpdate();

                            System.out.println(a+" Rows updated.......");

                             eid.setText("");
                             doj.setText("");
                             name.setText("");
                             fname.setText("");
                             dob.setText("");
                             desg.setText("");
                             pre_add1.setText("");
                             pre_add2.setText("");
                             pre_state.setText("");
                             pre_pincode.setText("");
                             pre_phno.setText("");
                             per_add1.setText("");
                             per_add2.setText("");
                             per_state.setText("");
                             per_pincode.setText("");
                             per_phno.setText("");
                             mobno.setText("");

                            status.setText("");

                    }catch(Exception e){ System.out.println(e);}

}

A: It does not matter in what order the data is stored.  Database systems store the data in a way they think most efficient.
Generally all tools exposes a way to get the data in ordered way ( say by an order by clause)

A: A common stumbling block for people getting started with parameterized queries against an ACE/Jet (Access) database is that the parameters must be added to the prepared statement in the exact same order that they appear in the SQL statement. This is certainly true with ACE/Jet OLEDB so I wouldn't be at all surprised if it was also true for ACE/Jet ODBC (which you are using).
So, change the order in which you issue the psm.setString statements to exactly match the order in which the corresponding fields appear in the INSERT INTO statement. The ACE/Jet drivers ignore parameter names; it's the order in which you add them to the Parameters collection that matters.


text:
Q: Reduction of different RG lattices to kG modules Every book on modular representation theory of finite groups introduces p-modular systems and describes how to reduce an ordinary representation $U$ to obtain one in characteristic p (call it $\overline{U}$), by choosing a lattice. They all prove that the resulting $kG$- module is not unique, but is well defined in the Grothendieck group.
Are there any general results about how rigid this process is. For example for which $U$ is it the case that $\overline{U}$ is uniquely determined up to isomorphism? Can any composition factor of $\overline{U}$ be forced to the socle by choosing an appropriate lattice? Can the number of indecomposable summands of $\overline{U}$ change depending on the choice of lattice? I haven't been able to find any results like these.

A: It is generally not rigid at all.  Note that if $U$ lifts an absolutely irreducible $kG$ module, then $\overline{U}$ is certainly uniquely defined upto isomorphism (though absolutely irreducible $kG$-modules may not themselves lift uniquely!).
Feit (Lemma 18.2 in "The Representation Theory of Finite Groups", p.70) shows that if the coefficient ring is suitably ramified, then for any filtration of $\overline{U}$, there is a lattice $U'$ such that $\overline{U'}$ is the direct sum of the successive quotients of the filtration (he constructs such a lattice).  In particular, there one can find lattices $V$ that are completely reducible modulo the radical of the coefficient ring.  I think that such lattices answer all your questions.     Feit's original paper with the result mentioned is "On finite linear groups", J. Algebra 5, 378-400 (1967).
Edit: I have a shameless plug. For the following jargon and proofs, see here: http://arxiv.org/pdf/1312.4475.pdf
Using the notation there, by Corollary 5.7 and Propositions 4.4 and 5.4, it follows that if $\mathcal{O}$ is ramified (at all, not just 'suitably'), then if $U$ has exponent $\pi$, it is determined upto isomorphism by $\overline{U}$.  to be more precise, $\overline{U}=M\oplus \Omega_{kG} M$, and $U\cong \Omega_{\mathcal{O}G} M$ for some $kG$-module $M$ (everything is projective-free).  I think that counts as a (non-trivial) example of when this is "rigid".

A: This question, or variants of it, appear here from time to time. With enough ramification, the reduction of an irreducible lattice can be made completely reducible ( see Feit's book on Representation theory). On the other hand, J.G. Thompson showed (in his "Vertices and Sources" that the reduction of an irreducible can be made to have a simple socle, and the socle can be made to correspond to any irreducible Brauer character which occurs in the (restriction to $p$-regular elements of) the character afforded by the lattice.


text:
Q: Receiving emails in Ruby I'm working with actionmailer. I'm trying to send a mail from email_idA to email_idB, then fetch that email from email_idB, and do some string operations on it to look for specific keywords.
I understood how to send the email. But how do I receive that email from email_idB's inbox? What configurations do I need to do? And how do I extract the email body as plain text?

A: Did you mean fetch or receive ? Your question uses both these terms and not sure what you mean.

*

*If you just want to do a keyword search on the mails you sent, why not store the outgoing mail in DB and do the search ? (as you said "somehow fetch that email")

*To be able to receive emails in your rails app, you would need to implement the receive method in your mailer. Follow this link - link

*If you meant fetching emails from your inbox then you have to use POP3. Follow this SO answer - link
Im not sure whats your requirement but I'm sure you will find the above links useful :)


text:
Q: Помогите разобраться с HTML CSS Мне нужно сделать 4 квадрата слева и прямоугольник справа, с квадратами я разобрался, а вот прямоугольник не получается
*{
    margin: 0;
}
.tools{
    display:flex;
    flex-wrap: wrap;
    flex-direction:row;
    justify-content: flex-start;

}
.block{
    text-align: center;
    width:600px;
    height: 450px;
    background: darkgrey;
    color:red;
    border: 2px solid black;
    margin: 7px 7px 7px 7px;
}
.tools1{
    display:flex;
    flex-wrap: wrap;
    flex-direction:row;
    justify-content: flex-start;

}

1

2

3

4

A:

1

2

3

4

RIGHT_BLOCK


text:
Q: Do I really need correlation coefficients when computing effect sizes from pretest-posttest studies? I am computing effect sizes from various studies for a meta-analysis. Most of those studies follow a typical pretest-posttest design (repeated measures), thus I compute the effect size as a "Standardized Mean Change".
I am using the metafor package in R to compute these effect sizes, but it asks for the correlation coefficient (, ri in metafor) between pre and posttest scores.
My formula is something like this:
escalc(data = df, measure = "SMCR", m1i = mean_pre, m2i = mean_post,
       sd1i = sd_pre, sd2i = sd_post, ni = n_subjects, append = T)
# Error in escalc.default(data = df, measure = "SMCR"...  :
#     Cannot compute outcomes. Check that all of the required
#     information is specified via the appropriate arguments.

→ It requires ri (correlation coefficient).
The problem is that no study ever reports correlation coefficients for a pretest-posttest design. And I don't think I can compute it from the summary statistics (M, SD). How should I proceed?

A: metafor gives you an opportunity to compute several default measures. WHICH measure you want to compute is your choice. The default measures are specified . BUT, none of these measure seem to respond your  goal i.e. computing effect-sizes in case of pre test and post test scores.. The default measures comute test-statistic such as  t-statistic and a few effect sizes other than what you are   looking for i.e. standardized mean difference. There is no need for a correlation coefficient for computation of this statistic. You can compute these effect-sizes for individual studies and proceed with meta- analysis of  computed effect-sizes.


text:
Q: HTML&CSS: Оптимизационные аспекты разбиения стилевого файла на несколько Делая адаптивную вёрстку, добился того, чтобы в зависимости от ширины окна была разная вёрстка и разные стили. Теперь я задумался о том, чтобы для каждой фазы (диапазона ширин экрана, при котором вёрстка и стили не меняются) разбить слилевой файл на несколько. Что из нижеследующих альтернатив будет лучшим вариантом с точки зрения оптимизации? (Если у Вас есть ещё какие-либо соображения, пожалуйста, приведите их).

*

*Поместить в head все стилевые файлы (применять одновременно будут стили только из 2 файлов, в остальных - медиазапросы для других фаз).
<!--css-->
<link rel="stylesheet" href="style/style.css" type="text/css">
<link rel="stylesheet" href="style/style1.css" type="text/css">
<link rel="stylesheet" href="style/style2.css" type="text/css">
<link rel="stylesheet" href="style/style3.css" type="text/css">
<link rel="stylesheet" href="style/style4.css" type="text/css">
<link rel="stylesheet" href="style/style5.css" type="text/css">

*Написать скрипт в JS, который при каждом изменеии фазы будет заменять в
<!--css-->
<link rel="stylesheet" href="style/styleN.css" type="text/css">

N на номер фазы.
Если лучше второй способ, то как его лучше реализовать? По классу и идентификатору <link> не найти с помощью Jquery, получается остаётся только через getElementsByTagName.

A: Существует общепринятая практика. Когда разработчик пишет код, располагаю модули (файлы css или js ...) как ему удобно. А потом система сборки собирает проект и упаковывает всё в один файл.
Пример, здесь я пишу css с помощью процессора stylus

Дальше моя система сборки, основанная на gulp собирает все css файлы в один и получается обычный css - понятный браузеру, но не такой удобный человеку.

Подробности как сделать здесь: в 4 серии описана сборка стилей

A: Используйте Grunt, куча модулей с удобными LESS или иными стилями. Но на продакшене все скомпилировано в одну min.css которая грузится быстрее и один раз. Также рекомендую при подключении css файла писать так:
<link rel="stylesheet" href="style/style.min.css?date=<?=filemtime('path to file')?>" type="text/css">

Это поможет избежать кеширования css файла.
Тестируйте зесь https://developers.google.com/speed/pagespeed/insights/, гугл говорит чем меньше файлов и чем меньше их размер тем лучше.


text:
Q: Qemu Debian x86 on RaspberryPi I want to create i386 environment with QEMU and chroot on Raspberry Pi.
I am using Raspberry Pi ver B, but I guess it should not matter much which version is used.
So far I did:
apt-get install qemu qemu-user qemu-user-static binfmt-support debootstrap binutils

Then I mounted chroot directory to /tmp/mnt and ran:
sudo debootstrap --foreign --arch i386 buster  ./ http://deb.debian.org/debian/

Then I mounted:
mount -t sysfs /sys /tmp/mnt/sys/
mount -t proc /proc /tmp/mnt/proc/
mount –bind /dev /tmp/mnt/dev/
mount –bind /dev/pts /tmp/mnt/dev/pts/
mount –bind /dev/shm /tmp/mnt/dev/shm/

Now when I try to run second stage of debootstrap:
sudo chroot ./ ./debootstrap/debootstrap --second-stage

I get the following error message:
W: Failure trying to run:  /sbin/ldconfig
W: See //debootstrap/debootstrap.log for details

I checked the debootstrap/debootstrap.log:
qemu: uncaught target signal 11 (Segmentation fault) - core dumped
Segmentation fault

Indeed when I try sudo chroot ./ ./sbin/ldconfig I get same Seg fault.
But when I try sudo chroot ./ ./bin/bash it works.
I am not sure what should be my next step.
I guess it is something related to my qemu config or verison (I am using version 2.8.1(Debian 1:2.8+dfsg-6+deb9u4)). I checked many threads about similar issues, but I could not find one which would help me to find the solution.

A: OK, I think I figured it out.
It works when I select stretch as Debian version in debootstrap command.
sudo debootstrap --foreign --arch i386 stretch  ./ http://deb.debian.org/debian/

Now when I think about it more, it makes sense. I guess running i386 Debian in chroot does not provide full separation from host OS (I mounted proc, sys, etc.).

A: I had the exact same problem running Raspbian Buster; the problem went away when chrooting Debian Stretch.
So somehow ldconfig from the i386 repository is not working with the qemu-i386-static emulator on buster, but it IS working on stretch!
Has nothing to do with the host system....


text:
Q: Module.nesting within instance_eval/exec or module_eval/exec I came up with this question when I was trying to answer this. The following is an expected behaviour:
module A
  p Module.nesting
end
# => [A]

But the following:
A.instance_eval{p Module.nesting}
A.instance_exec{p Module.nesting}
A.module_eval{p Module.nesting}
A.module_exec{p Module.nesting}

all return []. Why do these not work as the above?
Additional Question
Mu is too short suggested an interesting point. If that is correct, then Module.nesting would be one of the methods and variables that are dependent on the literal context like Method#source_location, __FILE__. Is this understanding correct? If so, can someone provide the inventory of these methods/variables that are dependent on the literal context? I think it would be useful for reference.

A: Warning: This is a little long and rambling. A bit of a tour through the Ruby source code seems necessary as the documentation is a bit thin. Feel free to skip to the end if you don't care about how sausage is made.

The 1.9.2 Module.nesting is implemented in eval.c like this:
static VALUE
rb_mod_nesting(void)
{
    VALUE ary = rb_ary_new();
    const NODE *cref = rb_vm_cref();

    while (cref && cref->nd_next) {
        VALUE klass = cref->nd_clss;
        if (!(cref->flags & NODE_FL_CREF_PUSHED_BY_EVAL) &&
            !NIL_P(klass)) {
            rb_ary_push(ary, klass);
        }
        cref = cref->nd_next;
    }
    return ary;
}

I don't know the Ruby internals that well but I read the while loop like this: extract from the cref linked list all the nodes that are associated with a class-like thing but didn't come from eval. The NODE_FL_CREF_PUSHED_BY_EVAL bit is only set in here:
/* block eval under the class/module context */
static VALUE
yield_under(VALUE under, VALUE self, VALUE values)

A bit more grepping and reading reveals that instance_eval does end up going through yield_under. I'll leave checking instance_exec, module_eval, and module_exec as exercises for the reader. In any case, it looks like instance_eval is explicitly excluded from the Module.nesting list; this is, however, more of a distraction than anything else, it just means that you won't see something the evals mentioned.
So now the question is "what are NODE and rb_vm_cref() all about?".
If you look in node.h you'll see a bunch of NODE constants for the various Ruby keywords and language structures:

*

*NODE_BLOCK

*NODE_BREAK

*NODE_CLASS

*NODE_MODULE

*NODE_DSYM

*...

so I'd guess that NODE is a node in the instruction tree. This lines up nicely with my

Module.nesting seems to be more about talking to the parser

conjecture in the comment. But we'll keep going anyway.
The rb_vm_cref function is just a wrapper for vm_get_cref which is a wrapper for vm_get_cref0. What is vm_get_cref0 all about? It is all about this:
static NODE *
vm_get_cref0(const rb_iseq_t *iseq, const VALUE *lfp, const VALUE *dfp)
{
    while (1) {
        if (lfp == dfp) {
            return iseq->cref_stack;
        }
        else if (dfp[-1] != Qnil) {
            return (NODE *)dfp[-1];
        }
        dfp = GET_PREV_DFP(dfp);
    }
}

All three arguments to the function come straight out of this control frame:
rb_control_frame_t *cfp = rb_vm_get_ruby_level_next_cfp(th, th->cfp);

The iseq appears to be an instruction sequence and the lfp and dfp are frame pointers:
VALUE *lfp;                 // cfp[6], local frame pointer
VALUE *dfp;                 // cfp[7], dynamic frame pointer

The definition of cref_stack is relevant:
/* klass/module nest information stack (cref) */
NODE *cref_stack;

So it looks like you're getting some sort of call or nesting stack out of rb_vm_cref.

Now back to the specifics at hand. When you do this:
module A
  p Module.nesting
end

You'll have module A in the cref linked list (which is filtered to produce the Module.nesting result array) as you haven't hit the end yet. When you say these:
A.instance_eval { puts Module.nesting }
A.instance_exec { puts Module.nesting }
A.module_eval   { puts Module.nesting }
A.module_exec   { puts Module.nesting }

You won't have module A in cref anymore because you've already hit the end popped module A off the stack. However, if you do this:
module A
  instance_eval { puts Module.nesting.inspect }
  instance_exec { puts Module.nesting.inspect }
  module_eval   { puts Module.nesting.inspect }
  module_exec   { puts Module.nesting.inspect }
end

You'll see this output:
[A]
[A]
[A]
[A]

because the module A hasn't been closed (and popped off cref) yet.
To finish off, the Module.nesting documentation says this:

Returns the list of Modules nested at the point of call.

I think this statement combined with the review of the internals indicates that Module.nesting does in fact depend on the specific literal context in which it is called.
If anyone with more experience in the Ruby internals has anything to add I can hand this over to the SO community as a community wiki.

UPDATE: All of this applies to class_eval as well as it does to module_eval and it also applies to 1.9.3 as well as it does to 1.9.2.


text:
Q: Convolving a histogram with a kernel I have some raw histogram driven out of a discrete dataset. In order to make it smooth, I have been told to convolve it with a kernel (ex. a Gaussian or a Hamming one) which values sum up to one.
Now the question is,what actually is a kernel ?And what should sum up to one and why?Is this a simple filtering using a Gaussian function?How should I implement this in MATLAB?
Thanks in advance.