text:
Q: Compiling triangulation_2 demo on CGAL Im just installed CGAL on Windows 8 for Visual Studio 2010 following this tutorial http://www.cgal.org/windows_installation.html#PrerequisitesforCompilingthe32-bitCGALLibraryusingMicrosoftVisualStudio2010. When im trying to compile a demo with CMake, it says:
The C compiler identification is MSVC 16.0.30319.1
The CXX compiler identification is MSVC 16.0.30319.1
Check for working C compiler using: Visual Studio 10 2010
Check for working C compiler using: Visual Studio 10 2010 -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Check for working CXX compiler using: Visual Studio 10 2010
Check for working CXX compiler using: Visual Studio 10 2010 -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Build type: Release
USING CXXFLAGS = ' /DWIN32 /D_WINDOWS /W3 /GR /EHsc -D_CRT_SECURE_NO_DEPRECATE -    D_SCL_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS /fp:strict     /fp:except- /wd4503 /bigobj /MD /O2 /Ob2 /D NDEBUG'
USING EXEFLAGS = ' /machine:X86  /INCREMENTAL:NO'
Targetting Visual Studio 10 2010
Target build enviroment supports auto-linking
Using VC10 compiler.
Generator uses intermediate configuration directory: $(Configuration)
Requested component: Qt4
Found OpenGL: opengl32
Looking for Q_WS_X11
Looking for Q_WS_X11 - not found
Looking for Q_WS_WIN
Looking for Q_WS_WIN - found
Looking for Q_WS_QWS
Looking for Q_WS_QWS - not found
Looking for Q_WS_MAC
Looking for Q_WS_MAC - not found
Found Qt4: C:/Qt/4.8.6/bin/qmake.exe (found version "4.8.6")
Requested component: MPFR
Requested component: GMP
NOTICE: This demo requires CGAL and Qt4, and will not be compiled.
Configuring done

A: This issue typically occurs when you use version 3+ of cmake. That version is not supported by CGAL-4.4, support will appear in CGAL-4.5. In the mean time, please use an older version of cmake.


text:
Q: Three computers, how to configure network without router/switch? I have 3 machines and want to configure network connections so that all 3 machines can reach each other without any switch or router in between. Machine A has 2 nics and the other 2 machines(machine B and machine C) connect via direct network cable to each of the nics of machine A. Machine B and Machine C are not connected via network cable. I Can obviously connect fine between machine A and machine B and between machine A and machine C. I want to also be able to connect and exchange traffic between machine B and machine C.

*

*I do not care about internet access, I only want the 3 machines to be able to connect to each other (ping, remote access, drive/folder mapping...)

*A switch/router is out of the question as the connects are 100 gigabit ports and I do not want to add a pricey 100Gb switch to this setup

*I cannot connect machine B and machine C via network cable because machine B connects to machine A via active optical fiber and I do not want to add a pricey 2nd AOC cable.

*I run Windows 10 for Workstations and Windows Server on the machines

*Bridging connections on machine A is out of the question because it under-performs and would make a 100Gb connection useless.

*I read that I can have machine A <-> machine B and machine A <-> machine C run on different networks and route traffic on machine A.

My question is: How can I configure the routes on machine A which runs windows. Pleases assume that I have plenty of resources (memory and CPU) and that I can accept network performance degradation due to the fact that traffic would be routed with CPU involvement rather than an optimized switch ASIC involvement. What I am interested is the software routing configuration so that machine B can communicate with machine C.

A: Per the suggestion here (for Windows 7, but since the registry entry has existed since Windows XP, could be it still works): https://social.technet.microsoft.com/Forums/lync/en-US/8f5ef2ca-c6e8-42e6-a70d-6d09bfdafa48/configuring-windows-7-as-a-router-in-lan , I suggest:

*

*You make the registry change on computer A,

*Configure B so that its default gateway is the IP address of A on the network B shares with A,

*Configure C so that its default gateway is the IP address of A on the network C shares with A

Note that in this configuration, if you change your mind about Internet access, you would want to configure A to have Internet access to ensure that B and C also are able to reach the Internet.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Resetting score in AS3 I am creating a "dice spinner" game by using Flash action script 3, The rules are if the player rolls a 7 or 11 on first throw then they win but if the user rolls a 2,3 or 12 on the first throw then they lose. If the first throw is 4,5,6,8,9 or 10 then that sum becomes the point and that user has to make a point by rolling again until they make the point (they win) or they throw a 7 (they lose)
I have succesfully created the functions for it to spin, generate a random between 1-6 on each "dice" and to add the points up from total but my problem is if the user wins or lose. I can't figure out on how to reset the points back to zero when the user rerolls from last attempt
The code is blow.
import flash.events.MouseEvent;

spinner_mc.stop();
spinner2_mc.stop();

roll_btn.addEventListener(MouseEvent.CLICK, startspin);
stop_btn.addEventListener(MouseEvent.CLICK, stopspin);
spinner_mc.addEventListener(Event.ENTER_FRAME, spin);
spinner2_mc.addEventListener(Event.ENTER_FRAME, spin)

var spinning = false

function spin(evt){
    if(spinning){
        spinner_mc.rotation += 5
        spinner2_mc.rotation += 5
    }
} //end spin function

function startspin(mEvt:MouseEvent){
    spinning = true

} //end startspin function

var points:int = 0;
function stopspin (mEvt){
    if (spinning){
        spinning = false
        var nextVal = newVal()
        var nextVal2 = newVal2()
        var addPoints = nextVal + nextVal2
        points += nextVal + nextVal2
        spinner_mc.gotoAndStop(nextVal)
        spinner_mc.rotation = 0
        spinner2_mc.gotoAndStop(nextVal2)
        spinner2_mc.rotation = 0
        value_txt.text = "point = " + points + ", new value " + addPoints
    }
    if ((points == 0) && (addPoints == 7) || (addPoints == 11))
    {
        info_txt.text = "You win!! You rolled a 7 or 11 on first throw!"

    }
    if ((points == 0) && (addPoints == 2) || (addPoints == 3) || (addPoints == 12))
    {
        info_txt.text ="You lose! You rolled a 2, 3 or 12 on first throw!"
    }

} // end stopspin function

function newVal(){
    var temp:int;
    temp = Math.random() * 6 + 1;
    return temp;
}

function newVal2(){
    var temp:int
    temp = Math.random() * 6 + 1;
    return temp;
}

A: You need to check for points and addPoints before you add points to the player, while your code has check for points outside the if (spinning) block. This makes your checks go awry even if points is yet zero. So, you first get the spin values, then check, then assign values.
function stopspin(evt:MouseEvent):void {
    if (!spinning) return; // this is shorter than wrapping the entire function
    // body into a single "if (spinning)" block. If we don't spin, get out
    spinning=false;
    var nextVal1:int=newVal();
    var nextVal2:int=newVal(); // no need of two functions doing the same :)
    var addPoints:int=nextVal1+nextVal2;
    spinner_mc.gotoAndStop(nextVal1);
    spinner_mc.rotation = 0;
    spinner2_mc.gotoAndStop(nextVal2);
    spinner2_mc.rotation = 0; // give values to spinners
    // now check phase
    if (points==0) {
        // this means first throw.
        if ((addPoints==7) || (addPoints==11)) {
            // player wins, insert win code
        } else if((addPoints==2)||(addPoints==3)||(addPoints==12)) {
            // player loses, insert lose code
        } else {
            points=addPoints; // otherwise making the player do second throw
            // add other code, say inform the player that he has to throw again
        }
    } else {
        // not a first throw. We have the "point" in "points" variable right now
        if (addPoints==points) {
            // player wins with second throw, add win code
            points=0; // okay, back to first throw
        } else if (addPoints==7) {
            // player loses second throw, add relevant code
            points=0; // again, back to first throw
        } else {
            // else no match, oh well.
        }
    }
}

Also, you should know better how to use event listeners if you want several objects to listen with a single function (in your case, spin). See, right now you have your spin function to update both spinners, and you have it being called twice per frame, so your spinners are spinning at twice the desired speed. You can get the actively listening movie clip using the Event class object passed into the listener, you need to get its target property. So, your listener can be rewritten like this:
function spin(evt:Event):void {
    var mc:DisplayObject=evt.target; // the object that's listening
    mc.rotation+=5; // now turn it.
}

And last, please place semicolons at the end of each line. Even if AS3 compiler does not strictly require this, it can save you from some really weird mistakes.


text:
Q: Why is Perl not printing all regex matches in a multi-line regex? I have this text (shortened version of my original text):

mytext.txt
  BAHJSBUBGUCYHAGSBUCAGSUCBASBCYHUBXZCZPZHCUIHAUISHCIUJXZJCBZYAUSGHDYUAGWEBWHBHJASBHJASCXZBUYTRTRTRJFUARGAFGOOPWWKBBCAAAABBXHABSDAUSBCZAAAAAAAAACGAFAXHJBJHXZCXZCCZCXZUCAGSUCBASBCYHUBXZCZPZHCUIHAUISHCIUJXZJCBZYAUSGHDYUAGWEBWHBHJASBHJASCXZBUYHABSDAUSZXHJBRRRRRRJFUABGAFGLLPKWAACAAAABBZJHXZXHJBJHXZXHJBJHXJBJHXZCXZCCZCXZUCAGSAJIJICXZIJUAUUISUSJUSSJSJSJAJCXZXCZTTTTTRJFUABGAFGLOPKWABCAAAABBU

My code is the following, which intends to print all of the matches and then save them into a file as well. But I am not getting any matches while I except there to be at least 10 in my original file.
open(text, "<mytext.txt");

push (@matches,$&) while(<text> =~ m{
    ([TR]{6}
    JFUA
    [ABR]{1}
    GAFG
    ( [LOP]{2,3} )
    [KW]{2,5}
    (??{ $2 =~ tr/LOP/ABC/r })
    AAAABB[UXZ]{1})
    /g
}x);

print "@matches\n";

my $filename = 'results_matches.txt';
open(my $fh, '>', $filename) or die "Could not open file '$filename' $!";
print $fh "@matches\n";
close $fh;
print "done\n";

I have also tried the following code and this also does not work:
my @matches = <text> =~ m{
        ([TR]{6}
        JFUA
        [ABR]{1}
        GAFG
        ( [LOP]{2,3} )
        [KW]{2,5}
        (??{ $2 =~ tr/LOP/ABC/r })
        AAAABB[UXZ]{1})
        /g
    }x;

print "@matches\n";

I have the following code which successfully prints out only one (the first) result. But it fails to print all of the matches.
if (<text> =~ m{
    ([TR]{6}
    JFUA
    [ABR]{1}
    GAFG
    ( [LOP]{2,3} )
    [KW]{2,5}
    (??{ $2 =~ tr/LOP/ABC/r })
    AAAABB[UXZ]{1})
}x) {print "$1\n";}

I have followed the answers in this topic but have not been able to get any of them to work: How can I find all matches to a regular expression in Perl?

A: By using while <text>, you are reading a new file from the file handle on each iteration of the loop. You need to loops, one iterating over the lines, and the inner loop to iterate over the matches.
while (my $line = <text>) {
    push @matches, $1 while $line
        =~ m{
            ([TR]{6}
            JFUA
            [ABR]
            GAFG
            ( [LOP]{2,3} )
            [KW]{2,5}
            (??{ $2 =~ tr/LOP/ABC/r })
            AAAABB[UXZ])
        }xg;
}

I also removed {1} as it's useless, used $1 instead of $& because $& imposes a performance penatly on all the matching you do in a program; and removed the /g and added the g to the right place (i.e. next to }x).
When testing, I copied'n'pasted the input from here, i.e. I have all the characters in one line. If your input is different, please use the code formatting for it, not quotation.


text:
Q: Using the Apache License 2.0 By Reference Only I want to license my software with the Apache License 2.0. The software is only a single file of source code. I do not want to include the entire license verbatim in the code. The license appendix describes how I may apply the license to my work by reference. This is done by including text in my software, referring to the license, which I am willing to do.
Recipients of my software then clearly will be subject to the terms of the license, one of which is a redistribution restriction (section 4(a)). That restriction requires that recipients who want to redistribute the work "must give any other recipients of the Work or Derivative Works a copy of this License".
Does this mean that recipients who want to redistribute the work must include 2 files, instead of merely 1 - the single file of source code, and a copy of the license?

A: On the very page of the Apache 2.0 license, it is explained how to include a boilerplate notice into the comment section of your work.
This notice is sufficient to inform any users of their rights and obligations in regards to your work.

A: Yes, that is what it means.
However, it is recommended that you already include that second file with a copy of the license, just to avoid that a (potential) user of your software needs to go to a different site (which might be down or unreachable from their location) to read what their rights and obligations are.


text:
Q: Multiple NICS on same IP Solution needed My network topology is as follows -

My problem, is that the Purple Red Green and Orange PC's are actually hard coded industrial systems, and i have no possibility of changing any settings on them.
I require to intercept and manipulate the UDP packets with the addition of the interception PC.
Example - RED PC 192.168.0.20 sends a UDP packet to the purple PC. This actually arrives at my Interception PC (Ubuntu 16.04) where i receive and reply to the packet. I then construct a different message and deliver to the purple PC.
The problem is, that the network is all on the same subnet, and  the kernel has no idea which NIC to send my outgoing packet as i already own the ip i am trying to forward to.
I have tried creating separate namespaces to own the NICS , and wrote several separate processes to communicate via Dbus between the namespaces, before realising they can not communicate.  I can purchase more hardware if required, but im looking for suggestions about how i might achieve this outcome.

A: Yes, using a network namespace to isolate the two "same" networks would work.
For example, you have one network namespace for the right-hand side, with all the three interfaces in that namespace, and in addition, you have a bridge in the namespace and a tap for the traffic interception and forwarding. Add the tap and the three NICs to the bridge, and assign 192.168.0.10 only to the tap. Thus, no IP assignments to the NICs; only to the tap. The bridge will take care of channeling all traffic to 192.168.0.10 on the right-hand side to the tap, and all traffic to 192.168.0.{20,21,22} through the apprioriate NICs.
Write your interception program to read/write the tap (Level 2), and forward packets through stdin/stdout (unbuffered). Also write a similar simple transfer program to channel stdin/stdout packets to/from a tap (another tap), which you put in the left-hand side global namespace. The programs must forward all packets, with your interception applied to some of them.
The left-hand side namespace (the global namespace) is arranged in a corresponding way, with a bridge for the NICs and a tap, and then add all the IP addresses 192.168.0.{20,21,22} to the tap.
Next, use the dpipe program from the vde2 package (or write your own) to start the two tap connectors such that their stdin/stdout are mutually connected. With dpipe the command for this would be something like the following:
# dpipe program1 tap1 = ip netns exec RHS program2 tap2

for the effect that stdout of program1 goes to stdin of program2, and stdout of program2 goes to stdin of program1. (I've included notionally tap name arguments for the programs just for the sake of illustration)
All in all, that would be a way to intercept and transfer packets between the two namespaces without needing to mess with IP translations.
Note that the set up would work equally well with a single NIC at each side, plus a switch on the right. Thus, there is no need for two triplets of NICs, but you can get away with just two: one to the left and one to the right, plus of course a switch for the right-hand side network, which has 4 physical hosts.

A: I unable to comment, so adding another answer.
I'm writing from my own experience : it is absolutely doable with network namespaces, but there is no generic solution. So it would be tighten to the requirement and actual network topology. And in most case will also require writing few scripts to automate such network initialization & configuration.
But again, it absolutely doable


text:
Q: Laravel getRouteKeyName replace white space to dash i looking for the url become 127.0.0.1:8000/news/some-article-title. Working on Laravel 5.8
current it show 127.0.0.1:8000/news/some%20article%20title.
I tried few ways to do it...
First
Reading the laravel documentation , i found to show title instead of id behind the url.
public function getRouteKeyName()
{
  return 'title';
}

Second
app/Providers/RouteServiceProvider
public function boot()
{
  parent::boot();

  Route::bind('news', function($value){
     return  \App\Models\News::where('title', str_replace('-', ' ', $value))->first();
  })
}

Didn't work. The Url still remain %20 instead of dash
Did i miss something important?

A: You need to make the reverse operation like this:
 title)}}"> {{$new->title}}

 Route::bind('news', function($value){
     return  \App\Models\News::where('title', str_replace(' ', '-', $value))->first();
  })

or you need to create specific column like slug which will have the same value of title but without spaces


text:
Q: JavaVM FATAL: Failed to load the jvm library I am trying to start the jvm using c++ . Here is My CmakeLists.txt and ny C++ code.
My System is macOS Mojave 10.14.6
Java using homebrew cask install
openjdk version "1.8.0_232"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_232-b09)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.232-b09, mixed mode)
cmake_minimum_required(VERSION 3.15)
project(jvm)

set(CMAKE_CXX_STANDARD 14)

include_directories(
        /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/include
        /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/include/darwin
)

link_libraries(
        /System/Library/Frameworks/JavaVM.framework/JavaVM
)

add_executable(jvm main.cpp)

#include <iostream>
#include "jni.h"

using namespace std;

int main() {
    std::cout << "Hello, World!" << std::endl;
    JavaVM *jvm;
    JNIEnv *env;

    JavaVMOption jvmopt[3];
    jvmopt[0].optionString = "-Djava.compiler=NONE";
    jvmopt[1].optionString = "-Djava.class.path=./";

    jvmopt[2].optionString=  "-verbose:class";

    JavaVMInitArgs vmArgs;
    vmArgs.version = JNI_VERSION_1_8;
    vmArgs.nOptions = 1;
    vmArgs.options = jvmopt;
    vmArgs.ignoreUnrecognized = JNI_TRUE;

    long  flag = JNI_CreateJavaVM(&jvm, (void **) &env, &vmArgs);
    cout << flag << endl;

    jvm->DestroyJavaVM();
    return 0;
}

The result of the main function run
JavaVM: Failed to load JVM: /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/bundle/Libraries/libserver.dylib
JavaVM FATAL: Failed to load the jvm library.

[UPDATE]
PROBLEM SLOVED !!!
The reason is I link the wrong library.
I should link $JAVA_HOME//lib/server/libjvm.dylib
What's more , I use oracle JDK instead of openjdk. Maybe something wrong with openjdk!!

A: sudo ln -s /Library/Java//JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/jre/lib/server/libjvm.dylib /Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/lib/libserver.dylib

alternatively that worked for me

A: Steps to resolve the issue (JavaVM: Failed to load JVM:.../libserver.dylib):
cd /Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home
cd lib

Create a softlink libjvm.dylib as libserver.dylib:
sudo ln -s ../jre/lib/server/libjvm.dylib libserver.dylib


text:
Q: Confused with pressure and condensation I'm confused with pressure and condensation of a gas inside a sealed container. Say I boil a liquid to it's gaseous state inside a sealed container and exert more pressure on that container then should the gas not turn back into a liquid?
For instance on Mount Everest the atmospheric pressure is 5psi and water boils at 71c, at ground level the pressure is 14psi and water boils at 100c. My thinking is that If I raise the pressure even more the temperature at which gas condensation occurs should be reached and the gas would suddenly turn back to a liquid?
If that's correct, what pressure would I need to exert on that gas to turn it back to a liquid state instantly?

A: Water vapor is not an ideal gas.  Due to this, when you compress it instantly, you do work on it, and the temperature of the water vapor rises.  Instant compression is adiabatic compression, and without heat transfer to the environment, you will not be able to transfer the heat necessary for condensation to occur.

A: Assume  that only vapour (and no air) is inside your container and that the temperature is kept fixed. When you use a piston to decrease the volume, and so increase the pressure until it reaches  the vapour pressure, then a small amount of the liquid will condense and lower the pressure until it is again at the vapour pressure (Vapour pressure = 5psi at T=71C acording to your data) . Reduce the volume a bit more and a bit more fluid will condense again lowering the pressure back to the vapour pressure. At T=71C this will continue, the pressure remaining constant at 5psi,  until you have turned all the vapour back into liquid and the piston is in contact with the liquid surface. If you try to reduce the volume even more you will be compressing the liquid and will have to exert a lot more  pressure.


text:
Q: AS3 NetConnection to MS Azure Media Services I'm trying to publish a live web cam stream to an Azure Media Services channel. I have the channel configured and am using the rtmp ingest url in the NetConnection.connect method.
I have my Flash AS3 setup to stream to an Adobe Media Server and it works fine. All I am doing so far is changing the URL to the Azure one.
All I ever get is NetConnection.Connect.Failed
If I use that same ingest url in wirecast I can stream my web cam fine.
Any thoughts as to why the Flash version is failing?


text:
Q: Return Values of Recursive Dynamic Variables in Batch I'm attempting to use dynamic variables within Delayed Variable Expansion to represent other Dynamic Variables. I'm running into some trouble. How can I get a dynamic variable's value's value if the dynamic variable's value is another dynamic variable with it's own value?
i.e. !valA! = %valB% = this
@ECHO OFF
SETLOCAL EnableExtensions EnableDelayedExpansion
...
...
FOR /F ... %%G IN (...) DO (
    SET _temp=%%~nG
    SET _file=!_temp:~0,-4!
    SET _cnt=0
    FOR /F ... %%L IN (...) DO (
        SET _temp=%%L
        SET _str=!_temp:*: =!
        SET /A _cnt+=1
        SET _temp=x!_file!!_cnt!
        IF DEFINED !_temp! (
            SET _temp=!%_temp%!
::
::_temp('s value) is _var('s value) is "xyz"
::Set new _temp to equal current _temp's "xyz"
::
            IF !_temp! NEQ !_str! (
                ECHO File Content Mismatch
            )
        ) ELSE (
            SET xvar=!_temp!
            SET !xvar!=!_str!
        )

    )
)
...
...
exit

Any help would be appreciated.

A: Logically your failing code equates to
setlocal enableDelayedExpansion
(
  set VAR1=success
  set VAR2=VAR1
  set VAR3=!%VAR2%!
  echo VAR3=!VAR3!
)

As has already been pointed out in previous answers and comments, you can't assign a value to VAR2 and then access the value using %VAR2% within the same code block because %VAR2% is expanded during the parsing phase of the code block, at which point the value is not what you want (probably undefined).
But you need a second level of expansion in addition to !VAR2! to get the result you want. I know of three solutions.
1) This solution works, but it is not recommended because it is slow.
setlocal enableDelayedExpansion
(
  set VAR1=success
  set VAR2=VAR1
  call set VAR3=%%!VAR2!%%
  echo VAR3=!VAR3!
)

Prior to the execution of the CALL, each %% is reduced to %, and !VAR2! becomes VAR1.
Thus the called statement becomes set VAR3=%VAR1%, and the called statement is reparsed through the %var% expansion phase, so you get your desired result.
BUT - CALL is relatively very expensive. When used in a loop it can cause severe performance degradation. jeb provides a good demonstration and explanation at CALL me, or better avoid call
1a) There is a variation of the CALL solution where you call a :LABELed subroutine. Because the subroutine is parsed after the call, you can simply use set VAR3=!%VAR2%!. But again, this uses CALL so it is relatively slow and not recommended.
2) This general solution works, and is MUCH faster in comparison. It uses a FOR variable for the second level of expansion. This is the recommended solution.
setlocal enableDelayedExpansion
(
  set VAR1=success
  set VAR2=VAR1
  for /f %%A in ("!VAR2!") do set VAR3=!%%A!
  echo VAR3=!VAR3!
)

3) If the value of VAR1 is known to be an integer, then there is a special case solution using SET /A
setlocal enableDelayedExpansion
(
  set VAR1=999
  set VAR2=VAR1
  set /a VAR3=!VAR2!
  echo VAR3=!VAR3!
)

The SET /A command has its own built in expansion of variables that takes place after delayed expansion, and no punctuation is needed.

A: Your code fails at SET _temp=!%_temp%!, as the percent expansion is evaluated while parsing the parenthesis block.
You could change it to
set "varname=!_temp!"
set "content=!varname!"

Btw. It would be much easier, if your sample would be reduced to the minimum of code, like.
setlocal EnableDelayedExpansion
set "var1=content of var1"
set "var2=var1"
set "result=!%var2%!"
echo !result!

This only works as it isn't in brackets.
To better understand how the different expansions work,
you can read How does the Windows Command Interpreter (CMD.EXE) parse scripts?


text:
Q: Project structure for Blazor project with Rest Api The questions are related to a school project.
We have among others the following requirements:

*

*"The application must have a web front-end for users to interact with the application using a browser"

*A REST API exposing (a suitable subset of) the business logic must be provided

We have free choice of technology and I would like to use this as an oppurtunity to learn more about Blazor. What would be the recommended way of organizing a project in Blazor with both front end and API (contaiing only a subset of the business logic)?
I guess the API and front end can be implemented in the same project using Blazor server? But maybe it is better to have separate projects, and have the front-end (Blazor wasm?) use the api?
All input highly appreciated!

A: Answering my own question in case someone else are in the same situation.
I started out with Blazor WASM hosted (dotnet new blazorwasm --hosted) as suggested by iamrafael. This was a good match for my requirements. If you need authentication/authorization I would include that in the scaffolding from the beginning.
I later found and switched to the template from
Blazor Hero, which seems like an excellent starting point for a clean architecture using Blazor wasm and asp.net


text:
Q: animate move x and y with soft move react native i want move a ball on x and y axis, but the animate not is soft,
the movement is tremulous, and if i move more fast it don't move on diagonally exact, but do a angle how i can move the ball with soft? here are the exemple:
https://snack.expo.io/HJvm5WI5N
the code is it:
import React from 'react';
import {Animated, StyleSheet, Text, TouchableOpacity, View} from 'react-native';

export default class App extends React.Component {

    constructor(props) {
        super(props)

        this.ball = new Animated.ValueXY({x: 30, y: 30})
    }

    moveBall = () => {
        Animated.timing(this.ball, {
            toValue: {x: 250, y: 350},
            duration: 2000
        }).start()
    }

    render() {
        return (
            <View style={styles.container}>
                <TouchableOpacity onPress={this.moveBall}>
                    <Animated.View style={[styles.ball, this.ball.getLayout()]}>
                        <Text style={styles.text}>+</Text>
                    </Animated.View>
                </TouchableOpacity>
            </View>
        );
    }
}

const styles = StyleSheet.create({
    container: {
        flex: 1,
        backgroundColor: '#fff',
    },
    ball: {
        width: 60,
        height: 60,
        borderRadius: 30,
        backgroundColor: 'red',
        alignItems: 'center',
        justifyContent: 'center',
    },
    text: {
        fontWeight: 'bold',
        color: 'white',
        fontSize: 32
    }
});

A: You can use useNativeDriver for better performance. Use it with translateX and translateY. Because you can't use useNativeDriver  with left and right properties of style.
export default class App extends React.Component {
  constructor(props) {
    super(props);

    this.ball = new Animated.Value(0);
  }

  moveBall = () => {
    Animated.timing(this.ball, {
      toValue: 1,
      duration: 1000,
      useNativeDriver: true,
    }).start();
  };

  render() {
    const xVal = this.ball.interpolate({
      inputRange: [0, 1],
      outputRange: [0, 250],
    });

    const yVal = this.ball.interpolate({
      inputRange: [0, 1],
      outputRange: [0, 350],
    });

    const animStyle = {
      transform: [
        {
          translateY: yVal,
          translateX: xVal,
        },
      ],
    };
    return (
      <View style={styles.container}>
        <TouchableOpacity onPress={this.moveBall}>
          <Animated.View style={[styles.ball, animStyle]}>
            <Text style={styles.text}>+</Text>
          </Animated.View>
        </TouchableOpacity>
      </View>
    );
  }
}

UPDATE
with hooks
const App = () => {
  const ballAnimatedValue = useRef(new Animated.Value(0)).current;

  const moveBall = () => {
    Animated.timing(ballAnimatedValue, {
      toValue: 1,
      duration: 1000,
      useNativeDriver: true,
    }).start();
  };

  const xVal = ballAnimatedValue.interpolate({
    inputRange: [0, 1],
    outputRange: [0, 250],
  });

  const yVal = ballAnimatedValue.interpolate({
    inputRange: [0, 1],
    outputRange: [0, 350],
  });

  const animStyle = {
    transform: [
      {
        translateY: yVal,
        translateX: xVal,
      },
    ],
  };

  return (
    <View style={styles.container}>
      <TouchableOpacity onPress={moveBall}>
        <Animated.View style={[styles.ball, animStyle]}>
          <Text style={styles.text}>+</Text>
        </Animated.View>
      </TouchableOpacity>
    </View>
  );
};


text:
Q: Is there a single word for "something people like to hear"? I'd like to know if there is a single word for "something people like to hear"

A: I think euphony is what you're after. — Dictionary.com

agreeableness of sound; pleasing effect to the ear, especially a pleasant sounding or harmonious combination or succession of words

A: It would help to have more context, but there is a slang term "ear candy" (http://www.urbandictionary.com/define.php?term=ear+candy) that is close to what you are saying.
Again, this is informal (and yes, it is technically two words), but the term "euphony," while perfectly accurate, is also very formal and rare, so you might consider slang more appropriate in some contexts.


text:
Q: Nginx config for vue app and express server I have a ubuntu server on which I have a vue app and am trying to add an express app. Everything is working correctly in my vue app but the only route that works for my express location is the index route at /api.
here is my nginx.conf:
server {
    listen 80 default_server;
    listen [::]:80 default_server;

    root /var/www/html/vue/family-showdown/client/dist;

    index index.html index.htm index.nginx-debian.html;

    server_name _;

    error_page 404 /;

    location /api {
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_redirect off;
            proxy_pass http://localhost:8080/;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection 'upgrade';
            proxy_set_header Host $host;
            proxy_cache_bypass $http_upgrade;
    }

    location / {
            root /var/www/html/vue/family-showdown/client/dist;
    }
}

in my express app.js I have:
app.use('/', _index["default"]);
app.use('/users', _users["default"]);

Navigating to /api works correctly so I would expect that navigating to /api/users should work but instead I get a 404 that says Cannot GET //users

A: there is no any location in your nginx configuration for /users path. you can try this configuration.
location / {
    root /var/www/html/vue/family-showdown/client/dist;
    index index.html;
    include  /etc/nginx/mime.types;
    try_files $uri $uri/ /index.html;
}

location /api/ {
    proxy_pass  http://localhost:8080;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection keep-alive;
    proxy_set_header Host $host;
    proxy_cache_bypass $http_upgrade;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
}

location /users/ {
    proxy_pass  http://localhost:8080;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection keep-alive;
    proxy_set_header Host $host;
    proxy_cache_bypass $http_upgrade;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
}

and delete these configurations
root /var/www/html/vue/family-showdown/client/dist;

index index.html index.htm index.nginx-debian.html;

server_name _;

error_page 404 /;

location / {
    root /var/www/html/vue/family-showdown/client/dist;
}


text:
Q: Is a coroutine a kind of thread that is managed by the user-program itself (rather than managed by the kernel)? In my opinion,
Kernel is an alias for a running program whose program text is in the kernel area and can access all memory spaces;
Process is an alias for a running program whose program  has an independent memory space in the user memory area. Which process can get the use of the CPU is completely managed by the kernel;
Thread is an alias for a running program whose program-text is in the memory space of a process and completely shares the memory space with another thread of the same process. Which thread can get the use of the CPU is completely managed by the kernel;
Coroutine is an alias for a running program whose program-text is in the memory space of a process.And it is a user thread that the process decides itself (not the kernel) how to use, and the kernel is only responsible for allocating CPU resources to the process.
Since the process itself has no right to schedule like the kernel, the coroutine can only be concurrent but not parallel.
Am I correct in saying Above?

A:
process is an alias for a running program...

The modern way to think of a process is to think of it as a container for a collection of threads and the resources that those threads need to execute.
Every process (except for "zombie" processes that can exist in some systems) must have at least one thread. It also has a virtual address space, open file handles, and maybe sockets and other resources that are shared by the threads.

Thread is an alias for a running program...

The problem with saying that is, "running program" sounds too much like "process," and a thread is most definitely not a process. (E.g., a thread can only exist in a process.)
A computer scientist might tell you that a thread is one particular execution of the application's code. I like to think of a thread as an independent agent who executes the code.

coroutine...is a user thread...

I'm going to mostly leave that one alone. "Coroutine" seems to mean something different from the highly formalized, and not particularly useful coroutines that I learned about more than forty years ago. What people call "coroutines" today seem to have somewhat in common with what I call "green threads," but there are details of how and when and why they are used that I don't yet understand.
Green threads (a.k.a., "user mode threads") simply are threads that the kernel doesn't know about. They are pretty much just like the threads that the kernel does know about except, the kernel scheduler never preempts them because, Duh! it doesn't know about them. Context switches between green threads can only happen at specific points where the application allows it (e.g., by calling a yield() function or, by calling some library function that is a documented yield point.)

kernel is an alias for a running program...

The kernel also is most definitely not a process.
I don't know every detail about every operating system, but the bulk of kernel code does not run independently of the applications that the kernel serves. It only runs when an application thread enters kernel mode by making a system call. The thread that runs the kernel code still belongs to the application process, but the code that determines the thread's behavior at that point is written or chosen by the kernel developers, not by the application developers.


text:
Q: Pasar de un activity a otro en segundo plano (Android Studio Java) Estoy realizando una aplicación Android y necesito pasar de mi activity principal a un segundo activity en el cual tomo mediante código un screen de pantalla y luego tendría que volver a mi activity principal. necesito que ese cambio de activity se haga en segundo plano, que el usuario no se entere de lo que esta pasando. Si saben como hacerlo me ayudarían muchísimo.
Este es mi código el cual se debería realizar en segundo plano (no quiero que el usuario vea esto, ni el layout enlazado a este, solo debería de ver un progress bar):
public class MainActivity2 extends AppCompatActivity {

Handler handler = new Handler();

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main2);

    Progress_foto.start(MainActivity2.this);

    handler.postDelayed(new Runnable() {
        public void run() {
            takeScreenshot();
            Progress_foto.stop();
        }
    }, 2000); // 2 segundos de "delay"

}

private void takeScreenshot() {
    Date now = new Date();
    android.text.format.DateFormat.format("yyyy-MM-dd_hh:mm:ss", now);

    try {

        String mPath = Environment.getExternalStorageDirectory().toString() + "/" + now + ".png";

        View u = findViewById(R.id.tabscroll);
        u.setDrawingCacheEnabled(true);
        ScrollView z = (ScrollView) findViewById(R.id.tabscroll);
        //z.setBackgroundColor(getResources().getColor(R.color.white));
        int totalHeight = z.getChildAt(0).getHeight();
        int totalWidth = z.getChildAt(0).getWidth();
        u.layout(0, 0, totalWidth, totalHeight);
        u.buildDrawingCache(true);
        Bitmap bitmap = Bitmap.createBitmap(u.getDrawingCache());
        u.setDrawingCacheEnabled(false);

        File imageFile = new File(mPath);

        FileOutputStream outputStream = new FileOutputStream(imageFile);
        int quality = 100;
        bitmap.compress(Bitmap.CompressFormat.PNG, quality, outputStream);
        outputStream.flush();
        outputStream.close();

    } catch (Throwable e) {

        e.printStackTrace();
    }
}

Y este es mi layout:
    <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/constrain"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="center"
    android:background="@drawable/fondo"
    android:theme="@style/Theme.Transparent">

<ScrollView
    android:id="@+id/tabscroll"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <LinearLayout
            android:id="@+id/linearLayout16"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <TextView
                android:id="@+id/textView18"
                android:layout_width="match_parent"
                android:layout_height="4dp"
                android:background="#3C5C97"
                android:text="@string/espacio"
                android:textColor="#3C5C97" />

            <LinearLayout
                android:id="@+id/linearLayout7"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <TextView
                    android:id="@+id/textView36"
                    android:layout_width="4dp"
                    android:layout_height="match_parent"
                    android:layout_weight="1"
                    android:background="#3C5C97"
                    android:text="@string/espacio"
                    android:textColor="#3C5C97" />

                <LinearLayout
                    android:layout_width="120dp"
                    android:layout_height="match_parent"
                    android:background="#FF867D"
                    android:orientation="vertical">

                    <Space
                        android:layout_width="match_parent"
                        android:layout_height="5dp" />

                    <TextView
                        android:id="@+id/textViewNumero"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginHorizontal="10dp"
                        android:background="@drawable/edittext_custom"
                        android:gravity="center"
                        android:textColor="#000000"
                        android:textSize="13sp"
                        android:textStyle="bold" />

                    <Space
                        android:layout_width="match_parent"
                        android:layout_height="5dp" />

                    <TextView
                        android:id="@+id/textViewNombre"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginHorizontal="10dp"
                        android:background="@drawable/edittext_custom"
                        android:gravity="center"
                        android:textColor="#000000"
                        android:textSize="13sp"
                        android:textStyle="bold" />

                    <Space
                        android:layout_width="match_parent"
                        android:layout_height="5dp" />

                    <TextView
                        android:id="@+id/textViewApellido"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginHorizontal="10dp"
                        android:background="@drawable/edittext_custom"
                        android:gravity="center"
                        android:textColor="#000000"
                        android:textSize="13sp"
                        android:textStyle="bold" />
                </LinearLayout>

                <TextView
                    android:id="@+id/textView19"
                    android:layout_width="4dp"
                    android:layout_height="match_parent"
                    android:background="#3C5C97"
                    android:text="@string/espacio"
                    android:textColor="#3C5C97" />

                <LinearLayout
                    android:id="@+id/linearLayout5"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:orientation="vertical">

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:orientation="horizontal">

                        <TextView
                            android:id="@+id/buscar_numA1"
                            android:layout_width="55dp"
                            android:layout_height="55dp"
                            android:background="@drawable/confirmar_number_custom"
                            android:gravity="center"
                            android:textColor="#000000"
                            android:textSize="20sp"
                            android:textStyle="bold" />

                        <TextView
                            android:id="@+id/buscar_numA2"
                            android:layout_width="55dp"
                            android:layout_height="55dp"
                            android:background="@drawable/confirmar_number_custom"
                            android:gravity="center"
                            android:textColor="#000000"
                            android:textSize="20sp"
                            android:textStyle="bold" />

                        <TextView
                            android:id="@+id/buscar_numA3"
                            android:layout_width="55dp"
                            android:layout_height="55dp"
                            android:background="@drawable/confirmar_number_custom"
                            android:gravity="center"
                            android:textColor="#000000"
                            android:textSize="20sp"
                            android:textStyle="bold" />

                        <TextView
                            android:id="@+id/buscar_numA4"
                            android:layout_width="55dp"
                            android:layout_height="55dp"
                            android:background="@drawable/confirmar_number_custom"
                            android:gravity="center"
                            android:textColor="#000000"
                            android:textSize="20sp"
                            android:textStyle="bold" />

                        <TextView
                            android:id="@+id/buscar_numA5"
                            android:layout_width="55dp"
                            android:layout_height="55dp"
                            android:background="@drawable/confirmar_number_custom"
                            android:gravity="center"
                            android:textColor="#000000"
                            android:textSize="20sp"
                            android:textStyle="bold" />

                        <TextView
                            android:id="@+id/buscar_numA6"
                            android:layout_width="55dp"
                            android:layout_height="55dp"
                            android:background="@drawable/confirmar_number_custom"
                            android:gravity="center"
                            android:textColor="#000000"
                            android:textSize="20sp"
                            android:textStyle="bold" />

                        <TextView
                            android:id="@+id/buscar_numA7"
                            android:layout_width="55dp"
                            android:layout_height="55dp"
                            android:background="@drawable/confirmar_number_custom"
                            android:gravity="center"
                            android:textColor="#000000"
                            android:textSize="20sp"
                            android:textStyle="bold" />

                        <TextView
                            android:id="@+id/buscar_numA8"
                            android:layout_width="55dp"
                            android:layout_height="55dp"
                            android:background="@drawable/confirmar_number_custom"
                            android:gravity="center"
                            android:textColor="#000000"
                            android:textSize="20sp"
                            android:textStyle="bold" />

                        <TextView
                            android:id="@+id/buscar_numA9"
                            android:layout_width="55dp"
                            android:layout_height="55dp"
                            android:background="@drawable/confirmar_number_custom"
                            android:gravity="center"
                            android:textColor="#000000"
                            android:textSize="20sp"
                            android:textStyle="bold" />

                    </LinearLayout>

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:orientation="horizontal">

                        <TextView
                            android:id="@+id/buscar_numB1"
                            android:layout_width="55dp"
                            android:layout_height="55dp"
                            android:background="@drawable/confirmar_number_custom"
                            android:gravity="center"
                            android:textColor="#000000"
                            android:textSize="20sp"
                            android:textStyle="bold" />

                        <TextView
                            android:id="@+id/buscar_numB2"
                            android:layout_width="55dp"
                            android:layout_height="55dp"
                            android:background="@drawable/confirmar_number_custom"
                            android:gravity="center"
                            android:textColor="#000000"
                            android:textSize="20sp"
                            android:textStyle="bold" />

                        <TextView
                            android:id="@+id/buscar_numB3"
                            android:layout_width="55dp"
                            android:layout_height="55dp"
                            android:background="@drawable/confirmar_number_custom"
                            android:gravity="center"
                            android:textColor="#000000"
                            android:textSize="20sp"
                            android:textStyle="bold" />

                        <TextView
                            android:id="@+id/buscar_numB4"
                            android:layout_width="55dp"
                            android:layout_height="55dp"
                            android:background="@drawable/confirmar_number_custom"
                            android:gravity="center"
                            android:textColor="#000000"
                            android:textSize="20sp"
                            android:textStyle="bold" />

                        <TextView
                            android:id="@+id/buscar_numB5"
                            android:layout_width="55dp"
                            android:layout_height="55dp"
                            android:background="@drawable/confirmar_number_custom"
                            android:gravity="center"
                            android:textColor="#000000"
                            android:textSize="20sp"
                            android:textStyle="bold" />

                        <TextView
                            android:id="@+id/buscar_numB6"
                            android:layout_width="55dp"
                            android:layout_height="55dp"
                            android:background="@drawable/confirmar_number_custom"
                            android:gravity="center"
                            android:textColor="#000000"
                            android:textSize="20sp"
                            android:textStyle="bold" />

                        <TextView
                            android:id="@+id/buscar_numB7"
                            android:layout_width="55dp"
                            android:layout_height="55dp"
                            android:background="@drawable/confirmar_number_custom"
                            android:gravity="center"
                            android:textColor="#000000"
                            android:textSize="20sp"
                            android:textStyle="bold" />

                        <TextView
                            android:id="@+id/buscar_numB8"
                            android:layout_width="55dp"
                            android:layout_height="55dp"
                            android:background="@drawable/confirmar_number_custom"
                            android:gravity="center"
                            android:textColor="#000000"
                            android:textSize="20sp"
                            android:textStyle="bold" />

                        <TextView
                            android:id="@+id/buscar_numB9"
                            android:layout_width="55dp"
                            android:layout_height="55dp"
                            android:background="@drawable/confirmar_number_custom"
                            android:gravity="center"
                            android:textColor="#000000"
                            android:textSize="20sp"
                            android:textStyle="bold" />

                    </LinearLayout>

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:orientation="horizontal">

                        <TextView
                            android:id="@+id/buscar_numC1"
                            android:layout_width="55dp"
                            android:layout_height="55dp"
                            android:background="@drawable/confirmar_number_custom"
                            android:gravity="center"
                            android:textColor="#000000"
                            android:textSize="20sp"
                            android:textStyle="bold" />

                        <TextView
                            android:id="@+id/buscar_numC2"
                            android:layout_width="55dp"
                            android:layout_height="55dp"
                            android:background="@drawable/confirmar_number_custom"
                            android:gravity="center"
                            android:textColor="#000000"
                            android:textSize="20sp"
                            android:textStyle="bold" />

                        <TextView
                            android:id="@+id/buscar_numC3"
                            android:layout_width="55dp"
                            android:layout_height="55dp"
                            android:background="@drawable/confirmar_number_custom"
                            android:gravity="center"
                            android:textColor="#000000"
                            android:textSize="20sp"
                            android:textStyle="bold" />

                        <TextView
                            android:id="@+id/buscar_numC4"
                            android:layout_width="55dp"
                            android:layout_height="55dp"
                            android:background="@drawable/confirmar_number_custom"
                            android:gravity="center"
                            android:textColor="#000000"
                            android:textSize="20sp"
                            android:textStyle="bold" />

                        <TextView
                            android:id="@+id/buscar_numC5"
                            android:layout_width="55dp"
                            android:layout_height="55dp"
                            android:background="@drawable/confirmar_number_custom"
                            android:gravity="center"
                            android:textColor="#000000"
                            android:textSize="20sp"
                            android:textStyle="bold" />

                        <TextView
                            android:id="@+id/buscar_numC6"
                            android:layout_width="55dp"
                            android:layout_height="55dp"
                            android:background="@drawable/confirmar_number_custom"
                            android:gravity="center"
                            android:textColor="#000000"
                            android:textSize="20sp"
                            android:textStyle="bold" />

                        <TextView
                            android:id="@+id/buscar_numC7"
                            android:layout_width="55dp"
                            android:layout_height="55dp"
                            android:background="@drawable/confirmar_number_custom"
                            android:gravity="center"
                            android:textColor="#000000"
                            android:textSize="20sp"
                            android:textStyle="bold" />

                        <TextView
                            android:id="@+id/buscar_numC8"
                            android:layout_width="55dp"
                            android:layout_height="55dp"
                            android:background="@drawable/confirmar_number_custom"
                            android:gravity="center"
                            android:textColor="#000000"
                            android:textSize="20sp"
                            android:textStyle="bold" />

                        <TextView
                            android:id="@+id/buscar_numC9"
                            android:layout_width="55dp"
                            android:layout_height="55dp"
                            android:background="@drawable/confirmar_number_custom"
                            android:gravity="center"
                            android:textColor="#000000"
                            android:textSize="20sp"
                            android:textStyle="bold" />

                    </LinearLayout>
                </LinearLayout>

                <TextView
                    android:id="@+id/textView20"
                    android:layout_width="4dp"
                    android:layout_height="match_parent"
                    android:background="#3C5C97"
                    android:text="@string/espacio"
                    android:textColor="#3C5C97" />

            </LinearLayout>

            <TextView
                android:id="@+id/textView17"
                android:layout_width="match_parent"
                android:layout_height="4dp"
                android:background="#3C5C97"
                android:text="@string/espacio"
                android:textColor="#3C5C97" />

        </LinearLayout>

    </LinearLayout>
</ScrollView>

</androidx.constraintlayout.widget.ConstraintLayout>


text:
Q: Website not loading css files on certain page The site i am building isn't loading any css/javascript file for certain pages. The pages in question are the markdown post files. I am using Jekyll to build the site.
Here is the link
http://joshhornby.co.uk/
As you can see the index page works but the blog posts dont.

A: your href does not start with / nor is it absolute (http://) so it will use a path relative to the current page.
It is looking for CSS in the folder http://joshhornby.co.uk/2012/11/14/
Add / before your stylesheet/ in the href and you should be good.


text:
Q: max-age=0 sent by browsers despite headers modified everywhere I have a headers/cache issue in my lamp [centos] website.
Config:
[root@localhost httpd]# httpd -v
Server version: Apache/2.2.23 (Unix)
Server built:   Nov 25 2012 15:03:00

[root@localhost httpd]# php -v
PHP 5.5.22 (cli) (built: Feb 20 2015 04:04:46)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
    with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2015, by Zend Technologies

php.ini:
session.cache_limiter = public
session.cache_expire = 535680

httpd.conf:
<IfModule mod_expires.c>
    # enable expirations
    ExpiresActive On
         <FilesMatch "\.(php)$">
                ExpiresDefault "access plus 1 month"
                Header set Cache-Control "max-age=32140800, public"
                Header unset ETag
                Header unset Last-Modified
                FileETag None
         </FilesMatch>
</IfModule>

Meta tags:
<meta HTTP-EQUIV="cache-control" CONTENT="public, max-age=32140800">

The Issue:

*

*Load the page for the first time (named si.php here)

*Clean access_log:
[root@localhost httpd]# > access_log

*Press F5 in firefox/chrome:
[root@localhost httpd]# cat access_log
192.168.0.16 - user [25/Jun/2015:04:16:19 +0100] "GET /path/si.php HTTP/1.1" 200 642 "-" "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36"

*Observe Http headers with live http headers firefox extension:
http://192.168.0.249/path/si.php

GET /path/si.php HTTP/1.1
Host: 192.168.0.249
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
DNT: 1
Cookie: __utma=254085576.10126650.1407082841.1422764987.1429480306.10; __utmz=254085576.1407082841.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); PHPSESSID=1cuf6d8764vu2i2u1hin4pg665
Authorization: Basic cmVjZqR0ZTq1c2VyMQ==
Connection: keep-alive
Cache-Control: max-age=0

HTTP/1.1 200 OK
Date: Thu, 25 Jun 2015 03:18:04 GMT
Server: Apache
X-Powered-By: PHP/5.5.22
Expires: Fri, 01 Jul 2016 03:18:04 GMT
Cache-Control: max-age=32140800, public
Vary: Accept-Encoding,User-Agent
Content-Encoding: gzip
Content-Length: 643
Keep-Alive: timeout=15, max=13
Connection: Keep-Alive
Content-Type: text/html; charset=utf-8

Why on earth is the max-age=0 header sent? Firefox and Chrome display both the same behavior. This is an extra 170ms I currently cannot afford.
What is even weirder is the 200 http response code. I don't modify the page at all, it should at the very least return a 304...

Edit:
Ok, as accepted answer proposes, solution is to:

*

*not open a fresh browser (might not retrieve from cache)

*not pressing f5

*not just pressing enter in address bar

After the page has been visited a first time in this browser instance, any subsequent normal visit will be from cache:

A: When you hit F5 in a browser, you are instructing the browser to ask the sever and any proxies in the path for new content. That Cache-Control request header does just that. It does not get added during normal navigation.
Also, PHP has no way of knowing that your content didn't change, especially if it is making a database call. It will never return a 304 for a request unless you add code that makes it do so under whatever conditions. The reason you set a cache-control response header is so the browser won't even make a request at all if the resource is in cache.
Stop hitting F5, browse normally, and watch the traffic with Fiddler or similar tool. You'll find that when you visit your PHP page, then go somewhere else, then come back without hitting F5 that your browser shows your PHP page without even requesting it from the server at all. You're changing that normal caching behavior by hitting F5!


text:
Q: How to set Class member variables in php I'm getting following error shown below while setting class member variables. How to set member variables in php like we normally do in c#.net
Parse error: syntax error, unexpected T_VAR, expecting T_VARIABLE ,Kindly help me out to fix it. I'm newbie in PHP
<?php

class clsCustomer{

       public var $customercode;
       public var $customername;
       public var $customeraddress;

       public function PrintCustomerDetails(){

        echo $this->customercode." ".$this->customername." ".$this->customeraddress;
       }

}

$obj = new clsCustomer();

$obj->customercode = 1;
$obj->customername = "Shiv";
$obj->customeraddress = "Mumbai India";

$obj->PrintCustomerDetails();

?>

A: Remove the var keywords from the property declarations:
class clsCustomer{

   public $customercode;
   public $customername;
   public $customeraddress;

   ...

}

Further Reading

*

*Classes and Objects

*Properties


text:
Q: c++ winapi - subclassing an edit control - annoying sound when clicking "Enter" I made an edit control able to accept data when somebody would click "Enter". I used subclassing to do that. It worked almost perfectly. However after clicking "Enter" the system plays "Error" sound every time. I tried to use ES_MULTILINE and ES_AUTOVSCROLL to bypass it but it helped partially. Now after clicking "Enter" there's no sound, but in the textbox appears useless "Enter" character, that is impossible to delete.
How to bypass the system sound? Or delete "Enter" character from that textbox (SetWindowText(handle, "") doesn't help).

A: You do not need the ES_MULTILINE, ES_AUTOVSCROLL or ES_WANTRETURN style flags.
To stop a single-line edit control from beeping on VK_RETURN you need to handle the WM_CHAR message for that control and return 0 for VK_RETURN without calling the default window procedure, which has to be called for all other keys.

A: I learned from WinAPI Reference that default processing of WM_CHAR for an edit calls MessageBeep function for an illegal character, such as enter and tab.  I had subclassed the edit control to tab between controls by intercepting WM_KEYDOWN (as shown by Petzold for scroll bars), but it was beeping when I pressed tab.  So I intercept WM_CHAR to avoid default processing when I press tab, and so stop the beep.


text:
Q: What issues (if any) do you see in using the builder-pattern within an entity itself as opposed to a separate inner class? After searching SOF for related questions and finding something roughly similar for PHP, but still not satisfying, here's my question.
Problem: using an inner static builder class feels like too much typing. I want to keep some properties immutable but I don't want to use constructors with a significant number of arguments, i.e. only those that are immutable.
Solution: Create a class with a constructor that takes all the required fields and setter methods for properties that aren't required. Chain the call to allow the following pattern.
var product = new Product("Car")
.withColor(Color.Black)
.withGears(5);

Do you consider this an anti-pattern? What benefit does the classic builder-pattern have over this? Read only fields would still be part of the constructor arguments.
My first post to SOF, thanks!

A: If you are developing a Domain Model this kind of solution violates the separation of concerns and muddles the definition of a particular part of the Model (a Product in your case).
A Product class represents a Product from the business domain that you are modeling. A Product class instance will be a concrete product, for example a book, a radiator, a bike etc. The Product class instance should have responsibilies for containing and managing it's life-cycle and keeping it's invariants.
Methods like WithColor and WithGears in Product muddle what it represents.
The creation of a Product is a separate responsibility. It can be given to a separte Class for example a ProductFactory or a ProductBuilder or it can be geven to the Class itself by the Constructor or static Factory methods.
Many different things can affect how you choose to create your Products.

*

*How complex the task is?

*How many variations of products are there? Can you have a separate factory method for reusing the creation of products and making this easier for client code?

If creating of Product instances is simple then you need only a constructor.
If you notice that thre are too many different ways to create a Product you can use a factory. For example:
class ProductFactory {

  public Product CrateBook(string title, ....);
  public Product CrateFictionalBook(string title, ....);
  public Product CrateScifiBook(string title, ....);
  public Product CrateMagazine(string title, ....);
}

These methods will create the most common types of books by setting the appropriate parameters so that your client code doesn't have to do it. As a consequence you have a more readable code, as the method names give you information of what type of book you are creating instead of having just a constructor.
This is more intention revealing and shorter:
book = ProductFactory.CreateScifiBook("Killer robots", ...);

than this:
book = new Product(BookTypes.Scifi, new ISBN(), "Killer robots", ...);

it's true that you have to write more classes and more methods, but if you have to create lots of products in the code you will save yourself a lot of typing.
In your case you have lots of different combinations between the properties of the Product class. Creating different methods like in the ProductFactory that create books, will lead to the explosion of methods that will make the code harder to write and undertand. These methods are not composable. In this case use the builder pattern to make the creation of a product easier and more readable like in your example.
If your system isn't very complex it's not necessary to add additional classes. If you system grows, adding factories and builder can reduce typing and make code more readable and explicit.
If you haven't read Domain Driven Design from Eric Evans I highly recommend it. It dicusses in detail how to build Domain Models.


text:
Q: How To Get List Of DropDown Menu Items of webbrowser? I'm creating an application in which I need to get a list of all the elements of the drop-down menu. I'm programming in Visual Basic Express 2010, and I have webbrowser1 on my form. The webpage has a drop-down menu like below:
<select name="abc" id="def">
  <option value="1">Element 1</option>
  <option value="2">Element 2</option>
  <option value="3">Element 3</option>
</select>

I would like to get elements of the drop-down menu to an array.

A: var options = $("select#def");

var valueArray = _.map(options ,function(option) {
    return option.value;
});

use Underscore.js _.map method to return values to an Array

A: Base on the CruleD 's solution:
Private Sub getOption()

    Dim optionList as new List(Of String)

    For Each element As HtmlElement In WebBrowser1.Document.GetElementById("def").Children

        optionList.Add(element.InnerHtml)

    Next

    Console.WriteLine(String.Join(",", optionList.ToArray))

End Sub

In Output window it will show:
Element 1,Element 2,Element 3
If you want to convert the list to array:
Dim myArray As String() = optionList.ToArray


text:
Q: Non-debug run in separate window or fullscreen Obviously one would use vsCode mostly for debug runs. But it would be nice to code in Zen mode or fullscreen, then press ctrl + f5 and see the (voluminous) result in fullscreen. What might work the best is to have an option where the debug etc panes are not at the bottom of the editor, but in separate windows by themselves. Is there an option or hack to achieve this?
Edit: The best seems to be: Go Zen, on the debug pane click on the up arrow to "maximize panel size", and then toggle its visibility with ctrl + j. But I'm even greedier than that so I'm asking for more!


text:
Q: I want to show the result based on my db column status I have created the database column status . In status columns data   is stored 0 or  1
1means=active
0 means=inactive

l want to show the data with status1 first and status0 second and order by news id desc.
Here is my code:The
select *from news where status='1'  or status='0' order by nid desc

Here i am getting the result , but i  want to  show what are data with status1 should be show first then status0

A: Several things about your question do not make sense:

*

*If the status is either 0 or 1, why are you comparing it to 1 and 2?

*If the status is an integer, why are do you use single quotes around the values?

The answer to your question is just to put the keys that you want in the order by statement:
select n.*
from news n
where n.status in (0, 1)
order by n.status desc, n.nid desc


text:
Q: Covariance of two additions of random variables I have a set of independent random variables $A_{1}, A_{2}, ... , A_{n}, n \geq 7$ with
$ \forall i \in[1, n], \ \mathbb{E}(A_{i}) = 0 \ \& \text{ Var}(A_{i}) = 1$
I have two other random variables, B and C where
$B = 5A_{p} + 7A_{p-3}, p\geq 4 $ and $C = 13A_{p+7m} - 6A_{p-3+4m}, m \geq 0$
I am attempting to determine Cov(B, C)
Everything I have attempted so far makes me believe the answer is $0$ but I feel this can't be right.

A: Note that for integers $p, m$ satisfying the given criteria, the set $\{p, p-3, p+7m, p-3+4m\}$ are all distinct unless $m = 0$, since $p = p-3$ is impossible; $p = p+7m$ or $p-3 = p-3 + 4m$ implies $m = 0$; $p = p-3 + 4m$ or $p-3 = p+7m$ implies $m$ is not an integer; and $p+7m = p-3 + 4m$ implies $m$ is negative.
If $m = 0$, then
$$\begin{align}
\operatorname{Cov}[B,C]
&= \operatorname{Cov}[5A_p + 7A_{p-3}, 13A_p - 6A_{p-3}] \\
&= 5(13) \operatorname{Cov}[A_p, A_p] - 5(6)\operatorname{Cov}[A_p, A_{p-3}] + 7(13)\operatorname{Cov}[A_{p-3}, A_p] - 7(6)\operatorname{Cov}[A_{p-3},A_{p-3}] \\
&= 65 \operatorname{Var}[A_p] - 42\operatorname{Var}[A_{p-3}] \\
&= 23.
\end{align}$$
If $m \ne 0$, then it is obvious that $\operatorname{Cov}[B,C] = 0$.


text:
Q: How is FlexBuilder compiling my app? I'd like to see the command-line arguments that FlexBuilder is using to compile my application. This is so that I can build them into the ANT script I'm working on. Is there any way to view the command line compilation step?
The reason I'm asking for this is that when I compile my app using Ant/Flex SDK vs. FlexBuilder my app behaves differently.

A: So I figured out the answer.
First of all, you can get a better idea of how FlexBuilder compiles your app by adding a -dump-config=C:\myConfig.xml to the compile arguments in FlexBuilder. This outputs an xml file containing configuration settings used in the compilation step. You can also use this file as an argument to compc or mxmlc if you'd like. Read more about it
here...
But, here's what actually solved my problem. I was using the regular old Flex SDK installed on our integration server to compile my apps using Ant. This is the free SDK you can download from Adobe's site. I then took the FlexBuilder directory from my local machine and copied it up to the integration server and pointed my build script to use that version of the SDK (and changed my path env variable).
When I compiled using the FlexBuilder version of the SDK, all was well and the strange bugs I was seeing in my app disappeared.
Moral of the story, make sure you are using the same version of the SDK for your automated builds as you use to build locally.


text:
Q: How to calculate address and jump in one step in x86-64 assembly? This question is about x86-64 assembly. Code is written in AT&T style syntax.
I want to do a jump to %rax+%rdx*8, but this seems to be possible only with
two instructions:
lea (%rax,%rdx,8),%rax
jmp *%rax

However, since there is a way to do an even more complex thing:
jmp *(%rax,%rdx,8) # jumps to the address stored at address %rax+%rdx*8

I wonder if there is also a way of jumping directly to %rax+%rdx*8.


text:
Q: Get substring by removing the last 3 characters in javascript I am trying to Get substring by removing the last 3 characters in javascript
I want to keep only 80000 from The string :

80000 km

A: If you want to clip the end (right side) of the string, you can grab the substring starting from the begining and stopping three characters shy of the original length.

const clipRight = (s, n) => s.substr(0, s.length - n),
      clipLeft  = (s, n) => s.substr(-n);

var str = "80000 km";

console.log(clipRight(str, 3)); // 80000
console.log(clipLeft(str, 2));  // km
.as-console-wrapper { top: 0 }

A: Use split.
var x = "80000 km";

var y = x.split(" ")[0];

-> y is 80000


text:
Q: Android: How to make item in ListView clickable I am currently attempting to make a ListView List in order to load the contact into the aforementioned list. However, the contact entry is not clickable. I try to use a solution in an unidentified website; I may be doing something wrong.
ContactManager.java
package com.example.android.contactmanager;

import android.app.Activity;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.provider.ContactsContract;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.ListView;
import android.widget.SimpleCursorAdapter;

public final class ContactManager extends Activity implements OnItemClickListener
{

    public static final String TAG = "ContactManager";

    private Button mAddAccountButton;
    private ListView mContactList;
    private boolean mShowInvisible;
    //public BooleanObservable ShowInvisible = new BooleanObservable(false);
    private CheckBox mShowInvisibleControl;

    /**
     * Called when the activity is first created. Responsible for initializing the UI.
     */

    @Override
    public void onCreate(Bundle savedInstanceState)
    {

         mContactList = (ListView) findViewById(R.id.contactList);
         mContactList.setOnItemClickListener(this);

        Log.v(TAG, "Activity State: onCreate()");
        super.onCreate(savedInstanceState);
        setContentView(R.layout.contact_manager);

        // Obtain handles to UI objects
        mAddAccountButton = (Button) findViewById(R.id.addContactButton);
        mContactList = (ListView) findViewById(R.id.contactList);
        mShowInvisibleControl = (CheckBox) findViewById(R.id.showInvisible);

        // Initialise class properties
        mShowInvisible = false;
        mShowInvisibleControl.setChecked(mShowInvisible);

        // Register handler for UI elements
        mAddAccountButton.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                Log.d(TAG, "mAddAccountButton clicked");
                launchContactAdder();
            }
        });
        mShowInvisibleControl.setOnCheckedChangeListener(new OnCheckedChangeListener()
        {
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
            {
                Log.d(TAG, "mShowInvisibleControl changed: " + isChecked);
                mShowInvisible = isChecked;
                populateContactList();
            }
        })

        ;

        // Populate the contact list
        populateContactList();
    }

    /**
     * Populate the contact list based on account currently selected in the account spinner.
     */
    private void populateContactList() {
        // Build adapter with contact entries
        Cursor cursor = getContacts();
        String[] fields = new String[] {
                ContactsContract.Data.DISPLAY_NAME
        };
        SimpleCursorAdapter adapter = new SimpleCursorAdapter(this, R.layout.contact_entry, cursor,
                fields, new int[] {R.id.contactEntryText});
        mContactList.setAdapter(adapter);
    }

    /**
     * Obtains the contact list for the currently selected account.
     *
     * @return A cursor for for accessing the contact list.
     */
    private Cursor getContacts()
    {
        // Run query
        Uri uri = ContactsContract.Contacts.CONTENT_URI;
        String[] projection = new String[] {
                ContactsContract.Contacts._ID,
                ContactsContract.Contacts.DISPLAY_NAME
        };
        String selection = ContactsContract.Contacts.IN_VISIBLE_GROUP + " = '" + (mShowInvisible ? "0" : "1") + "'";
        //String selection = ContactsContract.Contacts.IN_VISIBLE_GROUP + " = '" + (mShowInvisible.get() ? "0" : "1") + "'";
        String[] selectionArgs = null;
        String sortOrder = ContactsContract.Contacts.DISPLAY_NAME + " COLLATE LOCALIZED ASC";

        return this.managedQuery(uri, projection, selection, selectionArgs, sortOrder);
    }

    /**
     * Launches the ContactAdder activity to add a new contact to the selected account.
     */
    protected void launchContactAdder()
    {
        Intent i = new Intent(this, ContactAdder.class);
        startActivity(i);
    }

    public void onItemClick(AdapterView<?> l, View v, int position, long id) {
        Log.i("TAG", "You clicked item " + id + " at position " + position);
        // Here you start the intent to show the contact details
    }

}

contact_entry.xml
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2009 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content">
    <TextView android:text="@+id/contactEntryText"
              android:id="@+id/contactEntryText"
              android:layout_width="fill_parent"
              android:textSize="30sp"
              android:layout_height="wrap_content"/>
</LinearLayout>

The aforementioned code is not functioning as I would like it to.

A: You can do this by implementing the OnItemClickListener and handle the clicks in the method onItemClick. You also need to tell your mContactList to use the Listener (thx Sam):
public final class ContactManager extends Activity implements OnItemClickListener {

   @Override
   public void onCreate(Bundle savedInstanceState) {
       [...]
       mContactList = (ListView) findViewById(R.id.contactList);
       mContactList.setOnItemClickListener(this);
       [...]

    public void onItemClick(AdapterView<?> l, View v, int position, long id) {
        Log.i("TAG", "You clicked item " + id + " at position " + position);
        // Here you start the intent to show the contact details
    }
}

A: You have to set  OnItemClickListener for the listview 'mContactList " and you can navigate him to next activity using intent. Hope this helps you.
You can check this tutorial http://www.androidhive.info/2011/10/android-listview-tutorial/


text:
Q: How can I make my two JavaScripts work together? Hello I am trying to have my clock and my countdown timer on the same page so people/users can see when I am done with my game and for them to have the correct time with the countdown timer also. Here is the code. They both work separately but when the are both put on a .php page only the bottom one (countdown timer) works and if I do JQuery.noconflict to the timer the clock works but the countdown doesn't.

 Time until ^^<<>> opens!

Fixed the problem
Thanks to @Scronide , @James Thorpe , and @Ultimater. I put all of your methods into place and kept them separate and used @Scronide final method. Thanks again.

A: They're both assigning to window.onload so the second is overwriting the function of the first.
If you are using jquery, instead of assigning to window.onload, you can instead use:
/* first component */

//initialisation for first component
$(function() {
    dT();
});

/* second component */

//initialisation for second component
$(function() {
    var cdown = new CDown();
    //Year,Month,Day,Hour,Min,Sec\\ (Jan - 0 Fed - 1 ++ Dec - 11, 12 is replaced with 0 for Jan)
    cdown.add(new Date(2014,9,29,12,18,0), "countbox1");
});

A: Both use window.onload. Simply join the two functions into one.

A: Neither of these scripts use any jQuery, so it isn't a jQuery conflict. The problem is that they are both setting a function to window.onload, so the last script will always override the one before it.
I suggest removing the if(!document.all){ window.onload=dT; }else{ dT(); } line from the end of the clock script and adding dT(); inside the window.onload assignment from the second script.
So you would have something like:
window.onload=function(){
  dT();
  var cdown = new CDown();
  cdown.add(new Date(2014,9,29,12,18,0), "countbox1");
};


text:
Q: Should I Save widget HTML to a file cache? I have w3 total cache installed, but i have a custom plugin that i use to pull information from a large database. I use this to generate sidebar information. For example, i have custom fields for posts that allow me to associate a movie/game/person etc with a post. When the post loads i take this Id and perform a DB lookup to get information on this ID and then build the HTML. Rather than perform this SQL lookup every single time, would it be quicker if i saved the HTML to a file and refreshed it every now and then?
The reason i ask is because i ran P3 Plugin Profiler and my custom plugin is responsible for 60% of the page load time, so i badly need to make it more efficient.
Her eis what im doing. Posts have custom meta fields. A single post will have an ID of eg. 3. The widget will then perform a WP query to find other posts with the same ID. Other widgets will take the Id and perform an SQL query to get information for the movie from another database external to wordpress. so say a review for terminator, this will have the meta movie id for the movie from an external database that has all of the movie information. I want to find other posts related to the same movie based on the movieId and also get the movie information. This means it will be non existent for some posts and different for others. A cache will need to be done for each page.
My main question is will a file cache be faster than dynamically loading it each time?
if(is_single())
{
    Global $IDFromPostMetaField1;

    if($IDFromPostMetaField1 != "")
    {
        //sometimes this will be an SQL query and not a WP query
        $myquery = new WP_Query( "post_type=post&meta_key=abc....");
        $relatedposts = $myquery->posts;

        if(count($relatedposts) > 0)
        {
            //display other posts that are related to this movie.
        }
    }
}
else
{
    //do some other form of similar lookup
}


text:
Q: Finding a limit inside a limit 2 I'm stuck with this problem:
Given $\lim \limits_{x \to 2} \frac{f(x+2)+3f(x^2)}{x^2+1}=3$ find $\lim \limits_{x \to 4} f(x)$
I've alreadly asked this question (with a different example) (Finding a limit inside a limit) and I understood it perfectly, but I'm stuck in the last step:
$g(x)=\frac{f(x+2)+3f(x^2)}{x^2+1}$ with $\lim \limits_{x \to 2} g(x)=3$
Solving for $f$:
$f(x+2)+f(x^2)=\frac{g(x)(x^2+1)}{5}$
Now finding the limit as ${x \to 2}$
$\lim \limits_{x\to 2} \frac{g(x)(x^2+1)}{5}=\lim \limits_{x\to 2}f(x+2)+f(x^2)=3$
And now I have no idea what to do...
$\lim \limits_{x\to 2} f(x+2) + \lim \limits_{x\to 2} f(x^2) = 3$

A: We do not reduce generality by assuming $f$ continuous at $x=2$ (we know that the limit exists), and the question can be simply solved as
$$\frac{f(4)+3f(4)}{2^2+1}=3\implies f(4)=\frac{15}4.$$

A: For the first limit, do the variable change $u = x+2$, so that $u \to 4$ as $x \to 2$, giving
$$ \lim_{x\to 2} f(x+2) =\lim_{u\to 2} f(u), $$
and for the second limit, do the variable change $v = x^2$, so that $v \to 4$ as $x \to 2$, giving
$$ \lim_{x\to 2} f(x^2)=\lim_{v\to 2} f(v),  $$
so that the LHS of the final equality in your post is $$2\lim_{x\to 4} f(x). $$ Also, the RHS in that same equality is wrong, as pointed out by the others.

A: You are almost there!
First, let's note that since $2^2+1=5$, so $\lim\limits_{x\to2}f(x+2)+3\lim_{x\to2}f(x^2)=15$, not $3$.
Next, note a very special property of $2$: $2^2=2+2$. This is important because we know then that $\lim\limits_{x\to2}f(x+2)=\lim\limits_{x\to2}f(x^2)=\lim\limits_{x\to4}f(x)$ as polynomials are continuous functions. Hence, $4\cdot\lim\limits_{x\to4}f(x)=15$ so $$\lim_{x\to4}f(x)=\color{red}{\frac{15}4}$$

A: $$\lim \limits_{x \to 2} \frac{f(x+2)+3f(x^2)}{x^2+1}=3$$
Assuming the limits exist, we have $$\lim \limits_{x \to 2} {f(x+2)+3f(x^2)} = 3(2^2)+1=15$$
Thus $4 (\lim _{x\to 4} f(x))= 15 $ which results in $\lim _{x\to 4}=15/4$


text:
Q: Typekit font not loading in webkit browsers I'm using two fonts from typekit:
font-family:"proxima-nova", Arial, Helvetica, sans-serif; - WORKS OK

and
font-family:"garamond-premier-pro", Georgia, serif; - DOESN'T DISPLAY

While Proxima Nova loads ok - Garamond Premier Pro fails to load - but only in Chrome and Safari. Firefox and IE display the font ok. The css rule is ok - it even shows up in web inspector - I get no errors in console - typekit script is loaded - still the font won't display - it falls back to georgia.
I tried different solutions I found around (moving typekit script on top of header, disable text-shadow, remove -webkit prefixed rules from css) - nothing helps.
Is this problem font related? I read that webkit browsers have problems with opentype.

A: Garamond Premier Pro is a commercial product of Adobe. If you have purchased a license that allows web font usage, contact the vendor if the product does not work. Otherwise, don't try to use it as a web font.


text:
Q: How to create a SDK on android with ionic? I am trying to create a SDK on android with ionic, when i try i write

ionic cordova build android

but it does't work because when i search the SDK i don't find it, i don't know what to do, it is the first time that i use ionic and i don't know how to install the app on the phone,the app is ready to be used,to try the app i used the emulator with "ionic serve --lab" please help me
This is an image of what prompt does:

A: You may need to download gradle for building an android app. This answer is more proper as comment but I don't have enough reputations. So, I leave anwser.
Read the link below
ionic 2 - Error Could not find an installed version of Gradle either in Android Studio
p.s. My original answer is a mistake.


text:
Q: How to inject objects in custom object I'm implementing a update function that will use a server response to handle the update. Now my update need to ask the user (in a dialog) to restart the application. The only injection I can do in the class is the IEclipseContext.
Now how can I get the UISynchronize of the current running Eclipse RCP application? So that I safely can run this method:
private void showMessage(UISynchronize sync, final String message) {
        sync.syncExec(new Runnable() {

            @Override
            public void run() {
                MessageDialog.openInformation(null, "Information", message);
            }
        });
    }

A: UISynchronize is in the application IEclipseContext so it will be available in any context except the OSGi services context.
All that UISynchronize does is call Display.asyncExec so if you haven't got a context available just use the traditional
Display.getDefault().asyncExec(....)


text:
Q: Cannot make FileInput, it throws errors during rendering Hi what I want to do is to make FileInput inside my Create action of Admin On Rest panel.
Below is my Create action definition.
import React from 'react';
import {Create, SimpleForm, TextInput, ReferenceInput, SelectInput, FileInput, FileField} from 'admin-on-rest';

export default (props) => (
  <Create {...props}>
    <SimpleForm>
      <TextInput source="name" />
      <ReferenceInput label="Project" source="projectId" reference="projects" allowEmpty>
        <SelectInput optionText="name"/>
      </ReferenceInput>
    </SimpleForm>
    <FileInput source="files" label="Related files" accept="application/pdf">
      <FileField source="src" title="title" />
    </FileInput>
  </Create>
);

And it throws errors such as https://pastebin.com/E6zae4k6
Do you have any ideas why?

A:

import React from 'react';
import {Create, SimpleForm, TextInput, ReferenceInput, SelectInput, FileInput, FileField} from 'admin-on-rest';

export default (props) => (
  <Create {...props}>
    <SimpleForm>
      <TextInput source="name" />
      <ReferenceInput label="Project" source="projectId" reference="projects" allowEmpty>
        <SelectInput optionText="name"/>
      </ReferenceInput>
      <FileInput source="files" label="Related files" accept="application/pdf">
        <FileField source="src" title="title" />
      </FileInput>
    </SimpleForm>
  </Create>
);


text: Q: Call existing Excel Macros with phpExcel Once you export all of the data you need from MySQL into an Excel spreadsheet using PHP Excel, is it possible to call an existing Excel macro to apply formats to the data? If so could you provide an example, please?


text:
Q: object has no attribute 'get_notification_display' I am trying to display human readable label of choicefield.
def reminder(request, pk=None):
    reminder = get_object_or_404(Reminder, pk=pk)
    print(reminder.id)  # printing correct value
    print(reminder.get_notification_display())
    return render(request, 'reminder.html', {'reminder': reminder, 'title': 'Reminder'})

But it throws this error :
AttributeError: 'Reminder' object has no attribute 'get_notification_display'

Here is the model:
class Reminder(models.Model):
    provider_type = (
        ('Em', 'Email'),
        ('Sm', 'SMS'),
        ('De', 'Desktop'),
        ('Mo', 'Mobile'),
    )
    notification = ArrayField(models.CharField(choices=provider_type, max_length=2, default='Em'))

Here's the documentation on get_FOO_display - what am I missing?

A: The documentation says

For every field that has choices set, the object will have a get_FOO_display() method

but you don't have any choices set for notification. In other words, you need a NOTIFICATION_CHOICES iterable of lenght two iterables in your class.

A:  notification = models.CharField(choices=provider_type, max_length=2, default='Em')

remove the arrayfield as it is not allowing you to create and iterate one


text:
Q: Extra slashes in Visual Studio 2008 URLs I am trying to debug a very old (.net 2.0) web application in Visual Studio 2008.  When I run the app the resulting url is:
http://localhost:1070///Index.aspx
Which generates a 400-bad request.  Obviously its the extra slashes the the left of Index.aspx.  I find that these appear in virtually all URLs including the ones for images.  Why is this happening?  I cannot run the app.
Any help would be appreciated!
Thanks

A: I figured it out.  Changing the WEB settings for the start path to "/" then back to "" (blank) cleared it out.  Must have been a faulty or buggy setting.


text:
Q: Extend Array constrained when Element is a tuple Is there a way to extend an Array when the element is a type of tuple ?
public extension Array where Element: (timeZoneName: String, formattedName: String){

}

This declaration returns 4 errors:

*

*Statement cannot begin with a closure expression

*Braced block statements is an unused closure

*Expected '{' in extension

*Expected identifier for type name

I can't tell if the errors shown are accurate.
Any ideas?

A: Swift 3 version of appzYourLife's answer:
extension Sequence where Iterator.Element == Tuple2 {
    func foo() {}
}

A: It's now possible in Swift 3.1.
extension Array where Element == (String, String) {
    ...
}

A: Since (AFAIK) the Tuple type does not conform to a Protocol (and does not even have a name) it's very hard to do what you need.
This is the closest I could get (maybe others can provide more elegant solutions).
Typealias
First of all lets define a couple of typealiases
typealias Tuple2 = (Any, Any)
typealias Tuple3 = (Any, Any, Any)

Yes, some readers now understand where I am going and probably don't like it...
I don't like it neither

SequenceType
Now let's extend the protocol SequenceType adding the foo method when the Element of the sequence is Tuple2...
extension SequenceType where Generator.Element == Tuple2 {
    func foo() {}
}

or Tuple3
extension SequenceType where Generator.Element == Tuple3 {
    func foo() {}
}

Array
Next lets define and populate an array of Tuple2
let list: [Tuple2] = [(1,2)]

Now the extension is applied and we can write
list.foo()

Disclaimer :D
This does work only if the array is explicitly declared as [Tuple2] (or [Tuple3]).
Something like this does not work
let list = [(1,2)]
list.foo() // compile error

A: You can't add specific typing like extension Array where Element == Int because this would transform the generic Array into a non-generic version.
You will see an error something like same-type requirement makes generic parameter 'Element' non-generic
Edit
It does actually seem legit (at least in Swift 2.2) to do:

typealias tzTuple = (timeZoneName: String, formattedName: String)

extension Array where Element: tzTuple  {

}

You will have to see if this works in runtime though.
I was checking this in a Playground and at present, Playgrounds are not yet fully functional with Swift 2.2-dev
I would suggest this instead:

typealias tzTuple = (timeZoneName: String, formattedName: String)

extension Array {

  func formattedName(index: Int) -> String? {
    if self[index] is tzTuple {
      return (self[index] as! tzTuple).formattedName
    }
    return nil
  }
}

will allow you to do

let foo = [(timezoneName: "PST", formattedName: "Pacific Standard Time"),(timezoneName: "AEST", formattedName: "Australian Eastern Time")]
print(foo.formattedName(0))