text:
Q: What's the difference between "mirror" and "looking glass"? I have read that a looking glass is a surface with sufficient reflection to form an image of an object... doesn't that sound like a mirror?

A: There is no difference. "Looking glass" is a poetic and archaic way to refer to a mirror.

A: Looking glass was considered the 'proper' word to use when referring to what we now would all call a mirror. The word mirror was considered vulgar and middle-class by the upper classes. Some upper class people will still say looking glass instead of mirror. The word glass on its own also often refers to mirrors rather than glass. Hence pier glass, or 'go and look in the glass'.

A: When Perseus slays Medusa, he does so without looking directly at her, instead using his highly polished shield as a mirror. This sense of mirror is reflected (so to speak) in the first definition of the term in Merriam-Webster's Eleventh Collegiate Dictionary (2003):

mirror 1: a polished or smooth surface (as of glass) that forms images for reflection

But would it be correct to say that Perseus used his shield as a looking glass? The underlying question here is, How literally should we take the component "glass" in the term looking glass? If looking glasses must be made, in part, of glass, then a metal shield can't be a looking glass, though it can be a mirror.
The Eleventh Collegiate Dictionary isn't especially helpful on this point, as it defines looking glass simply as "MIRROR." Earlier dictionaries, however, don't treat the two terms as identical.
One of the clearest treatments of the differences between mirror and looking-glass appears in Merriam-Webster's [First] International Dictionary of the English Language (1890), which provides distinct definitions for three related terms:

Looking-glass A mirror made of glass on which has been placed a backing of some reflecting substance, as quicksilver.
Mirror A looking-glass or a speculum; any glass or polished substance that forms images by the reflection of rays of light.
Speculum 1. A mirror, or looking-glass; especially a metal mirror, as in Greek and Roman archaeology. 2. A reflector of polished metal, especially one used in reflecting telescopes. ...

From these definitions, it appears that (late in the nineteenth century, anyway) Perseus's shield would have qualified as both a mirror and a speculum, but not as a looking-glass.

A: The difference between looking glass and mirror is that looking glass, when used as adjective, means being or involving the opposite of what is normal or expected (a looking-glass land, looking-glass logic); mirror can also be figuratively used to mean something regarded as accurately representing something else (the stage is supposed to be the mirror of life).
[Reference: the New Oxford American Dictionary.]

A: A looking glass is indeed a mirror. As @JSBangs alluded to, it is only largely used in literary contexts. Two notable examples (book titles) are:

*

*Through the Looking-Glass (Lewis Carroll)

*Into the Looking Glass (John Ringo)


text:
Q: return union type in Golang I want to try the union type implementation in Golang as in this answer
I try this:
package main

import (
    "fmt"
    "math/rand"
    "time"
)

type intOrString interface {
    int | string
}

func main() {
    fmt.Println(measure())

}
func measure[T intOrString]() T {
    rand.Seed(time.Now().UnixNano())
    min := 20
    max := 35
    temp := rand.Intn(max-min+1) + min

    switch {
    case temp < 20:
        return "low" //'"low"' (type string) cannot be represented by the type T
    case temp > 20:
        return T("high") //Cannot convert an expression of the type 'string' to the type 'T'
    default:
        return T(temp)

    }
}

so how I can convert an expression of the type 'string' or 'int' to the type 'T'.

A: You misunderstand how generics work. For your function you must provide a type when you call the function. Like fmt.Println(measure[string]()), so in this case you expect to get a string from it. If you call it like measure[int]() then you expect an int as a result. But you cannot call it without a type parameter. Generics are for function which share the same logic for different types.
For what you want, you must use any as a result, then check it if it's a string or an int. Example:
package main

import (
    "fmt"
    "math/rand"
    "time"
)

func main() {
    res := measure()
    if v, ok := res.(int); ok {
        fmt.Printf("The temp is an int with value %v", v)
    }
    if v, ok := res.(string); ok {
        fmt.Printf("The temp is a string with value %v", v)
    }
}

func measure() any {
    rand.Seed(time.Now().UnixNano())
    min := 20
    max := 35
    temp := rand.Intn(max-min+1) + min

    switch {
    case temp < 20:
        return "low"
    case temp > 20:
        return "high"
    default:
        return temp
    }
}

Or if you want to just print it out (and don't need to know the type), you don't even need to check it, just call fmt.Printf("The temp is %v", res).

redpajama_set_name: RedPajamaStackExchange


text:
Q: Synchronize embedded DB with remote DB At the moment, I have a little JavaFX app that generates reports and statistics from the data on a remote MySQL-Server. I use EclipseLink for persistence. Since the access is read-only and the data doesn´t always need to be fresh, I thought I could speed things up by using an embedded DB (H2) that can be synchronized to the remote server when and if the user wishes to. The problem is, I don´t have a clue how to go about it.
What I came up with so far, is to execute mysqldump, make a dump of the remote server and execute the resulting SQL script locally. This is surely far from elegant, so: Is there a patent solution for this task?

A: Well, 50 tables possible have a considerable amount of relations, this can be tricky... As far as I know there is nothing that automate this for you or something like that. Very possible that you will have to create your own logic to that. When I did something like what are you trying to do I used the logic of "last update", like, the local data have the timestamp of the time it was last synced with the remote, and the remote data have the timestamp of the last time the data was updated there (himself on the table, or even a relation to it like a One-To-One). Having that data, every time the local user enter a part of the system that can be outdated, the client connect to the server and check if the last update timestamp is bigger that the local synced timestamp, if so, it updates the full object and relation. I consumed some time to develop but at the end worked like a charm. There may be some other way to do it, but this was the way I found at the time. Hope it helps you with your problem.


text:
Q: file strings requires and filename and output variable in cmake  target_link_libraries(${PROJECT_NAME}
                      serializer
                      iothub_client
                      iothub_client_mqtt_transport
                      umqtt
                      aziotsharedutil
                      ssl
                      crypto
                      curl
                       ssl..... utils)

Hello there , I am working on a project where I have a large set of libraries, and have use it like it (shown above). but instead of hardcoding these libraries explicitly,i want write it in a one line.
now I want to write it in a one line for linking, so specifically, what I have tried  in the root level I have created a file called "library.lst" and in this .lst file I am giving the path of that library
               build/src/con/shared/virtual/serializer/serializer.a"
               build/src/con/shared/virtual/iothub_client/iothub_client.a"
               build/src/con/shared/virtual/umqtt/ umqtt.a"
               build/src/con/shared/virtual/utils/utlis.a
              ## write for every library

I am placing this .lst file in the folder called "filelist",  e.g filelist/Library.lst where it will take all the libraries and will link.
so what I wrote this In each camkelists.txt where this library used by writing
file(STRINGS ${filelist} library) ,
target_link_libraries(${PROJECT NAME} ${library}),
but  when I am running this script I an getting the errors like
         "error:- "file strings requires and filename and output variable",

and I also have creates build.sh file where I am giving the path of it
"-D"filelist=%FILELISTSPATH%\library.lst"
" so could you please help me here and also need some explanation on it to understand it in a better way.Thanks in advance.


text:
Q: Unable to load dependency in Play framework project I am trying to use a library called REST Assured with the Play Framework. The documentation - https://code.google.com/p/rest-assured/wiki/GettingStarted - gives the following artifact for Maven -
<dependency>
      <groupId>com.jayway.restassured</groupId>
      <artifactId>rest-assured</artifactId>
      <version>1.8.0</version>
      <scope>test</scope>
</dependency>

So I altered my Build.scala file as follows to include this dependency -
  val appDependencies = Seq(
    // Add your project dependencies here,
    javaCore,
    javaJdbc,
    javaEbean,
    "com.jayway.restassured" % "rest-assured" % "1.8.0" % "test"
  )

Then I try and use this library in a Java by statically importing some packages, which is what the documentation instructs me to do -
import static com.jayway.restassured.RestAssured.*;
import static com.jayway.restassured.matcher.RestAssuredMatchers.*;
import static org.hamcrest.Matchers.*;

But this results in an Compilation error when I try and run the Play application -

error: package com.jayway.restassured does not exist

I know that Play/sbt is retrieving the dependency because I can see a "com.jayway.restassured" directory in the play-2.1.0/repository/cache directory. However it is not showing in the play-2.1.0/repository/local directory, I don't know if that has any significance.
So what's going wrong, why can't I access this library in my Play application?

A: If you need to access REST Assured from non-test code, the dependency should be defined as:
"com.jayway.restassured" % "rest-assured" % "1.8.0"

In other words, drop the "test" declaration. When that's present you're specifying that the library is a test-scope dependency. At the moment you're saying that REST Assured is not a dependency of your production code, and only needs to be scoped to code in your test tree (i.e added to the test classpath).
I guess the follow-up question is why you wish to reference a testing library from your app code?


text:
Q: DNS: CNAME as www record I'm considering changing the DNS www records of a domain name from an A record to a CNAME. Various questions and answers on serverfault are not as clear cut as I'd hoped. Also, many DNS checking tools like DNSsy or intoDNS have as a check the fact that the www record is not a CNAME, is an A record, pointing to a public IP address.
In my case, I want to point my domain's www record to an Amazon Web Services load balancer which I can only do with a CNAME. What would be the best way to achieve that?

A: If you are concerned about this issue, you can use Route 53 and ELB together to get what you want. Create the www record as an A record, then select the "Alias" option and the interface will allow you to select an AWS-specific target to point the record to. So the ELB has to exist first, then you can create the Alias to it.
So you start to create a new A record in Route 53 as usual, but you click on the "Alias" option right under the host name. The freeform text block will disappear and you will be given the ability to select your ELB under "Alias Target". Select your ELB and save the change. You will then have an A record that points to www, which will be your ELB.
(The above info about the Route 53 UI has been corrected from the original error.)
This is a special Route 53 feature most often used to handle serving from the domain apex, where A records are required. But it can also be used for subdomains such as www. Basically, it's an A record that acts like a CNAME within the confines of AWS. Using this feature, DNS tools will find an A record.

A:
In my case, I want to point my domain's www record to an Amazon Web Services load balancer which I can only do with a CNAME. What would be the best way to achieve that?

If the only way to do it is via a CNAME, it seems like the best way to do it would be a CNAME. I know it sounds simple, but if that's all that Amazon supports, then it's what you have to do, regardless of any other pros and cons.
Just for the record though, I've definitely CNAME'd www before without issue.

A: Creating the CNAME is what you're supposed to do, according to Amazon's documentation. You point it at the name of the Elastic Load Balancer that you were given, which you can find in the management console.
So you set up a CNAME record like:
www     IN      CNAME   lb-4294967295.us-east-1.elb.amazonaws.com.


text:
Q: ISO-8859-1 Input to UTF-8 Output via VFS We receive a XML file (not well-formed) encoded as ISO-8859-1 on a Linux system. An ESB Proxy picks this up and uses a Sequence to forward with SAMBA VFS to a Windows share.
On Windows certain characters are not displayed properly because I can't get it to encode as UTF-8. I have tried several approaches all without success. Using xxd these are the characters I have problems with:
0000b70: 4c55 45ef bfbd 5344 204a 503c 2f69 7373  LUEï.½SD JP</iss
0000bf0: 5445 4749 4320 5641 4c55 45ef bfbd 5344  TEGIC VALUEï.½SD

The half symbol. The proxy is:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse" name="Proxy" transports="vfs" statistics="enable" trace="disable" startOnLoad="true">
  <target faultSequence="ErrorSequence">
    <inSequence>
       <property name="OUT_ONLY" value="true"/>
       <clone sequential="true">
         <target sequence="Sequence"/>
       </clone>
    </inSequence>
  </target>
  <parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter>
  <parameter name="transport.PollInterval">60</parameter>
  <parameter name="transport.vfs.MoveAfterProcess">file:///data/process</parameter>
  <parameter name="transport.vfs.FileURI">file:///data/incoming</parameter>
  <parameter name="transport.vfs.MoveAfterFailure">file:///data/failed</parameter>
  <parameter name="transport.vfs.FileNamePattern">security.*</parameter>
  <parameter name="transport.vfs.ContentType">text/plain; charset="UTF-8"</parameter>
  <parameter name="transport.vfs.ActionAfterFailure">MOVE</parameter>
  <description/>
</proxy>

The sequence is:
<sequence xmlns="http://ws.apache.org/ns/synapse" name="Sequence" onError="ErrorSequence" trace="enable">
  <xslt key="UTF8Convert">
    <property name="encoding" value="UTF-8"></property>
    <property name="messageType" value="text/xml"></property>
    <property name="ContentType" value="text/xml; charset=UTF-8</property>
  </xslt>
  <property xmlns:ns="http://org.apache.synapse/xsd" name="filename" expression="(get-property('transport', 'FILE_NAME'))"></property>
  <property name="transport.vfs.ContentType" value="text/xml; charset="UTF-8"" scope="transport" type="STRING"></property
  <property xmlns:ns="http://org.apache.synapse/xsd" name="transport.vfs.ReplyFileName" expression="get-property('filename')" scope="transport"></property>
  <property name="OUT_ONLY" value="true"></property>
  <property xmlns:ns="http://org.apache.synapse/xsd" name="serverurl" expression="fn:concat('vfs:smb://',fn:normalize-space(get-property('DOMAIN')),'\',fn:normalize-space(get-property('USERNAME')),':',fn:normalize-space(get-property('PWD')),'@',fn:normalize-space(get-property('DESTINATION')),'/',fn:normalize-space(get-property('DIR')),'/')"></property>
  <header xmlns:ns="http://org.apache.synapse/xsd" name="To" expression="fn:concat(get-property('serverurl'),get-property('filename'))"></header>
  <send>
    <endpoint>
      <default></default>
    </endpoint>
  </send>
</sequence>

The XSLT is:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:output method="xml" version="1.0" encoding="UTF-8"></xsl:output>
  <xsl:template match="@*|node()">
    <xsl:copy>
        <xsl:apply-templates select="@*|node()"></xsl:apply-templates>
    </xsl:copy>
  </xsl:template>
</xsl:stylesheet>

The trace log is like this:
00:35:09,924 [-] [vfs-Worker-18]  INFO TRACE_LOGGER Start : Sequence<ApexXMLToEPMSequence>
00:35:09,924 [-] [vfs-Worker-18]  INFO TRACE_LOGGER Setting the onError handler : ErrorSequence for the sequence : Sequence
00:35:09,924 [-] [vfs-Worker-18]  INFO TRACE_LOGGER Sequence <SequenceMediator> ::mediate()
00:35:09,925 [-] [vfs-Worker-18]  INFO TRACE_LOGGER Mediation started from mediator position : 0
00:35:09,925 [-] [vfs-Worker-18]  INFO TRACE_LOGGER Start : XSLT mediator
00:35:09,927 [-] [vfs-Worker-18]  INFO TRACE_LOGGER Setting parameter 'encoding' to 'UTF-8'
00:35:09,927 [-] [vfs-Worker-18]  INFO TRACE_LOGGER Setting parameter 'messageType' to 'text/xml'
00:35:09,927 [-] [vfs-Worker-18]  INFO TRACE_LOGGER Setting parameter 'ContentType' to 'text/xml; charset=UTF-8'
00:35:09,927 [-] [vfs-Worker-18]  INFO TRACE_LOGGER output method: xml; encoding: UTF-8
00:35:09,927 [-] [vfs-Worker-18]  INFO TRACE_LOGGER Using org.apache.synapse.util.jaxp.StreamSourceBuilder
00:35:09,932 [-] [vfs-Worker-18]  INFO TRACE_LOGGER Transformation completed - processing result
00:35:09,933 [-] [vfs-Worker-18]  INFO TRACE_LOGGER Replace node with result
00:35:09,933 [-] [vfs-Worker-18]  INFO TRACE_LOGGER End : XSLT mediator
00:35:09,933 [-] [vfs-Worker-18]  INFO TRACE_LOGGER Start : Property mediator
00:35:09,933 [-] [vfs-Worker-18]  INFO TRACE_LOGGER Setting property : filename at scope : default to : security.2016046.113132 (i.e. result of expression : (get-property('transport', 'FILE_NAME')))
00:35:09,933 [-] [vfs-Worker-18]  INFO TRACE_LOGGER End : Property mediator
00:35:09,933 [-] [vfs-Worker-18]  INFO TRACE_LOGGER Start : Property mediator
00:35:09,933 [-] [vfs-Worker-18]  INFO TRACE_LOGGER Setting property : transport.vfs.ContentType at scope : transport to : text/xml; charset="UTF-8" (i.e. constant : text/xml; charset="UTF-8")
00:35:09,933 [-] [vfs-Worker-18]  INFO TRACE_LOGGER End : Property mediator
00:35:09,933 [-] [vfs-Worker-18]  INFO TRACE_LOGGER Start : Property mediator
00:35:09,934 [-] [vfs-Worker-18]  INFO TRACE_LOGGER Setting property : transport.vfs.ReplyFileName at scope : transport to : security.2016046 (i.e. result of expression : get-property('filename'))
00:35:09,934 [-] [vfs-Worker-18]  INFO TRACE_LOGGER End : Property mediator
00:35:09,934 [-] [vfs-Worker-18]  INFO TRACE_LOGGER Start : Property mediator
00:35:09,934 [-] [vfs-Worker-18]  INFO TRACE_LOGGER Setting property : OUT_ONLY at scope : default to : true (i.e. constant : true)
00:35:09,934 [-] [vfs-Worker-18]  INFO TRACE_LOGGER End : Property mediator
00:35:09,934 [-] [vfs-Worker-18]  INFO TRACE_LOGGER Start : Property mediator
00:35:09,934 [-] [vfs-Worker-18]  INFO TRACE_LOGGER Setting property : serverurl at scope : default to : vfs:smb://AC\user:passw@eserver/folder/ (i.e. result of expression : fn:concat('vfs:smb://',fn:normalize-space(get-property('DOMAIN')),'\',fn:normalize-space(get-property('USERNAME')),':',fn:normalize-space(get-property('PWD')),'@',fn:normalize-space(get-property('DESTINATION')),'/', fn:normalize-space(get-property('DIR')),'/'))
00:35:09,934 [-] [vfs-Worker-18]  INFO TRACE_LOGGER End : Property mediator
00:35:09,934 [-] [vfs-Worker-18]  INFO TRACE_LOGGER Start : Header mediator
00:35:09,934 [-] [vfs-Worker-18]  INFO TRACE_LOGGER Set SOAP header : To to : vfs:smb://AC\user:passw@server/folder/security.2016046
00:35:09,934 [-] [vfs-Worker-18]  INFO TRACE_LOGGER End : Header mediator
00:35:09,934 [-] [vfs-Worker-18]  INFO TRACE_LOGGER Start : Send mediator
00:35:09,934 [-] [vfs-Worker-18]  INFO TRACE_LOGGER Sending message through endpoint : null resolving to address = vfs:smb://AC\user:passw@server/folder/security.2016046
00:35:09,934 [-] [vfs-Worker-18]  INFO TRACE_LOGGER SOAPAction: urn:mediate
00:35:09,934 [-] [vfs-Worker-18]  INFO TRACE_LOGGER WSA-Action: urn:mediate
00:35:09,935 [-] [vfs-Worker-18]  INFO TRACE_LOGGER End : Send mediator
00:35:09,935 [-] [vfs-Worker-18]  INFO TRACE_LOGGER End : Sequence <Sequence>

The output on Windows shows as the input above with no coding to UTF-8. How do I make the ESB re-encode please?

A: If your xml file is encoded as ISO-8859-1, why do you configure your VFS proxy to read it as UTF-8 with : <parameter name="transport.vfs.ContentType">text/plain; charset="UTF-8"</parameter> ?
It seems that you read it as UTF-8 and write it as UTF-8
If you want to force output encoding with VFS, try to set a property named "CHARACTER_SET_ENCODING" before send

A: If you try to decode ISO-8859-1 encoded files using UTF-8, you will end up with some symbolic character representations (like accented characters). So best thing is Send the file as it is.
Use the VFS parameter like below,
 <parameter name="transport.vfs.ContentType">text/plain; charset=iso-8859-1</parameter>

Add the following property and try your scenario.
 <property name="messageType" value="text/plain; charset=iso-8859-1" scope="axis2"/>


text:
Q: why does my return does not show in the localhost 3000 import React from 'react';
import styled from 'styled-components';

const Login=(props) => {
    return(
        <div>
            Login
        </div>
    )
}

export default Login;

I have returned the login but the login word doesn't show in my website


text:
Q: Specified source 'MySource' is invalid I am updating Jenkins Pipeline for nuget package publishing. Everything is working perfectly expect a last step which is a bat command.
When I run following command in command line it works:
C:\Host\packages\release\nuget.exe push -Source MySource -ApiKey VSTS C:\Host\packages\release\CoreLogger.2.1.109.nupkg
Pushing CoreLogger.2.1.109.nupkg to 'C:\Host\packages'...
Your package was pushed.

It works.
I copy the same line and put it in my pipeline like:
bat "C:\\Host\\packages\\release\\nuget.exe push -Source MySource -ApiKey VSTS C:\\Host\\packages\\release\\CoreLogger.2.1.${BUILD_NUMBER}.nupkg"

if return following error!
C:\Host\packages\release\nuget.exe push -Source MySource -ApiKey VSTS C:\Host\packages\release\CoreLogger.2.1.109.nupkg
The specified source 'MySource' is invalid. Please provide a valid source.
script returned exit code 1

What could have been gone wrong?

A: The source is defined in your nuget.config file, and nuget.exe finds it by looking in the "current directory" and recursing up to the root directory. If the "current directory" when run on your build server isn't where you have your nuget.config, or a subdirectory under it, nuget.exe won't find it.
So, check your build configuration to make sure the current directory is where your nuget.config is. Or, you can pass the -ConfigFile parameter and explicitly tell it where the config file is.


text:
Q: Transition and mouseover Working with JavaScript it seems there may be an issue where transition causes an issue with the closing of a menu. In this MWE the menu on the left opens as it should by either clicking the menu icon or through mouseover. It also closes properly with mouseout. However, when attempting to close by clicking the close icon there is some discrepancy: it works erratically. Could this be due to the transition effect? It seems to close properly when the transition is removed. How could the transition be retained while also making the menu close properly both by mouseout and clicking the relevant icon?
Thanks.
MVE:

 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

 X
 =

Title

``


text:
Q: Using Postman-GRPC ,I need to upload a file as request(via postman) to the my GRPC-server I have a GRPC file-upload server(C#) running and I also have GRPC-client through which I was uploading files to the GRPC server but now I want to upload my file using postman(yes the new postman version supports GRPC) and now I am not able to figure out how to attach/send the file via the GRPC-postman to my GRPC-server ,for example in REST-postman u r able attach the file in body using FORM-DATA tab. can anyone give me a solution to this
Thank you


text:
Q: Convert non-ascii domain to SMTP compatible When customers enter email addresses with non-ascii chars like äüö our SMTP rejects to process them.
So I think might be there is a solution to handle those domains myself and convert them to punyocode.
Is there a simple way of doing so using c#?
Would this work anyway?

A: You can use Uri.DnsSafeHost to convert to Punycode:
using System;

class Test
{
    static void Main()
    {
        Console.WriteLine(ConvertToPunycode("caf\u00e9.com"));
    }

    static string ConvertToPunycode(string domain)
    {
        Uri uri = new Uri("http://"+domain);
        return uri.DnsSafeHost;
    }
}

In app.config:
<configuration>
  <uri>
    <idn enabled="All" />
  </uri>
</configuration>

Result:
xn--caf-dma.com

A: The problem with this approach is that you'll be changing the email addresses.
The email addresses bevan@example.com and bevän@example.com are different email addresses, however much they appear the same.
Making the change you suggest will break email - people might receive the messages, but they won't be able to reply to them.
Your SMTP server that doesn't handle accented characters sounds like a dinosaur. Much as it might be a pain in the proverbial, replacement and/or upgrade is likely the best solution.
You'll likely be able to get more appropriate assistance over on ServerFault.

A: Converting Unicode characters in your email address' domain name to Punycode resolves the correct DNS records so it won't be rejected by your SMTP. It can be done simply using System.Uri without modifying app.config:
/// <summary>
/// Try passing example@äüö.com
/// </summary>
/// <param name="email"></param>
/// <returns></returns>
internal string GetSafeEmail(string email)
{
    const char at = '@';
    string[] split = email.Split(at);
    string safeHost = new Uri("http://" + split[1]).IdnHost;
    // Don't convert the username to Punycode
    return string.Join(at, split[0], safeHost);
}


text:
Q: akka-http has mixed java and scala dsl definitions, preventing compilation There's the following error that happens when trying to compile the line of code in the error message. Removing withStatus makes the code compile.

[error] /home/anton/code/flow-mobile/server/src/main/scala/in/flow/server/FlowServerStack.scala:108: type mismatch;
[error]  found   : akka.http.javadsl.model.HttpResponse
[error]  required: akka.http.scaladsl.model.HttpResponse
[error]         r mapEntity {_ transformDataBytes errorFlow(ermsg) } withStatus code

For some reason the function signature is this (even though it is found in the scala dsl package)
  override def withStatus(statusCode: Int):
    akka.http.javadsl.model.HttpResponse = copy(status = statusCode)
  override def withStatus(statusCode: akka.http.javadsl.model.StatusCode):
    akka.http.javadsl.model.HttpResponse = copy(status = statusCode.asInstanceOf[StatusCode])

Whats going on?

A: The withStatus method is probably intended as a builder pattern helper to be used with Java.
If you want to alter a HttpResponse from Scala I reckon it would be more idiomatic to use .copy(status = StatusCodes.OK).

A: The thing is that you are supposed to use the copy method to change statusCode, headers etc with Scala dsl's HttpResponse. Other withXYZ methods are more for the internal workings of Java api.
val originalResponse = ...

val newResponse = originalResponse.copy(status = StatusCodes.OK)

// or
val newResponse = originalResponse.copy(status = StatusCodes.NotFound)

You can look at defined StatusCodes here - http://doc.akka.io/api/akka-http/current/akka/http/scaladsl/model/StatusCodes$.html


text:
Q: How to Try Catch in CodeceptJS I'm doing this in my page object:
try{
    I.selectOption(this.SELECT, this.OPTION);
}
catch(error){
    I.say('Option missing, but thats sometimes expected ' + error);
}

But it still fails the test when the locator doesn't match an option element.
I want to catch and continue the test, without failing.
UPDATE:
It looks like it depends on what's in the try block.
If I put an assertion there, like I.see('something'); Then the catch block is not skipped. But non-assertions in the try block, like I.selectOption('something') throw errors which are not caught by the catch.

A: Try-catch should be performed on a promise chain. I think you can get it this way:
I.selectOption(this.SELECT, this.OPTION).catch(() => I.say(''));

A: I.selectOption(this.SELECT, this.OPTION)
.then(() => I.say('try block'))
.catch(() => I.say('catch block'));


text:
Q: Why i can't create object from custom class in Unity3D? the object will not show in the hierarchy, and in other script which derived from MonoBehaviour call GameObject.Find("/Canvas") is null.
public class SceneUI
{
    [RuntimeInitializeOnLoadMethod]
    private static void __OnSceneChange()
    {
        Debug.Log("The Scene Had Changed To:" + SceneManager.GetActiveScene().name);
        __Init();
    }

    private static GameObject canvas;
    private static void __Init()
    {
        canvas = GameObject.Find("/Canvas") ?? new GameObject("Canvas");
        bool cmd;
        cmd = canvas.GetComponent<Canvas>() ?? canvas.AddComponent<Canvas>();
        cmd = canvas.GetComponent<CanvasScaler>() ?? canvas.AddComponent<CanvasScaler>();
        cmd = canvas.GetComponent<GraphicRaycaster>() ?? canvas.AddComponent<GraphicRaycaster>();

        foreach (dynamic pairs in GameApp.DataConf_["NavicatResource"])
        {
            GameObject dog = new GameObject("Puppy");
            string scene_name = pairs.Value.sceneName;
            DefaultControls.Resources ui_res = new DefaultControls.Resources();
            GameObject uiButton = DefaultControls.CreateButton(ui_res);
            uiButton.transform.SetParent(canvas.transform, false);
            uiButton.transform.position = new Vector3(0.0f, 0.0f, 0.0f);
        }
    }
}

A: That's because i changed the scene。 I should add
DontDestroyOnLoad(canvas);

after
canvas = GameObject.Find("/Canvas") ?? new GameObject("Canvas");


text:
Q: Template of old research document I've been looking at this PDF, and I can't figure out what template it is. It looks vaguely similar to this post: Showcase of beautiful typography done in TeX & friends
What I'm trying to accomplish is to replicate the style of the header, more specifically the size of the font and the type of the font.

http://www.wiwi.uni-jena.de/uiw/publications/pub_before_1999/Audretsch_Fritsch_1994b.pdf
I'm trying to replicate this document in TeX.
This is what I have so far.
%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode

\documentclass[12pt]{extarticle}

\usepackage[protrusion=true,expansion=true,tracking=true,kerning=true]{microtype}
\usepackage{multicol}
\usepackage{lipsum}

\usepackage[margin=0.5in,top=1in,bottom=1in]{geometry}

\setlength{\columnsep}{20pt}

\usepackage{fontspec,xltxtra,xunicode}
\defaultfontfeatures{Mapping=tex-text}
\setromanfont[Mapping=tex-text]{Adobe Caslon Pro}
%\setsansfont[Scale=MatchLowercase,Mapping=tex-text]{Gill Sans}
%\setmonofont[Scale=MatchLowercase]{Adobe Caslon Pro}

\title{Fancy title goes here.}
\author{Author name}
\date{November $21^{st}$, 2012}                                           % Activate to display a given date or no date

\begin{document}
\maketitle

\begin{center}
\rule[1cm]{17cm}{0.01cm}
\end{center}

\abstract{This paper will assess various aspects of a certain topic. \lipsum[24]}
\bigskip

\noindent Keywords: Something blah geography

\begin{multicols}{2}
\subsubsection*{\centerline{\bf{INTRODUCTION}}}

\lipsum[1-10]

\end{multicols}

\end{document}

A: I like old, beautiful fonts, too.  I looked through my library in search of some that bear a resemblance to what you have there.  I found a few, some more so some less so.  While fonts themselves are not really TeX questions, the relevance to my response is that I wrote the programs to install these fonts onto my LaTeX installation, as detailed in Displaying medieval scriptures and neumes in TeX .  Anyhow, here is a pic of those fontsets, none of which are an exact match to your example:

The fonts are identified by name above the image.  For them, I have no small caps, so the author names look nothing like the original.


text:
Q: Convert attribute into string I know this is really basic javascript but I'm really not so familiar with javascript.
What I'm trying here is to add prettyPhoto arguments where I want to be. First I get href attribute from link, then I convert it to string, then I take last 4 letters to check is it link to image or to some HTML page. And this code works fine but still my Firebug sends me an error:
TypeError: $hrefy is undefined
txt = $hrefy.toString();

How script can work if $hrefy is not defined and how to define it well. This error blocks only javascript code for filtering my portfolio, while other js work fine.
$(document).ready(function(){
$("a[data-rel^='prettyPhoto']").prettyPhoto();

$hrefy = $("article a").has('img').attr("href");
txt = $hrefy.toString();
var lastChar = txt.substr(txt.length - 4);
if (lastChar=='.jpg') {
    $('article a').has('img').attr('data-rel', 'prettyPhoto');
}

$('a img').click(function () {
    var desc = $(this).attr('title');
    $('a').has('img').attr('title', desc);
});

});

A: After looking into the source of the page you've linked, I've noticed that there is no <article> element declared anywhere. So, your jquery selector does not return anything and attr('href') is undefined.


text:
Q: HTML button moves aftter being clicked on I have 9 buttons looks like below:

However if I click on the button on top left, it becomes:

I am really not sure why it moves when being clicked on and where the extra spaces are coming from.
Below is the sample code:

var buttons = document.querySelectorAll("button");
buttons.forEach((b) => {
  b.addEventListener("click", onClick);
})

function onClick(event) {
    if(event.target) {
        event.target.innerText = "X";
    }
}
.board {
    margin: 50px auto;
    width: fit-content;
}

button {
    width: 100px;
    height: 100px;
    cursor: pointer;
    background: none;
}
<!DOCTYPE html>

  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>

    <button></button>
    <button></button>
    <button></button>

    <button></button>
    <button></button>
    <button></button>

    <button></button>
    <button></button>
    <button></button>

A: The default vertical-align: baseline is causing that. bottom fixes that issue.

var buttons = document.querySelectorAll("button");
buttons.forEach((b) => {
  b.addEventListener("click", onClick);
})

function onClick(event) {
    if(event.target) {
        event.target.innerText = "X";
    }
}
.board {
    margin: 50px auto;
    width: fit-content;
}

button {
    width: 100px;
    height: 100px;
    cursor: pointer;
    background: none;
    vertical-align: bottom; /* Add this */
}
<!DOCTYPE html>

  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>

    <button></button>
    <button></button>
    <button></button>

    <button></button>
    <button></button>
    <button></button>

    <button></button>
    <button></button>
    <button></button>

A: Buttons by default have a display property of inline-block. That can sometimes lead to funky things based on the baseline of the text.
Try adding a {display: block} to your buttons. Or maybe a {display: flex}
button {
  display: flex;
}


text:
Q: Double invoice for same order error I have a weird problem with a small amount of my orders where there are 2 invoices being created for the same order.
There seems to be no correlation between the orders this is happening to. Different payment systems etc.
First of all, how should I resolve this in the admin section? Should I just create a credit memo for the order so 1 invoice is begin cancelled? I think this would mess up the stock count etc?
Second, any idea what might be causing this? Might I have configured the preferences wrong somewhere?
Extra information: I am using Magento 1.7 and am using the MultiSafepay - Gateways - 2.0.2 module. The option to automatically generate an invoice after payment has been ACTIVATED.

A: To resolve this in the admin just make credit memos of the duplicate invoices and make sure to fill out 0 as the quantity to return to stock.
As to debugging this: found out who is creating these invoices. It's probably some Payment Service Provider or payment module so start by adding some logging in that module or contacting the company that gave you the module


text:
Q: How to create a single navigation menu in wordpress multisite network How to create a single/main navigation menu having menu of all the network sites in wordpress multisite in the front/User side.
Like I have a page of administration in my mother site and also in the child sites, then how can I group a menu Admin with sub-menu administration of site1, administration of site2 and all...
I have tried, 2-3 codes like this

//store the current blog_id being viewed global $blog_id;
  $current_blog_id = $blog_id;
//switch to the main blog which will have an id of 1
  switch_to_blog(1);
wp_nav_menu();
//output the WordPress navigation menu //wp_nav_menu( array('menu' =>
  'homepagemenu' ));
//wp_nav_menu( //array( 'theme_location' => 'homepagemenu' ) //); //
  //
//switch back to the current blog being viewed
  switch_to_blog($current_blog_id);

A: You could tinker with the main function of this plugin: http://wordpress.org/plugins/hyper-admins/ however it adds a menu of your sites to the admin bar, not to the frontend.
First, you should create a site-specific-plugin, with a function to load the sites in your network:
function all_the_sites_menu() {
if ( ! is_super_admin() )
    return;

// Get all blog ids
global $wpdb;

$blog_ids = $wpdb->get_col( $wpdb->prepare( "
    SELECT blog_id
    FROM {$wpdb->blogs}
    WHERE site_id = %d
    AND spam = '0'
    AND deleted = '0'
    AND archived = '0'
    ORDER BY registered DESC
", $wpdb->siteid ) );

    echo '
'; //start the list

foreach ( $blog_ids as $blog_id ) {
    $blog_id = (int) $blog_id;
    $blog = get_blog_details( $blog_id );
    echo '
siteurl . $blog->path .'">';
            echo $blog->blogname . '
';
}

    echo '
'; //end the list

}

Then you could insert a tag into your theme to output the list, like this:
<?php all_the_sites_menu(); ?>


text:
Q: Differences between encrypting an actual PC vs a virtual one? Are there any differences between using for example TrueCrypt to encrypt the system drive of an actual PC and a virtual one running on ESXi?
Are there any security advantages/differences?


text:
Q: Reordering Chart Data Series How does one reorder series used to create a chart in Excel?
For example, I go to the chart, right click > Select Data. In the left column I see series 1, series 2, to series n.
Say, I want to move series 3 after series 4, can it be done from chart view? I don't want to move the data cells in the worksheet.
I'm using Excel 2011 (mac OS X).

A: Select a series and look in the formula bar. The last argument is the plot order of the series. You can edit this formula just like any other, right in the formula bar.
For example, select series 4, then change the 4 to a 3.

A: See below
Use the below code, If you are using excel 2007 or 2010 and want to reorder the legends only. Make sure mChartName matched with your chart name.
Sub ReverseOrderLegends()

mChartName = "Chart 1"
Dim sSeriesCollection As SeriesCollection
Dim mSeries As Series
With ActiveSheet
    .ChartObjects(mChartName).Chart.SetElement (msoElementLegendNone)
    .ChartObjects(mChartName).Chart.SetElement (msoElementLegendRight)
    Set sSeriesCollection = .ChartObjects(mChartName).Chart.SeriesCollection
    For Each mSeries In sSeriesCollection
        If mSeries.Values(1) = 0.000000123 Or mSeries.Values(1) = Empty Then
            mSeries.Delete
        End If
    Next mSeries

    LegendCount = .ChartObjects(mChartName).Chart.SeriesCollection.Count
    For mLegend = 1 To LegendCount
        .ChartObjects(mChartName).Chart.SeriesCollection.NewSeries
        .ChartObjects(mChartName).Chart.SeriesCollection(LegendCount + mLegend).Name = .ChartObjects(mChartName).Chart.SeriesCollection(LegendCount - mLegend + 1).Name
        .ChartObjects(mChartName).Chart.SeriesCollection(LegendCount + mLegend).Values = "={0.000000123}"
        .ChartObjects(mChartName).Chart.SeriesCollection(LegendCount + mLegend).Format.Fill.ForeColor.RGB = .ChartObjects(mChartName).Chart.SeriesCollection(LegendCount - mLegend + 1).Format.Fill.ForeColor.RGB
    Next mLegend

    For mLegend = 1 To LegendCount
        .ChartObjects(mChartName).Chart.Legend.LegendEntries(1).Delete
    Next mLegend
End With
End Sub

A: Excel 2010 - if you're looking to reorder the series on a pivot chart:

*

*go to your underlying pivot table

*right-click on one of the Column Labels for the series you're looking to adjust (Note: you need to click on one of the series headings (i.e. 'Saturday' or 'Sunday' in the example shown below) not the 'Column Labels' text itself)

*in the pop-up menu, hover over 'Move' and then select an option from the resulting sub-menu to reposition the series variable.

*your pivot chart will update itself accordingly

A: Right-click any series on the chart. In the "Format Data Series" dialog, there is a "Series Order" tab, in which you can move series up and down. I find this much easier than fiddling with the last argument of the series formula.
This is in Excel 2003 in Windows. There is a similar dialog in Excel 2011 for Mac:

A: FYI, if you are using two y-axis, the order numbers will only make a difference within the set of series of that y-axis. I believe secondary -y-axis by default are on top of the primary. If you want the series in the primary axis to be on top, you'll need to make it secondary instead.

A: To change the stacking order for series in charts under Excel for Mac 2011:

*

*select the chart,

*select the series (easiest under Ribbon>Chart Layout>Current Selection),

*click Chart Layout>Format Selection or Menu>Format>Data Series …,

*on popup menu Format Data Series click Order, then click individual series and click Move Up or Move Down buttons to adjust the stacking order on the Axis for the subject series. This changes the order for the plot and for the legend, but may not change the order number in the Series formula.

I had a three series plot on the secondary axis, and the series I wanted on top was stuck on the bottom in defiance of the Move Up and Move Down buttons. It happened to be formatted as markers only. I inserted a line, and presto(!), I could change its order in the plot. Later I could remove the line and sometimes it could still be ordered, but sometimes not.

A: These are the buttons UP/DOWN

A: To change the sequence of a series in Excel 2010:

*

*Select (click on) any data series and click the "Design" tab in the "Chart Tools" group.

*Click "Select Data" in the "Data" group and in the pop-up window, highlight the series to be moved.

*Click the up or down triangle at the top of the left hand box labeled "Legend Entries" (Series).

A: This function gets the series names, puts them into an array, sorts the array and based on that defines the plotting order which will give the desired output.
Function Increasing_Legend_Sort(mychart As Chart)

    Dim Arr()
    ReDim Arr(1 To mychart.FullSeriesCollection.Count)

        'Assigning Series names to an array
        For i = LBound(Arr) To UBound(Arr)
        Arr(i) = mychart.FullSeriesCollection(i).Name
        Next i

        'Bubble-Sort (Sort the array in increasing order)
        For r1 = LBound(Arr) To UBound(Arr)
            rval = Arr(r1)
                For r2 = LBound(Arr) To UBound(Arr)
                    If Arr(r2) > rval Then 'Change ">" to "<" to make it decreasing
                        Arr(r1) = Arr(r2)
                        Arr(r2) = rval
                        rval = Arr(r1)
                    End If
                Next r2
        Next r1

    'Defining the PlotOrder
    For i = LBound(Arr) To UBound(Arr)
    mychart.FullSeriesCollection(Arr(i)).PlotOrder = i
    Next i

End Function


text:
Q: how do I access a character from 2-D char string #include <stdio.h>
#include <string.h>
#define max 50
#define len 30
char text[max][len];
void main(){
    register int i;
    printf("Enter an empty line to quit\n");
    for(i =0 ;i<max;i++){
        gets(text[i]);
        if(!*text[i]){break;}
    }
puts(text[1][0]);/*I want to display first character of second string but it doesn't print anything. Why??*/
}

how do i access character or part of string from array of string

A: In your code, puts(text[1][0]) is trying to print a text[1][0] which is a char, and puts only accepts an char*, leading to a segmentation fault on my computer.
But, printf allows you to print an char.
Fixed code:
#include <stdio.h>
#include <string.h>
#define max 50
#define len 30
char text[max][len];
void main(){
    register int i;
    printf("Enter an empty line to quit\n");
    for(i =0 ;i<max;i++){
        gets(text[i]);
        if(!*text[i]){break;}
    }
printf("%c\n", text[1][0]); /* printf allows you to print char */
}

Note: as said in the comments of the question, you can also use putchar() to print one character.
Input:
s
s

Output:
s

A: For starters according to the C Standard the function main without parameters shall be declared like
int main( void )

The function gets is unsafe and is not supported by the C Standard. Instead use standard C function fgets.
The function puts expects an argument of the pointer type char * that points to a string. However you are passing an object of the type char
puts(text[1][0]);

that invokes undefined behavior.
Also declare variables in minimum scope where they are used. There is no great sense to declare the array text in the file scope.
The program can look the following way
#include <stdio.h>

#define MAX 50
#define LEN 30

int main( void )
{
    char text[MAX][LEN] = { 0 };

    puts( "Enter an empty line to quit" );

    size_t i = 0;

    while ( i < MAX && fgets( text[i], LEN, stdin ) != NULL && text[i][0] != '\n' )
    {
        ++i;
    }

    if ( !( i < 2 ) ) printf( "%c\n", text[1][0] );
}

Pay attention to that the function fgets can store the new line character '\n' in the suppled array.
If you want to remove it then you can write for example
#include <string.h>

//...

text[i][ strcspn( text[i], "\n" ) ] = '\0';


text:
Q: how to know if it's email or username inputed Hello everyone i want to ask question my html form, requires to input username/Email that you can put.
Then it searches by username or email if in database that account exists if yes process.
The script works, but only with email.
My problem is how to identify in input field is the user written an username or email? Now it checks both but for some reason it dosen't detect username only email typed.
function getUserEmailExist( $input )
    {
    global $database;

        if( preg_match( '/^[a-z0-9]+([_\\.-][a-z0-9]+)*@([a-z0-9]+([\.-][a-z0-9]+)*)+\\.[a-z]{2,}$/i', $input ) ) {
            $type = 2;
            $get = $database->checkExistRecovery( $input, $type );
        }

        if( preg_match( '/[^0-9A-Za-z]/', $input ) ) {
            $type = 1;
            $get = $database->checkExistRecovery( $input, $type );
        }

        if( $get ) {
            $this->updateRecover( $input, $type );
        } else {
            return false;
        }
    }

A: You need to move your email if statement below.
Because if the input is an email, it's going to match the second preg match anyway.
So you're overwriting your $type variable.
Fixed.
    function getUserEmailExist( $input )
    {
        global $database;

        if( preg_match( '/[A-Za-z0-9]+/', $input ) ) {
            $type = 1;
            $get = $database->checkExistRecovery( $input, $type );
        }

if( preg_match( '/^[a-z0-9]+([_\\.-][a-z0-9]+)*@([a-z0-9]+([\.-][a-z0-9]+)*)+\\.[a-z]{2,}$/i', $input ) ) {
            $type = 2;
            $get = $database->checkExistRecovery( $input, $type );
        }

        if( $get ) {
            $this->updateRecover( $input, $type );
        } else {
            return false;
        }
    }

A: I think you want your second regex to be /[A-Za-z0-9]+/. You are currently looking for anything that doesn't contain those characters.

A: Why do you care about all that validation logic?  I can't see your actual DB queries, but it seems you could easily do something like this:
SELECT * FROM users
WHERE email = ? OR username = ?

Where ? would be the email or username value.


text:
Q: How to test difference between two groups of data in one line Usually, we can test difference of two groups of data by adding the dummy variable. But my question is, if these two groups of data in the same line, but they concentrate at the different part of this line. Is there any way we can test difference?
For example,in group one, our data set is $(x_{1i},y_{1i})$, in group two, our data set is $(x_{2j},y_{2j})$. Both of the groups can regress to the same line $y=a+bx$,where $a$ and $b$ are constant. But in group one $x_{1i}\in(1,3)$, in group two $x_{2j}\in(6,7)$. Thus if we plot group one and group two together, we can see they centralize to different part of line $y=a+bx$. Apparently, dummy variable does not work well here. So is there test can show the difference?
Thanks.


text:
Q: Optimizing nested RSpec contexts and examples I really like the self-documenting nature of RSpec tests so I often create many nested contexts and examples in order to clarify the intent of the tested objects and the situation in which they are being tested, like in this simplified example:
RSpec.describe Foo do
  ... some let definitions ...

  context 'when used properly' do
    before do
      something_expensive_to_calculate
    end

    it 'is successful' do
      ...
    end

    it 'has benefits' do
      ....
    end

    it 'has the power to change the world' do
      ...
    end
  end

  context 'in evil hands' do
    ... more nested contexts and examples ...
  end
end

Such approach, however, seems to repeat the setup phase for each of the examples and because of that slows the tests down considerably.
The question is whether there are some patterns which allow to add a documentation text to a group of assertions (like I use 'it'), but which would not set up the context as 'it' does.
I found before(:all) blocks. Unfortunately let variables cannot be used in them and so it is not a solution for me. Another solution would be let variables with context lifetimes, but it seems there is no such thing in RSpec.

A: I'm unsure if I properly understand your question but perhaps what you are looking for is the subject syntax ?
RSpec.describe Foo do
  ... some let definitions ...
  context 'when used properly' do
     subject { do_some stuff }

     it 'whatever' do
       expect(something).to_not eq true
       expect(subject).to eq false
     end
  end
end

The subject clause allows you to take a series of actions relating to something you are trying to test and re-use the actions inside the subject clause over and over again.

A: TestProf has something that you seem to need https://test-prof.evilmartians.io/#/recipes/let_it_be
let_it_be(:foo) { very_expensive_setup }

Which would instantiate the :foo once and keep its state for all the examples.
Make sure you also ready through caveates as this is not just simply better let


text:
Q: Database Design approach with many 'chained' Tables I want to create a database to store the fictional 'universe creation attempts'. My first idea was to break down the structure and I ended up with these tables. But when I viewed the tables as a diagram it suddenly looked like a bad approach :(. Now I want to ask for guidance if my approach is correct or if there is a better design pattern to create the structure I intend to create.
I was searching for information but I didnt get far with the term 'chained' or the infomation I found didnt really help me in finding an answer. Maybe I am using the wrong term for my search.
DROP TABLE IF EXISTS galactic_department CASCADE;
CREATE TABLE galactic_department (
    id serial UNIQUE PRIMARY KEY,
    code text
);

DROP TABLE IF EXISTS researcher CASCADE;
CREATE TABLE researcher (
    id serial UNIQUE PRIMARY KEY,
    galactic_department_id bigint REFERENCES galactic_department (id),
    code text,
    galactic_name text,
    galactic_phone text,
    galactic_email text
);

DROP TABLE IF EXISTS experiment CASCADE;
CREATE TABLE experiment (
    id serial UNIQUE PRIMARY KEY,
    creation_attampt_id text,
    conditions text,
    creation_success boolean,
    researcher_id bigint REFERENCES researcher (id),
    universe_id bigint REFERENCES universe (id)
);

DROP TABLE IF EXISTS universe CASCADE;
CREATE TABLE universe (
    id serial UNIQUE PRIMARY KEY,
    name text
);

DROP TABLE IF EXISTS cluster CASCADE;
CREATE TABLE cluster (
    id serial UNIQUE PRIMARY KEY,
    universe_id bigint REFERENCES universe (id),
    name text
);

DROP TABLE IF EXISTS galaxy CASCADE;
CREATE TABLE galaxy (
    id serial UNIQUE PRIMARY KEY,
    cluster_id bigint REFERENCES cluster (id),
    name text
);

DROP TABLE IF EXISTS star CASCADE;
CREATE TABLE star (
    id serial UNIQUE PRIMARY KEY,
    galaxy_id bigint REFERENCES galaxy (id),
    name text
);

DROP TABLE IF EXISTS planet CASCADE;
CREATE TABLE planet (
    id serial UNIQUE PRIMARY KEY,
    star_id bigint REFERENCES star (id),
    name text
);

DROP TABLE IF EXISTS planet_moon CASCADE;
CREATE TABLE planet_moon (
    id serial UNIQUE PRIMARY KEY,
    planet_id bigint REFERENCES planet (id),
    name text
);

DROP TABLE IF EXISTS lifeform CASCADE;
CREATE TABLE lifeform (
    id serial UNIQUE PRIMARY KEY,
    planet_id bigint REFERENCES planet (id),
    name text
);

DROP TABLE IF EXISTS lifeform_water CASCADE;
CREATE TABLE lifeform_water (
    id serial UNIQUE PRIMARY KEY,
    lifeform_id bigint REFERENCES lifeform (id),
    fin_count text
);

DROP TABLE IF EXISTS lifeform_ground CASCADE;
CREATE TABLE lifeform_ground (
    id serial UNIQUE PRIMARY KEY,
    lifeform_id bigint REFERENCES lifeform (id),
    leg_count text
);

DROP TABLE IF EXISTS lifeform_air CASCADE;
CREATE TABLE lifeform_air (
    id serial UNIQUE PRIMARY KEY,
    lifeform_id bigint REFERENCES lifeform (id),
    wing_count text
);

The schema looks like:

A: I'm a database designer and programmer, and it looks good to me. I'm not quite sure if the department, researcher, experiment are right but the galaxy and related tables look fine. I would need to understand a little more about how this all works together...but you're definitely on the right track.


text:
Q: Button not on the right side of text input since jquery mobile 1.2.0 After upgrading to jquery mobile 1.2.0 I can't put the button on the right side of the text input field.
<div data-role="fieldcontain">
        <fieldset data-role="controlgroup" data-type="horizontal">
             <input type="text" data-inline="true"/>
             <button data-inline="true" data-theme="b">Send</button>
         </fieldset>
</div>

A: I fixed that removing the data-type="horizontal" and added a class with style="float: right;" to the button.


text:
Q: Pagina en blanco al crear tabla Tengo una query que en los logs del servidor web me aparece lo siguiente y no me muestra nada en el Navegador:

PHP Warning:  mysql_fetch_array() expects parameter 1 to be resource, boolean given

El codigo que tengo es el siguiente:
 <?php
 include("conn.php");

$result = mysql_query("SELECT name, COUNT(IF(stat='open',1, NULL)) 'open',
       COUNT(IF(stat='close',1, NULL)) 'close',
       COUNT(IF(stat='all',1, NULL)) 'all',
       COUNT(IF(stat='reopen',1, NULL)) 'reopen',
       COUNT(IF(stat='finish',1, NULL)) 'finish'
FROM dashboard group by name order by name = 'Party' desc");

 while($test = mysql_fetch_array($result))
 {
 $id = $test['id'];
 echo"".$test['name']."	";
 echo"".$test['open']."	";
 echo"".$test['close']."	";
 echo"".$test['all']."	";
 echo"".$test['reopen']."	";
 echo"".$test['finish']."	";
 echo "
";
 }
 mysql_close($conn);
 ?>

mientras que si pongo la siguiente query si me aparecen datos:
 $result = mysql_query("SELECT * FROM dashboard");

Que me está fallando?
La query funciona si la ejecuto en la consola:
+----------+------+-------+-----+--------+--------+
| name     | open | close | all | reopen | finish |
+----------+------+-------+-----+--------+--------+
| Party    |   21 |     0 |   0 |      0 |      0 |
| Party1   |    0 |     0 |   0 |      0 |      0 |
| Party2   |    0 |     0 |   0 |      0 |      0 |
| Party3   |    2 |     0 |   0 |      0 |      0 |
+----------+------+-------+-----+--------+--------+

actualizo con datos de la tabla:
+-------------+--------------+------+-----+---------+----------------+
| Field       | Type         | Null | Key | Default | Extra          |
+-------------+--------------+------+-----+---------+----------------+
| id          | int(11)      | NO   | PRI | NULL    | auto_increment |
| name        | varchar(50)  | YES  |     | NULL    |                |
| description | varchar(200) | YES  |     | NULL    |                |
| stat        | varchar(20)  | YES  |     | NULL    |                |
+-------------+--------------+------+-----+---------+----------------+

En el momento que aparece el error Unknown column 'stat' in 'field list' valido que si existe:
MariaDB [rt2]> select stat from dashboard where stat = 'finish' limit 1;
+---------+
| stat    |
+---------+
| finish  |
+---------+
1 row in set (0.01 sec)


text:
Q: Force JAX-RS to serialize my class to a JSON object I have class which is a decorator around an inner list. I would like to use this class as a DTO in my JAX-RS service. Its code as follows:
@XmlRootElement(name = "movies")
public class MoviesResponse implements List<Movie> {

    @XmlElement(name = "movie")
    protected List<Movie> movies;

    /* tons of delegate methods */

}

I need to support both application/xml, and application/json.
The format is fixed, it has to be like
<movies>
 <movie>
  <foo />
 </movie>
 <movie>
  <foo />
 </movie>
</movies>

... in XML, and
{
 "movie": [
 {},{}
 ]
}

...in JSON.
XML works perfectly fine, but JSON looks like this:
[{},{}]

As you may suspect, if I don't implement the List interface, it generates the the format I need. So I guess the serializer is being smart and treating it as List thus serializing it into an array. But I need to serialize it into an object. How can I do this, implementing the List interface?

A: Assuming Jackson is your serializer, you could configure the ObjectMapper to WRAP_ROOT_VALUE. You would do that in the ContextResolver. So that the same configuration is not used for all types, you can use two different configured ObjectMappers, one for the list class, and one for the rest. For example
@Provider
public class ObjectMapperContextResolver implements ContextResolver<ObjectMapper> {

    final ObjectMapper listMapper = new ObjectMapper();
    final ObjectMapper defaultMapper = new ObjectMapper();

    public ObjectMapperContextResolver() {
        listMapper.configure(SerializationFeature.INDENT_OUTPUT, true);
        listMapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);

        listMapper.registerModule(new JaxbAnnotationModule());
        defaultMapper.registerModule(new JaxbAnnotationModule());
    }

    @Override
    public ObjectMapper getContext(Class<?> type) {
        if (type == MovieList.class) {
            return listMapper;
        }
        return defaultMapper;
    }
}

The MessageBodyWriter used for marshalling will call the getContext method, passing in the class it's trying to marshal. Based on the the result, that is the ObjectMapper that will be used. What WRAP_ROOT_VALUE does, is wrap the root value in a object, with the name being the value in @JsonRootName or @XmlRootElement (given JAXB annotation support is enabled- see here)
Test:
@Path("/movies")
public class MovieResource {

    @GET
    @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
    public Response getMovieList() {
        MovieList list = new MovieList();
        list.add(new Movie("I Origins"));
        list.add(new Movie("Imitation Game"));
        return Response.ok(list).build();
    }
}

C:\>curl -v -H "Accept:application/json" http://localhost:8080/api/movies
Result:
{
    "movies" : [ {
      "name" : "I Origins"
    }, {
      "name" : "Imitation Game"
    } ]
  }

UPDATE
So I noticed you have the list as being protected. Maybe you might later want to extend the MovieList class. In which case, this
if (type == MovieList.class) {
    return listMapper;
}

would bot be viable. You would instead need to check is the type isAssignableFrom
if (MovieList.class.isAssignableFrom(type)) {
    return listMapper;
}


text:
Q: iPhone Synchronizing SQLite with Windows Server Database Background information:
I have been building an App that allows users to interact with each other, post comments/images for the App etc and these all information gets displayed on my App's FanWall screen. I am getting users information using their FaceBook authentication through FBConnect.
To update fanwall screen efficiently, I want to have a local SQLite database for my App that contains userId, his profile image, his comments for my App etc. I have all these info in my SQL server database but not sure how to synchronize this info with iPhone's SQLite database.
My problems:
I am using ASIHTTPRequest to query my SQL database and it can return whole table as Array of C# .NET class. The things that I couldn't understand is;

*

*how to parse this C# .NET class using Objective-c to fetch each class object that is corresponds to each row.

*I can then update my local SQLite using this object information but what could be best way to update only rows that are changed? Ideally I should be able to get only required rows from SQL server Database so that I just need to insert them in SQLite. I saw this post but not much helpful for my problem. Just wondering if there is any tool out there that can do this synchronization? I can have tables exactly same on SQL Server and SQLite.

Please let me know your thought on this.
Thanks.

A: I'm working on a similar problem.  How to keep in sync a remote database with a local database.  Either end could add or update rows.  The solution seems to be to keep a column in each table called lastModifiedDate.  This column is set on the server so there will be uniform time.
Periodically, connect to the server and request all rows greater than your local lastModifedDate to  get updates and adds.  Also, when you push your local changes to the server, the server should modify the lastModifiedDate for uniformity.
I haven't seen a framework for something like this.


text:
Q: is there a way to get directions in mkmapview using a built in apple API? I know google maps are known to be the best maps out there, but i dont want to have to download a bunch of extra libraries and all that. I'd prefer to do something quick and simple to get a quick route from point A to B and be done with it. Is there a way to do this with built in functions/libraries? Can somebody point me in the right direction?
EDIT
I'm not trying to get turn by turn directions or anything in my case, i just want to draw a line from start to finish. maybe give options about which routes to take. Is there a way to do it or no?

A: In iOS 7, you can get and display directions using MKDirectionsRequest.
Here's some sample code for displaying directions from the current location to another map item:
MKDirectionsRequest *request = [[MKDirectionsRequest alloc] init];
[request setSource:[MKMapItem mapItemForCurrentLocation]];
[request setDestination:myMapItem];
[request setTransportType:MKDirectionsTransportTypeAny]; // This can be limited to automobile and walking directions.
[request setRequestsAlternateRoutes:YES]; // Gives you several route options.
MKDirections *directions = [[MKDirections alloc] initWithRequest:request];
[directions calculateDirectionsWithCompletionHandler:^(MKDirectionsResponse *response, NSError *error) {
    if (!error) {
        for (MKRoute *route in [response routes]) {
            [myMapView addOverlay:[route polyline] level:MKOverlayLevelAboveRoads]; // Draws the route above roads, but below labels.
            // You can also get turn-by-turn steps, distance, advisory notices, ETA, etc by accessing various route properties.
        }
    }
}];

If you're new to iOS 7, you'll need to implement the mapView:rendererForOverlay: method for any overlay to appear. Something like:
- (MKOverlayRenderer *)mapView:(MKMapView *)mapView rendererForOverlay:(id<MKOverlay>)overlay
{
    if ([overlay isKindOfClass:[MKPolyline class]]) {
        MKPolylineRenderer *renderer = [[MKPolylineRenderer alloc] initWithOverlay:overlay];
        [renderer setStrokeColor:[UIColor blueColor]];
        [renderer setLineWidth:5.0];
        return renderer;
    }
    return nil;
}

A: Swift version
        let request = MKDirectionsRequest();
        request.source = MKMapItem.mapItemForCurrentLocation();
        let locationPlacemark = MKPlacemark(coordinate: CLLocationCoordinate2DMake(13.724362, 100.515342), addressDictionary: nil);
        request.destination = MKMapItem(placemark: locationPlacemark);
        request.transportType = MKDirectionsTransportType.Any;
        request.requestsAlternateRoutes = true;
        let directions = MKDirections(request: request);

        directions.calculateDirectionsWithCompletionHandler ({
            (response: MKDirectionsResponse?, error: NSError?) in
            print(response?.description)
            print(error?.description)
            guard let response = response else {
                //handle the error here
                return;
            }
            self.myRoute = response.routes[0]
            self.mkMapView.addOverlay(self.myRoute!.polyline)
        });

and its delegate
        func mapView(mapView: MKMapView, rendererForOverlay overlay: MKOverlay) -> MKOverlayRenderer {
        let myLineRenderer = MKPolylineRenderer(polyline: (self.myRoute?.polyline)!)
        myLineRenderer.strokeColor = UIColor.redColor()
        myLineRenderer.lineWidth = 3
        return myLineRenderer
        }

A: Another possibility is to send the address to the Apple Maps app. I just saw this done in a professional setting and that was the chosen method.

A: if you want show a Alert Dialog when you tapped in a Pin make this:
- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view     calloutAccessoryControlTapped:(UIControl *)control {
[mapView deselectAnnotation:view.annotation animated:YES];

    if ([view.annotation isKindOfClass:[PinOfProject class]])
    {
        CLLocationCoordinate2D coordinate = [view.annotation coordinate];
        MKPlacemark *placemark = [[MKPlacemark alloc] initWithCoordinate:coordinate addressDictionary:nil];
        MKMapItem *mapitem = [[MKMapItem alloc] initWithPlacemark:placemark];
        self.mapItem = mapitem;

        CGPoint pin = [mapView convertCoordinate:view.annotation.coordinate toPointToView:self.view];
        CGRect rec = CGRectMake(pin.x-13, pin.y-14,view.frame.size.width,view.frame.size.height);

        [self showAlertInformationForTrash:rec];

    }
}

-(void)showAlertInformationForTrash:(CGRect)rec{

    UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Show Route?" delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:@"Route", @"Cancel", nil];
    actionSheet.tag = 1;
    [actionSheet showFromRect:rec inView:self.view animated:YES];
}

- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
    if (buttonIndex == 0) {
        [self showRouteToAnnotation];
    }
}

-(void)showRouteToAnnotation{
    MKMapItem *myMapItem = self.mapItem;
    MKDirectionsRequest *request = [[MKDirectionsRequest alloc] init];
    [request setSource:[MKMapItem mapItemForCurrentLocation]];
    [request setDestination:myMapItem];
    [request setTransportType:MKDirectionsTransportTypeAutomobile]; // This can be limited to automobile and walking directions.
    [request setRequestsAlternateRoutes:NO]; // Gives you several route options.
    MKDirections *directions = [[MKDirections alloc] initWithRequest:request];
    [directions calculateDirectionsWithCompletionHandler:^(MKDirectionsResponse *response, NSError *error) {
        if (!error) {
            for (MKRoute *route in [response routes]) {
                [self.mapView addOverlay:[route polyline] level:MKOverlayLevelAboveRoads]; // Draws the route above roads, but below labels.
                for (int i = 0; i < route.steps.count; i++) {
                    MKRouteStep *step = [route.steps objectAtIndex:i];
                    NSString *newStep = step.instructions;
                    NSLog(@"%@", newStep);
                }
            }
        }
    }];
}

- (MKOverlayRenderer *)mapView:(MKMapView *)mapView rendererForOverlay:(id<MKOverlay>)overlay
{
    if ([overlay isKindOfClass:[MKPolyline class]]) {
        MKPolylineRenderer *renderer = [[MKPolylineRenderer alloc] initWithOverlay:overlay];
        [renderer setStrokeColor:[UIColor blueColor]];
        [renderer setLineWidth:5.0];
        return renderer;
    }
    return nil;
}

*

*Oh, but note that i make a property in my .h
@property (strong, nonatomic)MKMapItem *mapItem;


text:
Q: Parallel.For with 64-bit unsigned indexes (UInt64) In C#, there's a System.Threading.Tasks.Parallel.For(...) which does the same as a for loop, without order, but in multiple threads.
The thing is, it works only on long and int, I want to work with ulong. Okay, I can typecast but I have some trouble with the borders.
Let's say, I want a loop from long.MaxValue-10 to long.MaxValue+10 (remember, I'm talking about ulong). How do I do that?
An example:
for (long i = long.MaxValue - 10; i < long.MaxValue; ++i)
{
    Console.WriteLine(i);
}
//does the same as
System.Threading.Tasks.Parallel.For(long.MaxValue - 10, long.MaxValue, delegate(long i)
{
    Console.WriteLine(i);
});
//except for the order, but theres no equivalent for
long max = long.MaxValue;
for (ulong i = (ulong)max - 10; i < (ulong)max + 10; ++i)
{
    Console.WriteLine(i);
}

A: You can always write to Microsoft and ask them to add Parallel.For(ulong, ulong, Action<ulong>) to the next version of the .NET Framework. Until that comes out, you'll have to resort to something like this:
Parallel.For(-10L, 10L, x => { var index = long.MaxValue + (ulong) x; });

A: Or you can create a custom range for Parallel.ForEach
public static IEnumerable<ulong> Range(ulong fromInclusive, ulong toExclusive)
{
  for (var i = fromInclusive; i < toExclusive; i++) yield return i;
}

public static void ParallelFor(ulong fromInclusive, ulong toExclusive, Action<ulong> body)
{
  Parallel.ForEach(
     Range(fromInclusive, toExclusive),
     new ParallelOptions { MaxDegreeOfParallelism = 4 },
     body);
}

A: This will work for every long value from long.MinValue inclusive to long.MaxValue exclusive
Parallel.For(long.MinValue, long.MaxValue, x =>
{
    ulong u = (ulong)(x + (-(long.MinValue + 1))) + 1;
    Console.WriteLine(u);
});


text:
Q: Binary Input Validator in Angular (TypeScript) Using typescript, i am trying to ensure that an input field only takes binary (0 and 1).
My html
<div>
     <input type="text" (keypress) = "binaryValidate($event)">
</div>

My ts
binaryValidate(evt: number) {
    if (evt === 1 ) {
        return true;
    } else if (evt === 0) {
        return true;
    } else {
        return false;
    }
}

for some reason it only returns false.

A: Event is not not a number, but KeyboardEvent. What you're looking for is testing its key:
binaryValidate(evt: KeyboardEvent) {
  const value = evt.key;
  return value === "1" || value === "0";
}

Try on codesabdbox


text:
Q: How to create username on stackoverflow.com? I have a signup page on my website where a user must provide a email address and password only.
I want to be able to create a username for this user automatically by using the first part of the email provided;
User supplies maruf@randomdomain.com, i want to make username 'mostasinmaruf'
I don't need explanation on how to create form or submission of data to database, just the code to extract data from email provided, and if necessary, if duplicate occurs add number to end.
Hope this makes sense, seems like a basic function but couldn't find examples of it anywhere on net!


text:
Q: Как менять дату на MacOS monterey через терминал? Пишу небольшую утилиту для себя и хочу поменять дату на маке. Команды "date 120520302021" или "sudo ntpdate -u time.apple.com" не работают. На первую пишет "date: settimeofday (timeval): Operation not permitted", а на вторую "sudo: ntpdate: command not found", причём время надо менять как на конкретное так и с сервера apple например(как во второй команде). На мак пересел совсем недавно и команд консоли толком не знаю, буду очень благодарен, если кто подскажет. Заранее большое спасибо)

A: Чтобы изменить текущую дату, используйте sudo и год в двузначном формате
sudo date 1205203021

Для синхронизации времени с сервером используйте sntp, так как ntpdate недоступна в MacOS начиная с Mojave
sudo sntp -sS time.apple.com


text:
Q: Solving a definite integral with u substitution $\displaystyle{\int_0^4} x \sqrt{36-x^2}dx$
This is a pretty basic question but I have something very wrong with my idea of U substitution. So what I do is set u = $ 36-x^2 $ which then gives me $\displaystyle du =-2xdx$ So what I do next is divide by -2 and get -$\displaystyle \frac{1}{2}du = dx$ So then you need to change your bounds which would I think give you
$\displaystyle-\frac{1}{2} {\int_{36}^{20}} \sqrt{u}$ du if you plug the original bounds back into the equation for u. So I get the integral to be $\displaystyle\frac{1}{3}u^{3/2}$ after integrating. I did flip the bounds so 36 is on top and 20 is on bottom and $\displaystyle \frac{1}{2}$ becomes positive. I evaluate on the bounds and I am getting $\displaystyle \frac{216}{3}-\frac{40\sqrt{5}}{3}$ which I know to be incorrect. Where am I going wrong?
The correct answer based on my book is $\displaystyle \frac{21\sqrt{21}-5\sqrt{5}}{3}$

A: Guessing:  A study guide or a computerized grader is expecting to see $72 - \frac{40\sqrt{5}}{3}$.  But $\frac{216}{3} = 72$, so these are equivalent.


text:
Q: Intersection of distinct, primed-ordered subgroups is trivial. $H$ and $K$ are different subgroups of a group $G$ such that $o(H) = o(K) = p$ where $p$ is prime. Show that $H \cap K = \{e\}$. Deduce that if $G$ has exactly $m$ distinct subgroup of prime order $p$ then total number of elements of order $p$ is $m(p-1)$.

A: The intersection $H\cap K$ is a subgroup of $H$.
Can you make a list of all the subgroups of $H$?


text:
Q: Uncaught ReferenceError: getElementById is not defined at null:1 I am trying to get the contents of hiddenDivHL which is present in the part of the following HTML page :

http://74.127.61.106/udayavaniIpad/details.php?home=0&catid=884&newsid=123663[InnerSep]http://www.udayavani.com/udayavani_cms/gall_content/2012/1/2012_1$thumbimg120_Jan_2012_215842267.jpg[InnerSep]ಹಾಕಿ ಸರಣಿ ಗೆದ್ದ ಭಾರತ[OuterSep]http://74.127.61.106/udayavaniIpad/details.php?home=0&catid=884&newsid=123661[InnerSep]http://www.udayavani.com/udayavani_cms/gall_content/2012/1/2012_1$thumbimg120_Jan_2012_215521230.jpg[InnerSep]ಟಾಪ್-10: ಜಹೀರ್, ಸಚಿನ್ ಮಾತ್ರ...[OuterSep]http://74.127.61.106/udayavaniIpad/details.php?home=0&catid=884&newsid=123659[InnerSep]http://www.udayavani.com/udayavani_cms/gall_content/2012/1/2012_1$thumbimg120_Jan_2012_214720800.jpg[InnerSep]ಫೆಡರರ್, ನಡಾಲ್ ನಾಲ್ಕನೇ ಸುತ್ತಿಗೆ[OuterSep]http://74.127.61.106/udayavaniIpad/details.php?home=0&catid=884&newsid=123658[InnerSep]http://www.udayavani.com/udayavani_cms/gall_content/2012/1/2012_1$thumbimg120_Jan_2012_212550060.jpg[InnerSep]ಆರ್‌ಸಿಬಿಯಲ್ಲೇ ಉಳಿದ ಕ್ರಿಸ್ ಗೇಲ್[OuterSep]http://74.127.61.106/udayavaniIpad/details.php?home=0&catid=884&newsid=123657[InnerSep]http://www.udayavani.com/udayavani_cms/gall_content/2012/1/2012_1$thumbimg120_Jan_2012_212421517.jpg[InnerSep]ಎಐಟಿಎ ಧೋರಣೆಗೆ ಭೂಪತಿ ಕಿಡಿ[OuterSep]http://74.127.61.106/udayavaniIpad/details.php?home=0&catid=884&newsid=123655[InnerSep]http://www.udayavani.com/udayavani_cms/gall_content/2012/1/2012_1$thumbimg120_Jan_2012_211511413.jpg[InnerSep]ಐಪಿಎಲ್ ಹರಾಜಿನಲ್ಲಿ 183 ಆಟಗಾರರು[OuterSep]http://74.127.61.106/udayavaniIpad/details.php?home=0&catid=884&newsid=123622[InnerSep]http://www.udayavani.com/udayavani_cms/gall_content/2012/1/2012_1$thumbimg120_Jan_2012_201031107.jpg[InnerSep]ಸಾಕ್ಷಿ ಕುತ್ತಿಗೆಯಲ್ಲಿ ಮಹಿ ಟ್ಯಾಟೂ[OuterSep]http://74.127.61.106/udayavaniIpad/details.php?home=0&catid=884&newsid=123579[InnerSep]http://www.udayavani.com/udayavani_cms/gall_content/2012/1/2012_1$thumbimg120_Jan_2012_171346020.jpg[InnerSep]ಒತ್ತಡವೇನಿಲ್ಲ: ಸಾಹಾ[OuterSep]http://74.127.61.106/udayavaniIpad/details.php?home=0&catid=884&newsid=123578[InnerSep]http://www.udayavani.com/udayavani_cms/gall_content/2012/1/2012_1$thumbimg120_Jan_2012_171314597.jpg[InnerSep]ಏಶ್ಯನ್ ಶೂಟಿಂಗ್: ವಿಜಯ್‌ಗೆ ಚಿನ್ನ[OuterSep]http://74.127.61.106/udayavaniIpad/details.php?home=0&catid=884&newsid=123569[InnerSep]http://www.udayavani.com/udayavani_cms/gall_content/2012/1/2012_1$thumbimg120_Jan_2012_163014790.jpg[InnerSep]ಬಾಂಗ್ಲಾ ಲೀಗ್‌ಗಿಂತ ತವರಿನ ಸೇವೆ ಮುಖ್ಯ...[OuterSep]http://74.127.61.106/udayavaniIpad/details.php?home=0&catid=884&newsid=123656[InnerSep]http://www.udayavani.com/udayavani_cms/gall_content/2012/1/2012_1$thumbimg120_Jan_2012_212321253.jpg[InnerSep]ರಣಜಿ ಫೈನಲ್: ರಾಜಸ್ಥಾನ ಬಿಗಿ ಹಿಡಿತ[OuterSep]http://74.127.61.106/udayavaniIpad/details.php?home=0&catid=884&newsid=123568[InnerSep]http://www.udayavani.com/udayavani_cms/gall_content/2012/1/2012_1$thumbimg120_Jan_2012_162923840.jpg[InnerSep]ಅಡಿಲೇಡ್‌ನ‌ಲ್ಲಿ ಕಾದಿದೆ ಎಕ್ಸ್‌ಟ್ರಾ ಬೌನ್ಸ್, ಮೋರ್ ಗ್ರಾಸ್...[OuterSep]http://74.127.61.106/udayavaniIpad/details.php?home=0&catid=884&newsid=123631[InnerSep]http://www.udayavani.com/udayavani_cms/gall_content/2012/1/2012_1$thumbimg120_Jan_2012_202426003.jpg[InnerSep]ಹೆಜಮಾಡಿ: ಜಿಲ್ಲಾಮಟ್ಟದ ಕ್ರಿಕೆಟ್ ಪಂದ್ಯಾಟ[OuterSep]http://74.127.61.106/udayavaniIpad/details.php?home=0&catid=884&newsid=123629[InnerSep]http://74.127.61.106/udayavaniIpad/images/udayavani.png[InnerSep]ಇಂದು ಉಡುಪಿಯಲ್ಲಿ ಹೊನಲು ಬೆಳಕಿನ ವಾಲಿಬಾಲ್[OuterSep]http://74.127.61.106/udayavaniIpad/details.php?home=0&catid=884&newsid=123542[InnerSep]http://www.udayavani.com/udayavani_cms/gall_content/2012/1/2012_1$thumbimg119_Jan_2012_233254747.jpg[InnerSep]ಟೀಮ್ ಇಂಡಿಯಾ ಶಾಪಿಂಗ್; ಲಕ್ಷ್ಮಣ್ ಪ್ರ್ಯಾಕ್ಟೀಸ್[OuterSep]http://74.127.61.106/udayavaniIpad/details.php?home=0&catid=884&newsid=123541[InnerSep]http://www.udayavani.com/udayavani_cms/gall_content/2012/1/2012_1$thumbimg119_Jan_2012_233157827.jpg[InnerSep]ಪಾಕಿಸ್ಥಾನ ಜಯಭೇರಿ[OuterSep]http://74.127.61.106/udayavaniIpad/details.php?home=0&catid=884&newsid=123540[InnerSep]http://www.udayavani.com/udayavani_cms/gall_content/2012/1/2012_1$thumbimg119_Jan_2012_232902477.jpg[InnerSep]ಸಾನಿಯಾ-ವೆಸ್ನಿನಾ ದ್ವಿತೀಯ ಸುತ್ತು ಪ್ರವೇಶ[OuterSep]http://74.127.61.106/udayavaniIpad/details.php?home=0&catid=884&newsid=123539[InnerSep]http://www.udayavani.com/udayavani_cms/gall_content/2012/1/2012_1$thumbimg119_Jan_2012_232547687.jpg[InnerSep]ಹಾಕಿ: ಭಾರತದ ಕ್ಲೀನ್‌ಸ್ವೀಪ್ ಸಾಧನೆ[OuterSep]http://74.127.61.106/udayavaniIpad/details.php?home=0&catid=884&newsid=123538[InnerSep]http://www.udayavani.com/udayavani_cms/gall_content/2012/1/2012_1$thumbimg119_Jan_2012_232335163.jpg[InnerSep]ಬಾಂಗ್ಲಾ ಪ್ರೀಮಿಯರ ಲೀಗ್: ಅಫ್ರಿದಿಗೆ ಬಂಪರ್[OuterSep]http://74.127.61.106/udayavaniIpad/details.php?home=0&catid=884&newsid=123537[InnerSep]http://www.udayavani.com/udayavani_cms/gall_content/2012/1/2012_1$thumbimg119_Jan_2012_231809443.jpg[InnerSep]ಮೂರಕ್ಕೆ ನೆಗೆದ ಜೊಕೋವಿಕ್, ಸೆರೆನಾ[OuterSep]http://74.127.61.106/udayavaniIpad/details.php?home=0&catid=884&newsid=123536[InnerSep]http://www.udayavani.com/udayavani_cms/gall_content/2012/1/2012_1$thumbimg119_Jan_2012_231141100.jpg[InnerSep]ಆಸ್ಟ್ರೇಲಿಯನ್ ಓಪನ್‌ನಲ್ಲಿ ಟ್ಯಾಟೂಗಳ ಲೋಕ...[OuterSep]http://74.127.61.106/udayavaniIpad/details.php?home=0&catid=884&newsid=123531[InnerSep]http://www.udayavani.com/udayavani_cms/gall_content/2012/1/2012_1$thumbimg119_Jan_2012_230000680.jpg[InnerSep]ವೆಸ್ಟ್‌ಇಂಡೀಸ್ ವಿರುದ್ಧ ನಾನು ಬಹಳಷ್ಟು ಆಟವನ್ನು ಆನಂದಿಸಿದ್ದೇನೆ[OuterSep]http://74.127.61.106/udayavaniIpad/details.php?home=0&catid=884&newsid=123529[InnerSep]http://www.udayavani.com/udayavani_cms/gall_content/2012/1/2012_1$thumbimg119_Jan_2012_225728670.jpg[InnerSep]ಹಾಕಿ: ಭಾರತಕ್ಕೆ ಸೋಲು[OuterSep]http://74.127.61.106/udayavaniIpad/details.php?home=0&catid=884&newsid=123525[InnerSep]http://www.udayavani.com/udayavani_cms/gall_content/2012/1/2012_1$thumbimg119_Jan_2012_225325587.jpg[InnerSep]ರಾಜಸ್ಥಾನ ನೋಲಾಸ್ ಬ್ಯಾಟಿಂಗ್

using the below code:
 public class WesActivity extends Activity {

    public void onCreate(Bundle savedInstanceState) {
     super.onCreate(savedInstanceState);
     setContentView(R.layout.main);
     mWebView = (WebView) findViewById(R.id.webview);

     mWebView.loadUrl("http://74.127.61.106/udayavaniIpad/details_android.php?home=1&catid=894&newsid=28100");
     mWebView.setWebChromeClient(new MyWebChromeClient());
     mWebView.loadUrl("javascript:getElementById('hiddenDivHL')");

     }

final class MyWebChromeClient extends WebChromeClient {
    @Override
    public boolean onJsAlert(WebView view, String url, String message, JsResult result) {
        Log.d("LogTag", message);
        Toast.makeText(getApplicationContext(), message, Toast.LENGTH_LONG).show();
        result.confirm();
        return true;
       }
    }
  }

and I am getting error as:

01-21 12:22:24.660: E/Web Console(5527): Uncaught ReferenceError: getElementById is not defined at null:1
01-21 12:22:27.840: E/Web Console(5527): Uncaught ReferenceError: callTimer is not defined at http://74.127.61.106/udayavaniIpad/details_android.php?home=1&catid=894&newsid=28100:434

I have got questions,

*

*Since I have no idea whatsoever on to loading a HTML page, I want to know,is this the right way to extract the contents of HTML page?

*I have no idea about the error I am getting

A: I think it must be javascript:alert(document.getElementById('theid').innerHTML()) or something alike and it must be executed when the page is loaded fully.
Like this: In Android Webview, am I able to modify a webpage's DOM?
Of course enable JavaScript in the WebView.


text:
Q: Object doesn't support this property or method vba word The error occurs in here:
Application.Run "Macro2.Execute", param
...

Execute is a public sub i called from other Module "Macro2" installed in another template.
Upon run of the code:
IF there is NO open Word Document = No error
IF another instance of Word Document is open = Stated error occurs.
Is there any fix on this? :(
The whole code is below:
Dim objWord As Object

On Error Resume Next 'suppress error checking for the next instruction
 Set objWord = GetObject(, "Word.Application")

 If objWord Is Nothing Then
    'no instance, so make a new one
    Set objWord = CreateObject("Word.Application")
    bNewInstance = True
 End If
On Error GoTo 0 'resume error checking

'Close Document1
ActiveDocument.Close wdDoNotSaveChanges

' Open the global template
Set docAddIn = objWord.Documents.Open("C:\WordAPI\GlobalTemplate.dotm")
docAddIn.ActiveWindow.Visible = False

' Run the the public sub Execute from global template module "Macro2"
Application.Run "Macro2.Execute", param


text:
Q: Hightlight keyword when grep I have a script that highlight the keyword when I grep it and it works great.
#!/bin/bash
OUTPUT_LOG="/Sandbox/myfile/somelogs.log"
grep --color=always $1 myfile.txt

If I was to do the same thing but write the output to a file, then it doesn't work.
#!/bin/bash
OUTPUT_LOG="/Sandbox/myfile/somelogs.log"
grep --color=always $1 myfile.txt >> $OUTPUT_LOG
vi $OUTPUT_LOG;

I tried vi or less but I still don't see my keyword being hightlight.  I'm confuse. Any reason why it wouldn't work?
tks

A: vi might not be a good test for your output-to-file.
Instead, try less -R $OUTPUT_LOG
The highlighting in grep works by inserting non-ASCII control characters to change the formatting in your terminal.
I do not think vi will interpret those characters as color control (since it has its own syntax highlighting system).
see How to get Vim to highlight non-ascii characters?, if you really want to go that route.


text:
Q: COUNT(*) gives more than 1 with LIMIT 1? I'm trying to count old records. Why does Postgres give a result of 1160, even though I set some limit, LIMIT 1 in this case?
SELECT COUNT(*) FROM data WHERE datetime < '2015-09-23 00:00:00' LIMIT 1;

 count
--------
1160
(1 row)

I expected a result of 1 or 0, but it gives 1160. Why?

A: From the postgres manual (http://www.postgresql.org/docs/current/static/queries-limit.html):

If a limit count is given, no more than that many rows will be returned (but possibly less, if the query itself yields less rows).

Limit does not constrain how many rows your query will scan - it only affects how many rows will show up in your record set.

A: You're limiting the resultset of the aggregate function count(), which will always return 1 row. IE: It's limiting the output of the count(*) function, rather than LIMITing just FROM data WHERE datetime < '2015-09-23 00:00:00'.
Basically:

*

*Postgres reads all the rows FROM data WHERE datetime < '2015-09-23 00:00:00'

*Postgres then count(*)s them

*Postgres then LIMITs that
count
I suspect you're wanting it to do this:
SELECT COUNT(*) FROM (
    SELECT * FROM data WHERE datetime < '2015-09-23 00:00:00' LIMIT 1
);

As this is basically an existence check, one could also do:
SELECT (EXISTS
           (SELECT 1 FROM data WHERE datetime < '2015-09-23 00:00:00')
       )::integer;

A:   SELECT
    count(x.*) OVER() AS total_count,
    x.id,
    x.data_name
  FROM (
         SELECT
           id,
           data_name
         FROM data
         WHERE
           datetime < '2015-09-23 00:00:00'
         LIMIT 1
       ) x;

It Will give result as you want and you can add more fields to fetch and get aggregated records in json also


text:
Q: Clarity Design Datagrid how to change column width I want to manual set column(head and body) size(width, height).
I tired to set style but not work and find all document not found about this.
DataGrid Component

DataGrid set width size not work

A: Setting the column width:
<clr-dg-column [style.width.px]="200">my column</clr-dg-column>
This will also set width for all column cells.
To control height and width you can either put the datagrid inside a container with a set height/width.

A: After i tired use set style on template(html)
my column
I have other problem when use follow Server Driven(https://clarity.design/documentation/datagrid/server-driven)
When next pagging each column length adjusted according to data i found overlap column
Data overlap column
and when binding long length data i found header separate column incorrect
header wrong separate column
My solution i think i have to loop for looking longest length and setting style width and writing logic in to typescript.
Have any solution easy way please suggest me.


text:
Q: Decision Tree Binary Classifier shortcut (sorting) Normally, at each node of the decision tree, we consider all features and all splitting points for each feature. We calculate the difference between the entropy of the entire node and the weighted avg of the entropies of potential left and right branches, and the feature + splitting feature_value that gives us the greatest entropy drop is chosen as the splitting criterion for that particular node.
Can someone explain why the above process, which requires (2^m -2)/2 tries for each feature at each node, where m is the number of distinct feature_values at the node, is the same as trying ONLY m-1 splits:

*

*sort the m distinct feature_values by the percentage of 1's of the samples within the node that takes that feature_value for that feature.

*Only try the m-1 ways of splitting the sorted list.

This 'trying only m-1 splits' method is mentioned as a 'shortcut' in the article below, which (by definition of 'shortcut') means the results of the two methods which differ drastically in runtime are exactly the same.
The quote:"For regression and binary classification problems, with K = 2 response classes, there is a computational shortcut [1]. The tree can order the categories by mean response (for regression) or class probability for one of the classes (for classification). Then, the optimal split is one of the L – 1 splits for the ordered list. "
The article:
http://www.mathworks.com/help/stats/splitting-categorical-predictors-for-multiclass-classification.html?s_tid=gn_loc_drop&requestedDomain=uk.mathworks.com
Note that I'm talking only about categorical variables.

A:
Can someone explain why the above process, which requires (2^m -2)/2 tries for each feature at each node, where m is the number of distinct feature_values at the node, is the same as trying ONLY m-1 splits:

The answer is simple: both procedures just aren't the same. As you noticed, splitting in the exact way is an NP-hard problem and thus hardly feasible for any problem in practice. Moreover, due to overfitting that would usually be not the optimal result in terms of generaluzation.
Instead, the exhaustive search is replaced by some kind of greedy procedure which goes like: sort first, then try all ordered splits. In general this leads to different results than the exact splitting.
In order to improve on the greedy result, one further often applies pruning (which can be seen as another greedy and heuristic method). And never methods like random forests or BART deal with this problem effectively by averaging over several trees -- so that the deviation of a single tree becomes less important.


text:
Q: Randrange outcome help? Python Random Number Generator Trying to create a Random Number Generator that depending on the number outputs a statement. I keep getting the output of Over 50 no matter what. I can't seem to figure out why though.
from random import randrange
print randrange(100)

number = randrange

if number <= 49:
    print"Under 50"
else:
    print"Over 50"

Changing the following line corrected the issue.
number = randrange(100)

A: This statement doesn't do what you think:
number = randrange

It's setting number to the function, not to a result from calling the function. If you now did print number(100) you'd see what I mean. Python 2 allows you to compare arbitrary values to each other, even if they're not really comparable, so the <= doesn't fail but doesn't deliver a result that makes sense either. Python 3 would generate an error if you tried to do the same thing.


text:
Q: HighCharts - Show dataLabel for last value in stockChart I would like to show the last value of the stock on the chart.
I've tried adding dataLabel but it doesn't work.
var data = [
  [1589973960000,506.5065,0.0],
  [1589974020000,506.3055,0.0],
  [1589974080000,506.1055,0.0],
  [1589974140000,506.1055,0.0],
  [1589974200000,506.005,0.0],
  [1589974260000,506.205,0.0],
  [1589974320000,null,null],
  [1589974380000,null,null]
];

// Calculate last non-empty index
var lastIndex = 0;
for (var i = 1; i < data.length; i++) {
  if (data[i][1] == null) {
    lastIndex = i-1;
    break;
  }
}

data[lastIndex] = {
  x: data[lastIndex][0],
  y: data[lastIndex][1],
  z: data[lastIndex][2],
  dataLabels: {enabled:true}
};

When I set it in chart options it works but that is displayed for all values. I want to display it just for the last value.
Stock chart with last value visible

A: You can use the dataLabel.formatter callback to achieve the wanted effect.
Demo: https://jsfiddle.net/BlackLabel/a8t3zhs9/
  formatter() {
    let points = this.series.points;
    if (this.x === points[points.length - 1].x) {
      return this.y
    }
  }

API: https://api.highcharts.com/highcharts/series.line.dataLabels.formatter
EDIT

@Nelie upgraded solution which detects null points in the chart: https://jsfiddle.net/1utz2x09/3/

A: For me, the other answer did not work as expected. I am using a dynamic chart where I am dynamically add points to the chart using Highchart's series.addPoint(..) API function. Using the above answer the dataLabel would disappear randomly.
So, I made a small utility function which I call every time after series.addPoint(...). This function accepts Highchart Series object as parameter which can be obtained using const series = chart?.series[0];. This utility function could also work for static data when called after the chart is rendered.
export function showLastPointDataLabel(series: Highcharts.Series) {
  series.points.forEach((point, index) => {
    if (index === (series.points.length - 1)) {
      // Only show data label for the last point
      point.update({
        dataLabels: {
          enabled: true
        }
      });
    } else {
      // Hide data label for other points
      point.update({
        dataLabels: {
          enabled: false
        }
      });
    }
  });
}


text:
Q: Printf to Only Display decimal and one character after it In my code I have a subtraction such as this: (numbers are arbitrary)
(2.3 + 6.0) - 8.3 = 0.0
I want to use the printf function in order to display this: .0 yet no matter what variation of printf I use, the best I can get is 0.0 using %.1f
Anyone know a way?

A: snprintf could be used, but I would prefer having a simpler if/else logic. One more dependency on a lib is avoided. The 0.0 case is a unique case. snprintf might work out better if there are several conditions to handle.
if(num == 0.0f) {
    printf(".0");
}
else {
    printf(".2f", num);
}

Remember there are rare fp results that are near to zero, but not absolutely zero. So use with care.


text:
Q: pdflatex and shell script I need to watch for a specific directory changes in osx, in order to see if a file was uploaded, when the file is inside the dir i want to run a very basic script(simply 'compile' .tex files using pdflatex), what I've done so far :
1)launchd to monitor my dir, this is my test.plist file
<plist version="1.0">
<dict>
    <key>Label</key>
 <string>DirMonitor</string>
 <key>ProgramArguments</key>
 <array>
  <string>/Users/Caffeina/Desktop/test.sh</string>
  <string>path modified</string>
 </array>
 <key>QueueDirectories</key>
 <array>
  <string>/Users/Caffeina/Desktop/test_dir/</string>
 </array>
</dict>
</plist>

2) test.sh :
#!/bin/sh
/usr/texbin/pdflatex -interaction=nonstopmode /Users/Caffeina/Desktop/test_dir/test.tex

3) starting the monitor  :
launchctl load /Users/Caffeina/Library/LaunchAgents/test.plist

4) to test if all is working properly I move a file inside the monitored dir.... but nothing happen. Looking into the console output i can red this error :
logger[4155]    This is pdfTeX, Version 3.1415926-1.40.11 (TeX Live 2010)
logger[4155]    restricted \write18 enabled.
logger[4155]    entering extended mode
logger[4155]    ! I can't write on file `test.log'.
logger[4155]    (Press Enter to retry, or Control-D to exit; default file extension is `.log')
logger[4155]    Please type another transcript file name
logger[4155]    ! Emergency stop
logger[4155]    !  ==> Fatal error occurred, no output PDF file produced!
    com.apple.launchd.peruser.501[127]  (logger[4155]) Exited with exit code: 1

I don't understand why this error, any idea?

A: The working directory is not correct. I would guess working directory is the one where launchd is located (you can test it by adding the 'pwd' command to shell script). You should change this, or you could modify your pdflatex command:
/usr/texbin/pdflatex -interaction=nonstopmode -output-directory=/tmp /Users/Caffeina/Desktop/test_dir/test.tex

I added -output-directory=/tmp, I now assume that you have read and write access to /tmp. If this works, problem was with the write permissions. You could then play around to get the correct output dir. You could do it either through launchd or just 'cd myDir' in shell script.

A: It seems that you have no permissions to write on file `test.log'.


text:
Q: HashMap.get() doesn't return the proper value, thanks to "hashCode()" I'm currently working on a TD game with a map editor. Now obviously, you can save and load these maps (or should be able to, at least).
Problem is: at some point I'm calling .get() on a HashMap. Unfortunately, the keys that should be the same (logic-wise) are not the same object (in terms of reference), and, according to my previous google research, overriding their .equals method isn't sufficient, since they still return different hashes with .hashCode() (I verified that, they DO return different hashes, while .equals does return true).
(On a side note, that's rather confusing, since the javadoc of HashMap.get(key) only states that they have to be equal)
More specifically, the HashMap contains instances of a class Path of mine as keys, and should return the corresponding list of enemies (= value).
short version of Path (without getters etc.):
public class Path
{
    private List<Tile> tiles = new ArrayList<>();
    @Override
    public boolean equals(Object obj) {
        //code comparing the two paths
    }
    @Override
    public int hashCode() {
        //what I still need to implement. ATM, it returns super.hashCode()
    }
}

public class Tile
{
    private int x;
    private int y;
    //constructor
    //overrides equals
    //getters & some convenience methods
}

Now if two Paths are equal, I'd like them to return the same hash code, so that the HashMap returns the correct list of enemies. (I'll make sure not two identical paths can be added).
Now my question:
Do you suggest

*

*using some external library to generate a hash

*that I write my own implementation of calculating a hash, or

*something else

?
Note that I'd prefer to avoid changing the HashMap to some other type of map, if that would even help solve the problem.

A: You definitely do need to implement your hashCode consistent with equals. IDEs often do decent job generating hashCode and equals. Also consider Objects.equals(...) and Objects.hash(...).
One warning about using Path as keys in the HashMap. You will have to make the class immutable to make it work reliably. Or at least make sure that hashCode of the key does not change. Otherwise you may not able to get you data back even with the same or equal key.

A: The List has a useful method which conveniently is also named list.hashCode(). This will compute the hashCode of all the elements inside the list. So you also have to implement the hashCode for Tile which probably consist of some primitive fields or such.
e.g.
 @Override
    public int hashCode() {
         return tiles != null ? tiles.hashCode() : 0;
    }

See the docs here

int hashCode()
  Returns the hash code value for this list. The hash code of a list is defined to be the result of the following calculation:

  int hashCode = 1;
  for (E e : list)
      hashCode = 31*hashCode + (e==null ? 0 : e.hashCode());

This ensures that list1.equals(list2) implies that list1.hashCode()==list2.hashCode() for any two lists, list1 and list2, as required by the general contract of Object.hashCode().