text:
Q: force haproxy to https I can't get haproxy to force https. It works with http and https. I want it to force port 443.  When I try to force it using .htaccess, it says "To many redirects"
Here is my haproxy.cfg:
global
    log 127.0.0.1 local2
    maxconn 2048
    user haproxy
    group haproxy
    daemon
    tune.ssl.default-dh-param 2048

defaults
    timeout server 86400000
    timeout connect 86400000
    timeout client 86400000
    timeout queue 1000s

listen premierdis
    bind 192.168.1.200:80
    bind 192.168.1.200:443 ssl crt /root/.ssl/website.com.pem ciphers TLSv1+HIGH:!SSLv2:RC4+MEDIUM:!aNULL:!eNULL:!3DES:@STRENGTH
    mode http
    rspirep ^Location:\ http://(.*):80(.*)  Location:\ https://\1:443\2   if  { ssl_fc }
    stats enable
    stats uri /haproxy?stats
    stats realm STATS
    stats auth user:pass
    balance source
    option http-server-close
    timeout http-keep-alive 3000
    reqidel ^X-Real-IP:
    option forwardfor header X-Real-IP
    reqadd X-Forwarded-Proto:\ https
    server srvg-webc-11 192.168.1.21:80 check
    server srvg-webc-12 192.168.1.22:80 check
    server srvg-webc-13 192.168.1.23:80 check

A: If you split out your configuration into one section for HTTP and one section for HTTPS, then you can use redirect scheme in the HTTP section to redirect the client to use HTTPS instead.
global
    log 127.0.0.1 local2
    maxconn 2048
    user haproxy
    group haproxy
    daemon
    tune.ssl.default-dh-param 2048

defaults
    timeout server 86400000
    timeout connect 86400000
    timeout client 86400000
    timeout queue 1000s

listen premierdis-http
    bind 192.168.1.200:80
    mode http
    redirect scheme https if !{ ssl_fc }

listen premierdis
    bind 192.168.1.200:443 ssl crt /root/.ssl/website.com.pem ciphers TLSv1+HIGH:!SSLv2:RC4+MEDIUM:!aNULL:!eNULL:!3DES:@STRENGTH
    mode http
    stats enable
    stats uri /haproxy?stats
    stats realm STATS
    stats auth user:pass
    balance source
    option http-server-close
    timeout http-keep-alive 3000
    reqidel ^X-Real-IP:
    option forwardfor header X-Real-IP
    reqadd X-Forwarded-Proto:\ https
    server srvg-webc-11 192.168.1.21:80 check
    server srvg-webc-12 192.168.1.22:80 check
    server srvg-webc-13 192.168.1.23:80 check

Hope that helps.


text:
Q: Magento catalog price rules discount doesn't work with products with custom options We have added several catalog price rules in our magento stores, but it seems that they don't get applied with additional costs that we set inside products with custom options, but they only work with standard product price, is there a way to fix this? thanks

A: Catalog price rules don't work on simple product's options, they only work on sub-products i.e. childs of configurable products.
If you want to have discounts on single product options you have to create as many products as the options to discount and then to associate them to a configurable product.

A: I think you're just missing one thing.
On your catalog price rule, go under Actions and change the item called Enable Discount to Subproducts to Yes.
And then set this number to be the same as your original discount above.
Example: If you're selling a pair of shoes, and red ones normally cost $10 more.
With the subproduct rule set to no, the $10 mark-up stays at $10, even if your shoes are 50% off. If you turn that subproduct option on, you set a separate line item, to change the mark-up value - so it's shoes 50% off and then 50% off the markup for red ones.

redpajama_set_name: RedPajamaStackExchange


text:
Q: The best way to use dictionary items as we use the advantages of List I want to get use of dictionary items like I do in List generic class,
e.g;
foreach(item in ItemList)
{
  item.BlaBla;
}

But in dictionary there s no chance, like e method above...
Dictionary<string, HtmlInputImage> smartPenImageDictionary;

I mean I got to know the key item for the dictionary item.. but what I want, I want to travel from beginning of the list till the end..

A: I am not absolutely sure what you want to achieve but here are the common things you can do with a dictionary.
IDictionary<Int32, String> dictionary = new Dictionary<Int32, String>();

// Iterate over all key value pairs.
foreach (KeyValuePair<Int32, String> keyValuePair in dictionary)
{
    Int32  key = keyValuePair.Key;
    String value = keyValuePair.Value;
}

// Iterate over all keys.
foreach (Int32 key in dictionary.Keys)
{
    // Get the value by key.
    String value = dictionary[key];
}

// Iterate over all values.
foreach (String value in dictionary.Values)
{
}

A: Iterating over a dictionary results in KeyValuePair<>s. Simply access the Key and Value members of the appropriate variable.

A: Something like this:
foreach (KeyValuePair<string, HtmlInputImage> kvp in smartPenImageDictionary)
{
   Console.WriteLine("Value " + kvp.Value);
}

A: A dictionary doesn't have a "beginning" and "end" - it's unordered.
However, you can iterate over the keys or the values:
foreach (string key in smartPenImageDictionary.Keys)
{
    ...
}

foreach (HtmlInputImage image in smartPenImageDictionary.Values)
{
    ...
}

or key/value pairs:
foreach (KeyValuePair<string, HtmlInputImage> pair in smartPenImageDictionary)
{
    string key = pair.Key;
    HtmlInputImage image = pair.Value;
    ...
}

(Or course var makes the last case rather nicer.)

A: I assume you want them in order, the same way an IList<T> provides. As far as I know there is no order guaranteed for a Dictionary<Tkey,TValue>, so you'll need to
mydictionary.ToList();

However as you add and remove items, or even call this again it may change. One solution is to write your own Collection that has a custom indexer you can use.


text:
Q: Is there an equivalent of the DebuggerStepThrough Attribute in VB6 I'm looking for a way to have the equivalent of the DebuggerStepThrough attribute in the VB6 IDE.
 There are methods (trace methods for example) I know, I won't need to step in.
I know I can use the Shortcut Shift-F8 to step over but when debugging a long method, it's not practical to switch form F8 to Shift-F8


text:
Q: How can I use data.table or data.csv and extra data for click event handling I have a pie chart built using a data.table (HTML table). http://jsfiddle.net/m78Lwkqt/2/
I want to use a 3rd column of the table to drive a click to a particular URL.
       series:[
        {
          type: 'pie',
          animation: false,
          point:{
              events:{
                  click:
                      function (event)
                      {
                          // I want to get the 3rd column of the table's value
                          // that corresponds to this point.
                          alert(this.y);
                      }
                  }
              }
       }
       ]

A: Found an answer: http://jsfiddle.net/ryanreid22/m78Lwkqt/4/
The trick is to add a seriesMapping value (in this case I've called it 'accountCode') that can be used in the point.click handler.
data: {
            table: 'smry_t_pb_outlay_by_account',
            seriesMapping: [{
                 x: 0, // X values are pulled from column 0 by default
                 y: 1, // Y values are pulled from column 1 by default
                accountCode: 2 // used in the point.click below
            }]
        },

events: {
        click:
            function (event) {
                alert(this.accountCode);
            }
        }

A: You could use a jQuery selector to get all the tds from the third column, and when needed match this.x from this click event up against the array you got from the jQuery selector.
For example, getting the third column using a jQuery selector:
var thirdColumn = $("#smry_t_pb_outlay_by_account tr td:nth-child(3)");

And then using this array inside your point.events.click to get the data:
point: {
    events: {
        click: function (event) {
            alert(thirdColumn[this.x].innerHTML);
        }
    }
}

See this JSFiddle demonstration of the code.


text:
Q: What is the cause of compilation error in my code I am running asp.net, C#4.0 application in VS2010. I get the following compilation error:
Server Error in '/' Application.

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: ASPNET: Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl).

Source Error:

Line 1:  using System;

Line 2:  using System.Collections.Generic;

Line 3:  using System.Linq;

My page attribute is :
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs"
    EnableEventValidation="false" Inherits="jsPlumb_jsPlumb_Default2" %>

my c#codebehind class:
  namespace CompanyDisplay.jsPlumb.jsPlumb.jsPlumb
  {
        public  class jsPlumb_jsPlumb_Default2 : System.Web.UI.Page
        {
    }
}

i want namespace to present for running some webservice applications.

A: Try to do this :

*

*add batch="false" in the compilation tag of your applications web.config file as shown below
compilation debug="true" batch="false"

*clean solution

*delete the temporary files folder in Visual Studio(the folder which it shows in the exception)

*do an iisreset and the rebuild my code again

A: This error shows up when code-behind class name doesn't match "inherits" attribute on your aspx page. Maybe you tried to rename something?
Furthermore, I've seen this error, when you try to view a new page, but didn't compile the source, so even though your aspx exists, it can't fight the corresponding code-behind class.
Edit:
You have a completely messed up naming conventions, no surprise you're having troubles to match class names properly.
Sorry, but this is just preposterous!
inherits="CompanyDisplay.jsPlumb.jsPlumb.jsPlumb.jsPlumb_jsPlumb_Default2"

Fix your conventions and maybe you find yourself having source files like this:
CodeBehind="Default.aspx.cs" Inherits="MyNamespace.jsPlumb.Default"

Don't do it like jsPlumb.jsPlumb.jsPlumb....That's just a nightmare!

A: I got the ANSWER ; I should give the inherit attribute as;
inherits="CompanyDisplay.jsPlumb.jsPlumb.jsPlumb.jsPlumb_jsPlumb_Default2"


text:
Q: SAS Studio sql query statement Im new to SAS query.
Im trying to import excel file which has been done. And im trying to select to filter one of the column from another list of data from the same excel list..
Sorry for the grammar.. Let me put the question on..
Create the SAS data, Nonidentified that contains the information of customers who live in neither of the 16 cities. There are three attributes, Name, ID, and Gender in Nonidentified.

And there will be a table store customer data which has one column called city.
Here is the code I have written so far:
proc sql; select * from list2; run;

Thank you guys...

A: It seems like you are not showing us the fields in the tables List1 and List2. These are essential to answering the question. However, assuming that one of them contains data of the customer (Name,ID, Gender,City) here is the answer (I am assuming that the name of the imported table is 'Cities'):
proc sql;
create table nonidentified as
select name,id,gender
from List2
where City not in (select City from Cities);
quit;


text:
Q: inline style is not applying in image tag I am getting html response with inline style from the service. below is the response value im getting.but that inline style is not applying.

when i inspect that element in browser, it is showing below output

A: you are missing px

A: You are missing px or It may possible that some other CSS is applying to it , if you provide !important to your inline CSS then in will get Apply .why !important use in CSS
try like this :

A: Try using px and !important:


text:
Q: React.js Appropiate structure of a multiple language app Background: I'm using Django as the framework for the backend, here, I have a single app with multiple models (one per each language) and React.js as the framework for the fronted. Once the main version is over, I want to make the site multilanguage.
Question: Should I duplicate the original app (say this app is in English) deploy these two versions or maybe create these versions inside of the main version?
Directory structure case A
mainAPP-EN
mainAPP-ES

Directory structure case B
mainAPP
  -> EN
  -> ES

Note. The site is not complex so both options are suitable for me.
Thank you in advance for your time and help!

A: You don't need multiple modules to do that. In fact I would strongly suggest you do not do that, it will become very hard to maintain (IE: bugs and features need to be fixed on each language).
Django's support for multiple locales is great (official docs):
from django.utils.translation import gettext as _

def my_view(request):
    output = _("Welcome to my site.")
    return HttpResponse(output)

On the React side, there are many libraries, the one I like for its simplicity is Airbnb's Polyglot:
const SPANISH_PHRASES = {
  locale: 'es',

  phrases: {
    "hello": "hola"
  },
};

const polyglot = new Polyglot(SPANISH_PHRASES);

polyglot.t("hello"); // returns "hola"

Usually, you would like to define a, say, Translate component that does this under the hood:
// basic example, needs more elaboration!
export default function Translate({ phrase }) {
  return <span>{ polyglot.t(phrase) }</span>
}

Then to use it:
function SomeComponent() {
  return (
   <SomeMenu><Translate phrase="hello" /></SomeMenu>
  );
}


text:
Q: PDF attachment is not opening which I sent by php in Yahoo and some other email providers except gmail This is my code.Here I am converting one of my html to pdf after that I attach it and send a mail along with one subject..
Subject also html only
Attachment can open from gmail but other mails like yahoo, hot mails are not responding well
This is Codeigniter (MVC) coding
   $this->load->view('table2',$data);
    // Get output html
    $html = $this->output->get_output();

    // Load library
    $this->load->library('dompdf_gen');

    //PATH
    $path = FCPATH.'pdf_files/';
    $filename = 'Invoice_pdf'.date('dmYHis').'.pdf';
    $output_file = $path.$filename;
    $data['file_name'] = $this->config->item('base_url').'pdf_files/'.$filename;

    // Convert to PDF
    $this->dompdf->load_html($html);
    $this->dompdf->render();

    $this->dompdf->set_paper(array(0, 0, 792.00, 1224.00),'portrait');
    $output = $this->dompdf->output();
    file_put_contents($output_file, $output);

    // Mail Sending with attachments
    //echo $path; exit;
    $file = $path.$filename;
    $message1 = $this->load->view('mail_sub',$data, TRUE);
    //echo $message1; exit;
    $content = file_get_contents($file);
    $content = chunk_split(base64_encode($content));

    // a random hash will be necessary to send mixed content
    $separator = md5(time());

    // carriage return type (RFC)
    $eol = "\r\n";

    $to = 'example@example.com';

    $headers = "From: <accounts@example.com>" . $eol;
    $headers .= 'CC:'. $session_data['mailid'] ."\r\n";//$session_data['mailid']
    $headers .= "MIME-Version: 1.0" . $eol;
    $headers .= "Content-Type: multipart/mixed; boundary=\"" . $separator . "\"" . $eol;
    $headers .= "Content-Transfer-Encoding: 8bit" . $eol;
    $headers .= "This is a MIME encoded message." . $eol;

    // message
    $body = "--" . $separator . $eol;
    $body .= "Content-Type: text/HTML; charset=\"iso-8859-1\"" . $eol;
    $body .= "Content-Transfer-Encoding: 8bit" . $eol;
    $body .= $message1."\r\n";
    // attachment
    $body .= "--" . $separator . $eol;
    $body .= "Content-Type: application/octet-stream; name=\"" . $filename . "\"" . $eol;
    $body .= "Content-Transfer-Encoding: base64" . $eol;
    $body .= "Content-Disposition: attachment" . $eol;
    $body .= $content . $eol;
    $body .= "--" . $separator . "--";


text:
Q: WHERE clause on one of two parameters A table has sequence numbers and timestamps and other data.
A stored procedure takes 2 parameters, and the user can pass in a null sequence number.
This is what I am trying to achieve but it doesn't work (SQL says Incorrect syntax near >)
create proc dbo.MyProc( @SequenceNo int, @Timestamp datetime ) as
begin
  select * from MyTable where
        case when @SequenceNo is not null THEN SequenceNo > @SequenceNo
              ELSE Timestamp > @Timestamp
        end
end

How to do this?

A: You can use the code below. It uses a case statement in where clause:
declare proc.MyProc( @SequenceNo int, @Timestamp datetime ) as
begin
  select *
  from MyTable
  where
        1 = case
                when @SequenceNo is not null and SequenceNo > @SequenceNo then 1
                when @SequenceNo is null and Timestamp > @Timestamp then 1
                else 0
            end
end

A: Your code looks like SQL Server (although this doesn't make a difference to the answer).  In general, it is best to leave CASE expressions out of WHERE clauses and to just use boolean logic:
select t.*
from MyTable t
where (@SequenceNo is not null and SequenceNo > @SequenceNo) or
      (@SequenceNo is null and Timestamp > @Timestamp);

Because NULL values fail all comparisons, you can simplify this to:
select t.*
from MyTable t
where (SequenceNo > @SequenceNo) or
      (@SequenceNo is null and Timestamp > @Timestamp);

And, in case you want to pass in both values and have filtering, perhaps this is useful:
select t.*
from MyTable t
where (SequenceNo > @SequenceNo or @SequenceNo is null) and
      (Timestamp > @Timestamp or @Timestamp is null);

It is not the same logic, but quite possibly what you want.

A: Use CASE Statement in below format :
DECLARE proc dbo.MyProc( @SequenceNo int, @Timestamp datetime ) as
BEGIN
    SELECT * FROM MyTable
    WHERE SequenceNo = CASE WHEN ( @SequenceNo IS NOT NULL OR SequenceNo >
         @SequenceNo ) THEN @SequenceNo ELSE SequenceNo END
         AND Timestamp  = CASE WHEN @SequenceNo IS NULL AND Timestamp >
      @Timestamp THEN @Timestamp ELSE Timestamp  END
END

A: Use Dynamic Query Like This

CREATE PROCEDURE MyProc
(
  @SequenceNo int, @Timestamp datetime
)
 AS
BEGIN
DECLARE @SQL Nvarchar(max)
SELECT @SQL = N'select * from MyTable where'

IF @SequenceNo IS NOT NULL
 BEGIN
    SELECT @SQL = @SQL + N' SequenceNo > @SequenceNo';
 END
ELSE
  BEGIN
     SELECT @SQL = @SQL + N' Timestamp > @Timestamp';
   END

EXEC( @SQL)
END


text:
Q: Allowing User to alter Nested List/Dictionary Values I have a list that is holding dictionary values (the whole program is reading in lines from a text file, then storing information into a dictionary and then storing all of the "rows" of dictionary data into a list. I am running into an issue trying to figure an effective and functional way to allow for a user to input some value in the dataset that they want to remove and to allow it to do so. What I've got so far is:
file = open('FOLDER\\FILE.txt', "r")
strData = ""
dictRow = {}
lstTable = []

for line in file:
    k, v = line.strip().split(',')
    dictRow[k] = v.strip()

lstTable.append(dictRow)

print(lstTable)

file.close()

while(True):
    print ("""
    Menu of Options
    1) Show current data
    2) Add a new item.
    3) Remove an existing item.
""")

strChoice = str(input("Which option would you like to perform? [1 to 4] - "))
print()#adding a new line

if (strChoice.strip() == '1'):
    print("Current values in the list table are: ")
    print(lstTable)
    continue

elif(strChoice.strip() == '2'):

    newRow = {}     # Empty dictionary to hold new entries
    key = input("Enter a task to complete: ")
    val = input("Enter the priority of the task (high/average/low):  ")
    newRow[key.strip()] = val.strip()  # Formatting user input as dictionary values within newRow{}
    dictRow.update(newRow)     # Updates existing dictionary with new values (e.g. updates list/Table)

    print("The values in the list table are now: ")     # Display the results
    print(lstTable)
    continue

elif(strChoice == '3'):
    print(lstTable)
    question = input("What item do you want to remove from the list? ")

    if(question in lstTable == True):

        areYouSure = input("You selected " + question + " to be removed from the list. Continue? Y/N: ").upper()

        if(areYouSure == "Y"):
            lstTable.remove(question)
            print("You subtracted " + question + " from the list!")
            print("The values in the list table are now: ")
            print(lstTable)
        continue

The main issue is the last block of code at the bottom - the section with variable:
question = input("What item do you want to remove from the list? ")

When I've tested index or text entries it never gets past the if block:
if(question in lstTable == True):

And I cannot figure out how to configure things correctly so that the user can just enter the key string value and then delete that dictionary value altogether from the list based on that...Any suggestions?

A: There is a few problems here, let me address them one by one:
First your lstTable does not contain rows of the dictionary, it contains the entire dictionary, like this: [{}]
So when you do the if question in lstTable: you are actually comparing a string with a dictionary, as you've said, it would never go through.
The reason why option 2 works is that when you did lstTable.append(dictRow) at the beginning, lstTable actually took a reference of dictRow instead of values in dictRow. So things in lstTable auto updates when you change anything in dictRow since it's just a reference.
I suggest the following for your option 3:
elif(strChoice == '3'):
    print(lstTable)
    question = input("What item do you want to remove from the list? ")
    if question in dictRow:
        areYouSure = input("You selected " + question + " to be removed from the list. Continue? Y/N: ").upper()
        if(areYouSure == "Y"):
            del(dictRow[question])
            print("You subtracted " + question + " from the list!")
            print("The values in the list table are now: ")
            print(lstTable)
        continue

As I said your lstTable only stores a reference to your dictRow, I would not worry about changing anything in lstTable. Once you add/remove items from dictRow, lstTable would display the updated dictRow for you automatically.

A: Instead of:
if(question in lstTable == True):

Use:
if question in lstTable:

Python has operator chaining, so the first expression is not doing what you expect.


text:
Q: Example using Cauchy's Theorem and integrating over a contour This is an example out of Stein and Shakarachi Complex Analysis.  My question is, Why do they choose $f(z) = \frac{(1 - e^{iz})}{z^2}?$

A: $f(z) = \frac{(1 - e^{iz})}{z^2}$
when z is on the real axis ...
$f(z) = \frac{(1 - e^{ix})}{x^2}$ where x is real
$f(z) = \frac{1 - (\cos(x)+i\sin(x))}{x^2}= \frac{1 - \cos(x)}{x^2}-i \frac{\sin(x)}{x^2}$
so the integral of $\frac{1 - \cos(x)}{x^2}$ is the real part of the integral of $f(z)$

A: The difficult part of doing this integral by complex analysis is that $\cos{z}$ blows up as the imaginary part of $z$ becomes large:
$$ 2\cos{(x+iy)} = e^{ix}e^{-y}+e^{-ix}e^{y}, $$
so the second term is exponentially increasing as $y \to +\infty$. In order to use a contour like the one in the picture (which is the only known contour that works for such a function, as far as I know), we need to have a function that decays faster than $|z|^{-1}$ as $|z|$ becomes large. The way to do this is to remember that $ \Re(e^{iz}) = \cos{z} $, and $e^{iz}$ behaves nicely in the upper half-plane:
$$ e^{i(x+iy)} = e^{ix}e^{-y} \to 0 \quad \text{as } y\to \infty, $$
so the integrand is bounded above by $2/R^2$, so the integral over $\gamma_R^+$ tends to zero, as noted in the proof. You couldn't do this if you kept a $\cos{z}$ in the numerator.

A: Because on the real axis $y=0$ we have
$$\operatorname{Re} \left( \frac{1-e^{iz}}{z^2} \right) = \operatorname{Re} \left( \frac{1-e^{ix}}{x^2} \right) = \operatorname{Re} \left( \frac{1-\cos(x) - i \sin(x)}{x^2} \right) = \frac{1-\cos(x)}{x^2}.$$


text:
Q: Finding a particular string from a file I have a file that contains one particular string many times. How can I print all occurrences of the string on the screen along with letters following that word till the next space is encountered.
Suppose a line contained:
example="123asdfadf" foo=bar

I want to print example="123asdfadf".
I had tried using less filename | grep -i "example=*" but it was printing the complete lines in which example appeared.

A: $ grep -o "example[^ ]*" foo
example="abc"
example="123asdfadf"

A: Since -o is only supported by GNU grep, a portable solution would be to use sed:
sed -n 's/.*\(example=[^[:space:]]*\).*/\1/p' file


text:
Q: error: expected class name (linked list c++) I'm supposed to create a linked list (asked to put everything for now in header file) and I am trying to create a struct for nodes but it says it needs a class name. What did I do wrong? I am a bit confused on using a struct to create nodes for the list.
#include "LinkedListInterface.h"

#ifndef LAB03LINKEDLIST_LINKEDLIST_H
#define LAB03LINKEDLIST_LINKEDLIST_H

template <typename T>
class LinkedList: public LinkedListInterface<T>
{
public:    // this is where the functions go
    LinkedList();
    void AddNode(T addData)
    {
        nodePtr n = new node;
        n->next = NULL;
        n->data = addData;

        if (head != NULL)
        {
            current = head;
            while (current->next != NULL)
            {
                current = current->next;
            }
            current->next = n;
        }
        else
        {
            head = n;
        }
    }
    void DeleteNode(T delData);
    void PrintList();
private:
    struct node:
    {
    T data;
    node* next;
    };
    typedef struct node* nodePtr;
    nodePtr head;
    nodePtr current;
    nodePtr temp;
};

#endif //LAB03LINKEDLIST_LINKEDLIST_H

A: struct node:
{
    T data;
    node* next;
};

Should be
struct node
{
    T data;
    node* next;
};

There is no : after a class name unless you intend to use inheritance - @john


text:
Q: Everytime my page is refreshed, the colors of each letter are randomized Every time my page is refreshed, the colors of each letter are randomized. How can I get it so that there are two colors, and just alternating them.
Here are the HTML colors:
011a39
29c3fd

// Menu Visual
var myText = document.getElementById('myText');
var tempText = "";

for(let x in myText.textContent){
  var rnd =  Math.floor(Math.random() * (2 - 0 +  1));
  var rndBounce =  Math.floor(Math.random() * (11 - 5) + 5) / 10;
  if(rnd === 0){
    tempText += "" + myText.textContent[x] + "";
  } else if (rnd === 1) {
    tempText += "" + myText.textContent[x] + "";
  } else {
    tempText += "" + myText.textContent[x] + "";
  }
}
myText.innerHTML = tempText;
@keyframes bounce {
  from { top: 10px; }
  to { top: 0; }
}

#textContainer {
  position: absolute;
top: 100px;
    left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
}

#myText {
  text-align: center;
}

#myText>span {
  position: relative;
  font-size: 5em;
  font-family: 'Baloo Bhaijaan', cursive;
  animation-name: bounce;
  animation-iteration-count: infinite;
  animation-direction: alternate;
}

Hello

A: I think this will work for you. If you want other colors, just change them inside the colors array

// Menu Visual
var myText = document.getElementById('myText');
var tempText = "";
var colors = ["#011a39", "#29c3fd"];
for(let x in myText.textContent){
var rndBounce =  Math.floor(Math.random() * (11 - 5) + 5) / 10;
    //you can use the modulus operator (%) to guarantee that the counter variable keeps alternating between 1 and 0 (the colors array length)
    tempText += "" + myText.textContent[x] + "";
}
myText.innerHTML = tempText;
@keyframes bounce {
  from { top: 10px; }
  to { top: 0; }
}

#textContainer {
  position: absolute;
top: 100px;
    left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
}

#myText {
  text-align: center;
}

#myText>span {
  position: relative;
  font-size: 5em;
  font-family: 'Baloo Bhaijaan', cursive;
  animation-name: bounce;
  animation-iteration-count: infinite;
  animation-direction: alternate;
}

Hello

A: For one thing, you are randomizing the colors in this line:

var rnd =  Math.floor(Math.random() * (2 - 0 +  1));

If you want to alternate just do something like this :
int i = 0;
for(let x in myText.textContent){
  var rnd =  i % 2;
  var rndBounce =  Math.floor(Math.random() * (11 - 5) + 5) / 10;
  if(rnd === 0){
    tempText += "" + myText.textContent[x] + "";
  } else if (rnd === 1) {
    tempText += "" + myText.textContent[x] + "";
  } else {
    tempText += "" + myText.textContent[x] + "";
  }
  i += 1;
}

A: You don't want to randomize for each letter, just on load, try this out:

// Menu Visual
var myText = document.getElementById('myText');
var rnd = Math.random() > 0.5 ? 1 : 0; // set once, if you always want it to start with the same color, then just set this to 0 or 1;
var tempText = "";

for(let x = 0, length = myText.textContent.length; x < length; x ++){
  var rndBounce =  Math.floor(Math.random() * (11 - 5) + 5) / 10;

  if(x % 2 === rnd) { // based on if rnd is 0 or 1
      tempText += "" + myText.textContent[x] + "";
  } else {
      tempText += "" + myText.textContent[x] + "";
  }
}
myText.innerHTML = tempText;
@keyframes bounce {
  from { top: 10px; }
  to { top: 0; }
}

#textContainer {
  position: absolute;
top: 100px;
    left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
}

#myText {
  text-align: center;
}

#myText>span {
  position: relative;
  font-size: 5em;
  font-family: 'Baloo Bhaijaan', cursive;
  animation-name: bounce;
  animation-iteration-count: infinite;
  animation-direction: alternate;
}

Hello

A: Using sessionStorage or cookie, when you first load the page you random the color for each letter, then when you refresh you should only alternating them.
Therefore it is good to use sessionStorage to hold the rnd number you got from last time, only get new random if a sessionStorage for that letter can no be found.
Try it yourself here (refresh to alternating)

https://jsfiddle.net/dalinhuang/db54ttuq/

// Menu Visual
var myText = document.getElementById('myText');
var tempText = "";

for (let x in myText.textContent) {
  var rnd = Math.floor(Math.random() * (2 - 0 + 1));
  var rndBounce = Math.floor(Math.random() * (11 - 5) + 5) / 10;

  if (sessionStorage.getItem('item' + x)) {
    rnd = sessionStorage.getItem('item' + x) === '1' ? 0 : 1;
  }
  sessionStorage.setItem('item' + x, rnd);

  if (rnd === 0) {
    tempText += "" + myText.textContent[x] + "";
  } else if (rnd === 1) {
    tempText += "" + myText.textContent[x] + "";
  } else {
    tempText += "" + myText.textContent[x] + "";
  }
}
myText.innerHTML = tempText;


text:
Q: .Net XML Serializer and matrix I have a C++/CLI code wrapped and used in C# project.
I have a class in the C++/CLI code which contains a matrix declared as follows:
array<double, 2>^   S_to_Box_Matrix;
S_to_Box_Matrix = gcnew array<double, 2>(4, 4);

it seems that this variable is not serializable.
How to make it serializable?
If not possible then How to exclude it from being serialized (which C++/CLI keyword and what libraries to import)
Thanks.

A: XmlSerializer does not support 2d arrays.  The most straightforward way to work around this is to modify your c++/cli class as follows:

*

*Mark the 2d array with [XmlIgnore]

*Introduce a proxy property that converts the 2d array from and to a jagged array.

*Mark the jagged array property with [XmlArray]
For instance:
#using <System.Xml.dll>

public ref class Array2DTestClass
{
public:
    [System::Xml::Serialization::XmlIgnore]
    array<double, 2> ^S_to_Box_Matrix;

    [System::Xml::Serialization::XmlArray("S_to_Box_Matrix")]
    property array<array<double> ^>^  S_to_Box_Matrix_Serializable {
        array<array<double> ^>^  get();
        System::Void set(array<array<double> ^>^  value);
    }
};

With implementations
array<array<double> ^>^  Array2DTestClass::S_to_Box_Matrix_Serializable::get() {
    return ArrayExtensions::ToJaggedArray(this->S_to_Box_Matrix);
}

System::Void Array2DTestClass::S_to_Box_Matrix_Serializable::set(array<array<double> ^>^  value) {
    this->S_to_Box_Matrix = ArrayExtensions::To2DArray(value);
}

Using the helper methods:
public ref class ArrayExtensions abstract sealed {
    public:
        generic<typename T> static array<array<T>^> ^ToJaggedArray(array<T, 2> ^input)
        {
            if (input == nullptr)
                return nullptr;
            int nRow = input->GetLength(0);
            int nCol = input->GetLength(1);
            array<array<T>^> ^output = gcnew array<array<T>^>(nRow);
            for (int iRow = 0; iRow < nRow; iRow++)
            {
                output[iRow] = gcnew array<T>(nCol);
                for (int iCol = 0; iCol < nCol; iCol++)
                    output[iRow][iCol] = input[iRow, iCol];
            }
            return output;
        }

        generic<typename T> static array<T, 2> ^To2DArray(array<array<T> ^>^input)
        {
            if (input == nullptr)
                return nullptr;
            int nRow = input->Length;
            int nCol = 0;
            for (int iRow = 0; iRow < nRow; iRow++)
                if (input[iRow] != nullptr)
                    nCol = Math::Max(nCol, input[iRow]->Length);
            array<T, 2> ^ output = gcnew array<T, 2>(nRow, nCol);
            for (int iRow = 0; iRow < nRow; iRow++)
                if (input[iRow] != nullptr)
                    for (int iCol = 0; iCol < input[iRow]->Length; iCol++)
                        output[iRow, iCol] = input[iRow][iCol];
            return output;
        }
};

Doing so, I get XML that looks like:

<Array2DTestClass xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <S_to_Box_Matrix>
        <ArrayOfDouble>
            <double>0</double>
            <double>1</double>
            <double>2</double>
        </ArrayOfDouble>
        <ArrayOfDouble>
            <double>3</double>
            <double>4</double>
            <double>5</double>
        </ArrayOfDouble>
    </S_to_Box_Matrix>
</Array2DTestClass>


text:
Q: How do extract defect report from Visual studio Team services? I want to extract defect report from Visual studio Team services as we do from ALM
Please advise as how to perform this

A: The VSTS doesn't have the reports like TFS, but it integrates with Power BI, also there is Analytics Marketplace extension available that provides access to several useful widgets, such as Cycle time.
You can build report in a web app or VSTS extension by using VSTS API, such as Rest API if the built-in reports don't meet your requirement.


text:
Q: Svelte global styles not working as expected So I have a Svelte component that looks like this:

Page Title

Some text

Some more text

My expectation is that the p tags should be red, but that's not what's happening. I'm using webpack to build the app and the relevant config for Svelte is:
{
  test: /\.html$/,
  exclude: /node_modules/,
  use: 'svelte-loader'
}

The styles that are generated are:
    div.svelte-f5mkpg :global(p),
   .svelte-f5mkpg div :global(p){color:red}

I'm using Svelte 1.59.0 and svelte-loader 2.5.1. Any idea what's wrong here? I also see this behavior in the default Sapper app. The global CSS is actually in a global.css file and the :global styles don't seem to take.

A: In order to use the :global(...) modifier, you need to explicitly prevent CSS cascading:
{
  test: /\.html$/,
  exclude: /node_modules/,
  use: {
    loader: 'svelte-loader',
    options: {
      cascade: false
    }
  }
}

In version 2 (coming soon, hopefully) cascading will always be prevented, but it was necessary to put it behind an option until then to prevent a breaking change.
The compiler could warn on :global(...) if options.cascade !== false — I've opened an issue.


text:
Q: Where can I download old stable builds of Chromium from? I've found a Website containing a lot of builds of Chromium but the folders are named after the build number (those numbers are not visibly connected to Chromium version numbers) and there is no information if the builds are developer, beta or stable builds.
Here is the link:
I would like to be able to chose from those folders only the stable builds of Chromium.
For example if I want a stable build of Chromium 35.0, how can I find it?
Thanks
Later edit: I need 64-bit binary releases for Windows 7

A: All Chromium Portable releases for Windows (binary format):
https://sourceforge.net/projects/crportable/files/

A: Another way, as described here:

*

*Look up the version number (for example "44.0.2403.157") in the Position Lookup

*In this case it returns a base position of "330231". This is the commit of where the 44 release was branched, back in May 2015.

*Open the continuous builds archive

*Click through on your platform (Linux/Mac/Win)

*Paste "330231" into the filter field at the top and wait for all the results to XHR in.

*Eventually I get a perfect hit: https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Mac/330231/

*

*Sometimes you may have to decrement the commit number until you find one.

A: Source
You can find the stable channel releases here. For instance, the last v35 release is this one.

Binary
If you want a binary, it should be easy to find one based on the v35 stable build.

*

*If you run GNU/Linux, you should be able to find old packages (eg. the Ubuntu 64-bit package is here).

*For Windows, you might download a Portable Apps version (file list)

*I'm not sure where the best place is for OS X, but as an example, here's a build based on v35 stable from the FreeSMUG user group.

A: I would try to look at https://github.com/henrypp/chromium/releases, and search "(stable)" text in notes. Using the "next" button somewhere on the bottom of website you can go back to previous versions. There is no archaic versions but few previous stable versions can be found.


text:
Q: Curl does not fall back to ipv4 I have gentoo build with ipv6 and ipv4 configured for localhost
/etc/hosts
# IPv4 and IPv6 localhost aliases
127.0.0.1   sunils-pc.homenetwork sunils-pc localhost
::1     sunils-pc.homenetwork sunils-pc localhost

I have enabled the ipv6 forward as below
sunils@sunils-pc ~ $ cat /proc/sys/net/ipv6/conf/all/forwarding
1

sunils@sunils-pc ~ $ cat /proc/sys/net/ipv4/conf/all/forwarding
1

I have ran the docker swarm with docker container exposing web server at 8080. I can access the website using below command
curl -4 http://localhost:8080/

But when I try to access it using curl http://localhost:8080/ it hangs for infinite time. From the verbose output it shows its trying to reach the service at ipv4 address and hangs indefinitely without falling back to ipv4.
sunils@sunils-pc ~ $ curl -v http://localhost:8080
* Rebuilt URL to: http://localhost:8080/
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 8080 (#0)
> GET / HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.61.0
> Accept: */*
>

I am not sure where should I investigate further. I am running gentoo linux with ipv6 enabled kernel.
==Update
When I use ipv4 I get the proper HTTP response on terminal, but in case of ipv6 it hangs indefinitely.
sunils@sunils-pc ~ $ curl -4 -v http://localhost:8080
* Rebuilt URL to: http://localhost:8080/
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 8080 (#0)
> GET / HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.61.0
> Accept: */*
>
< HTTP/1.1 200
< Set-Cookie: XSRF-TOKEN=e20b76f1-78c3-473c-a518-da2519983985; Path=/
< X-Content-Type-Options: nosniff
< X-XSS-Protection: 1; mode=block
< Cache-Control: no-cache, no-store, max-age=0, must-revalidate
< Pragma: no-cache
< Expires: 0
< X-Frame-Options: DENY
< Content-Type: text/html;charset=UTF-8
< Content-Language: en-US
< Transfer-Encoding: chunked
< Date: Wed, 26 Sep 2018 17:13:11 GMT
<
<!doctype html>
...

A: It appears that you are successfully connecting to the port via ipv6, per the following message:
* Connected to localhost (::1) port 8080 (#0)

Since the connection has entered the ESTABLISHED state, curl deems this as a successful connection to the IPv6 host, and it is correct.
The next thing that happens is that the curl client sends the HTTP request to the localhost(::1) on port 8080. However, the server never responds back with the document that you expect.
There's no reason at this point why curl would re-try with IPv4 as the connection was established with IPv6, however, the server did not send the HTTP payload.
It appears that the issue may be with the server not being properly bound to the IPv6 port, there are two instances of the server running both trying to bind to the IPv6 port 8080, or another problem with the server being bound to the IPv6 port that does not replicate when you use IPv4.


text:
Q: Elastic Search query analyzing I want to see all the tokens is generated from 'match' text
I am wondering to know is there any specific file or capability to show details of query executing in elastic search or another way to see what is generated as a sequence of tokens when I am using 'match level' queries?

A: I did not use the log file to see which tokens are generated in the time of 'match' operation. Instead, I used _analayze endpoint.
Better to say if you want to use analyser of the specific index (in the case of different indices that each of them using its own customised analyser) put the name of the index in the URL:
POST /index_name/_analyze
{
  "text" : "1174HHA8285M360"
}

This will use the default analyser defined in that index. And if we have more than one analyser in one index we can specify it in the query just as follow:
POST /index_name/_analyze
{
  "text" : "1174HHA8285M360",
  "analyzer" : "analyser_name"
}


text:
Q: How can I convert this vbs into a batch file? Here is the code:
Set sapi=Createobject("sapi.spvoice")
sapi.Speak ("Preparing your file now...")
I want to insert it into a batch file with other codes in it. It would be something like this;
Start google chrome
Open a new command prompt tab
Go to stack overflow
*Set sapi=Createobject("sapi.spvoice")
sapi.Speak ("Please subscribe to AstralWolf")*

How can I make that code VBS - Batch?
Thanks!

A: A quick way to do it is to create a temp vbs file and run it from bat file. Sample batch file code would be something like the below
@echo off
cd %temp%
echo set varSAPI=WScript.CreateObject("sapi.spvoice") >> "tmp.vbs"
echo varSAPI.Speak "Please subscribe to AstralWolf" >> "tmp.vbs"
start tmp.vbs
pause
del tmp.vbs
@echo on
exit /b

Edit - As per @Ansgar Wiechers's suggestion, I am using temp folder.

A: You can try like that by the easy way when you call it as a function : Call:Speak "<your message goes here>"
@echo off
Start "" chrome.exe "www.stackoverflow.com"
Call:Speak "Please subscribe to AstralWolf"
exit /b
::**********************************************
:Speak <msg>
(
    echo Set sapi=Createobject("sapi.spvoice"^)
    echo sapi.Speak("%~1"^)
)>"%tmp%\%~n0.vbs"
Cscript /nologo "%tmp%\%~n0.vbs"
Del "%tmp%\%~n0.vbs"
exit /b
::**********************************************

A: @echo off
cscript yourscript.vbs

Paste it into a batch, it will open it.
To hide the VBS, right-click, properties, and check "Hidden". If you had it on, in Control Panel, untick "Show Hidden Icons".


text:
Q: Find matching record in SQL Server I have 3 tables;

1)Employee      (EmployeeId,Name)
2)Role          (RoleId,RoleName)
3)EmployeeRole  (EmployeeId,RoleId)

I have that records;
I want to do that i'll give the EmployeeId and query must give me the reply which users have the same role with Employee which i gave the EmployeeID.
For example;
I give the EmployeeID is 1 , i want to see Employees have roles 1,2,3 (all of them, i dont want to get 1 or 2 or 1,2 or 1,3 i want 1,2,3 all roles must be match)
How can i do can you help me?
I've try that but i didn't work that is my query;
DECLARE @Query varchar(max) = ''
DECLARE @RoleID INT
DECLARE crsEmployeeRole CURSOR FOR
SELECT RoleID FROM Employee_Role where EmployeeID = 2340
OPEN crsEmployeeRole
FETCH NEXT FROM crsEmployeeRole INTO @RoleID
WHILE @@FETCH_STATUS = 0
       BEGIN
            SET @Query = @Query + 'select EmployeeID into #temp'+cast(@RoleID as varchar(max))+' from Employee_Role where RoleID = '+cast(@RoleID as varchar(max))+' '
            FETCH NEXT FROM crsEmployeeRole INTO @RoleID
       END
CLOSE crsEmployeeRole
DEALLOCATE crsEmployeeRole

exec(@Query)

DECLARE @Query2 varchar(max) = ''
DECLARE @RoleID2 INT
DECLARE crsEmployeeRole CURSOR FOR
SELECT RoleID FROM Employee_Role where EmployeeID = 2340
OPEN crsEmployeeRole
FETCH NEXT FROM crsEmployeeRole INTO @RoleID2
WHILE @@FETCH_STATUS = 0
       BEGIN
             if(@Query2 = '')
             SET @Query2 = 'SELECT t1.* FROM #temp'+cast(@RoleID2 as varchar(max))+' t1'
             else
             SET @Query2 = @Query2 + ' inner join #temp'+cast(@RoleID2 as varchar(max))+' on t1.EmployeeID = #temp'+cast(@RoleID2 as varchar(max))+'.EmployeeID'
             FETCH NEXT FROM crsEmployeeRole INTO @RoleID2
       END
CLOSE crsEmployeeRole
DEALLOCATE crsEmployeeRole

exec(@Query2)

A: You can count the matching roles using a join and group by:
select employee_id, count(*)
from employee_role er join
     employee_role er1
     on er.role_id = er1.role_id
where er1.employee_id = @id
group by er.employee_id;

A having clause or subquery, then does what you want:
select employee_id, count(*)
from employee_role er join
     (select er1.*, count(*) over () as cnt
      from employee_role er1
      where er1.employee_id = @id
     ) er1
     on er.role_id = er1.role_id
group by er.employee_id, cnt
having count(*) = cnt;

A: that will work.. GL...
DECLARE @Query varchar(max) = ''

DECLARE @DeleteTemp varchar(max) = ''

DECLARE @RoleID INT

DECLARE crsEmployeeRole CURSOR FOR

SELECT RoleID FROM Employee_Role where EmployeeID = 1

OPEN crsEmployeeRole

FETCH NEXT FROM crsEmployeeRole INTO @RoleID

WHILE @@FETCH_STATUS = 0

       BEGIN

             SET @DeleteTemp = 'if OBJECT_ID(''tempdb..##temp'+cast(@RoleID as varchar(max))+''') is not null begin DROP TABLE ##temp'+cast(@RoleID as varchar(max))+' end'

             exec (@DeleteTemp)

             SET @Query = @Query + 'select PersonelID into ##temp'+cast(@RoleID as varchar(max))+' from Employee_Role where RoleID = '+cast(@RoleID as varchar(max))+' '

             FETCH NEXT FROM crsEmployeeRole INTO @RoleID

       END

CLOSE crsEmployeeRole

DEALLOCATE crsEmployeeRole

exec (@Query)

DECLARE @Query2 varchar(max) = ''

DECLARE @RoleID2 INT

DECLARE crsEmployeeRole CURSOR FOR

SELECT RoleID FROM Employee_Role where EmployeeID = 1

OPEN crsEmployeeRole

FETCH NEXT FROM crsEmployeeRole INTO @RoleID2

WHILE @@FETCH_STATUS = 0

       BEGIN

             if(@Query2 = '')

             SET @Query2 = 'SELECT t1.* FROM ##temp'+cast(@RoleID2 as varchar(max))+' t1'

             else
             SET @Query2 = @Query2 + ' inner join ##temp'+cast(@RoleID2 as varchar(max))+' on t1.PersonelID = ##temp'+cast(@RoleID2 as varchar(max))+'.PersonelID'

             FETCH NEXT FROM crsEmployeeRole INTO @RoleID2

       END

CLOSE crsEmployeeRole

DEALLOCATE crsEmployeeRole

exec(@Query2)

A: If you want only the ids of the employees then use a cte:
with cte as (select roleid from employee_role where employeeid = 1)
select employeeid
from employee_role
where roleid in (select roleid from cte) and employeeid <> 1
group by employeeid
having count(*) = (select count(*) from cte)

If you also want the names of the employees join the above query to the table employee:
with cte as (select roleid from employee_role where employeeid = 1)
select e.*
from employee e inner join (
    select employeeid
    from employee_role
    where roleid in (select roleid from cte) and employeeid <> 1
    group by employeeid
    having count(*) = (select count(*) from cte)
) g on g.employeeid = e.employeeid

A: You could try this:
CREATE TABLE #EMPLOYEE
(
  EMPLOYEEID INT NOT NULL
, NAME VARCHAR(100) NOT NULL
)

INSERT INTO #EMPLOYEE VALUES
  (1, 'John')
, (2, 'Lisa')
, (3, 'Emilia')
, (4, 'Jacob')
, (5, 'Henry')

CREATE TABLE #ROLE
(
  ROLEID INT NOT NULL
, ROLENAME VARCHAR(100) NOT NULL
)

INSERT INTO #ROLE VALUES
  (1, 'helper')
, (2, 'viewer')
, (3, 'designer')

CREATE TABLE #EMPLOYEE_ROLE
(
  EMPLOYEEID INT NOT NULL
, ROLEID INT NOT NULL
)

INSERT INTO #EMPLOYEE_ROLE VALUES
  (1, 1)
, (1, 2)
, (1, 3)
, (2, 2)
, (2, 3)
, (3, 1)
, (3, 2)
, (3, 3)
, (4, 1)
, (5, 1)

SELECT #EMPLOYEE.EMPLOYEEID
     , #EMPLOYEE.NAME
FROM #EMPLOYEE
INNER JOIN #EMPLOYEE_ROLE
ON #EMPLOYEE.EMPLOYEEID = #EMPLOYEE_ROLE.EMPLOYEEID
  WHERE #EMPLOYEE_ROLE.ROLEID IN
(
--EMPLOYEE-ROLES
SELECT DISTINCT ER.ROLEID
FROM #EMPLOYEE E
INNER JOIN #EMPLOYEE_ROLE ER
ON E.EMPLOYEEID = ER.EMPLOYEEID
WHERE E.EMPLOYEEID = 5  --HERE IS THE PARAMETER
)
GROUP BY #EMPLOYEE.EMPLOYEEID
       , #EMPLOYEE.NAME

If you put 5 in the WHERE clause you have
3   Emilia
5   Henry
4   Jacob
1   John

Hope it helps


text:
Q: Make header image right part clickable I have a header that is full page width. That header has CSS with background image. On that image there is some text on the center and a box "Contact us" on the right side of that image drawed. How to make that button clickable (so that user clicks on it and follows a link). Preferably only right part of that header image should be clickable. Can this be made with jquery?
Hacks are welcomed.

A: *

*It seems your question is more about how to construct a navigation menu.

I would suggest you use "grid" which is built-in with css. By doing that you can build several areas in the top bar and add pictures or text. I do not recommend you to use image map since you then use positioning that will not adapt based on your device.
Below you have a base that uses grid. I have added both HTML and CSS for simplicity. If you are aiming at creating a navigation bar, you need to add text links and position it into respective area.
<!DOCTYPE html>

  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Test</title>

A: You have create it with position: relative for header and position: absolute for  element. Try this code.

.header {
    position: relative;
}
.header .link {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 100px;
    z-index: 2;
}


text:
Q: Android strange onClick() behavior with 2D scrolling I've written my own "Minesweeper" game, trying to make it as faithful as possible to the original Microsoft game.
To create a variable-sized minefield, my XML has a (vertical) TableLayout nested inside the horizontal and vertical ScrollViews. I populate the TableLayout with TableRows, to which I add ImageViews representing the minefield squares in each row. I give each ImageView an id representing its row/column. My onClick() handler converts the id to a row/column and handles it. It works fine, except that scrolling the minefield can be done in only one dimension at a time.
I found a very nice technique for 2D scrolling published on YouTube by William Kwan ( https://www.youtube.com/watch?v=Y-q6eWFyS54 ). I incorporated it into my app, and it scrolls very nicely. But it has produced a strange onClick() result when I scroll horizontally (not when I scroll vertically).
In the new implementation, when I scroll horizontally and click (touch) a square, onClick() receives an id that corresponds, not to the square I clicked, but to the square that would have been in that position if I had not scrolled. For example, if, before scrolling, I click a square whose coordinates are (1,3), onClick receives an ImageView whose id corresponds to (1,3). But if I scroll a distance that corresponds to 2 squares to the left, and I click the same position on the screen, which should represent the ImageView at coordinates (1,5), onClick returns the ImageView whose id corresponds to (1,3). It's as if the scroll had not happened.
I tried a circumvention using getScrollX() (the number of pixels that the
OuterHorizontalScrollView has scrolled) and getWidth() (the width of a "square") to calculate how may "squares" have been scrolled, and adjusting the y in the (x,y) coordinates. But when the scroll is close to "half a square", the result is sometimes off by one.
Any suggestions?
Thank you.
My XML:
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android">

    <LinearLayout
        android:id="@+id/fullscreen"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1"
            android:orientation="horizontal">

            <ImageView
                android:id="@+id/rMines100"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:src="@drawable/digit8" />

            <ImageView
                android:id="@+id/rMines10"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:src="@drawable/digit8" />

            <ImageView
                android:id="@+id/rMines1"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:src="@drawable/digit8" />

            <ImageButton
                android:id="@+id/smileyButton"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_gravity="right"
                android:layout_weight="3"
                android:paddingLeft="40dp" />

            <ImageButton
                android:id="@+id/flagOrMineButton"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1.5"
                android:text="New Button" />

            <ImageView
                android:id="@+id/eTime100"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:src="@drawable/digit8" />

            <ImageView
                android:id="@+id/eTime10"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:src="@drawable/digit8" />

            <ImageView
                android:id="@+id/eTime1"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:src="@drawable/digit8" />m
        </LinearLayout>

        <com.mpa.minesweeper.OuterHorizontalScrollView
            android:id="@+id/horizontal"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="9">

            <ScrollView
                android:id="@+id/vertical"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content">

                <TableLayout
                    android:id="@+id/tableLayout"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:orientation="vertical"></TableLayout>

            </ScrollView>
        </com.mpa.minesweeper.OuterHorizontalScrollView>

    </LinearLayout>
 </layout>

The OuterHorizontalScrollView Class:
package com.mpa.minesweeper;

        import android.content.Context;
        import android.util.AttributeSet;
        import android.view.MotionEvent;
        import android.widget.HorizontalScrollView;
        import android.widget.ScrollView;

/**
 * Created by willi on 2017-06-08.
 */

public class OuterHorizontalScrollView extends HorizontalScrollView {
    public ScrollView scrollView;

    public OuterHorizontalScrollView(Context context) {
        super(context);
    }

    public OuterHorizontalScrollView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public OuterHorizontalScrollView(Context context, AttributeSet attrs,
int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev) {
        super.onInterceptTouchEvent(ev);
        scrollView.onInterceptTouchEvent(ev);
        return true;
    }

    @Override
    public boolean onTouchEvent(MotionEvent ev) {
        super.onTouchEvent(ev);
        scrollView.dispatchTouchEvent(ev);
        return true;
    }
}


text:
Q: Variable not printing (ECHO) inside IF statement of batch file For some reason I can't get %NetVerClientOrFull% to print inside of the IF statement. This is really weird because it sometimes does and sometimes doesn't even when I don't change anything. I have tested on multiple machines with the same results. If I use %NetVer% inside the IF statement is always prints. Any ideas what is going on?
ECHO Client or Full? %NetVerClientOrFull%     (should display Client or Full and sometimes does)
@echo off
  set frameworkDirectory=Reg query "HKLM\Software\Microsoft\NET Framework Setup\NDP"
  FOR /F "TOKENS=6 DELIMS=\." %%A IN ('%frameworkDirectory%') DO set NetVer=%%A
  ECHO The most current version of the .NET Framework installed is: %NetVer%

  if "%NetVer%"=="v4" (
  set clientOrFullDirectory=Reg query "HKLM\Software\Microsoft\NET Framework Setup\NDP\v4"
  FOR /F "TOKENS=7 DELIMS=\." %%A IN ('%clientOrFullDirectory%') DO set NetVerClientOrFull=%%A
  ECHO Client or Full? %NetVerClientOrFull%

  )

pause

To add onto this it seems like it works on my third run, makes no sense:
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\Nick>C:\Users\Nick\Desktop\FrameworkVersionChecker.bat
The most current version of the .NET Framework installed is: v4
Client or Full?
Press any key to continue . . .

C:\Users\Nick>C:\Users\Nick\Desktop\FrameworkVersionChecker.bat
The most current version of the .NET Framework installed is: v4
Client or Full?
Press any key to continue . . .

C:\Users\Nick>C:\Users\Nick\Desktop\FrameworkVersionChecker.bat
The most current version of the .NET Framework installed is: v4
Client or Full? Full
Press any key to continue . . .

A: That's because parser expands variables when it reads a block, not when it's statements are executed. Your statements inside if () block see variables as they were set before entry to this block. This problem, and how to overcome it (by use of delayed expansion)  is well explained in set help. Just execute help set from command line - there is even similar example included. It's also explained here: windows batch SET inside IF not working
Why it prints on third (and subsequent) run? You do not use setlocal - thus when you execute your batch next time it will see variables as set in previous run. Remove or remark @echo off, and execute your batch from freshly started console. You will see how variables get expanded and why it works only 3rd time onwards.


text:
Q: Uncaught TypeError: Cannot read property 'setVisible' of undefined , filtering using knockout I want to filter the array based on search result. I came up with this code but it shows error: Uncaught TypeError: Cannot read property 'setVisible' of undefined
var viewmodel = function(){
    var self = this;
    self.location = ko.observableArray(locations)
    self.query = ko.observable('');
    //filtering
    self.filteredItems = ko.computed(function() {
        var query = self.query().toLowerCase(); // to convert to lowercase

        if(!query) {
            for(var i = 0; i < self.location.length; i++) {
                self.location()[i].marker.setVisible(true);
            }
            return self.location();
        }
        else {
            return ko.utils.arrayFilter(locations, function(item) {
                var match = item.title.toLowerCase().indexOf(query)!==-1;
                item.marker.setVisible(match); //display the filtered markers ,**error is shown in this line**
                return match;
            })
        }
    }, self)
}

ko.applyBindings(new viewmodel());

A: Your error indicates that it's trying to read a property (setVisible) of an undefined reference. You can track this down by down a simple search for setVisible and checking where the issue may be: either the marker in your for loop is undefined or the one in the else block is. You have 2 mistakes that could be causing your problem in either location:

*

*for(var i = 0; i < self.location.length; i++) {: You need to check against self.location().length otherwise you're asking for the length property of the observable, not the array.

*ko.utils.arrayFilter(locations, function(item) {: You need to pass in self.locations() otherwise you're not actually giving the function an array.
Both issues seem to be mistakes with using the observable vs. the underlying data. You must call an observable like a function in order to read the underlying data. The exception to this is knockout defined functions such as splice or removeAll() that are meant to be used on observables.


text:
Q: vb.net loading tab pages on demand I have a desktop application in vb.net. The tab control has around 13 tabs.
All these tabs have windows controls in them and they are populated with data from sql server locally.
The first time the application runs, it takes a lot of time for these tabs to load. Is there a way to make sure only the first tab is loaded and next ones are loaded on click or demand?

A: You can juste populate data for the first tab in Form_load,and then handel the event tabControl1_SelectedIndexChanged for populate just the selected tab like :
  private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
        {

            if (tabControl1.SelectedIndex == 1)
            {
                //Populate seconde tab
            }
            else if (tabControl1.SelectedIndex == 2)
            {
                 //Populate the third tab
            }

        }


text:
Q: vb.net Manipulation of a string Hello I am trying to get part of my string out and was wondering if anyone can help so here is what I am working with
Dim tempName, NewName As String

'This is an example of what tempName will Equal
'What I need is the information in between the first -
'and the second one.  In this case it would be 120
'I can not do it by number because the dashes are the only thing
'that stays the same.
tempName = "3-120-12-6"

NewName = tempName 'Do not know what String Manipulation to use.

Another few examples would be 6-56.5-12-12 I need the 56.5 or 2-89-12-4 I would need the 89
Thank you for the help.

A: You can do this too... You can break it up into pieces by detecting the first -. Then get the second...
Dim x as String = Mid(tempName, InStr(tempName, "-") + 1)
NewName = Mid(x, 1, InStr(x , "-") - 1)

Or make something like this to get it into 1 line of code...
NewName = Mid(Mid(tempName, InStr(tempName, "-") + 1), 1, InStr(Mid(tempName, InStr(tempName, "-") + 1), "-") - 1)

Or the quickest approach to this would be to use Split like the code below... This code equates the values between - into an array. Since you want the second value, you'd want the array with the index of 1 since an array starts with 0. If you're only starting, do try to create your own way to manipulate the string, this will help your mind think of new things and not just rely on built-in functions...
Dim tempName As String = "3-120-12-6"
Dim secondname() As String = Split(tempName, "-")
NewName = secondname(1)


text:
Q: Bootstrap and Leaflet - Grid Issue Trying to use integrate a simple leaflet map within Bootstrap grid / column.  While I am trying to follow tutorials and templates, for some reason the
 id="map"
does not seem to be nesting within the column. The column only seems to be 1px in height.  In fact, when looking at Firefox Inspector, the full extent of the map window doesn't even appear to be registering as part of the body (apologies for any dubious terminology - very much starting out and probably running before I can walk).
My simple code is as follows:

Simple Mapping Page

Some witty lead in text...

Some test text

I also apply the following CSS:
#map {
width: 100%;
position: absolute;
height: 600px;
margin:0;
padding:0;
border: 1px solid black;
border-radius: 8px;
}

While the second column appears to the right of the map, there is no padding etc.

A: I'm not entirely sure what is not working for you, but at a minimum your markup seems to be missing a L.tileLayer( declaration just before the open street layer tiles (around line 23)
That line should look like this:
L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution: 'Map data © '+ mapLink , maxZoom: 24,}).addTo(map);
working version here: JSFiddle
Note: depending on your screen resolution, you may have to expand the map window in JSFiddle to see the two columns. As an alternative, you could use small columns (col-sm-$), or different column widths e.g. 8/4

A: I had a similar problem and I managed to fix it by changing the div height with JavaScript. My code looks something like this:
function stuffToRezie(){
        var h_window = $(window).height();
        var h_map = h_window - 125;
        $('#map_canvas').css('height', h_map);
}

$(window).on("resize", stuffToRezie).trigger('resize');

In my case I had to calculate the map height. Another approach that should work is if you define a height of a parent div or the body.

A: Thanks for the suggestions.  I tried adding height to the
 and this worked in a fashion.  However, I also simply changed position: absolute; to position: inherited; in the CSS file and this seems to have sorted it too!  I'm not quite sure why, but it worked anyway.


text:
Q: Do we need to store access token both on client and server side? My question is - Do we need to store access token both on client and server side?
Identity Server 4 store access tokens for us, as far as I know, so we don't have to worry about that, but do we have to manage storing access token in the client side (e.g. cookie in browser)?

A: Typically yes, you'll need to store the access token on the client side. Assuming you want to call APIs repeatedly with that access token, you'll need to store in memory. If your Client lives in a browser (i.e. Javascript) you'll need to store it in a cookie or local storage. If you have a non-browser Client and you want to survive restarts, you'll need to store it on persistent storage, i.e. disk.
The only exception to all of this are Clients that only need to call an API once, which is a rare case.


text:
Q: how to crawl a 403 forbidden SNS i'm crawling an SNS with crawler written in python
it works for a long time, but few days ago, the webpages got from my severs were ERROR 403 FORBIDDEN.
i tried to change the cookie, change the browser, change the account, but all failed.
and it seems that are the forbidden severs are in the same network segment.
what can i do? steal someone else's ip? = =...
thx a lot

A: Looks like you've been blacklisted at the router level in that subnet, perhaps because you (or somebody else in the subnet) was violating terms of use, robots.txt, max crawling frequency as specified in a site-map, or something like that.
The solution is not technical, but social: contact the webmaster, be properly apologetic, learn what exactly you (or one of your associates) had done wrong, convincingly promise to never do it again, apologize again until they remove the blacklisting.  If you can give that webmaster any reason why they should want to let you crawl that site (e.g., your crawling feeds a search engine that will bring them traffic, or something like this), so much the better!-)


text:
Q: SQL {setCharset} AUTO_INCREMENT=1' at line 1 DROP TABLE IF EXISTS `{DB_TABLE_PREFIX}broadcast`;
#[QUERY]
CREATE TABLE `{DB_TABLE_PREFIX}broadcast` (
  `bid` mediumint(8) NOT NULL auto_increment,
  `sortid` mediumint(8) NOT NULL default '0',
  `content` varchar(255) NOT NULL default '',
  `gourl` varchar(255) NOT NULL default '#',
  PRIMARY KEY  (`bid`)
) TYPE=MyISAM {setCharset} AUTO_INCREMENT=1 ;
#[QUERY]
DROP TABLE IF EXISTS `{DB_TABLE_PREFIX}items`;
#[QUERY]
CREATE TABLE `{DB_TABLE_PREFIX}items` (
  `itemid` mediumint(8) unsigned NOT NULL auto_increment,
  `uid` mediumint(8) unsigned NOT NULL default '0',
  `account` varchar(15) NOT NULL default '',
  `content` varchar(255) NOT NULL default '',
  `dateline` int(10) unsigned NOT NULL default '0',
  `digg` mediumint(8) unsigned NOT NULL default '0',
  `reply` mediumint(5) unsigned NOT NULL default '0',
  PRIMARY KEY  (`itemid`),
  KEY `uid` (`uid`)
) TYPE=MyISAM {setCharset} AUTO_INCREMENT=1 ;
#[QUERY]
DROP TABLE IF EXISTS `{DB_TABLE_PREFIX}reply`;
#[QUERY]
CREATE TABLE `{DB_TABLE_PREFIX}reply` (
  `rid` mediumint(8) NOT NULL auto_increment,
  `replyto` mediumint(8) unsigned NOT NULL default '0',
  `uid` mediumint(8) NOT NULL default '0',
  `account` varchar(15) NOT NULL default '',
  `content` varchar(255) NOT NULL default '',
  `dateline` int(10) unsigned NOT NULL default '0',
  PRIMARY KEY  (`rid`),
  KEY `uid` (`uid`),
  KEY `replyto` (`replyto`)
) TYPE=MyISAM {setCharset} AUTO_INCREMENT=1 ;
#[QUERY]
DROP TABLE IF EXISTS `{DB_TABLE_PREFIX}setting`;
#[QUERY]
CREATE TABLE `{DB_TABLE_PREFIX}setting` (
  `setname` varchar(255) NOT NULL default '',
  `data` text NOT NULL,
  PRIMARY KEY  (`setname`)
) TYPE=MyISAM {setCharset} ;

I try to import this to mysql database and receive this error

You have an error in your SQL syntax; check the manual that
  corresponds to your MySQL server version for the right syntax to use
  near '{setCharset} AUTO_INCREMENT=1' at line 1

Did I did miss something? Please help me out!

A: Replace
TYPE=MyISAM

by
ENGINE=MYISAM

Try this, I have used table prefix as "t_"
DROP TABLE IF EXISTS `t_broadcast`;
CREATE TABLE `t_broadcast` (
  `bid` MEDIUMINT(8) NOT NULL AUTO_INCREMENT,
  `sortid` MEDIUMINT(8) NOT NULL DEFAULT '0',
  `content` VARCHAR(255) NOT NULL DEFAULT '',
  `gourl` VARCHAR(255) NOT NULL DEFAULT '#',
  PRIMARY KEY  (`bid`)
) ENGINE=MYISAM;

DROP TABLE IF EXISTS `t_items`;
CREATE TABLE `t_items` (
  `itemid` MEDIUMINT(8) UNSIGNED NOT NULL AUTO_INCREMENT,
  `uid` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0',
  `account` VARCHAR(15) NOT NULL DEFAULT '',
  `content` VARCHAR(255) NOT NULL DEFAULT '',
  `dateline` INT(10) UNSIGNED NOT NULL DEFAULT '0',
  `digg` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0',
  `reply` MEDIUMINT(5) UNSIGNED NOT NULL DEFAULT '0',
  PRIMARY KEY  (`itemid`),
  KEY `uid` (`uid`)
) ENGINE=MYISAM;

DROP TABLE IF EXISTS `t_reply`;
CREATE TABLE `t_reply` (
  `rid` MEDIUMINT(8) NOT NULL AUTO_INCREMENT,
  `replyto` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0',
  `uid` MEDIUMINT(8) NOT NULL DEFAULT '0',
  `account` VARCHAR(15) NOT NULL DEFAULT '',
  `content` VARCHAR(255) NOT NULL DEFAULT '',
  `dateline` INT(10) UNSIGNED NOT NULL DEFAULT '0',
  PRIMARY KEY  (`rid`),
  KEY `uid` (`uid`),
  KEY `replyto` (`replyto`)
) ENGINE=MYISAM;

DROP TABLE IF EXISTS `t_setting`;
CREATE TABLE `t_setting` (
  `setname` VARCHAR(255) NOT NULL DEFAULT '',
  `data` TEXT NOT NULL,
  PRIMARY KEY  (`setname`)
) ENGINE=MYISAM ;

A: Try this:
CREATE TABLE `broadcast` (
  `bid` mediumint(8) NOT NULL auto_increment,
  `sortid` mediumint(8) NOT NULL default '0',
  `content` varchar(255) NOT NULL default '',
  `gourl` varchar(255) NOT NULL default '#',
  PRIMARY KEY  (`bid`)
) TYPE=MyISAM  AUTO_INCREMENT=50 ;

The curly brackets were just for explanation as you refereed the syntax from some other source.


text:
Q: How to check string contain a year sarting from 20.. or 19 I have a string, I want to check whether that string contain string like bellow, and get that string no(eg:2012) if exist. (I am trying to get years of a string)
"from 20##" , "From 20##" , "from 19##" or "From 19##"

and
  "to 20##" , "To 20##" , "to 19##" or "To 19##"    # can be any one digit no

please tell me how to do this

A: Use Regular Expression to search the pattern.
You can replace any digit by "[/d]" in the regular expression.
So, if you are searching for 20##, your search pattern will be 20[\d][\d].
Have a look at this tutorial is you still have doubts.

A: All you really need is
int year = Integer.parseInt(str.substring(str.length()-4)

and you are free to check that year >= 1900 && year < 2100.
If you need to assert that the string matches your pattern, you can test for
str.matches("([Ff]rom|[Tt]o)\\s+\\d{4}")


text:
Q: How to show the existence of positive root for this equation? $f(x)=x-(x+k)^\epsilon$ where $k>1$ and $0<\epsilon<1$.
How do I show that $f(x)=0$ has a root at $x>0$?
The only one root part is obvious, but I am asking this to rigorously show that there is a root. I have an argument involving the growth rates of $x$ and $(x+k)^\epsilon$ in my mind, but somehow I feel that is not rigorous enough.
The problem came up in another problem involving some limits, but this is the only step prevening me from reaching the solution. Thanks in advance.

A: Here a proof that a root exists: first, note that $f(1)<0$. Then, note that
$$
\lim_{x\to \infty}\frac{x}{(x+k)^{\epsilon}} > 1
$$
So, there exists a $c>0$ with $c>(c+k)^{\epsilon}$. By the intermediate value theorem, $f$ has a root.


text:
Q: Check Axios request url before sending API requests are failing because the URL generated by Axios is incorrect due to my config. I know what the request url is suppose to look like, so I want to see the request url Axios generates.
I can point Axios to my local server and see the requests there, but I want to debug this on the client. I want to play with the config, and see how the requests change. Is there a way to output the request url from Axios before or after sending?
// param format
{ address: 'Vancouver', key: GOOGLE_API_KEY }

// Geocode sample
https://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&key=YOUR_API_KEY

_request = async (...args) => {
  const { outputFormat, params } = args
  const instance = axios.create({
    baseURL: `https://maps.googleapis.com`,
  })

  const response = await instance.get('/maps/api/geocode/${outputFormat}?', {
    params,
  })

  // I want to see the url generated by Axios so I can debug the issue

  console.log(response)
}

I am within the Expo, React Native environment.
Working example using fetch:
const url = `https://maps.googleapis.com/maps/api/geocode/json?address=vancouver&key=${GOOGLE_API_KEY}`

fetch(url)
  .then((response) => response.json())
  .then((data) => {
    console.log(data)
  })
  .catch(function(error) {
    console.log(error)
  })

Solution used:
_request = async (obj) => {
  const { outputFormat, params } = obj

  const instance = axios.create({
    baseURL: `https://maps.googleapis.com`,
  })

  instance.interceptors.request.use(function (config) {
    console.log(config)
    return config
  }, function (error) {
    return Promise.reject(error)
  })

  const response = await instance.get(`/maps/api/geocode/${outputFormat}`, {
    params,
  })
}

A: You can turn on debug mode and look at the network tab as mentioned in the other answer, or you can intercept axios and console.log or do whatever you want with the request before it's sent:
axios.interceptors.request.use(function (config) {
    // Do something before request is sent
    console.log(config)
    return config;
  }, function (error) {
    // Do something with request error
    return Promise.reject(error);
  });

A: You can just use axios#getUri([config]) (source) to perform the same logic as the request. It merges the configurations (e.g. the given config and the instance configuration), merges the url with the baseURL, and appends any params using the paramSerializer.


text:
Q: Como puedo eliminar una instancia de clase? Soy un programador principiante, me he ayudado con youtube y quiero hacer una especie de videojuego de escritorio que sea puro texto (con labels) y que en cuanto mas texto se muestre, los textos de arriba se vayan ocultando o eliminando...
Por ejemplo yo tengo este codigo.

from tkinter import Tk
from tkinter import Frame
from tkinter import Label
from tkinter import Entry

root = Tk()
root.resizable(0, 0)
root.config(width=80, height=100)
fframe = Frame(root)
fframe.config(bg="black")
fframe.pack()
###########################################################################
# COLORES
azulClaro = "#0078A7"
Celeste = "#4ABDAC"
Rojo = "#A31730"
Gris = "#4E4E4E"
ColorResp = "#30b18a"
###########################################################################
# ====================================================================================================================================
# ====================================================================================================================================
# PANTALLA INICIAL
###########################################################################
Inicio1 = Label(
    fframe,
    text=("=" * len("ES IMPORTANTE QUE SEPAS QUE ES UN VERSION DE PRUEBA..."))
    + "\nHOLA...\nBIENVENIDO AL JUEGO_1\nES IMPORTANTE QUE SEPAS QUE ES UNA VERSION DE PRUEBA..."
    + "\nASI QUE NO TE PREOCUPES POR LA JUGABILIDAD..."
    + "\nAL SER UNA VERSION BETA NO TIENE SISTEMA DE GUARDADO"
    + "\nPOR LO QUE SI SE CIERRA EL JUEGO TENDRAS QUE INICIAR DESDE CERO :("
    + "\nCADA VEZ QUE TE APARESCA UNA BARRA DE OPCIONES ABAJO"
    + "\nDEBERAS ESCRIBIR EL NUMERO DE OPCION..."
    + "\nY DA -|ENTER|-"
    + "\nSI LA OPCION SON '...' SOLO DA -|ENTER|-\n"
    + ("=" * len("ES IMPORTANTE QUE SEPAS QUE ES UN VERSION DE PRUEBA...")),
    anchor="w",
    justify="left",
)
Inicio1.grid(row=0, column=0, sticky="w")
Inicio1.config(
    bg="black", fg=azulClaro,
)
Inicio = Label(
    fframe,
    text=("=" * len("  SI QUIERES INICIAR ESCRIBE 'si'...  "))
    + "\n SI QUIERES INICIAR ESCRIBE 'si'... \n"
    + ("=" * len("  SI QUIERES INICIAR ESCRIBE 'si'...  ")),
    anchor="w",
    justify="left",
)
Inicio.grid(row=1, column=0, sticky="w")
Inicio.config(
    bg="black", fg=Celeste,
)
Entry1 = Entry(fframe)
Entry1.grid(row=2, column=0, sticky="nsew")
Entry1.config(bg="#24242C", fg=ColorResp)
###########################################################################
# ====================================================================================================================================
# ====================================================================================================================================
# CAPITULO 1
###########################################################################

def Capitulo_1(event):
    if "S" in Entry1.get() or "s" in Entry1.get():
        Inicio1.destroy()
        Inicio.destroy()
    Entry1.destroy()

lo que me gustaria hacer es hacer una clase que me cree los label y que yo pueda eliminarlos, así como si  usara el destroy, o que yo pueda hacer que los esconda en una scroll bar, me gustaria mucho que apoyaran, o que me dijeran donde puedo conseguir esa información.
Sin más que decir gracias comunidad.


text:
Q: Handle wordrap deliminator in CLOB fields I have this request below that does exactly what I want but  it does it only if the fields Author_ID and Author_Name are VARCHAR and values within them are separated by stars like in this table:
ID_BOOK | ID_AUTHOR |       NAME AUTHOR       |
-----------------------------------------------
001     |01         | AuthorU                 |
-----------------------------------------------
002     |02*03*04   | AuthorX*AuthorY*AuthorZ |
-----------------------------------------------

The request will give me this result:
ID_BOOK | ID_AUTHOR |       NAME AUTHOR       |
-----------------------------------------------
001     |01         | AuthorU                 |
-----------------------------------------------
002     |02         | AuthorX                 |
-----------------------------------------------
002     |03         | AuthorY                 |
-----------------------------------------------
002     |04         | AuthorZ                 |
-----------------------------------------------

BUT in real life these two fields are CLOB and there is no star deliminator, there i a wordrap deliminator, so data looks like that in real life:
ID_BOOK | ID_AUTHOR |       NAME AUTHOR       |
-----------------------------------------------
001     |01         | AuthorU                 |
-----------------------------------------------
002     |02*03*04   | AuthorXAuthorYAuthorZ   |

I'm trying to have the same result that i got it with the Varchar fields and the star deliminator because with CLOB I can't use REGEXP_SUBSTR and I don't know how to handle the wordrap deliminator. Could you please help me with some hints. Many thanks.
SELECT
 ID_Book,
 REGEXP_SUBSTR(ID_Author, '[^*]+', 1, Counter) AS AuthID,
 REGEXP_SUBSTR(Name_Author, '[^*]+', 1, Counter) AS AuthName
FROM Books
CROSS JOIN (
  SELECT LEVEL Counter
    FROM DUAL
    CONNECT BY LEVEL <= (
      SELECT MAX(REGEXP_COUNT(ID_Author, '[^*]+'))
      FROM Books))
WHERE REGEXP_SUBSTR(Name_Author, '[^*]+', 1, Counter) IS NOT NULL
ORDER BY 1, 2

A: You could convert clob to varchar2 using to_char function.

EDIT :
If Name_Author is a CLOB, try
  to_char(REGEXP_SUBSTR(Name_Author, '[^'||chr(10)||chr(13)||']+', 1, Counter))

or
  to_char(REGEXP_SUBSTR(Name_Author, '^.*?$', 1, Counter, 'm'))

The latter expression is shorter, but it does not strip out chr(13) symbols.


text:
Q: Loading not advertised layers into opengeo SDK app I`ve made several apps using OpenGeo suite SDK but so far never needed to keep layers from being exposed in the capabilities. Now I´ll like to "hide" some of them but still being able to load them. I taught that the solution was to set the layers as not advertised but if I do that the app will not load those layers!!
As far as I understand I should be able to call a layer that is not advertised!!
Using geoexplorer and saving the map I can do the same with no problems….  Any idea what may be wrong?

A: You will need to use lazy loading (which bypasses GetCapabilities, so provide title and bbox properties in the layer's config), see also:
https://github.com/boundlessgeo/gxp/blob/master/src/script/plugins/WMSSource.js#L172:L186


text:
Q: Pick 4 random elements from an NSArray of count 6 I am new to Objective C. I am coding the game Mastermind where the computer chooses 4 random colors out of 6 and the user tries to guess the 4 colors in 6 tries.
I have an NSArray to represent all the six possible colors here:
    NSArray * allColors = [[NSArray alloc] initWithObjects:@"r", @"g", @"b", @"y", @"p", @"o", nil];

    //Computer choose 4 random colors:

    NSArray * computersSelection = [[NSArray alloc] init];

I need to write code to choose 4 UNIQUE random colors from the array. Is there a smart way to do this?
I can create four int variables and use a while loop to generate four random numbers and then pull the objects from the NSArray based on the four random integer values and put them in the computerSelection array but I am wondering if there's any simpler way of doing things?
Thanks

A: A relatively simple way to ensure unique values is, since the initial array is fixed, to remove objects rather than selecting them. In this case, remove two and you have an array of four, uniqueness guaranteed. Here's the basic code:
    NSArray *allColors = @[@"r", @"g", @"b", @"y", @"p", @"o"];
    NSMutableArray *fourColors = [allColors mutableCopy];
    [fourColors removeObjectAtIndex:arc4random_uniform((u_int32_t)(fourColors.count + 1))];
    [fourColors removeObjectAtIndex:arc4random_uniform((u_int32_t)(fourColors.count + 1))];
    NSLog(@"%@", fourColors);

A:  //0 r
    //1 g
    //2 b
    //3 y
    //4 p
    //5 o
    NSArray * allColors = [[NSArray alloc] initWithObjects:@"r", @"g", @"b", @"y", @"p", @"o", nil];

    //Computer choose 4 random colors:

    NSUInteger x1 =1;
    NSUInteger x2 =1;
    NSUInteger x3 =1;
    NSUInteger x4 =1;

    while(x1 == x2 || x1 == x3 || x1 == x4 || x2 == x3 || x2 == x4 || x3 == x4)
    {
        x1 = arc4random() % 6;
        x2 = arc4random() % 6;
        x3 = arc4random() % 6;
        x4 = arc4random() % 6;
    }
    NSArray * computersSelection = [[NSArray alloc] initWithObjects: [allColors objectAtIndex: x1], [allColors objectAtIndex: x2], [allColors objectAtIndex: x3], [allColors objectAtIndex: x4], nil];

    NSLog(@"%@, %@, %@, %@", [computersSelection objectAtIndex:0], [computersSelection objectAtIndex:1], [computersSelection objectAtIndex:2], [computersSelection objectAtIndex:3]);

So here is my attempt. But I still prefer @jshier 's response above.

A: Preserves the original source list:
NSUInteger const kChoiceSize = 4;
NSArray * allColors = [[NSArray alloc] initWithObjects:@"r", @"g", @"b", @"y", @"p", @"o", nil];

NSMutableSet *choice = [[NSMutableSet alloc] init];
while ([choice count] < kChoiceSize) {
    int randomIndex = arc4random_uniform([allColors count]);
    [choice addObject:[allColors objectAtIndex:randomIndex]];
}


text:
Q: for loop apeend to vector I have a y_test.shape = (2005, 1) I build a model and did a prediction as follow prediction=model1.predict(np.array(test_x))
I got prediction shape (2005, 7)
I wanted to get the model accuracy but due to diffrent shapes I can't perform perform accuracy calculation. The way model predict worked is each class was in a column and if the pictures belongs to the class it will have 1. Is there a way to make it vector with each row corresponding to the class number.
Also is there another way to get the accuracy of the prediction if I have the labeled test? and I want to compare it with the prediction?

A: Assume prediction is the predicted probability of test_x in each and every class, yo u may use prediction.argmax(axis=1) to get a size-2005 vector containing the index of the predicted class (from 0 to 6).  The prediction loss can also be computed
pred_class = prediction.argmax(axis=1)
l2loss = ((pred_class - y_test[:, 0]) ** 2).mean()

y_test[:, 0] merely change a matrix (2005, 1) to a vector of size 2005.  Or you may do the 0/1 loss as
binary_loss = (pred_class != y_test[:, 0]).mean()


text:
Q: Will $x+U$ be open set in metric space $X$ if $U$ is open in $X$? "If $U$ is an open set in normed linear space $X$, then for any $x\in X$, $x+U$ is open". My question is:
What can we say if $X$ is not a normed linear space, will it hold? I tried finding counterexamples but couldn't find it. Any hints?

A: If $X$ is a topological vector space, then by definition the sum operation $+$ is continuous. Since $U$ is open, and $f(y)= y+x$ is a homeomorphism (it is continuous and its inverse $g(z)=z-x$ is also continuous) then also $f(U)=U+x$ is open.


text:
Q: x11 mouse themes not showing on desktop (unity)
Possible Duplicate:
How do I install and select cursor themes?

Hi I have install a few different themes for the mouse cursor. They work well except on the desktop, taskbar or unity launcher where it defaults to the original theme.
Any help with this is much appreciated...

A: You may need to restart some applications for the new theme to work. If you log out, and then log back in, the new cursors should show in those areas, rather than the old one.


text:
Q: Idiomatic Javascript dependency graph Given the following Javascript, would it be better/more idiomatic to inject the MyService object into myMethod so that a fake version of MyService could be injected for testing? Or am I missing something?
var myObject = {
  myMethod: function() {
    var myService = new MyService();
    return myService.doSomething();
  }
}

A: Dependency injection always takes precedence over hard-coding the dependencies. Also, by coding to interfaces (assuming the myObject instance has been given a copy of a Service object that has a doSomething() method) could come handy here.


text:
Q: Using ggplot2, Why is it returning NULL when i am trying to add an average line through my bar chart using geom line? options(repr.plot.width=8, repr.plot.height=3)

    ggplot(filtered, aes(x =reorder(CountyName,Added_Column), y = Added_Column)) +
    geom_bar(stat = "identity") +
    coord_flip() + scale_y_continuous(name="total cases per 100k by county 2021-12-21 ") +
    geom_text(aes(label=Added_Column), hjust=2.9, color="white", size=3.5)
  +
    geom_line() +
    geom_hline(xintercept = mean(Added_Column), color="blue")

    ggtitle("Covid Cases per 100k by county ") +

    theme(axis.text.x = element_text(face="bold", color="#008000",
                                   size=8, angle=0),
        axis.text.y = element_text(face="bold", color="#008000",
                                   size=8, angle=0))

here is what the  graph looks like before i add the following :
geom_line() +
geom_hline(yintercept = mean(Added_Column), color="blue")

when i add this line of code trying to get an average line to run through my graph , it returns
NULL. what can i do to fix this??

A: try:
geom_hline(aes(yintercept=mean(Added_Column, na.rm=T)), color="blue)

A: I updated your code and I think this is what you are after.
Sample data:
filtered<-structure(list(CountyName = c("Monaghan", "Donegal", "Louth",
"Dublin", "Cavan", "Carlow", "Limerick", "Meath", "Waterford",
"Longford", "Westmeath", "Kildare", "Laois", "Offaly", "Mayo",
"Cork", "Galway", "Roscommon", "Tipperary", "Leitrim", "Kilkenny",
"Wexford", "Kerry", "Calre", "Sligo", "Wicklow"), Added_Column = c(18286,
18107, 17870, 16361, 15937, 15406, 14520, 14374, 14312, 14266,
14196, 14199, 13237, 12976, 12409, 12091, 11987, 11893, 11660,
11428, 11414, 11384, 11357, 11278, 10636, 10342)), spec = structure(list(
    cols = list(CountyName = structure(list(), class = c("collector_character",
    "collector")), Added_Column = structure(list(), class = c("collector_double",
    "collector"))), default = structure(list(), class = c("collector_guess",
    "collector")), delim = ","), class = "col_spec"), problems = <pointer: 0x1b70d488>, row.names = c(NA,
-26L), class = c("spec_tbl_df", "tbl_df", "tbl", "data.frame"
))

Sample code:
library(ggplot2)

ggplot(filtered, aes(x = reorder(CountyName, Added_Column), y = Added_Column)) +
  geom_bar(stat = "identity") +
  geom_line() +
  geom_hline(yintercept = mean(filtered$Added_Column), size=1, color="blue") +
  geom_text(aes(label=Added_Column), hjust=2.9, color="white", size=3.5)+
  coord_flip() +
  labs( x="", y="Total cases per 100k by county 2021-12-21", title="Covid Cases per 100k by county ")+
  theme_bw()+
  theme(axis.text.x = element_text(face="bold", color="#008000",size=12, angle=0),
        axis.text.y = element_text(face="bold", color="#008000",size=12, angle=0),
        axis.title.x = element_text(face="bold", size=12, color="black"),
        plot.title  = element_text( face = "bold", colour = "black", size = 20,, hjust = 0.5))+
  scale_y_continuous(expand=c(0,0))

Plot:


text:
Q: Package 'chromium-browser' has no installation candidate I am trying to install the chrome browser in a docker image with
RUN apt-get install chromium-browser

but I get the error:
Package chromium-browser is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'chromium-browser' has no installation candidate

How to correctly install chromium in a docker image?

A: Use the following to install chrome in a docker container:
RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
RUN dpkg -i google-chrome-stable_current_amd64.deb --fix-missing; apt-get -fy install`

A: If you happen to be running a Debian-based image, the package you want is chromium (vs chromium-browser). So, for such images, this'll take care of it for you:
RUN apt-get install chromium -y

A: I solved it as follows:
# install manually all the missing libraries
RUN apt-get install -y gconf-service libasound2 libatk1.0-0 libcairo2 libcups2 libfontconfig1 libgdk-pixbuf2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libxss1 fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils

# install chrome
RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
RUN dpkg -i google-chrome-stable_current_amd64.deb; apt-get -fy install