text:
Q: Unbinding in module I am creating a shiny module that inputs a dataset, and outputs a DataTable with the data and a numeric input. I know that with inputs in DataTables you need to bind and unbind the elements with javascript each time the table is redrawn or else you will only be able to read the values from the initial table. (https://groups.google.com/forum/#!topic/shiny-discuss/ZUMBGGl1sss) I don't know if the issue is with namespaces, but I can't seem to get the elements of the table to succesfully unbind inside a module. Here is my code:
library(shiny)
library(DT)
# module UI
dtInputUI <- function(id) {
  ns <- NS(id)
  tbl <- DT::dataTableOutput(ns("tbl"))
  btn <- actionButton(ns("btn"),"Submit")
  scrpt1 <- tags$script(HTML(
    "Shiny.addCustomMessageHandler('display', function(html) {
      var w=window.open();
      $(w.document.body).html(html);})"
    ))
  # doesn't appear to work properly
  scrpt2 <- tags$script(HTML(paste0(
    "Shiny.addCustomMessageHandler('unbind-DT', function(id) {
      Shiny.unbindAll($('#'+id).find('table').DataTable().table().node());
    })")))
  tagList(
    btn,tbl,scrpt1,scrpt2
    )
}
# module server
dtInput <- function(input, output, session, data) {
  ns <- session$ns
  # numeric inputs
  form <- reactive({
    n <- nrow(data())
    inputs <- character(n)
    for (i in seq_len(n)) {
      inputs[i] <- as.character(numericInput(
        ns(paste0("Form",i)),value=0,label=NULL)
        )
    }
    session$sendCustomMessage('unbind-DT',ns("tbl"))
    data.frame(data(), RATE=inputs)
  })
  # datatable
  output$tbl <- DT::renderDataTable(form(),
                server=FALSE,escape=FALSE,selection='none',
                rownames=FALSE,options=list(
                  paging=FALSE,
                  bInfo=0,
                  bSort=0,
                  bfilter=0,
                    preDrawCallback=DT::JS(
                      'function() {Shiny.unbindAll(this.api().table().node());}'),
                   drawCallback=DT::JS(
                     'function(settings) {Shiny.bindAll(this.api().table().node());}')
                ))

  vals <- reactive({
    unlist(lapply(seq_len(nrow(data())),function(i) {
      value <- ifelse(is.null(input[[paste0("Form",i)]]),NA,input[[paste0("Form",i)]])
    }))
  })
  # generate webpage when button clicked
  observeEvent(input$btn, {
    HTML <- paste0("<p>",paste0(vals(),collapse=" </p> <p>"),"</p>")
    session$sendCustomMessage("display",HTML)
  })
}

ui <- fluidPage(
  mainPanel(
    selectInput("choose","Choose data",choices=c("mtcars","iris")),
    dtInputUI("example")
  )
)

server <- function(input, output, session) {
  dat <- reactive({
    req(input$choose)
    get(input$choose)
  })

  callModule(dtInput,"example",reactive(dat()))

}

shinyApp(ui, server)

Enter anything in the inputs and press the button and a webpage with the inputs is created. Change the dataset, enter different info in the inputs, and press the button again and you get the same info as before, which tells me that the old inputs didn't successfully unbind.
Any idea what I am doing wrong?
Thanks


text:
Q: Permission denied when tried to connect to an SSH server I have installed a python server on my robot and also create a socket to robot successfully. Everything is looking fine but when I want to create a channel I have an error that says:
sending naocom/start.sh
W/System.err: bash: naocom/start.sh: Permission denied

here is where I tried to start connection and start python server with
 public Map<String, Integer> sendSSHCommands(String[] aCommands, String... aInput){

    // Connect to ssh server
    Session vSession = connectSSH();
    Map<String, Integer> vExitStatus = new HashMap<String, Integer>();

    if( vSession != null){

        // execute commands
        for( int i=0; i < aCommands.length; i++ ){
            String cmd = aCommands[i];
            try{
                // open channel
                Channel vChannel = vSession.openChannel("naocom/start.sh");
                ChannelExec vChannelExec = (ChannelExec) vChannel;
                OutputStream vOutStream = vChannel.getOutputStream();
                vChannelExec.setCommand(cmd);
                vChannelExec.setOutputStream(System.out);
                vChannelExec.setErrStream(System.err);

                // connect
                Log.i(TAG, "sending " + cmd);
                vChannel.connect();

                // get user information
                SharedPreferences vPreferences = MainActivity.getPreferences();

                // wait for command to complete
                while( !vChannel.isClosed() ){
                    try {
                        Thread.sleep(100);
                    } catch (InterruptedException e) {}
                };

                // add exit status
                vExitStatus.put( cmd, vChannel.getExitStatus() );
                vOutStream.close();
                vChannel.disconnect();

            } catch(JSchException e){
                Log.e(TAG, e.getMessage());
            } catch (IOException e) {
                Log.e(TAG, e.getMessage());
                e.printStackTrace();
            }
        }

        // close ssh connection
        closeSSH(vSession);
    }

    return vExitStatus;
}

when I debuged my code I found it happend when start(); in Channel.java called
  public void connect() throws JSchException{
    connect(0);
  }

  public void connect(int connectTimeout) throws JSchException{
    this.connectTimeout=connectTimeout;
    try{
      sendChannelOpen();
      start(); //here i have an error
    }
    catch(Exception e){
      connected=false;
      disconnect();
      if(e instanceof JSchException)
        throw (JSchException)e;
      throw new JSchException(e.toString(), e);
    }
  }

redpajama_set_name: RedPajamaStackExchange


text:
Q: Add a contact using Google Contacts API Version 3.0 & OAuth 2.0 in C# and ASP.NET I have created the developer's account, got my client-id and secret key. I'm new to C#, I'm able to retrieve contacts using using C#. Can anyone post the code for adding a new contact entry? Google has proper documentation for this purpose, but I'm having problem to implement it using C#. Please help!
Thank you
I Could Accomplish using PHP (Adding a Contact)
Here is the code
<?php

$group_id = "6"; // Used as the default 'My Contacts' group.

require_once 'google-api-php-client/src/Google_Client.php';

session_start();

$client = new Google_Client();
$client->setApplicationName("Google Apps PHP Starter Application");
$client->setScopes(array(
'https://apps-apis.google.com/a/feeds/groups/',
'https://apps-apis.google.com/a/feeds/alias/',
'https://apps-apis.google.com/a/feeds/user/',
'https://www.google.com/m8/feeds/',
'https://www.google.com/m8/feeds/user/',
 ));

$client->setClientId('#################################');
$client->setClientSecret('***************************');
$client->setRedirectUri('http://localhost/try/index.php');
$client->setDeveloperKey('DEVELOPER_KEY');

if (isset($_REQUEST['logout'])) {
unset($_SESSION['access_token']);
}

if (isset($_GET['code'])) {
$client->authenticate();
$_SESSION['access_token'] = $client->getAccessToken();
$redirect = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
header('Location: ' . filter_var($redirect, FILTER_SANITIZE_URL));
}

if (isset($_SESSION['access_token'])) {

$client->setAccessToken($_SESSION['access_token']);
$token = json_decode($_SESSION['access_token']);

$auth_pass = $token->access_token;

//Get Email of User ------------------------------------
// You are now logged in
// We need the users email address for later use. We can get that here.

$req = new Google_HttpRequest("https://www.google.com/m8/feeds/contacts/default/full");
$req->setRequestHeaders(array('GData-Version'=> '3.0','content-type'=>'application/atom+xml; charset=UTF-8; type=feed'));

$val = $client->getIo()->authenticatedRequest($req);

  // The contacts api only returns XML responses.
  $response =$val->getResponseBody();

$xml = simplexml_load_string($response); // Convert to an ARRAY

$user_email = urlencode($xml->id); // email address
unset($xml); // clean-up

//-------------------------------------
// How to save an entry to your My Contacts List

// This is an example contact XML that Google is looking for.

$contact="
<atom:entry xmlns:atom='http://www.w3.org/2005/Atom'
    xmlns:gd='http://schemas.google.com/g/2005'
    xmlns:gContact='http://schemas.google.com/contact/2008'>
  <atom:category scheme='http://schemas.google.com/g/2005#kind'
    term='http://schemas.google.com/contact/2008#contact'/>
  <gd:name>
     <gd:givenName>abc_Name</gd:givenName>
     <gd:familyName>abc_familyname</gd:familyName>
     <gd:fullName>abc_fullname</gd:fullName>
  </gd:name>
  <atom:content type='text'>
  abc_Description</atom:content>
  <link rel='http://schemas.google.com/contacts/2008/rel#photo' type='image/*'
    href='https://www.google.com/m8/feeds/photos/media/userEmail/contactId'
    gd:etag='photoEtag'/>
  <gd:email rel='http://schemas.google.com/g/2005#work'
    primary='true'
    address='abc@gmail.com' displayName='E. Bennet'/>
  <gd:phoneNumber rel='http://schemas.google.com/g/2005#work'
    primary='true'>
    9999999999999
  </gd:phoneNumber>

  <gd:structuredPostalAddress
      rel='http://schemas.google.com/g/2005#work'
      primary='true'>
    <gd:city>abc_city</gd:city>
    <gd:street>abc_street</gd:street>
    <gd:region>abc_state</gd:region>
    <gd:postcode>abc_pin</gd:postcode>
    <gd:country>abc_nation</gd:country>
    <gd:formattedAddress>
            abc_formatted address
    </gd:formattedAddress>
   </gd:structuredPostalAddress>
   <gContact:groupMembershipInfo deleted='false' href='http://www.google.com/m8/feeds/groups/".$user_email."/base/6'/>
  </atom:entry>";

  $len = strlen($contact);
  $add = new Google_HttpRequest("https://www.google.com/m8/feeds/contacts/".$user_email."/full/");
  $add->setRequestMethod("POST");
  $add->setPostBody($contact);
  $add->setRequestHeaders(array('content-length' => $len, 'GData-Version'=> '3.0','content-type'=>'application/atom+xml; charset=UTF-8; type=feed'));

  $submit = $client->getIo()->authenticatedRequest($add);
  $sub_response = $submit->getResponseBody();

  $parsed = simplexml_load_string($sub_response);
  $client_id = explode("base/",$parsed->id);

  // Contact Groups -------------------------------------------------
 // This section will collect all the groups for this user for contact sorting.
// For now, I have set the default group to "My Contacts" of that user.

$group="http%3A%2F%2Fwww.google.com%2Fm8%2Ffeeds%2Fgroups%2F".$user_email."%2Fbase%2F6";

//Get Contacts by Group -------------------------------------------------------------------
// Now we request the users contacts based on group. For now, we will retreive 'My Contacts'

$req = new Google_HttpRequest("https://www.google.com/m8/feeds/contacts/".$user_email."/full?group=".$group);
$req->setRequestHeaders(array('GData-Version'=> '3.0','content-type'=>'application/atom+xml; charset=UTF-8; type=feed'));
$val = $client->getIo()->authenticatedRequest($req);

  // The contacts api only returns XML responses.
  $response =$val->getResponseBody();

    $xml = simplexml_load_string($response); // Convert the response to an ARRAY

//print_r($xml);

        echo "Group: ".$xml->title."
";
        echo "Email: ".$xml->id."
";
        echo "

";

        for($i = 0; $i <= sizeof($xml->entry); $i++)

            {

            echo $xml->entry[$i]->title."
";

            }

// The access token may have been updated lazily.
$_SESSION['access_token'] = $client->getAccessToken();
} else {
$authUrl = $client->createAuthUrl();
}

if(isset($authUrl)) {
print "Connect Me!";
} else {
 print "Logout";
}

I could Get a working C# code for retrieving contacts from here

A: The Contacts API developer page some samples that can be beneficial for you.
This is the code sample taken from the Creating Accounts section in .NET.
public static Contact CreateContact(ContactsRequest cr)
{
  Contact newEntry = new Contact();
  // Set the contact's name.
  newEntry.Name = new Name()
      {
    FullName = "Elizabeth Bennet",
    GivenName = "Elizabeth",
    FamilyName = "Bennet",
      };
  newEntry.Content = "Notes";
  // Set the contact's e-mail addresses.
  newEntry.Emails.Add(new EMail()
      {
    Primary = true,
    Rel = ContactsRelationships.IsHome,
    Address = "liz@gmail.com"
      });
  newEntry.Emails.Add(new EMail()
      {
    Rel = ContactsRelationships.IsWork,
    Address = "liz@example.com"
      });
  // Set the contact's phone numbers.
  newEntry.Phonenumbers.Add(new PhoneNumber()
      {
    Primary = true,
    Rel = ContactsRelationships.IsWork,
    Value = "(206)555-1212",
      });
  newEntry.Phonenumbers.Add(new PhoneNumber()
      {
    Rel = ContactsRelationships.IsHome,
    Value = "(206)555-1213",
      });
  // Set the contact's IM information.
  newEntry.IMs.Add(new IMAddress()
      {
    Primary = true,
    Rel = ContactsRelationships.IsHome,
    Protocol = ContactsProtocols.IsGoogleTalk,
      });
  // Set the contact's postal address.
  newEntry.PostalAddresses.Add(new StructuredPostalAddress()
      {
    Rel = ContactsRelationships.IsWork,
    Primary = true,
    Street = "1600 Amphitheatre Pkwy",
    City ="Mountain View",
    Region = "CA",
    Postcode = "94043",
    Country = "United States",
    FormattedAddress = "1600 Amphitheatre Pkwy Mountain View",
      });
  // Insert the contact.
  Uri feedUri = new Uri(ContactsQuery.CreateContactsUri("default"));
  Contact createdEntry = cr.Insert(feedUri, newEntry);
  Console.WriteLine("Contact's ID: " + createdEntry.Id)
  return createdEntry;
}


text:
Q: How to find where the chrome Driver of Google chrome is located in your system without it was been "added into system variables"? I am learning Selenium WebDriver with java and I have to mention the chrome driver location. I need to find out how chrome driver location can be found in the system which is already existing.
I tried to go through my environment variables but there was no path been mentioned by default


text:
Q: Shade area between a straight line and plot I have searched the web thoroughly but still found no exact solution to this. I need to shade the intersecting area above the straight line and below the plot in MATLAB.

I need to shade the area above the threshold at 110 and under the plot.

A: here's a way using area :
% generate "data"
    x=1:100;
    y1=0.5*ones(100,1);
    y2=exp(-(x(:)-50).^2/500).^.5+0.1*rand(100,1);

% do the plot

    h=area([y1(:) , (y2(:)-y1(:)).* (y2(:)>y1(:)) ]);
    h(1).FaceColor=[1 1 1];
    h(2).FaceColor=[0 0 1 ];
    hold on;

    plot(x,y2,'b',x,y1,'r');


text:
Q: Using Silverlight to send ZPL commands to a Zebra printer works only for limited numbers of labels I developed an in-browser Silverlight application that consist in a button. When it pressed it open a Socket to send ZPL commands to a Zebra Printer (model RZ400).
I made all the required actions to allow in-browser app to open connection to other hosts.
The printer works well except that it print only a limited number of labels (27) even if the socket send right all the data to the printer (that consist in 48 labels, about 440 bytes each).
To be sure, I check the buffer size of the socket that is 65536 bytes. The amount of data that I send to the printer through the socket is only 21282 bytes.
foreach (Label l in args.Labels)
{
    saea = new SocketAsyncEventArgs();
    printCommand = GetPrintCommandFromLabelAndPRN(l, args.SelectedPrinter.prn);

    buffer = Encoding.UTF8.GetBytes(printCommand);
    saea.SetBuffer(buffer, 0, buffer.Length);

    willRaiseEvent = args.ConnectionSocket.SendAsync(saea);
    totBytes += buffer.Length;

    Log("Pack " + l.data + " inviato al socket di stampa");
}

The method GetPrintCommandFromLabelAndPRN build the PRN command for a single label:
private string GetPrintCommandFromLabelAndPRN(Label l, string prn)
{
    // Codice e RFID
    string aux = prn.Replace("{code}", l.code).Replace("{epc}", l.data);

    // Meta
    foreach (labelMeta meta in l.meta)
    {
        if (meta.key != null && !meta.key.Equals(String.Empty))
        {
            aux = aux.Replace("{" + meta.key + "}", meta.value);
        }
    }

    return aux;
}

And this is the PRN template:
^XA
~SD25
^FO10,70^XGE:LOGO.GRF,1,1^FS
^FT275,65^A0N,29,28^FH\^FDArticolo:^FS
^FT375,65^A0N,29,28^FH\^FD{code}^FS
^FT509,65^A0N,25,24^FH\^FD{description1}^FS
^FT275,99^A0N,25,24^FH\^FD{description2}^FS
^BY2,3,57^FT275,166^BCN,50,Y,N,N^FD>:{code}^FS
^FT50,225^A0N,29,28^FH\^FDLotto:^FS
^BY2,3,35^FT130,225^BCN,30,Y,N,N^FD>:{lotCode}^FS
^PQ1,0,1,Y
^RR2
^RS8,300,50,2,N
^RW20,20
^RFW,H
^FD{epc}^FS
~RVE
^XZ

I try to do the same in Java, with the same PRN, using PrintWriter and it works correctly. So I exclude that is a printer issue.

A: I would bet that the printer is queuing up your labels and that is what causes it to stop at 27. Have you tried sending one at a time just to test to see if you might need to let the printer 'catch up' with the print jobs you are sending? We used to have an issue similar to this - when we slowed down the loop to the printer it allowed the printer to work at it's own rate just fine, but labels came out at a slower rate.


text:
Q: Потеря данных при отправке POST запроса через AJAX Пытаюсь разобрать в обработке запросов с использованием AJAX, при отправке запроса через JS, происходит добавление данных в БД, но я не могу их поймать и обработать как мне нужно, во view происходит исключение. При расшифровке запроса, передаваемые данные пустые. В чем моя ошибка, почему я не могу поймать передаваемые данные?
view.py
def UpdateMessage(request, chat_id):
    data = {
        'test': chat_id,
    }
    if request.is_ajax():
       message = request.POST.get('message')
       slug = request.POST.get('slug_message')

       data['slug'] = slug
       data['message'] = message
    return JsonResponse(data)

urls.py
path('dialogs/<str:chat_id>/updateMessage/', UpdateMessage, name='update_message_url'),
js
var innerMessage = document.getElementById('innerMessages');
    innerMessage.addEventListener('click', edit);

    function edit(event) {
        var targ = event.target.className === 'edit-message';
        if (targ) {
            var message = event.target.closest('.item-message-id');
            var data_id = message.getAttribute('data-message-id');
            var message_id = document.getElementById(data_id);
            var editInput = message.querySelector('input.edit-input');
            var btnEdit = message.querySelector('input.edit-message');
            var btnSave = message.querySelector('.btn-form');
            editInput.style.display = 'block';
            message_id.style.display = 'none';
            editInput.value = message_id.innerText;
            btnEdit.style.display = 'none';
            btnSave.style.display = 'block';
            btnSave.addEventListener('click', UpdateMessage);
        }
    }
    function UpdateMessage(event) {
        var targ = event.target.className === 'btn-form';
        if (targ) {
            var message = event.target.closest('.item-message-id');
            var data_id = message.getAttribute('data-message-id');
            var message_id = document.getElementById(data_id);
            var editInput = message.querySelector('input.edit-input');
            var btnEdit = message.querySelector('input.edit-message');
            var btnSave = message.querySelector('.btn-form');
            var slug = message.getAttribute('data-message-slug');
            $.ajax({
                type: 'POST',
                dataType: 'json',
                data: {
                    slug_message: slug,
                    message: editInput.value
                },
                success: function () {
                    editInput.style.display = 'none';
                    message_id.style.display = 'block';
                    btnEdit.style.display = 'block';
                    btnSave.style.display = 'none';
                    message_id.innerHTML = editInput.value;
                }
            });
        }
    }

html

{{ message_item.message|safe }}

            <input type="submit" style="margin-left: 90%" class="edit-message" value="редактировать">
            <form action="{% url 'update_message_url' chat.id %}" method="POST">
                {% csrf_token %}
                <input type="text" style="display: none" class="edit-input">
                <button style="margin-left: 90%; display: none" class="btn-form">сохранить</button>
            </form>

errors
"POST /dialogs/1/updateMessage/ HTTP/1.1" 200 44
----------------------------------------

Exception happened during processing of request from ('127.0.0.1', 62484)
Traceback (most recent call last):
  File "C:\Users\Jony\AppData\Local\Programs\Python\Python38-32\lib\socketserver.py", line 650, in process_request_thread
    self.finish_request(request, client_address)
  File "C:\Users\Jony\AppData\Local\Programs\Python\Python38-32\lib\socketserver.py", line 360, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "C:\Users\Jony\AppData\Local\Programs\Python\Python38-32\lib\socketserver.py", line 720, in __init__
    self.handle()
  File "C:\Users\Jony\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\servers\basehttp.py", line 171, in handle
    self.handle_one_request()
  File "C:\Users\Jony\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\servers\basehttp.py", line 179, in handle_one_request
    self.raw_requestline = self.rfile.readline(65537)
  File "C:\Users\Jony\AppData\Local\Programs\Python\Python38-32\lib\socket.py", line 669, in readinto
    return self._sock.recv_into(b)

JSON который я получаю на выходе
{"test": "1", "slug": null, "message": null}

A: function UpdateMessage(event) {
  event.preventDefault();
  ...
  $.ajax({
    url: ???


text:
Q: Can't open Eclipse in new workspace I work upon an Android project on MacOS. Recently i had to create a copy of my project in another location. Say it was Users/user/SVN/Applications/BarPoject/AndroidBarProject and now it is Users/user/Projects/AndroidBarProject.
Now i'm trying to make Eclipse work with the project in new location. When launching Eclipse i browse to the new workspace then i click OK and then i'm presented with a popup alert which reads:
An error has occurred. See the log file /Users/user/Projects/AndroidBarProject/.metadata/.log

What i do next is i open Eclipse in the old workspace and click File/Switch Workspace but again i see exactly the same popup message.
I open that log file, and here are excerpts from it, which i suppose describe the problem:
org.osgi.framework.BundleException: Exception in org.eclipse.core.resources.ResourcesPlugin.start() of bundle org.eclipse.core.resources.
Caused by: org.eclipse.core.internal.dtree.ObjectNotFoundException: Tree element '/BarApp/bin/jarlist.cache' not found.

but i HAVE PUT jarlist.cache file into the bin directory!
further it complains again on missing jarlist.cache file and besides it:
java.lang.NoClassDefFoundError: org/eclipse/core/resources/IContainer
Caused by: org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter$TerminatingClassNotFoundException: An error occurred while automatically activating bundle org.eclipse.core.resources (78).
Caused by: org.osgi.framework.BundleException: Exception in org.eclipse.core.resources.ResourcesPlugin.start() of bundle org.eclipse.core.resources.
Caused by: org.eclipse.core.internal.dtree.ObjectNotFoundException: Tree element '/BarApp/bin/jarlist.cache' not found.

again i wanna emphasize that jar list.cache file is present in needed directory.
Please help me someone. I can show the whole log file content if you need


text:
Q: Can ships be tracked and chased through hyperspace? In Rogue One,

 Vader arrives at the battle and witnesses the escape of the Tantive IV into hyperspace.

At the beginning of A New Hope, we see Vader's ship chasing the Tantive IV, eventually overpowering it. How was Vader able to find the Tantive IV? Presumably through some method of tracking the ship through hyperspace, but this raises more questions:

*

*If ships can be tracked through hyperspace, why do the Imperials need to place a tracking device on the Falcon?

*Why aren't Rebels chased through hyperspace more often? (E.g. after successfully destroying both Death Stars, or after practically any engagement in the SW:Rebels show)

*Does Vader himself use unconventional means to locate the Tantive IV?

So my question is thus: Can ships be tracked and chased through hyperspace without the use of a planted tracker or Force shenanigans?

A: Possibly the Force can be used to track the ship.
From the script of Episode I: The Phantom Menace, Amidala's ship can be found after a hyperspace jump using the Force:

DARTH SIDIOUS : Destroy all high-ranking officials,
  Viceroy...slowly...quietly. And Queen Amidala, has she signed the treaty?
NUTE : She has disappeared, My Lord. One Naboo cruiser got past the
  blockade.
DARTH SIDIOUS : Viceroy, find her! I want that treaty signed.
NUTE : My Lord, it's impossible to locate the ship. It's out of our range.
DARTH SIDIOUS : ...not for a Sith...

However this exchange leaves it ambiguous as to whether a ship can be tracked through hyperspace by the Force. For example, it may have been that Maul tracked the accompanying Jedi using the Force.

A: Yes, they can, if they have an exit vector.
In ESB, after the Falcon disappears, Vader commands Admiral Piett to:

Calculate every possible destination along their last know trajectory

Vader clearly cares about what their last trajectory is as well and believes he can find possible destinations from that information.

If ships can be tracked through hyperspace, why do the Imperials need to place a tracking device on the Falcon?

Imagine that Leia had been smart enough to tell Han "hey by the way they probably will try to track us, maybe we should make some decoy jumps/stops first?"
Suddenly, any visual track through hyperspace becomes worthless.

Can ships be tracked and chased through hyperspace without the use of a planted tracker or Force shenanigans?

Yes. This happens elsewhere in the Star Wars universe. For example, after the Vader example above, Fett tracks Han to Cloud City this way by lingering after all Imperial ships leave, we see him observing Han's exit vector and the Imperials/Fett immediately head to Cloud City and in fact arrive before Han.
It's pretty clear that Fett got enough information from the Falcon's lightspeed jump to identify his target location well enough to tell Darth Vader, "Han Solo will be on Bespin." Given Fett's reputation, it seems unlikely he would tell Vader this on a whim or speculation.
Keep in mind that if you know the precise exit vector of a ship there are fairly few planets that would be feasible destinations, assuming you make a direct trip.

Why aren't Rebels chased through hyperspace more often?

Generally, it's good tactics to make hit/run from a temporary staging point. This entirely negates any advantage of following a hyperspace jump (especially if the Rebels use a deep space rendezvous point, like at the end of ESB).
Interestingly, Leia seems involved in nearly all "track from exit vector" situations in Star Wars... so... maybe because they didn't involve Leia most of the time? ;-)

A: They can't be tracked, but can be traced and chased, as they look for a last know trajectory.
In empire, there was a conversation between the top officer(admiral i think) and either Vader or his sub-lieutenant. They wanted to find the Falcon's last known trajectory, and plot a course along that. If they had guessed right, they would have seen a ship on a closer range scanner. Otherwise, they would always know where the Falcon, not to mention the rebel fleet was! The Tantive IV did give them a direction, and raced away. All it really had was a head start.

A: "Chased" yes, "tracked" no
We see this very clearly in the canon novel Tarkin, where Tarkin and Darth Vader are forced to pursue Tarkin's (stolen) ship on a package tour of Imperial installations. Initially, Vader is able to track the ship through the Force (his meditation sphere being loaded in the cargo bay) but, once that is jettisoned, Tarkin remarks:

"They have jumped to lightspeed," Vader said.
Tarkin ran a hand over his high forehead. "Then they've managed to make themselves untraceable, as well as invisible."
Tarkin Chapter 13: "Soft Targets"

After this, Tarkin is forced to resort to guessing the movements of his quarry. Fortunately, because there are only a finite number of hyperspace routes out of a given system, it's relatively easy to guess a ship's next destination; this becomes exponentially more difficult as a ship makes multiple jumps, however.

A: The new (and fully canon) Star Wars: From a Certain Point of View book deals with this particular issue. In short, a hyperspace jump should be untraceable but the Tantive IV's engines were so horribly damaged that tracing them via their "hyperspace wake" should be child's play for the Empire.

"The real problem is what we're leaving behind us," the officer continued. "We can't exactly run quiet with a hyperdrive that's barely holding together. If the Empire detected any trace of an abnormal hyperspace wake when we jumped to lightspeed, it won't take them long to use it to track us."
Raymus sighed; he had dreaded this possibility and had warned Leia of it prior to their setting their escape course from Scarif. Typically a jump to hyperspace meant a clean getaway, a ship's
lightspeed trajectory impossible to track. But the Tantive IV's
impaired hyperdrive was like a leaky oil pan, leaving behind it a
residual energy signature that was unique—and traceable. He wondered
now how long it would take the Empire, with all their resources no
doubt already diverted to finding them, to pick up their trail and
follow it.
Star Wars: From a Certain Point of View - "Raymus" by Gary Whitta

You may also wish to note that in Star Wars: The Last Jedi, the ability of the evil Snoke and his fleet to track the Resistance's ships through hyperspace is a key part of the plotline. This was accomplished using a combination of brute-force number-crunching and masses of data.

The First Order tracks targets through hyperspace using a combination
of technological advances and brute-force data crunching. The
shipboard tracking control complex boasts the data-sifting power of a
planetary intel hub, linking huge computer arrays to databanks loaded
with centuries of combat reports and astrogation data.
A static hyperspace field generated around the machines then
accelerates their processing power to unheard-of levels. A target's
last known trajectory yields trillions of potential destinations, but
the system can assess them with terrifying speed.
Star Wars: The Last Jedi: Incredible Cross-Sections

A: (new answer based on Episode VIII: The Last Jedi)
Before the events of The Last Jedi, a computer could generate a list of possible destinations using a ship's "starting trajectory" - but there was no way to definitively know where the ship was going to exit Hyperspace. It would require massive resources (such as those held by The Empire) to explore all the possible destinations. Even then, if a ship exited Hyperspace in a random part of space (as opposed to a system), there would be no hope of finding them.
However, in The Last Jedi,

The First Order invents a new technology that allows them to actually track the Resistance Fleet through Hyperspace. They are able to arrive at the Resistance Fleet's exact location seconds after they have exited Hyperspace.

We also learn that

This new technology has some limitations: it can only be used by 1 ship at a time, and can be disabled without detection for the length of a "system cycle" (about 6 minutes).


text:
Q: How can I use a "Splash" UIViewController to conditionally redirect to another view controller? I have a "Splash screen" ViewController extending UIViewController, set as the the initial app VC in my storyboard. This controller features a login form.
When the app starts, and before anything is displayed on the screen, I want this splash VC to check the user defaults to see if the user is already logged in. If so, I want the splash VC to redirect to the app's home VC, all before anything is displayed on the screen.
If the user is not logged in, I want the Splash VC to finish loading, displaying the login forms.
How would I go about implementing this? Would I place all of these checks in the init methods? I was having a hard time getting any code in the splash VC init methods to run at all, for some reason these methods don't get called.
Code in the viewDidLoad method runs fine, but running the code there would defeat the purpose of trying to allow the already-logged-in-user to start the app right into the home screen.
Suggestions? Thanks in advance.

A: My pick of the place to put this logic is in application didFinishLaunchingWithOptions: of application delegate. Here is how it would look :
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{

        //////////////////////////////////////////////
        // 1. do loading data etc.
        // 2. check whether user is signed in or not
        //////////////////////////////////////////////

        if(already signed in)
        {
            dispatch_sync(dispatch_get_main_queue(), ^{
                [self.window.rootViewController performSegueWithIdentifier:@"segue identifier to home VC" sender:self.window.rootViewController];
            });
        }
        else
        {
            dispatch_sync(dispatch_get_main_queue(), ^{
                [self.window.rootViewController performSegueWithIdentifier:@"segue identifier to login VC" sender:self.window.rootViewController];
            });
        }
    });
    return YES;
}

And this is my quick storyboarding to assist the code. Hopefully you get the idea.


text:
Q: Django ForeignKey with null=True, inner join, and left outer join Let's say I have two Django models Person and Company as follows: -
class Company(models.Model):
    name = models.CharField()

class Person(models.Model):
    last_name = models.CharField(blank=True)
    first_name = models.CharField()
    company = models.ForeignKey(Company, null=True, blank=True)

A Person may or may not belong to a Company.
I am using MySQL. I want all Persons that do not belong to any Company, that is, Persons where company is null.
If I do Person.objects.filter(company__isnull=True) I get an SQL which is essentially: -
SELECT * FROM PersonTable LEFT OUTER JOIN AgencyTable ON (PersonTable.company_id = AgencyTable.id) WHERE AgencyTable.id IS NULL
How do I go about achieving the following SQL: -
SELECT * FROM PersonTable INNER JOIN AgencyTable ON (PersonTable.company_id = AgencyTable.id) WHERE AgencyTable.id IS NULL
From what I gather from reading up the Django Users mailing list, this used to be the behavior before QuerySet Refactor.
EDIT -- Now I see the blasphemy of my question!
What I want to say is I simply want to do
SELECT * FROM PersonTable WHERE PersonTable.company_id IS NULL

A: Well, this question is old, and soon the patch will be in Django. But for the brief meantime, the answer is in http://code.djangoproject.com/ticket/10790:

Workaround: Instead of
Person.objects.filter(company=None)
use
Person.objects.exclude(company__isnull=False)

A: It should be as simple as:
Person.objects.filter(company_id__isnull=True)

Note the use of company_id which is the default integer field created by the ForeignKey
Edit
Sorry, I haven't actively used django since 0.9.5. Either I'm thinking of pre-1.0 behavior, or I'm muddling up sqlalchemy and Django ORM. In either case, as the comments stated, the above appears to not work.
It looks like the only way to get the query you want in current django is to use the .extra query parameter, which comes with a whole list of caveats.
Person.objects.extra(where=['company_id IS NULL'])

Note that this may not be portable to all DB's, and it may not work combined with filter(), and any number of possible issues. I would recommend not using this throughout your code, and instead moving it to a classmethod on Person like:
 @classmethod
 def list_unaffiliated_people(cls):
    return cls.objects.extra(where=['company_id IS NULL'])

Alternately, just use the proper ORM query syntax and suck up the possible performance hit (have you actually benchmarked the more complicated query to see that it's any slower?)

A: Django will treat NULL as Python's None object so:
Person.objects.filter(company = None)


text:
Q: Height percentage + static height of image I created a swf file not long ago, and I have some meaningless 'broken' link to a once existing affiliate. I wanted to take this link off of my game, but it appears as though I lost my .fla file. =/
So what I want to do is JUST display my main game content at 100%, so the broken link is not being displayed. The ad for the affiliate is a static 100px.
So basically what I would want to do is set the height to 100% + 100px, so the link is out of view unless you scroll down. Is this possible?

A: not sure if i get it right.

*

*you can embed your swf and set the
size which you need to a new swf
file.

*you can play with html and css to
hide content which you don't want to
show.
Update:
i will try to explaine my idea about first method more clear.

*

*create a new flash movie in a flash.

*set stage width and height to the
   width = old_SWF_file.width;
   height = old_SWF_file.width - bunner.height; //-100px

*import old swf file to the stage to the point(0,0), so  the banner should be out from the stage, and shouldn be visible for user.

`


text:
Q: How to run SQL Script using specific parameters PHP I need to run a SQL file (to create a user) from within my PHP. I know how this is done:
$commands = file_get_contents("sql/create_usr.sql")
$commands = explode(";", $commands);
foreach($commands as $command){
    if($command){
        $success += (@mysql_query($command)==false ? 0 : 1);
        $total += 1;
    }
}

How do I run the SQL file with specific parameters (e.g. username, password) from a PHP file.
Thanks in advance.

A: You might want to use a simple shell execution for this, instead of splitting the file with PHP:
shell_exec( 'mysql DATABASE -u USERNAME -pPASSWORD < sql/create_usr.sql' );

To test, if you can run a SQL-Query using shell_exec you might want to try this code:
echo shell_exec( 'mysql DATABASE -u USERAME -pPASSWORD -e "SELECT DATABASE();" 2>&1' );

A: Read your file line by line and the execute the sentense
$handle = fopen("inputfile.txt", "r");
if ($handle) {
    while (($line = fgets($handle)) !== false) {
        // process the line read.
    }
} else {
    // error opening the file.
}
fclose($handle);


text:
Q: Xamarin forms Resources designer.cs not creating using visual studio mac I'm facing a strange issue I have created a brand new xamarin forms project and i'm trying to adding Resource file in the shared project but when i add the Resource file then .resx extenshion file is created Like AppResources.resx creates but the code behind like AppResource.designer.cs not creating
Things that i have tried.

*

*I have try multiple time and clean rebuild the project.

*Create new project and try to again add resource file.

*use custom tool to build the resource.

A: To manually fix the csproj, so it generates AppResources.designer.cs from AppResources.resx, follow these steps:

*

*Close Solution (or quit Visual Studio).

*Open YourProject.csproj in any text editor.

*Find all lines that refer to AppResources.designer.cs or AppResources.resx.

*Add or change as needed, to be similar to this (from https://github.com/xamarin/xamarin-forms-samples/blob/main/UsingResxLocalization/UsingResxLocalization/UsingResxLocalization/UsingResxLocalization.csproj):

  <ItemGroup>
    <Compile Update="Resx\AppResources.Designer.cs">
      <DesignTime>True</DesignTime>
      <AutoGen>True</AutoGen>
      <DependentUpon>AppResources.resx</DependentUpon>
    </Compile>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Update="Resx\AppResources.resx">
      <Generator>PublicResXFileCodeGenerator</Generator>
      <LastGenOutput>AppResources.Designer.cs</LastGenOutput>
    </EmbeddedResource>
  </ItemGroup>

*

*Save the csproj file.

*Open your solution.


text:
Q: Find a string in a table then copy the next cell to that value into another row I have been experimenting with some code but cant seem to get it to work. Thanks!
Sub c()

    Dim srchrng As Variant
    Dim cells As Variant
    Dim i As Integer

        For Each cells In srchrng
            If cells.Value = "Moisture Content" Then
                cells.Offset(0, 1).Select
                Selection.Copy
                Active.cell ("Q20")
                i = i + 1
            End If
        Next cells

    End Sub

A: Try this:
Dim cells As Variant
For Each cells In [G2:G8]
        If cells = "Moisture Content" Then
            [Q20] = cells.Offset(0, 1)
            Exit For
        End If
Next cells

There's no need for i, the For Each loop manages the iteration for you.


text:
Q: entity framework with plugin datatypes I want to build a system where user plugins can implement an interface for different data elements which are to be stored in a database.  Now since I don't know the details of implementation until runtime, I can't create my database to encompass all derived types... but is it possible to perhaps:
a) Manage entities only at the interface level, so regardless of the concrete types implemented by the user, I could manage the relationships between entities at the interface level
b) have the plugins themselves manage the EF persistence of the concrete classes, so in the end we have one entity context to manage the relationships between entities at the interface level, and additional contexts to store concrete implementations in another database
Its a long shot, but I'm hoping someone would know if something like this might work.

A: Correct me if I'm wrong but It sounds like you want to implement an EAV (Entity Attribute Value) structure using the Entity Framework


text:
Q: How to stop terminal from starting on same line as output I'm currently starting to learn php off of Laracasts, and I have a very basic issue. My code is the following:
    <?php
    echo 'Hello World';

In the video, this exact code outputs "Hello World", and then starts the terminal prompt on a new line.
He doesn't use /n or any other new line code
I wrote this same code on Sublime Text. When I run this in terminal, the echo'd "Hello World" displays, but it is on the same line as the next terminal prompt.
However, if I run the exact same code in a different text editor(I tried Visual Studio Code next) the "Hello World" displays, but the terminal prompt starts on a new line.
Wondering why this is happening in Sublime Text.

A: You want to specify a new line character/carriage return.
In PHP you need to use double quotes like this: echo "Hello World\n";
more info on carriage returns here:
\r\n, \r and \n what is the difference between them?
Windows and Linux both have their own interpretations, more information can be found in this informative post.


text:
Q: Conformal Killing vectors fields on Minkowski spacetime As is well known Minkowski spacetime (which is four dimensional vector space with scalar product $\eta _{\mu \nu}$ of signature $-+++$) is maximally symmetric, which manifests itself in presence of ten Killing vector fields. Those are generators of one parameter groups of isometries, which can be understood as translations, boosts (hyperbolic rotations) and Euclidean rotations. There are also five conformal Killing vectors fields, which are generators of one parameter groups of conformal transformations. One of those transformations is simply scaling whole space. However there are four others, with generators:
$K _ {\mu} = 2 \eta _{\mu \alpha} x^{\alpha} x^{\nu} \partial _{\nu} - x^{\alpha} x_{\alpha} \partial _{\mu}$
With standard identification of tangent vectors and partial derivatives understood in this formula. My question is what are those transformations? Can I visualize them or explicitly find those groups? What is their interpretation or significance? Any insight will be appreciated.

A: Let us first look at the 1-dimensional complex case. In the Riemann sphere, you can define a conjugate-addition, $| : \hat{\mathbb{C}} \times \hat{\mathbb{C}} \rightarrow \hat{\mathbb{C}}$, by
$$ \frac1x + \frac1y = \frac1{x | y} $$
In explicit form,
$$ x | y = \frac{xy}{x+y} $$
and $\infty | \infty = \infty$. It's easy to prove that conjugate-addition behaves exactly like addition: it is commutative, associative, distributive with respect to multiplication, and has an identity $\frac10 = \infty$ (and zero is now the absorbing element). This operation may already be familiar to you, it is for example implicitly used in defining the harmonic mean and when summing resistors in parallel.
Geometrically, what we really are doing is interchanging the behavior of the Northern and Southern hemispheres of the Riemann sphere with respect to addition, by means of the Möbius transformation $ x \rightarrow 1/x $. So you can imagine it as "addition from the point of view of $\infty$ ", if you take ordinary addition as being from the point of view of $0$.
In higher dimensions you can use spherical inversion to do the same thing, defining:
$$ \frac{x^{\mu}}{x^2} + \frac{y^{\mu}}{y^2} = \frac{x^{\mu} | y^{\mu}}{(x|y)^2} $$
It is a bit more tricky, but you can also get the explicit form from the definition. First, take the scalar product of the defining equation with itself:
$$ \left (\frac{x^{\mu}}{x^2} + \frac{y^{\mu}}{y^2} \right)^2 = \frac1{x^2} + \frac1{y^2} + 2 \frac{x^{\mu} y_{\mu}}{x^2 y^2} = \frac1{(x|y)^2} $$
Inverting we have
$$ (x|y)^2 = \frac{x^2 y^2}{x^2 + y^2 + 2 x^{\mu} y_{\mu}} $$
And substituting this back into the defining equation, we have finally:
$$x^{\mu} | y^{\mu} = (x|y)^2 \left( \frac{x^{\mu}}{x^2} + \frac{y^{\mu}}{y^2} \right) = \frac{x^2 y^{\mu} +  y^2 x^{\mu}}{x^2 + y^2 + 2 x^{\mu} y_{\mu}} $$
Then, the special conformal generators $b^{\mu} K_{\mu}$ are just the generators of conjugate-translations:
$$x^{\mu} \rightarrow x^{\mu} | \left( - \frac{b^{\mu}}{b^2} \right) = \frac{x^{\mu} -  x^2 b^{\mu}}{1 + b^2 x^2 - 2 b^{\mu} x_{\mu}} $$
The interpretation is the same, we are interchanging the behavior of the two "hemispheres" in the compactified Minkowski spacetime, and performing addition "with respect to the point at infinity".
With that image in mind, we can get the explicit form of $K_{\mu}$ by expanding
$$\frac{\partial}{\partial(x^{\mu}/x^2)} $$
using the chain rule.

A: This is all taken from Conformal field theory by Francesco, Mathieu, and Senechal. A conformal symmetry, $\phi^*g_{\mu\nu}=\Lambda^2g_{\mu\nu}$, implies $\mathit L _{\epsilon}g_{\mu\nu}=f(x)g_{\mu\nu} $, so, for a Minkowski metric
$$\partial_\mu \epsilon_\nu+\partial_\nu \epsilon_\mu=f(x)\eta_{\mu\nu}.$$
We can apply another partial derivative, permute indices and obtain
$$2\partial_{\mu}\partial_\nu\epsilon_\rho=\eta_{\mu\rho}\partial_\nu f+\eta_{\nu\rho}\partial_\mu f-\eta_{\mu\nu}\partial_\rho f$$
which we can contract with the inverse metric:
$$2\partial^2\epsilon_\mu=(2-d)\partial_\mu f$$
so that, appying another partial derivative and using the first equation,
$$(2-d)\partial_\mu\partial_\nu f = \eta_{\mu\nu}\partial^2f.$$
Contracting: $(d-1)\partial^2f=0$. Therefore, $f(x)=A+B_\mu x^\mu$, and by the second equation, $\epsilon$ is quadratic, $\epsilon_\mu = a_\mu + b_{\mu\nu} x^\nu + c_{\mu\nu\rho} x^\nu x^\rho$. The constant amounts to an infinitesimal translation, whereas substituting the linear term into the first equation gives a scale transformation and an infinitesimal rotation. Substituting the quadratic part into the second equation gives
$$c_{\mu\nu\rho}=\eta_{\mu\rho}\beta_\nu+\eta_{\mu\nu}\beta_\rho-\eta_{\nu\rho}\beta_\mu, \:\beta_\mu:=\frac{1}{d}{c^{\lambda}}_{\lambda\mu}$$
which means that this corresponds to
$$x^\mu\mapsto x^\mu + 2 (x\cdot\beta) x^\mu - \beta^{\mu} x^2$$
This is the infinitesimal transformation corresponding to a special conformal transformation,
$$x'^\mu = \frac{x^\mu-\beta^\mu x^2}{1 - 2 x\cdot\beta - \beta^2 x^2}.$$
You can easily verify that this can be written as:
$$\frac{x'^\mu}{x'^2}=\frac{x^\mu}{x^2}-\beta^\mu$$
so these transformations are an inversion ($x^\mu\mapsto x^\mu/x^2$), followed by a translation, and another inversion.


text:
Q: PHP Write data in seperate columns When I want to put data in a CSV/Excel file it will automatically put all data in one column. This isn't very clear to read and I would like to have a single column for each data. Here is my code:
<?php
$data = array(
  'aaa,bbb,ccc,dddd',
  '123,456,789',
  '"aaa","bbb"'
);
$fp = fopen('test.csv', 'w');
foreach ( $data as $line ) {
  $val = explode(",", $line);
  fputcsv($fp, $val);
}
fclose($fp);
?>

and this is what it is showing inside the CSV/excel file:
How it is now:

And here is how it should be:

A: Try it like this:
<?php
$data = array(
  'aaa,bbb,ccc,dddd',
  '123,456,789',
  '"aaa","bbb"'
);
$fp = fopen('test.csv', 'w');
foreach ( $data as $line ) {
  $val = explode(",", $line);
  fputcsv($fp, $val, ";");
}
fclose($fp);
?>

A: Seems that fputcsv use semicolon as default delimiter. You can pass the delimiter you want as third parameter to fputcsv.
$data = array(
    'aaa,bbb,ccc,dddd',
    '123,456,789',
    '"aaa","bbb"'
);
$fp = fopen('test.csv', 'w');
foreach ( $data as $line ) {
    $val = explode(",", $line);
    fputcsv($fp, $val, ',');
}
fclose($fp);


text:
Q: Why hadoop just stuck there after I set the map compression properties? Here's the code snippet that works fine:
Configuration conf = new Configuration();

//PROBLEM PART!!!!!
//conf.setBoolean("mapred.compress.map.output", true);
//conf.set("mapred.output.compression.type", "BLOCK");
//conf.setClass("mapred.map.output.compression.codec", GzipCodec.class, CompressionCodec.class);

Job job = new Job(conf, "WordCount");
job.setJarByClass(WordCount.class);
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(IntWritable.class);

job.setMapperClass(WordCountMap.class);
job.setReducerClass(Reduce.class);

job.setInputFormatClass(TextInputFormat.class);
job.setOutputFormatClass(TextOutputFormat.class);

FileInputFormat.addInputPath(job, new Path(args[0]));
FileOutputFormat.setOutputPath(job, new Path(args[1]));

job.waitForCompletion(true);

But if I enable the PROBLEM PART in the code snippet above, the output of console will stuck at:
13/12/26 18:08:06 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
13/12/26 18:08:06 WARN mapred.JobClient: Use GenericOptionsParser for parsing the arguments. Applications should implement Tool for the same.
13/12/26 18:08:06 WARN mapred.JobClient: No job jar file set.  User classes may not be found. See JobConf(Class) or JobConf#setJar(String).
13/12/26 18:08:06 INFO input.FileInputFormat: Total input paths to process : 20
13/12/26 18:08:06 WARN snappy.LoadSnappy: Snappy native library not loaded
13/12/26 18:08:06 INFO mapred.JobClient: Running job: job_local1943436108_0001
13/12/26 18:08:06 INFO mapred.LocalJobRunner: Waiting for map tasks
13/12/26 18:08:06 INFO mapred.LocalJobRunner: Starting task: attempt_local1943436108_0001_m_000000_0
13/12/26 18:08:07 INFO util.ProcessTree: setsid exited with exit code 0
13/12/26 18:08:07 INFO mapred.Task:  Using ResourceCalculatorPlugin : org.apache.hadoop.util.LinuxResourceCalculatorPlugin@731d2572
13/12/26 18:08:07 INFO mapred.MapTask: Processing split: hdfs://localhost:9000/user/jude/input/capacity-scheduler.xml:0+7457
13/12/26 18:08:07 INFO mapred.MapTask: io.sort.mb = 100
13/12/26 18:08:07 INFO mapred.MapTask: data buffer = 79691776/99614720
13/12/26 18:08:07 INFO mapred.MapTask: record buffer = 262144/327680
13/12/26 18:08:07 INFO mapred.MapTask: Starting flush of map output
13/12/26 18:08:07 INFO compress.CodecPool: Got brand-new compressor
13/12/26 18:08:07 INFO mapred.MapTask: Starting flush of map output
13/12/26 18:08:07 INFO mapred.JobClient:  map 0% reduce 0%
13/12/26 18:08:12 INFO mapred.LocalJobRunner:
13/12/26 18:08:13 INFO mapred.JobClient:  map 5% reduce 0%
//no more

I just intend to compress the output of map, is there anything wrong with my code? Thanks a lot!

A: Using compression requires Hadoop to use native libraries for your platform, but apparently you don't have them (or have not configured the path to the libraries correctly). This is the message that is explaining the problem:
[...] NativeCodeLoader: Unable to load native-hadoop library for your platform...

Possible solutions:

*

*Most common problem is to have the 32-bit libraries on a 64-bit architecture. You can download the pre-compiled 64 native libraries OR compile them yourself using mvn package -Pdist,**native**,docs.

*Or, you may need to configure the path to the native libraries correctly; see these other questions on how to do this: use -Djava.libray.path, or LD_LIBRARY_PATH.


text:
Q: Google Earth Engine: Difference in Area of Feature Collection when calculating using a reducer vs. when calculating using clipping I am wondering why the two approaches to calculate the area of a feature collection return different results and which one is "correct"?

*

*I clip the feature collection on a white image and sum up over the multiplied area

    var whiteImage = ee.Image().unmask().eq(0).rename('test')
    var trueAreaImage = whiteImageClipped.multiply(ee.Image.pixelArea());
    var trueArea = trueAreaImage.reduceRegion({
      reducer: ee.Reducer.sum(),
      geometry: validationRegion,
      scale: 10
    });

*The other time I am using a reducer to generate the raster data and sum up over the multiplied area

    var reducedImage = groundTruth.reduceToImage(['test'],'anyNonZero').rename('test')
    var trueAreaImage = reducedImage.multiply(ee.Image.pixelArea());
    var trueArea = trueAreaImage.reduceRegion({
      reducer: ee.Reducer.sum(),
      geometry: validationRegion,
      scale: 10
    });

The result of the two approaches is significantly different.
https://code.earthengine.google.com/8baa2a6c27490ca44d7904f7ab6208be

A: The conversion of vector to raster is the likely source of the difference. I'm concluding this based on three other ways of calculating image region area by reduction which produce equal results and none of them use vector to raster conversion.
Code Editor link
// ROI
var roi = ee.Geometry.Polygon(
  [[[-122.18794270981743, 37.238143748045786],
    [-122.18794270981743, 37.02574255804269],
    [-121.82814046372368, 37.02574255804269],
    [-121.82814046372368, 37.238143748045786]]], null, false);

// Get a pixel area image.
var areaImg = ee.Image.pixelArea();

// Calculate area of ROI by image reduction (NO CLIP).
var roiAreaNoClip = areaImg.reduceRegion({
  reducer: ee.Reducer.sum(),
  geometry: roi,
  scale: 10
});

// Calculate area of ROI by image reduction (CLIP to ROI).
var roiAreaClip = areaImg.clip(roi).reduceRegion({
  reducer: ee.Reducer.sum(),
  geometry: roi,
  scale: 10
});

// Multiply area image by constant 1 image (CLIP to ROI).
var roiAreaMultiplyClip = ee.Image.constant(1).clip(roi).multiply(areaImg)
  .reduceRegion({
    reducer: ee.Reducer.sum(),
    geometry: roi,
    scale: 10
  });

print('Compute area by reduction:', roiAreaNoClip.get('area'));
print('Clip image then compute area by reduction:', roiAreaClip.get('area'));
print('Multiply area image by constant 1 image (CLIP to ROI):', roiAreaMultiplyClip.get('constant'));

Compute area by reduction:
  753633057.7863889
  Clip image then compute area by reduction:
  753633057.7863889
  Multiply area image by constant 1 image (CLIP to ROI):
  753633057.7863889

It seems like this is an unnecessary step in your example:
var trueAreaImage = reducedImage.multiply(ee.Image.pixelArea());

It could just be:
var area = ee.Image.pixelArea().reduceRegion({
  reducer: ee.Reducer.sum(),
  geometry: <THE COLLECTION USED TO CREATE THE reducedImage VAR>,
  scale: 10
});


text:
Q: What is the side effect of having Cassandra tables with partition sizes of more than 100MB? I am running Apache Cassandra 3.11.1 and have 6 tables sizes in the failing state.
Max partition is larger than 100MB.
For these 6 tables the partition sizes are on average between 200MB and upwards of 5GB.
These 6 tables are split across 3 key spaces and are specific to Akka Persistence eventsByTag (i.e. eventsByTag1, eventsByTag2).
Much of the data in these tables is not used it still needs to be available.
I'm looking at changing the data model however at the same time I'm trying to better understand what the impact is of having large partition sizes.
Other than running out of memory or hitting Cassandra limitations what are some of the other negative impacts of having large partition sizes if most of the data is not accessed?
A specific case that might be related (not confirmed) is that I'm currently running Cassandra with materialized views and elasticsearch. At times the projections used to update elasticsearch with data from Cassandra fail and I'm not yet sure if this is related.
The error message I receive in this case is:
Caused by: com.datastax.driver.core.exceptions.ReadTimeoutException:
Cassandra timeout during read query at consistency LOCAL_QUORUM (2
responses were required but only 1 replica responded)

A: With this version of Cassandra it should be better than before, although still there could be performance problems accounted to accessing to many SSTables, making selections only on partition key, etc.
This presentation gives good overview of work done to support "wide partitions", although it's still recommended way to re-model data.


text:
Q: GIt - Can't clone on wifi network alone I have a wifi router at my home.When i connected my laptop to Wifi and try to clone i'm getting this error:
git clone https://github.com/CyanogenMod/android_packages_apps_Dialer.git
Cloning into 'android_packages_apps_Dialer'...
fatal: unable to access 'https://github.com/CyanogenMod/android_packages_apps_Dialer.git/': Failed to connect to github.com port 443: Network is unreachable

But Internet is working fine through Browser and Terminal (apt-get).
Same Wifi connected on my mobile and connected to laptop using USB tethering. Now git clone is working fine.I dont know why same wifi not working when connected directly on laptop.


text:
Q: WKWebView & Swift 3 - set cookie using evaluateJavaScript I have been trying to set a cookie for WKWebView using Swift 3 in order to pass a device token to a server.
The code I've been trying to get working in order to set the cookie is as follows:
wkWebView.evaluateJavaScript("document.cookie='access_token=your token';domain='your domain';") { (data, error) -> Void in
    print("data: \(data)")
    print("error2: \(error)")
    wkWebView.reload()
}

However, I'm stuck here because this code produces the following error output:

error2: Optional(Error Domain=WKErrorDomain Code=4 "A JavaScript exception occurred" UserInfo={WKJavaScriptExceptionLineNumber=0, WKJavaScriptExceptionMessage=SecurityError (DOM Exception 18): The operation is insecure., WKJavaScriptExceptionSourceURL=undefined, NSLocalizedDescription=A JavaScript exception occurred, WKJavaScriptExceptionColumnNumber=0})

A: I ended up setting the cookie by injecting a script into WKWebView at runtime, which sets the Firebase device token, which is the string I want to pass to my server, as a local storage item.
The code I've ended up with is as follows;
To set the local storage in WKWebView:
let addCookieScript="localStorage.setItem('device', '\(self.tokenFirebase)');\nconsole.log(localStorage.getItem('token'));\nconsole.log(localStorage.getItem('userId'));\n"
let script: WKUserScript = WKUserScript(source: addCookieScript as String, injectionTime: .atDocumentEnd, forMainFrameOnly: false)

Adding the script to the WKWebView:
userContentController.addUserScript(script)

After this it is just a matter of loading the WKWebView as normal, and to monitor the local storage of the session through the Safari Developer Tool


text:
Q: Show Iframe after Image has Faded Out I am using this code where a user clicks on the image and then the youtube video is loaded and autoplayed. Everything works apart from the fact that the video instantly appears at the bottom of the image, once the image is clicked by the user.
I need to figure out some code so that the image fade outs completely and then the video is shown. What I tried in my code with delay doesn't work. Any ideas?

A: Here you go with a solution https://jsfiddle.net/rdmwtcbx/1/

$('#vidocr').click(function(){
  $('#vidocr').fadeOut(500, function(){
    $('#thevideo')
      .fadeIn('slow')
      .find('iframe#iframe')
      .attr('src', $('iframe#iframe').attr('src').replace('autoplay=0', 'autoplay=1'));
  });
});

jQuery fadeOut is having callback function, once fadeOut completes fadeIn will start for the video & auto play will happen.
Hope this will help you.


text:
Q: modifying res object in express.js I had this idea for a backend design for my SPA-website. I would implement it so that routes starting with "/api/" would return only the relevant data in JSON. all other routes would lead to a full-page load.
Now my idea is to do this in middleware, as such:
app.use(function(req, res, next() ){
  if(req.path.split("/")[0]=="api"){
     res.send = res.json;
     //or other custom response-function, I see many possibilities here!
  }else{
  ...
  }
});
app.use(routes);

now, my question is, does this modify the res object globally, or just for the current request (this instance of res)? My understanding is just the current one gets modified, and as far as I can tell thats true, but node is blazingly fast, so it's kinda hard to test on my own ( one can only refresh so many tabs in a millisecond! ) anyone know for sure?
Edit: A lot of the people answering my question have asked why I would want to do this. The point is to abstract what the server does for requests coming from clients with the front-end loaded, and clients who need the full page. I'm also considering the possibility of adding a route for loading partial templates, using this same method. by modifying res.send my controllers can worry about getting the data and send it of, res.send will already know if there needs to be some rendering involved. On second thought though res.send is really useful on its own, I might modify res to have res.answer or similar instead.(makes for less confusion too!)

A: I decided to make this an answer because sometimes future readers don't read the comments.
1) You can modify res and its members to your heart's content. You are operating on an instance of response, not its prototype. There is no "global" resource, but it does have a prototype.
2) Reading the documentation will pay off here. res.send operates identically to res.json if it is passed an object or array. Which is to say that the rest of your code will, in the typical case, run no differently than if you didn't monkey with res.send() but will confuse the heck out of someone (maybe you) several months or years later.

A: I tested this and each time a request came the response object had the original send function instead of the changed value. So no, it doesn't change it globally.
Here is the test I did:
app.use(function(req, res){
    console.log(res.send);
    res.send = 'a';
    console.log(res.send);
});

Though I'm still not quite sure why you want to do this? It seems like it would be very confusing when someone looks at your API routes and sees res.send() but the effect instead is that of res.json. Why can't you use res.json in your API route functions?


text:
Q: Debugging python in Aptana 3 I have a pydev project going in aptana studio 3.
In the image below, you can see my project structure and the fact that my nosetests are all passing.

If I click on a file scheduled.py that has a breakpoint in it, and hit debug as > python run it fails to be able to import my modules.
pydev debugger: starting
Traceback (most recent call last):
  File "C:\Users\mapserv\AppData\Local\Aptana Studio 3\plugins\org.python.pydev_2.7.0.2012110722\pysrc\pydevd.py", line 1397, in <module>
    debugger.run(setup['file'], None, None)
  File "C:\Users\mapserv\AppData\Local\Aptana Studio 3\plugins\org.python.pydev_2.7.0.2012110722\pysrc\pydevd.py", line 1090, in run
    pydev_imports.execfile(file, globals, locals) #execute the script
  File "C:\Users\mapserv\Desktop\Projects\Aptana\AutomatedCaching\agrc\caching\scheduled.py", line 1, in <module>
    from agrc.caching.commands import cache
ImportError: No module named agrc.caching.commands

I've noticed that aptana has the notion of packages/modules. Is there something wrong with my project structure that is causing this? Should my folders be packages? Do I need to setup more things with my interpreter which looks like?

Edited
If I try to run scheduled.py from the command line it has the same problem. How is nose running my tests and making everything happy yet it doesn't work outside of that?

A: Well the answer was to update your PYTHONPATH. On windows, put the path to the AutomatedCaching folder inside the automated_caching.pth file.
eg: C:\Projects\AutomatedCaching
Then move the file into your site packages folder. For arcgis users it will be something like
C:\Python27\ArcGISx6410.1\Lib\site-packages
or
C:\Python27\ArcGIS10.1\Lib\site-packages
depending if you installed server and desktop. I'm thinking the last install wins the PATH war? I installed server then desktop and it uses the second in the path without the x64.
running
import sys
for i in sys.path:
     print i

should verify that your location has been added.
Now the fact that arcgis for server and desktop install two different pythons into c:\python27 is a whole different story.
Now aptana shows my package explorer like it is a package

A: Did you try putting it in your "PyDev - PYTHONPATH" project properties? Project -> Properties -> PyDev - PYTHONPATH -> Source Folders(tab) -> Add source folder.
Then you don't have to mess with your system PYTHONPATH.
It worked for me.
Tried to post an image but I guess I don't have enough reputation points.


text:
Q: bootstrap button loading state I am trying to make it so that when someone click on the button it goes from normal button to toggled button with text changed to Loading...
so I included this button
<button type="button" id="fat-btn" data-loading-text="loading..." class="btn btn-primary">
    Loading state
</button>

but nothing happens when I click on the button.
I also have this at the bottom of the body.
<script>
        $(function() {
          var btn = $('#fat-btn').click(function () {
            btn.button('loading')
            setTimeout(function () {
              btn.button('reset')
            }, 3000)
          })
        })
</script>
<script src="http://code.jquery.com/jquery.js"></script>
<script src="bootstrap/js/bootstrap.min.js"></script>

Here is the website I am trying to include the button(its at the bottom of the screen)
http://www.ticketmachine.x10.mx/

A: Once you've sorted your jQuery issue, you should update your click function as follows:
$(function(){
    var $btn = $('#fat-btn');
    $btn.click(function(){
        var $this = $(this);
        $this.attr('disabled', 'disabled').html("Loading...");
        setTimeout(function () {
            $this.removeAttr('disabled').html('Hello');
        }, 3000)
    });
})

Fiddle: http://jsfiddle.net/RJDgG/1/

A: I have visited the link you provided. I opened firebug it logs JS error given below.

Uncaught ReferenceError: $ is not defined

You wrote some JavaScript which used jQuery but it was added before including the jQuery library.
You should move the script tag after the jQuery link.


text:
Q: superagent set custom request headers es6 not Access-Control-Request-Headers I know this is addressed in this post but I am still having trouble setting a custom header using ES6 and am wondering if anyone has run into this issue?  The problem is when is set the header using .set I only set the Access-Control-Request-Header to the label I want to set it and the value is lost. I want to set a custom field on the request header using superagent and not sure how.
Let's say I am running this in my app (client)
import ajax from 'superagent'

ajax.get(baseURL + "/query/")
    .query({q: "SELECT Id FROM USER WHERE Id=" + id})
    .set('X-Authorization', 'Oauth ' + token)
    .set('Content-Type', 'application/json')
    .end((error, response) => {
        if(errro) { console.log(error); }
    }

the header the get request makes contains:
Access-Control-Request-Headers:content-type, x-authorization

under Request Headers in the network tab of the browser debugger.  I want to set the headers of the get so that under Request Headers in the network tab of the browser dubugger I see:
X-Authorization:  some_token
Content-Type: application/json

Does anyone have any ideas on how I can set the Request Headers to have any field/value I want using ES6 and superagent?
thanks to all in advanced!

A: try adding the following code to your script, before get is called.
ajax._defaultHeaders = {};

function isObject(obj) { return Object(obj) === obj; };

ajax.set = (function (field, value) {
   if (isObject(field)) {
      for(var key in field) this.set(key, field[key]);
      return this;
   }
   this._defaultHeaders[field] = value;
   return this;
}).bind(ajax)

A: used to have similar problem with Spring Boot application and React JS on frontend.
When I dump headers that were attached to RQ I used to see only headers with pattern:
Access-Control-Request-Headers:content-type, x-authorization, etc...

however that was problem connected with my backend application, NOT with superagent on frontend.
I had to turn on cors() in WebSecurityConfig to look similar to this one:
@Override
protected void configure(HttpSecurity httpSecurity) throws Exception {
    httpSecurity.csrf().disable()
            .cors().and()
            .authorizeRequests().antMatchers("/auth/login", "/auth/register").permitAll().
            anyRequest().authenticated().and().
            exceptionHandling().authenticationEntryPoint(jwtAuthenticationEntryPoint).and().sessionManagement()
            .sessionCreationPolicy(SessionCreationPolicy.STATELESS);

so as you can see problem was with Spring configuration, not with Superagent,
Regards
R.


text:
Q: checking if string only contains certain letters in Python i'm trying to write a program that completes the MU game
https://en.wikipedia.org/wiki/MU_puzzle
basically i'm stuck with ensuring that the user input contains ONLY M, U and I characters.
i've written
alphabet = ('abcdefghijklmnopqrstuvwxyz')

string = input("Enter a combination of M, U and I: ")

if "M" and "U" and "I" in string:
    print("This is correct")
else:
    print("This is invalid")

i only just realised this doesnt work because its not exclusive to just M U and I. can anyone give me a hand?

A: if all(c in "MIU" for c in string):

Checks to see if every character of the string is one of M, I, or U.
Note that this accepts an empty string, since every character of it is either an M, I, or a U, there just aren't any characters in "every character." If you require that the string actually contain text, try:
if string and all(c in "MIU" for c in string):

A: If you're a fan of regex you can do this, to remove any characters that aren't m, u, or i
import re
starting = "jksahdjkamdhuiadhuiqsad"
fixedString = re.sub(r"[^mui]", "" , starting)

print(fixedString)
#output: muiui

A: A simple program that achieve your goal with primitive structures:
valid = "IMU"
chaine = input ('enter a combination of letters among ' + valid + ' : ')

test=True
for caracter in chaine:
    if caracter not in valid:
        test = False

if test :
    print ('This is correct')
else:
    print('This is not valid')


text:
Q: Change of variables in two dimensions This is from Munkres' Analysis on Manifolds, Section 17, Question 4.

(a) Show that
  $$ \int_\Bbb {R^2} e^{-(x^2+y^2)} = \left[ \int_\Bbb R e^{-x^2}\right]^2,$$
  provided the first of these integrals exists.
(b) Show that the first of these integrals exists and evaluate it.

So using the change of variable equation with $g(x,y) = (x\cos(y), x\sin(y))$, you get
$$\int e^{-x^2}x.$$
However, this does not even equal the same thing as the original integral.

A: a) By Fubini's theorem, we have, if
$$ \int_\Bbb {R^2} e^{-(x^2+y^2)}dxdy < \infty, $$
then
$$ \int_\Bbb {R^2} e^{-(x^2+y^2)}dxdy = \int_\Bbb {R^2} e^{-(x^2+y^2)}dydx= \int_\Bbb {R} e^{-x^2}dx \int_\Bbb {R}e^{-y^2}dy = \left(\int_\Bbb {R} e^{-x^2}dx \right)^2 .$$
b) Let $x=r\cos(\theta)$ and $y=r\sin(\theta)$, then we have
$$ \int_\Bbb {R^2} e^{-(x^2+y^2)}dxdy = 4\int_{0}^{\infty}\int_{0}^{\infty}e^{-(x^2+y^2)}=4 \int_{0}^{\pi/2}\int_{0}^{\infty} e^{-r^2} r dr d\theta= \pi .$$

A: This is known as the problem of the Gaussian Integral. Some very useful information on this problem, including the careful derivation and evaluation, can be found here.

A: You are trying to find the integral:
$$I := \int_{-\infty}^{\infty} \operatorname{e}^{-x^2} \, \operatorname{d}\!x$$
The trick is to consider the following product:
$$\left( \int_{-\infty}^{\infty} \operatorname{e}^{-x^2} \, \operatorname{d}\!x \right)\left( \int_{-\infty}^{\infty} \operatorname{e}^{-y^2} \, \operatorname{d}\!y \right) = I^2$$
We can bring these two integrals together to form a double integral:
$$\int_{-\infty}^{\infty}\int_{-\infty}^{\infty} \operatorname{e}^{-x^2} \operatorname{e}^{-y^2}\operatorname{d}\!x \, \operatorname{d}\!y = \int_{-\infty}^{\infty}\int_{-\infty}^{\infty} \operatorname{e}^{-(x^2+y^2)} \operatorname{d}\!x \, \operatorname{d}\!y$$
To evaluate the double integral, we make the following change of variable: $x=r\cos\theta$ and $y=r\sin\theta$. In such a case, $x^2+y^2 = r^2$ and
$$\begin{array}{ccc}
\operatorname{d}\!x & = & \cos\theta \, \operatorname{d}\!r - r\sin\theta \, \operatorname{d}\!\theta \\
\operatorname{d}\!y & = & \sin\theta \, \operatorname{d}\!r  + r\cos\theta \, \operatorname{d}\!\theta
\end{array}$$
It follows that $\operatorname{d}\!x \, \operatorname{d}\!y = \operatorname{d}\!x \wedge \operatorname{d}\!y = r \, \operatorname{d}\!r \wedge \operatorname{d}\!\theta $ Hence:
$$I^2 = \int_{-\infty}^{\infty}\int_{-\infty}^{\infty} \operatorname{e}^{-(x^2+y^2)} \operatorname{d}\!x \, \operatorname{d}\!y = \int_0^{2\pi}\int_0^{\infty} r\operatorname{e}^{-r^2} \, \operatorname{d}\!r \, \operatorname{d}\!\theta$$
The change of limits came from the fact that, in polar coordinates, a ray from the origin to positive infinity, rotated about the origin by an angle of $2\pi$ radians will cover the plane. Finally:
\begin{array}{ccc}
\int_0^{2\pi}\int_0^{\infty} r\operatorname{e}^{-r^2} \, \operatorname{d}\!r \, \operatorname{d}\!\theta &=& \int_0^{2\pi}\left[-\frac{1}{2}\operatorname{e}^{-r^2}\right]_0^{\infty} \operatorname{d}\!\theta \\
&=& \frac{1}{2}\int_0^{2\pi} \operatorname{d}\!\theta \\
&=& \pi
\end{array}
We finally conclude that $I^2 = \pi$ and, since $\operatorname{e}^{-x^2} > 0$ for all $x$, hence $I = \sqrt{\pi}$.

A: I am reading "Analysis on Manifolds" by James R. Munkres.
I used the following propositions:

Theorem 15.2 on p.123 in "Analysis on Manifolds"
Let $A$ be open in $\mathbb{R}^n$; let $f:A\to\mathbb{R}$ be continuous. Choose a sequence $C_N$ of compact rectifiable subsets of $A$ whose union is $A$ such that $C_N\subset\operatorname{Int}C_{N+1}$ for each $N$. Then $f$ is integrable over $A$ if and only if the sequence $\int_{C_N} |f|$ is bounded. In this case, $$\int_A f=\lim_{N\to\infty} \int_{C_N} f.$$

My Proposition:
If $\lim_{n\to\infty}x_n^2$ exists, then $\lim_{n\to\infty} |x_n|$ exists.

I solved this exercise as follows:

(a)
Let $D_N:=\{(x,y)\in\mathbb{R}^2\mid -N\leq x\leq N\text{ and }-N\leq y\leq N\}.$
Then the union of a sequence $D_N$ of compact rectifiable subsets of $\mathbb{R}^2$ is $\mathbb{R}^2$ such that $D_N\subset\operatorname{Int}D_{N+1}$ for each $N$.
And $\int_{\mathbb{R}^2} e^{-(x^2+y^2)}$ exists by our assumption.
So, by Theorem 15.2, $\lim_{N\to\infty} \int_{D_N} e^{-(x^2+y^2)}$ exists and $$\int_{\mathbb{R}^2} e^{-(x^2+y^2)}=\lim_{N\to\infty} \int_{D_N} e^{-(x^2+y^2)}.$$
$\int_{D_N} e^{-(x^2+y^2)}=\int_{y=-N}^{y=N}\int_{x=-N}^{x=N} e^{-(x^2+y^2)}=\int_{y=-N}^{y=N}e^{-y^2}\int_{x=-N}^{x=N}e^{-x^2}=\left(\int_{x=-N}^{x=N}e^{-x^2}\right)^2.$
So, $$\int_{\mathbb{R}^2} e^{-(x^2+y^2)}=\lim_{N\to\infty}\left(\int_{x=-N}^{x=N}e^{-x^2}\right)^2.$$
By my proposition above, $\lim_{N\to\infty}\int_{x=-N}^{x=N}e^{-x^2}$ exists and $$\int_{\mathbb{R}^2} e^{-(x^2+y^2)}=\left(\lim_{N\to\infty}\int_{x=-N}^{x=N}e^{-x^2}\right)^2.$$
Let $B_N:=\{x\mid -N\leq x\leq N\}.$
Then the union of a sequence $B_N$ of compact rectifiable subsets of $\mathbb{R}$ is $\mathbb{R}$ such that $B_N\subset\operatorname{Int}B_{N+1}$ for each $N$.
So, by Theorem 15.2, $\int_{\mathbb{R}}e^{-x^2}$ exists and $$\int_{\mathbb{R}}e^{-x^2}=\lim_{N\to\infty}\int_{x=-N}^{x=N}e^{-x^2}.$$
So, $$\int_{\mathbb{R}^2} e^{-(x^2+y^2)}=\left[\int_{\mathbb{R}}e^{-x^2}\right]^2.$$

(b)
Let $C_N:=\{(x,y)\in\mathbb{R}^2\mid x^2+y^2\leq N^2\}.$
Then the union of a sequence $C_N$ of compact rectifiable subsets of $\mathbb{R}^2$ is $\mathbb{R}^2$ such that $C_N\subset\operatorname{Int}C_{N+1}$ for each $N$.
Let $U_N:=\{(x,y)\mid x^2+y^2<N^2\text{ and }x<0\text{ if }y=0\}.$
The set $U_N$ consists of $\operatorname{Int}C_N$ with the non-negative $x$-axis deleted. Because the non-negative $x$-axis has measure zero, $$\int_{C_N} e^{-(x^2+y^2)}=\int_{\operatorname{Int}C_N} e^{-(x^2+y^2)}=\int_{U_N} e^{-(x^2+y^2)}.$$
The polar coordinate transformation $g$ defines a diffeomorphism of the open set $(0,N)\times (0,2\pi)$ with $U_N$.
So, by Change of variables theorem, $$\lim_{N\to\infty}\int_{C_N} e^{-(x^2+y^2)}=\lim_{N\to\infty}\int_{U_N} e^{-(x^2+y^2)}=\lim_{N\to\infty}\int_{\theta=0}^{\theta=2\pi}\int_{r=0}^{r=N} r e^{-r^2}=\pi.$$
So, by Theorem 15.2, $\int_{\mathbb{R}^2} e^{-(x^2+y^2)}$ exists and $$\int_{\mathbb{R}^2} e^{-(x^2+y^2)}=\lim_{N\to\infty}\int_{C_N} e^{-(x^2+y^2)}=\pi.$$


text:
Q: How can I run Multiple Servers on Different Digital Ocean droplets with single domain name server? I am sorry for the newbie question. Let me help you to understand the complete scenario.
I already have 1 droplet at the digital ocean running OpenLiteSpeed server. Here, I am planning to add multiple servers in different droplets.

*

*Droplet 1: US Datacenter: srv01.domain.com

*Droplet 2: AMS Datacenter: srv02.domain.com

*Droplet 3: UK Datacenter: srv03.domain.com

Let's assume all droplets will run Litespeed Server & CyberPanel.
Now, I would like to know if it is possible to have my nameserver something like following to point all the droplets.

*

*ns1.domain.com

*ns2.domain.com

If this is not possible is it possible to have something like this:

*

*ns1.srv01.domain.com

*ns2.srv01.domain.com

If both approaches are possible which do you recommend & why.
Thanks a lot in advance.

A: You can register and point an unlimited number of different domain names to the same (pair of) name servers.
A single name server can host a nearly unlimited number of domains , each with their own unique records.


text:
Q: How can i do a syntax check for shell scripting via github workflows Basically i need the workflow to check the whole code and should fail if it has any syntax errors.
repo: https://github.com/CyberJalagam/android_rom_building_scripts

A: Add a step to a workflow that runs on push or PR to main to validate syntax:
      - name: Validate syntax
        run: bash -n *.sh


text:
Q: Maven archetype for liferay hook Liferay has not provided maven archetype for hook. But they have provided eclipse plug-in to create a hook. Does any one know how to create a maven archetype for Liferay hook?  And how should I build it to create a war file out of it?
Regards

A: You can check it out from LR svn repository

A: Liferay now provides archetypes for various development projects (hooks, themes, portlets, etc.)
https://www.liferay.com/web/mika.koivisto/blog/-/blogs/12322618


text:
Q: Linux RAW Socket Error - How to get the correct MTU to use after a send failure? I have an application that is using sendmsg() on a RAW socket.  My application uses the IP_HDRINCL socket option, as it sets up the IP header.
I set the DF bit in the egress packet to 1 (don't fragment).
Here is what I want to do next... When the Kernel tries to send the packet, it's looking up the route entry for the destination, and it gets the MTU to use for that host from the entry (sometimes lower due to PMTU discovery).
When I try to send a larger packet, the sendmsg() call fails, and the error code is "message too big".
What I now want is to figure out in the application what the MTU should actually be.  I have been trying to use the ancillary data.  I set IP_RECVERR in the socket options, and then called recvmsg() on the same send file descriptor with the MSG_ERRQUEUE flag set, but that call fails.
Is this the correct path to take?  I am reading in the man pages that the ancillary data behavior differs for different socket types.  Does this work for RAW?
Or is there a better Kernel API to get the correct MTU from the route entry?


text:
Q: C# ComboBox string array with int Well, the title is a bit confusing but I want to ask if it possible to have a array with string and int inside ?
For example:
string[] versions = new string[] { "Normal",1, "Expert",2, "Pro",3 };
comboBox.Items.AddRange(versions);

So if I would select Normal, the version integer would be set to 1. In my programm I got alot if items in my comboBox, and I don't want to have 50+ if functions to set the integer.
Sorry for my bad english.

A: What you are looking for is an Object containing the string and int properties/fields. Try the following:
public class Version // You can replace "Version" with any name you'd like
{
    public string Name { get; set; }
    public int Value { get; set; }
}

Then you have an array of your Version-objects you can use:
Version[] versions = new Version[] {
    new Version { Name = "Normal", Value = 1 },
    new Version { Name = "Expert", Value = 2 },
    new Version { Name = "Pro", Value = 3 }
};

I couldn't tell which programming language you are using (although I assumed .NET C# based on the code given).


text:
Q: Algorithm for Cost Connectivity tool of ArcGIS Spatial Analyst? For the Cost Connectivity tool in the Spatial Analyst toolbox, what is the algorithm used to compute the minimum spanning tree?
The ArcGIS website includes a general description of how the cost connectivity algorithm works, but it does not specify what minimum spanning tree algorithm is used.
I am asking because I am a PhD student who may use the cost connectivity tool for my research, and it is important that I understand how the tool works.
Edit to clarify based on responses so far: Please note I am specifically interested in the minimum spanning tree algorithm (e.g., Dijkstra). From the Esri website, I understand generally how the Cost Connectivity tool otherwise works.

A: Below is an illustration of how the algorithm works as provided by Esri. I'm pulling in my comment from below to also add:
Esri provides an illustration, they are not being specific about the MST used, only stating "optimum network (the minimum spanning tree) is the desired output." Furthermore, Esri is being ambiguous "The minimum spanning tree is determined using graph theory to connect the vertices (the regions) in the most effective (least cost) way possible." Nonetheless, Esri is trying to show the " steps are conceptually how the Cost Connectivity algorithm works:"
Esri provides an overview of Cost Connectivity

The two inputs (regions and cost data) are shown on the left side of the image, and right side of the image shows the output least-cost network displayed over the regions.

The minimum spanning tree is described:

The minimum spanning tree is calculated from the graph representation of the paths to determine the least-cost path network necessary to travel between the regions.

Esri also provides How the Cost Connectivity tool works
Which provides a section focused on How the cost connectivity algorithm works
The input sources and cost surface are identified.
In the graphic below, the input regions (the colored polygons) are displayed over the cost surface layer.

A Cost Allocation is performed.
In the graphic below, the input regions are displayed over the associated cost allocation layer. The value of each cell in the allocation raster is that of the particular region that can be reached with the cheapest (lowest) accumulated cost.

Cost paths are created between each region and its neighboring cost region.
In the graphic below, the input regions and the least-cost paths from each region to its neighboring cost region (magenta lines) are displayed over the associated cost allocation layer.

The regions and the resulting paths are converted to a graph (in graph theory). In the translation, the regions are the vertices and the paths are the edges. The accumulative cost for the path is the weight for the edge.
Conceptually, the translation of the regions and paths into graph theory can be represented by the following illustration. The numbered circles are the vertices (the regions) and the connecting lines between the vertices are the edges (the least-cost paths). The weights for the edges are the accumulative cost for the paths. In the illustration, the higher the cost, the thicker the line.

Esri also recommends to have an understanding of graph theory:

To fully understand how this tool works, it is recommended that you have some basic understanding of graph theory. Many resources are available for this, but you can start with the Wikipedia entry at Graph Theory.
The minimum spanning tree is determined using graph theory to connect the vertices (the regions) in the most effective (least cost) way possible. More information about minimum spanning trees is available online, such as from the Wikipedia entry at Minimum Spanning Tree

The spatial representation of the regions and the paths from the minimum spanning tree are mapped back to an output feature class.
In the graphic below, the input regions and the least-cost path network from the minimum spanning tree (magenta color) are displayed over the associated cost surface layer.

Comparing the paths when using just the Cost Distance and Cost Path tools (left) against the Cost Connectivity tool (right)


text:
Q: Why is the intersections between $f(x)=x^{2}+x^{-2}-3$ and the x-axis resembles $\varphi$? The story behind this is quite silly, I was messing around with functions in geogebra, inputting several functions to see their properties, until I was amazed by something i don't know about.

Apparently, the intersections (unfortunately I don't know how the're named in english) between $f(x)=x^{2}+x^{-2}-3$ and the x-axis resembles $\varphi$, in the screenshot i've attached you can see it reveals the first 8 digits of $\varphi$ correctly. Can someone explain to me why this happens? I don't believe it's just a coincidence and I'm definitely missing something.

A: The intersection points are the solutions to the equation
$$x^2+x^{-2}-3=0.$$
The solutions are precisely the (nonzero) solutions to the equation
$$x^2(x^2+x^{-2}-3)=0,$$
or equivalently
$$x^4-3x^2+1=0.$$
It turns out that this polynomial factors as the product of two quadratic polynomials:
$$x^4-3x^2+1=(x^2-x-1)(x^2+x-1).$$
And of course the golden ratio $\varphi$ and its conjugate $\varphi^{-1}=\varphi-1$ are precisely the roots of
$$x^2+x-1=0.$$
And similarly their negatives $-\varphi$ and $-\varphi^{-1}$ are precisely the roots of
$$(-x)^2+(-x)-1=0,$$
or equivalently
$$x^2-x-1=0.$$
So the four solutions to the original equation are precisely $\pm\varphi$ and $\pm\varphi^{-1}$.


text:
Q: jQuery $(window).resize not firing in Firefox For environmental reasons, I am only able to test this in Firefox currently, so I don't know what's happening in other browsers. I am trying to track down why binding the window resize event isn't working.
This is a legacy project with a lot of JavaScript, and I cannot find anywhere where events are being unbound, or any other bindings to resize.
jQuery version is 1.7.3
I have code that looks like this:
$(function(){
    $(window).resize(function(){
       console.log("resize 1");
    });
    $(window).on("resize", function(){
       console.log("resize 2");
    });
    window.onresize = function(){
     console.log("resize 3");
    }
});

When I resize the window, only "resize 3" is logged.
If I do:
$(window).trigger("resize");

Then all three are logged to the console.
If I remove window.onresize - nothing happens when I resize, but triggering resize logs.

A: I'd make sure, that this function is really loaded with the document ready event and use only the .resize function from jquery. It works on every platform as far as I know. So the code.
$(document).ready(function(){
  $(window).resize(function(){
    console.log("this really works for me");
  });
});

Example http://jsfiddle.net/nTej2/


text:
Q: Is there a Ubuntu Server Minimal CD? Is there a Ubuntu Server Minimal CD? This can be helpful when you want to install Ubuntu on a server through KVM by selecting a local ISO file and the upload speed on your local computer is not great.

A: Have a look at this wiki page which contains a list of Ubuntu minimal CDs:

*

*https://help.ubuntu.com/community/Installation/MinimalCD


text:
Q: Call Scala code from Java? I'm using Netbeans to write Scala and Java.
Netbeans generated a .jar file for the Scala project. I tried importing that file in the Java project. But I couldn't import any class from that .jar file into my Java project.
I also tried importing scala-library.jar to the java project, and could import classes from that jar.
I want to write my library in Scala, then expose a small interface that only involves Java stuff, then write a Java wrapper so that people can use it as a Java package. Is that possible? How do I do it?
Thank you very much.

A: There should be no problem in doing this.

*

*Have you verified (e.g. using WinZip or the jar utility) that your .jar file actually contains the relevant .class files? (use jar tvf mylib.jar to check)

*If you have verified that the correct .class files exist in your jar file, what is the runtime error you are seeing? Is it a NoClassDefFoundError? If so, which class cannot be found? How are you referring to the (Scala) class in your (Java) code?


text:
Q: jQuery plugin for table cell replacement I need a jQuery plugin that will take an HTML table, and will allow the replacement of cells in between each other, via drag n drop. Example:
[1][2][3]
[4][5][6]
[7][8][9]

When I drag 1 onto 9, it should replace them like so:
[9][2][3]
[4][5][6]
[7][8][1]

ideally with an optional callback function (to update a remote page with ajax).
Thanks in advance.

A: Look at this:
http://www.redips.net/javascript/drag-and-drop-table-content/
Check the "Switch content option" below the table.

A:
If not a plugin, then at least how to get to it and even try to write it myself.

Using jQuery UI you can create draggable elements. You can also create droppable elements.
Try messing around with those demos using a table and table cells and see how far you can get by yourself. If you hit a dead-end, come back and someone may be able to help you out once you have some code!

A: I've got it! http://jsfiddle.net/8dRZz/
In this example, it will stay "loading" forever, easily understandable since the handler in not there, so no AJAX success call.


text:
Q: What is LLL can represent into luxonjs In my project, I have this in moment for time, this one,
  moment().format('LLL')    // June 9 2014 9:32 PM
  moment().format('D MMM YYYY[,] HH[:]mm z')

but if I use this in luxon how can i make this format in luxon, for example, given below,
   luxon.DateTime.utc().toFormat('')
   luxon.DateTime.now().toFormat('d MMM yyyy[,] HH[:]mm z')

Here if i use this, in luxon LLL it represents month as an abbreviated localized string and it might only show me the month only.

A: From the docs.
moment.js
LLL = Month name, day of month, year, time
luxon.js
LLL = month as an abbreviated localized string
So looking a Luxon's docs,
the closest is ff but the month is short.
and fff but has the locale at the end.
If neither of those work for you, you could could maybe use.
LLLL d, yyyy t a