text:
Q: Erro ao chamar getLayoutInflater() dentro de uma fragment Estou com um problema para criar uma janela personalizada. A ideia é ter um balão que apresente uma imagem e algumas informações básicas sobre algum local, com um link para outra activity com um detalhamento maior.
O problema é que o getLayoutInflater() apresenta o seguinte erro:

"Fragment.getLayoutInflater can only be called from within the same
  library group (groupId=com.android.support)"

MapaFragment.java
import android.app.admin.SystemUpdatePolicy;
import android.content.Context;
import android.location.Criteria;
import android.location.LocationManager;
import android.support.v4.app.FragmentActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Toast;

import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;

public class MapaFragment extends SupportMapFragment implements OnMapReadyCallback {
    private Context context;
    LayoutInflater inflater = (LayoutInflater) context.getSystemService( Context.LAYOUT_INFLATER_SERVICE );

    SupportMapFragment mapFragment;
    private GoogleMap mMap;
    private LocationManager locationManager;
    private static final String TAG = "MapaTag";
    private String title[] = {"Medianeira - PR", "Pensao da Juraci"};
    private String here = "Estou Aqui!";

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getMapAsync(this);

    }

    /**
     * Manipulates the map once available.
     * This callback is triggered when the map is ready to be used.
     * This is where we can add markers or lines, add listeners or move the camera. In this case,
     * we just add a marker near Sydney, Australia.
     * If Google Play services is not installed on the device, the user will be prompted to install
     * it inside the SupportMapFragment. This method will only be triggered once the user has
     * installed Google Play services and returned to the app.
     */
    @Override
    public void onMapReady(GoogleMap googleMap) {

        mMap.setInfoWindowAdapter(new GoogleMap.InfoWindowAdapter() {

            @Override
            public View getInfoWindow(Marker arg0) {
                return null;
            }

            @Override
            public View getInfoContents(Marker arg0) {

                View v = getLayoutInflater().inflate(R.layout.inflate, null);
                return v;

            }
        });

        mMap = googleMap;
        Marker marker;

        //Location
        LatLng medianeira = new LatLng(-25.295,-54.0939);
        LatLng pensaoJuraci = new LatLng(-25.302268,-54.116805);

        // Add a marker in Medianeira
        mMap.addMarker(new MarkerOptions().position(medianeira).title(title[0]).snippet(here));
        mMap.addMarker(new MarkerOptions().position(pensaoJuraci).title(title[1]).snippet(here));

        // Move the camera to inicial location
        mMap.moveCamera(CameraUpdateFactory.newLatLng(medianeira));

        MarkerOptions options = new MarkerOptions();

        try {
            locationManager = (LocationManager) getActivity().getSystemService(Context.LOCATION_SERVICE);

            Criteria criteria = new Criteria();
            String provider = locationManager.getBestProvider(criteria, true);

            mMap.setMyLocationEnabled(true);
            Toast.makeText(getContext(), "Provider: "+provider, Toast.LENGTH_SHORT).show();
        }catch (SecurityException ex){
            Log.e(TAG, "ERROR", ex);
        }
    }
}

A: O erro indica que esse método só pode ser usado dentro do grupo com.android.support, ou seja, o seu uso é restrito à API/LIBRARY.
Não consigo verificar mas ele deve estar anotado com @RestrictTo(LIBRARY_GROUP).
Suponho que esteja a usar uma versão antiga da API pois não consigo reproduzir esse erro na versão mais actual.
Além desse problema existe outro no seu código, a linha
LayoutInflater inflater = (LayoutInflater) context.getSystemService( Context.LAYOUT_INFLATER_SERVICE );

irá lançar uma excepção, já que context é nulo.
Elimine essa linha e obtenha o LayoutInflater, no método getInfoContents(), assim:
LayoutInflater inflater = LayoutInflater.from(getActivity());
View v = inflater.inflate(R.layout.inflate, null);


text:
Q: using an array in a loop =(DAYS(ArrayFormula(A10:A20),TODAY()))
Trying to get the days remaining as the output for B10:B20 to the corresponding dates in A10:A20

A: You should wrap in ArrayFormula your whole formula and not the range in particular:
=ArrayFormula(Days(A10:A20,TODAY()))

redpajama_set_name: RedPajamaStackExchange


text:
Q: React component re-renders endlessly with onClick I want the onClick event of the button in result.js to render my Spinner component, and have so far (kind of) gotten it to do so. At the moment, Spinner mostly has some console.log() statements, and it keeps logging "Rendered spinner." endlessly after clicking the button, about once every second.
For the record, the returned paragraph isn't being displayed, but I haven't gotten around to debugging that yet. Also, I have excluded some code in Result.js that I think is irrelevant.
For now, I just want Spinner to only render once after pressing the button. Any tips?
result.js:
import React, { Component } from "react";
import { connect } from "react-redux";
import Spinner from "./spinner";

class UnboxResult extends Component {
  constructor(props) {
    super(props);
    this.state = {
      showSpinner: false
    };
    this.handleUnboxClicked = this.handleUnboxClicked.bind(this);
  }

  handleUnboxClicked(event) {
    event.preventDefault();
    console.log("Inside handleUnboxClicked");
    this.setState({
      showSpinner: true
    });
  }

  render() {

    return (

            <button onClick={this.handleUnboxClicked}>UNBOX</button>

            {this.state.showSpinner ?
              <Spinner items={this.props.unbox.items}/> :
              null}

    );
  }
}

export default connect(state => ({
  unbox: state.unbox
}))(UnboxResult);

spinner.js:
import React, { Component } from 'react';

class Spinner extends Component {
  constructor(props) {
    console.log("Before super");
    super(props);
    console.log("Ran constructor.");
  }

  render(){
    console.log("Rendered spinner.");
    return(

Spinning..

    );
  }
}
export default Spinner;

A: You could add a handler method to update the state from spinner
handleClick(){
  this.setState({
    showSpinner: true
  })
}

and in your render it will need to be passed as prop

  {this.state.showSpinner ?
    <Spinner handleClick={this.handleClick}/> :
    null}

In your spinner component return you can trigger this using onclick
<button onClick = {this.props.handleClick} > Click </button>

This will allow you to update the state back in your parent, You might want to figure out how you would display the items one at a time in spinner and only set state to false when there is no items left to display.
Sorry if i misunderstood your comment.


text:
Q: Powered down my laptop during a drive partition, any way to save some data? I was in the process of partitioning my laptop drive which was running the latest version of Ubuntu when I was forced to turn it off, knowing the damage it could cause.
When I turned it on later it booted to a terminal prompt saying boot/grub/i386-pc/normal.mod not found ubuntu.
I have some data on there that I really want to save before reformatting the drive. Is there anything I can do?


text:
Q: Bind rectangle's Fill color to Foreground color I have a custom control inside a button. In the control's template, I have a rectangle, and a text block. When the button is pressed, VSM animates the button's "(Button.Foreground).(SolidColorBrush.Color)" property that's propagated to a text block so the color of the text changes.
How can I set the rectangle's fill property to the same brush?
I tried "{TemplateBinding Foreground}", "{Binding Path=Foreground, RelativeSource={RelativeSource Self}}", and even creating the bindings in code (in OnApplyTemplate) - either not works at all, or the initially set color is not animated. I also tried the element to element binding to bind the rectangle's Fill property to the TextBlock's Foreground property, same result (the initial color is OK, while animating the colors are different).
Thanks in advance.

A: I think it might be a bug in the WP 7.1.
Found the workaround. To make it all work:

*

*In the custom control template, specify Fill="{TemplateBinding Foreground}"

*In the button template, inside <VisualState x:Name="Normal">, set the foreground color for the normal state.

When the initial Foreground value comes from <Setter Property="Foreground" ... in the button's style, when the visual state manager animates the foreground value, TextBlock objects receive the new value, however the <Rectangle Fill="{TemplateBinding Foreground}" stays painted with the old color.
When initial value comes from the visual state manager, the rectangle inside custom control template is correctly receiving new property values as the VSM animates color change.


text:
Q: To match a list type column with other columns in DF I have a data frame with the approximate structure:
         C1                   C2      C3
1  c("XXX", "Y3")            "XXX"   "Y31"
2  c("SFM", "DD31", "DSDW")  "SFF"   "DD31"

The column C1 is a list. It was a string which I split into separate words. The other 2 columns are character.
I need to match C2 and C3 against C1 so that in case of the match (100% there is a match), replace the value in C1 with another value. For example:
The first row has 2 matches because fuzzy match is also a match:

*

*C1~C2: replace "XXX" in C1 with the modified value from C1 "XXX[TAG]"

*C1~C3: replace "Y3"  in C1 with the modified value from C3 "Y31[TAG]"

In general I understand how to do that: with a for loop, match function and regex but my knowledge does not allow me to combine everything together. Thank you in advance!
EDITED
What I have:
x <- structure(list(Description = list(c("2012", "Deere", "544K",
                                    "Wheel", "Loader,"), c("Caterpillar","Model", "988", "Year", "1972")),
                    Manufacturer = c("john deere", "caterpillar"),
                    Model = c("544k", "988")), .Names = c("Description", "Manufacturer", "Model"), row.names = 4:5, class = "data.frame")

#>     Description                        Manufacturer Model
#> 4   2012, Deere, 544K, Wheel, Loader,   john deere  544k
#> 5 Caterpillar, Model, 988, Year, 1972  caterpillar   988

What I want to have:
x.new <- structure(list(Description = list(c("2012", "john deere[Manufacturer]", "544k[Model]",
                                         "Wheel", "Loader,"), c("caterpillar[Manufacturer]","Model", "988[Model]", "Year", "1972")),
                    Manufacturer = c("john deere", "caterpillar"),
                    Model = c("544k", "988")), .Names = c("Description", "Manufacturer", "Model"), row.names = 4:5, class = "data.frame")

#>  Description                                                 Manufacturer Model
#> 4 2012, john deere[Manufacturer], 544k[Model], Wheel, Loader,  john deere  544k
#> 5 caterpillar[Manufacturer], Model, 988[Model], Year, 1972    caterpillar   988

A: With list columns, you'll need a lot of lapply and its multivariate equivalent, Map, which allow you to iterate over the list column and return a list which can be reassigned as a column. For example,
df <- structure(list(C1 = list(c("XXX", "Y3"), c("SFM", "DD31", "DSDW")),
                     C2 = c("XXX", "SFF"),
                     C3 = c("Y31", "DD31")),
                .Names = c("C1", "C2", "C3"), row.names = c(NA, -2L), class = "data.frame")

df$C1_new <- Map(function(c1, c2, c3){
    sapply(c1, function(x){
        mtch <- grepl(x, c(c2, c3));
        if (any(mtch)) {paste0(c(c2, c3)[mtch], '[', names(df)[-1][mtch], ']')} else {x}
    })},
    df$C1, df$C2, df$C3)

df
#>                C1  C2   C3              C1_new
#> 1         XXX, Y3 XXX  Y31    XXX[C2], Y31[C3]
#> 2 SFM, DD31, DSDW SFF DD31 SFM, DD31[C3], DSDW

There are many other ways to set this up, including using using packages like purrr and stringr that make the syntax simpler and more uniform. Vary as you like.
To apply to the second dataset listed, it works with some slight edits:
x <- structure(list(Description = list(c("2012", "Deere", "544K", "Wheel", "Loader,"),
                                       c("Caterpillar","Model", "988", "Year", "1972")),
                    Manufacturer = c("john deere", "caterpillar"),
                    Model = c("544k", "988")),
               .Names = c("Description", "Manufacturer", "Model"), row.names = 4:5, class = "data.frame")

x$Description <- Map(function(desc, mfr, mdl){
    sapply(desc, function(wrd){
        mtch <- grepl(wrd, c(mfr, mdl), ignore.case = TRUE);
        if (any(mtch)) {paste0(c(mfr, mdl)[mtch], '[', names(x)[-1][mtch], ']')} else {wrd}
    })},
    x$Description, x$Manufacturer, x$Model)

x
#>                                                   Description Manufacturer Model
#> 4 2012, john deere[Manufacturer], 544k[Model], Wheel, Loader,   john deere  544k
#> 5    caterpillar[Manufacturer], Model, 988[Model], Year, 1972  caterpillar   988


text:
Q: What does $\{x|x = 7\} = \emptyset$ mean? (Probability) To my understanding $\{x|x = 7\} = \emptyset$  means that the number seven is a not allowed value. But I do not understand the meaning of "$x|x$". Can anybody please explain $\{x|x = 7\} = \emptyset$ more in detail.
It's from an introduction book into probability theory. It says:" ... Not possible events are for example $\{x|x = 7\} = \emptyset$ , $\{x|x = 0\} = \emptyset$ , ...". Basis is the Throwing Dice example as e. g. also available on the page http://www.mathsisfun.com/data/probability.html

A: I guess the bar $|$ means "such that". Therefore "the set of possible outcomes of $x$ such that $x=7$ is an empty set"

A: The formalization of the "Throwing a Dice" example involves the construction of a set $\Omega$, known as the sample space, whose elements $\omega$ correspond to each possible result of the experiment. Hence, you can take as your sample space the six elements set
$$
  \Omega =\{ \bullet, \bullet\bullet, \bullet\bullet\bullet, \bullet\bullet\bullet\bullet, \bullet\bullet\bullet\bullet\bullet, \bullet\bullet\bullet\bullet\bullet\bullet \} \, .
$$
A random variable $X$ is a function which maps $\Omega$ to the set of real numbers. For example, you can construct a random variable $X$ which gives you the number of dots in the dice's face which turned up. Here is the function:
$$
  X(\bullet) = 1 \qquad X(\bullet\bullet) = 2 \qquad X(\bullet\bullet\bullet) = 3
$$
$$
  X(\bullet\bullet\bullet\bullet) = 4 \qquad X(\bullet\bullet\bullet\bullet\bullet) = 5 \qquad X(\bullet\bullet\bullet\bullet\bullet\bullet) = 6 \, .
$$
For some subset $A$ of the real numbers, the inverse image $X^{-1}(A)$ is the set of elements $\omega\in\Omega$ such that $X(\omega)$ belongs to $A$. Symbolically,
$$
  X^{-1}(A) = \{ \omega\in\Omega : X(\omega)\in A\} \, .
$$
Note that you can consider the inverse image of some set by any function. The function doesn't need to have an inverse.
Consider these examples:
$$
  X^{-1}(\{5\}) = \{ \bullet\bullet\bullet\bullet\bullet \}
$$
$$
  X^{-1}(\{1,6\}) = \{ \bullet, \bullet\bullet\bullet\bullet\bullet\bullet \}
$$
$$
  X^{-1}((-\infty,3]) = \{ \bullet, \bullet\bullet,\bullet\bullet\bullet \}
$$
Now consider $X^{-1}(\{7\})$. First, write the formal definition
$$
  X^{-1}(\{7\}) = \{ \omega\in\Omega : X(\omega)= 7\} \, .
$$
Is there any $\omega\in\Omega$ such that $X(\omega)=7$? No. Hence,
$$
  X^{-1}(\{7\}) = \emptyset.
$$


text:
Q: Can't connect to pear.php.net If I try anything with PEAR, I get:
# pear list-all
Connection to `pear.php.net:80' failed: Connection timed out

If I ping it, I get the following:
# ping pear.php.net
PING euk1.php.net (5.77.39.20) 56(84) bytes of data.

I've also tried host and dig on the URL:
# host pear.php.net
pear.php.net is an alias for euk1.php.net.
euk1.php.net has address 5.77.39.20
# dig pear.php.net

; <<>> DiG 9.7.3 <<>> pear.php.net
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 5866
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;pear.php.net.                  IN      A

;; ANSWER SECTION:
pear.php.net.           292     IN      CNAME   euk1.php.net.
euk1.php.net.           292     IN      A       5.77.39.20

;; Query time: 0 msec
;; SERVER: 85.119.80.232#53(85.119.80.232)
;; WHEN: Mon Dec  3 11:45:33 2012
;; MSG SIZE  rcvd: 65

If I use curl pear.php.net I get a connection timeout, but if I try curl www.google.co.uk I get a response. I'm not really sure about iptables, but have also documented the output from that:
# iptables -n -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

Anyone have any ideas what to try or to look at to try and resolve this?

A: I can ping this address without problem so maybe it's problem with firewall somewhere in your network or problem on internetwork connections. You can diagnose this problem using command
traceroute pear.php.net

or
mtr pear.php.net


text:
Q: How to provide conditional arguments to a mock function in Python? My project makes various calls to external API's using Python's urllib2.urlopen. I'm using NoseTests for my unit testing and MiniMock to mock up calls made to urllib2.urlopen.
The mocking code:
from hashlib import md5
from os.path import dirname, join
from urllib2 import Request, urlopen

from minimock import mock, restore

def urlopen_stub(url, data=None, timeout=30):
    """
    Mock urllib2.urlopen and return a local file handle or create file if
    not existent and then return it.
    """

    if isinstance(url, Request):
        key = md5(url.get_full_url()).hexdigest()
    else:
        key = md5(url).hexdigest()
    data_file = join(dirname(__file__), 'cache', '%s.xml' % key)
    try:
        f = open(data_file)
    except IOError:
        restore() # restore normal function
        data = urlopen(url, data).read()
        mock('urlopen', returns_func=urlopen_stub, tracker=None) # re-mock it.
        with open(data_file, 'w') as f:
            f.write(data)
        f = open(data_file, 'r')
    return f

mock('urlopen', returns_func=urlopen_stub, tracker=None)

I'm running my tests like so:
from os.path import isfile, join
from shutil import copytree, rmtree

from nose.tools import assert_raises, assert_true

import urlopenmock

class TestMain(object):
    working = 'testing/working'

    def setUp(self):
        files = 'testing/files'
        copytree(files, self.working)

    def tearDown(self):
        rmtree(self.working)

    def test_foo(self):
        func_a_calling_urlopen()
        assert_true(isfile(join(self.working, 'file_b.txt')))

    def test_bar(self):
        func_b_calling_urlopen()
        assert_true(isfile(join(self.working, 'file_b.txt')))

    def test_bar_exception(self):
        assert_raises(AnException, func_c_calling_urlopen)

Originally I had the test checking for the exception in a separate module which imported a different mocking file that returned a broken XML file when urlopen was called. However importing that mocking class overrode the one shown above, breaking all the tests as the broken XML was used each time.
I assume this was because the exception testing module was loaded after the others thus it's import was called last and the mocked function returning the broken XML overrode the original mocked function.
I'd like to be able to tell the mocking code to use the broken XML file when test_bar_exception is run so that it raises the exception. How would I go about doing this?

A: Seems to me that you will need to setup and teardown your mock urlopen on each test that needs to use it and have a different mock urlopen to return a broken xml file for those tests dealing with that error condition. Something like:
class TestMain(object):
    # ...

    def test_foo(self):
        mock('urlopen', returns_func=urlopen_stub, tracker=None)
        func_a_calling_urlopen()
        assert_true(isfile(join(self.working, 'file_b.txt')))
        restore()

    # ...

    def test_bar_exception(self):
        mock('urlopen',
                returns_func=urlopen_stub_which_returns_broken_xml_file,
                tracker=None)
        assert_raises(AnException, func_c_calling_urlopen)
        restore()

There is a problem with the above, however, if a test raises an exception and the restore() call is not reached. You could wrap with try: ... finally: however, that's a lot of red-tape for each test.
You might want to take a look Michael Foord's mock library.
Pycon presentation: http://blip.tv/file/4881513
Take a look at patch which gives you decorator and context-manager options for replacing and restoring your calls on urlopen. Its very nifty!

A: Assume that your input to request is 'a url' and output would be 'aresponse', and for input 'burl' output is 'bresponse', so use
@mock.patch('requests.get', mock.Mock(side_effect = lambda k:{'aurl': 'a response', 'burl' : 'b response'}.get(k, 'unhandled request %s'%k)))


text:
Q: How to configure SonarQube using an aws cloud formation script? I have a SonarQube installation in an existing Amazon AmiID. I now want to change a few lines in the SonarQube configuration dynamically during cloud formation.
How do I modify the /opt/sonarqube/conf/sonar.properties file using an aws cloud formation script?

A: I assume you create an ec2 instance from the AMI.
You can add UserData property in the resource's property section and do your modification in there inform of a bash script.
"UserData":{
   "Fn::Base64":{
      "Fn::Join":[
         "",
         [
            "#!/bin/bash -v\n",
            "#Change Sonar Properties",
            "sed -i 'line_number/old_text/new_text/' /opt/sonarqube/conf/sonar.properties\n"
         ]
      ]
   }
}


text:
Q: VBScript get external IP address and telnet it to a device I have some knowledge about programming and i've searched the web a bit, but i can't seem to find what i need.
This is the deal, i have a device that uses an ethernet module for communication from Lantronix called Xport.
Now, that device can be configured through a web browser or Telnet.
Among the options their's one called remote IP.
I'm trying to develop a script that can capture my external IP Address, memorize each number from that ip to a variable, then open my device through telnet, access a certain option that he has, and write that IP through sendkeys or something.
By each number i mean 192, number 1, number 9 and number 2, for example.
Another option would be a script that does the same through web browser.
I've already crated some batch files that do some of that, one of the batch files asks for an IP, number by number (i have to write everything, 0's and all, for example 66 writes 066), then open the telnet, insert a password in the device, send several keys until the option i want, enter that option, writes the ip that i've wrote and then exits. But i found that script is not very user friendly.
So i'm looking for a two click file solution.
This is what i've got so far.
First the batch file that i use today.
@if (@CodeSection == @Batch) @then

@echo off

rem Use %SendKeys% to send keys to the keyboard buffer
set SendKeys=CScript //nologo //E:JScript "%~F0"

echo Please write the IP address one number at a time, pressing enter after each number

echo Insert first Number

set /p var1=

echo Insert second Number

set /p var2=

echo Insert ... Number

set /p var3=

echo Insert ... Number

set /p var4=

echo Insert ... Number

set /p var5=

echo Insert ... Number

set /p var6=

echo Insert ... Number

set /p var7=

echo Insert ... Number

set /p var8=

echo Insert ... Number

set /p var9=

echo Insert ... Number

set /p var10=

echo Insert ... Number

set /p var11=

echo Insert ... Number

set /p var12=

rem Starts Telnet and enters the device, then inserts the IP

start "" /B telnet.exe address.com 9999

ping -n 1 -w 1 127.0.0.1 > NUL
%SendKeys% "{p}{a}{s}{s}{w}{o}{r}{d}{ENTER}"

%SendKeys% "echo off{ENTER}"

%SendKeys% "echo off{1}{ENTER}{ENTER}{ENTER}{ENTER}{ENTER}{ENTER}{ENTER}{ENTER}{ENTER}"

%SendKeys% "echo off{%var1%}{%var2%}{%var3%}{ENTER}{%var4%}{%var5%}{%var6%}{ENTER}{%var7%}{%var8%}{%var9%}{ENTER}{%var10%}{%var11%}{%var12%}{ENTER}"

%SendKeys% "echo off{ENTER}{ENTER}{ENTER}{ENTER}{ENTER}{ENTER}{ENTER}{ENTER}"

%SendKeys% "echo off{9}{ENTER}"

set /P "=" < NUL
ping -n 1 -w 1 127.0.0.1 > NUL
%SendKeys% "{ENTER}"

goto :EOF

@end

// JScript section

var WshShell = WScript.CreateObject("WScript.Shell");
WshShell.SendKeys(WScript.Arguments(0));

If i could get the external IP through a batch file and put each number in a variable, and then mix this bat with that one, it would be a solution too.
I also have some vbs files and i want tu put them together.
First the code to get the external IP (this one i got from here)
Option Explicit
Dim objHTTP : Set objHTTP = WScript.CreateObject("MSXML2.ServerXmlHttp")
objHTTP.Open "GET", "http://icanhazip.com", False
objHTTP.Send
Wscript.Echo objHTTP.ResponseText
Set objHTTP  = Nothing

Then the code to write variables to a text (but what i want is to write the ip to telnet)
Dim Input, filesys, filetxt, getname, path
Input = InputBox("Enter your name")

Set filesys = CreateObject("Scripting.FileSystemObject")
Set filetxt = filesys.OpenTextFile("DataLog.txt", 8, True)
path = filesys.GetAbsolutePathName("DataLog.txt")
getname = filesys.GetFileName(path)
filetxt.WriteLine input & ", " & ServiceTag
filetxt.close

I've tried to mix this two togheter, but it didn't work
Option Explicit
Dim objHTTP : Set objHTTP = WScript.CreateObject("MSXML2.ServerXmlHttp")
objHTTP.Open "GET", "http://icanhazip.com", False
objHTTP.Send
Set objHTTP  = Nothing

dim filesys, filetxt, getname, path
Set filesys = CreateObject("Scripting.FileSystemObject")
Set filetxt = filesys.OpenTextFile("DataLog.txt", 8, True)
path = filesys.GetAbsolutePathName("DataLog.txt")
getname = filesys.GetFileName(path)
filetxt.WriteLine objHTTP.ResponseText & ", " & ServiceTag
filetxt.Close

By the way, one question, what is the servicetag for!?!?!? (well i'll check that one on google, but if someone wants to tell me, i'll be appreciated).
Thank you in advance for all or any help!
19-08-2014
Well Matt, i'm almost there but i'm still missing a peace of the puzzle, which is to write the external ip through sendkeys, and for that i tried to just call the variable with the external IP, but it doesn't work, so i need to split it into arrays like you said. i just need to find where to place you're code with mine.
This is my code so far (i hate to have to give four spaces for each code line, there's got to be an easier way to place code here).
Option Explicit
Dim objHTTP : Set objHTTP = WScript.CreateObject("MSXML2.ServerXmlHttp")
objHTTP.Open "GET", "http://icanhazip.com", False
objHTTP.Send

On Error Resume Next

Dim WshShell

set WshShell=CreateObject("WScript.Shell")

WshShell.run "cmd.exe"

WScript.Sleep 1000

WshShell.SendKeys "telnet domain.com 9999"

WshShell.SendKeys ("{Enter}")

WScript.Sleep 1000

WshShell.SendKeys "p"

WshShell.SendKeys "a"

WshShell.SendKeys "s"

WshShell.SendKeys "s"

WshShell.SendKeys "w"

WshShell.SendKeys "o"

WshShell.SendKeys "r"

WshShell.SendKeys "d"

WshShell.SendKeys ("{Enter}")

WScript.Sleep 1000

WshShell.SendKeys "1"

WshShell.SendKeys ("{Enter}")

WScript.Sleep 1000

WshShell.SendKeys ("{Enter}")

WScript.Sleep 1000

WshShell.SendKeys ("{Enter}")

WScript.Sleep 1000

WshShell.SendKeys ("{Enter}")

WScript.Sleep 1000

WshShell.SendKeys ("{Enter}")

WScript.Sleep 1000

WshShell.SendKeys ("{Enter}")

WScript.Sleep 1000

WshShell.SendKeys ("{Enter}")

WScript.Sleep 1000

WshShell.SendKeys ("{Enter}")

WScript.Sleep 1000

WshShell.SendKeys ("{Enter}")

WScript.Sleep 1000

WshShell.SendKeys ("{Enter}")

WScript.Sleep 1000

Set objWSHShell = WScript.CreateObject("WScript.Shell")

WScript.Sleep 1000

objWSHShell.SendKeys objHTTP.ResponseText

WScript.Sleep 1000

WshShell.SendKeys ("{Enter}")

WScript.Sleep 1000

WshShell.SendKeys ("{Enter}")

WScript.Sleep 1000

WshShell.SendKeys ("{Enter}")

WScript.Sleep 1000

WshShell.SendKeys ("{Enter}")

WScript.Sleep 1000

WshShell.SendKeys ("{Enter}")

WScript.Sleep 1000

WshShell.SendKeys ("{Enter}")

WScript.Sleep 1000

WshShell.SendKeys ("{Enter}")

WScript.Sleep 1000

WshShell.SendKeys ("{Enter}")

WScript.Sleep 1000

WshShell.SendKeys ("{Enter}")

WScript.Sleep 1000

WshShell.SendKeys ("{Enter}")

WScript.Sleep 1000

WshShell.SendKeys ("{Enter}")

WScript.Sleep 1000

WScript.Quit

Set objHTTP  = Nothing

So now i just need to put the external ip where i have the line
objWSHShell.SendKeys objHTTP.ResponseText

which is not working has it should, i mean i can make it write the ip to a text file, and i imagine that it writes one character at a time (or doesn't it?), so if it does, it should write to telnet, but it doesn't, and that's why i need to brake the external IP apart, number by number and adding the dot's (.) whithout the brakets.

A: In your final code example you delete the object reference with Set objHTTP  = Nothing then you later try to refer to it again with objHTTP.ResponseText. If nothing else you need to move your Set objHTTP  = Nothing line to the bottom.
Guessing you code bite that from someone using it to get information for a Dell system. Since you are just writing it with Writeline I don't see it being needed in your code
As for the ip address into variables you could convert the string into a character array and address it that way.
Function IPAddressToCharArray(pIpAddress)
    Dim intCounter
    Dim intLen
    Dim singleCharacter
    Dim strFormattedIpAddress
    Dim arrChars()

    ' Remove the periods
    ' strFormattedIpAddress = Replace(pIpAddress,".","")

    ' Set the array length
    intLen = Len(strFormattedIpAddress)-1
    redim arrChars(intLen)

    ' Cycle through the string
    For intCounter = 0 to intLen
        ' Capture the current character.
        arrChars(intCounter)  = Mid(strFormattedIpAddress, intCounter + 1,1)
    Next

    IPAddressToCharArray = arrChars
End Function

I dont see a need for this but it would create the array. You could then use a for each object loop to process.
If you wanted to work with this then you just need to put it through a For Each Loop to extract everycharater. If you are using option explicit these variables will need to be declared.
For Each strSingleCharacter in IPAddressToCharArray(objHTTP.ResponseText)
    WshShell.SendKeys strSingleCharacter
Next

Look at this telnet example though there is no need to break up the characters for send keys. Since sendkeys documentation states: "Send one or more keystrokes to the active window as if they were typed at the keyboard. This method is similar to the VB SendKeys method."
For example:
WshShell.SendKeys "telnet 55.42.58.123 49000"


text:
Q: Epsilon(ε) productions and LR(0) grammars and LL(1) grammars At many places (for example in this answer here), I have seen it is written that an LR(0) grammar cannot contain ε productions.
Also in Wikipedia I have seen statements like: An ε free LL(1) grammar is also SLR(1).

Now the problem which I am facing is that I cannot reason out the logic behind these statements.
Well, I know that LR(0) grammars accept the languages accepted by a DPDA by empty stack, i.e. the language they accept must have prefix property. [This prefix property can, however, be dealt with if we assume end markers and as such given any language the prefix property shall always be satisfied. Many texts like Theory of Computation by Sipser assume this end marker to simply their argument]. That being said, we can say (informally?) that a grammar is LR(0) if there is no state in the canonical collection of LR(0) items that have a shift-reduce conflict or reduce-reduce conflict.
With this background, I tried to consider the following grammar:
S -> Aa
A -> ε

canonical collection of LR(0) items
In the above DFA, I find that there is no state which has a shift-reduce conflict or reduce-reduce conflict.
So this grammar should be LR(0) as per my analysis. But it also has ε production.
Isn't this example contradicting the statement:

"no grammar with ε productions can be LR(0)"

I guess if I know the logic behind the above quoted statement then I can understand the concept better.

Actually my main problem arose with the statement :

An ε free LL(1) grammar is also SLR(1).

When I asked one of my friends, he gave the argument that as the LL(1) grammar is ε free hence it is LR(0) and hence it is SLR(1).
But I could not understand his logic either. When I asked him about reasoning, he started sharing post regarding "grammar with ε productions can never be LR(0)"...
But personally I could not think of any logic as to how "ε free LL(1) grammar is SLR(1)". Is it really related to the above property of "grammar with ε productions cannot be LR(0)"? If so, please do help me out.. If not, then should I consider asking a separate question for the second confusion?

I have got my concepts of compiler design from the dragon book by Ullman only. Also the knowledge of TOC from Ullman and from few other texts like Sipser, Linz.

A: A notable feature of your grammar is that A could just be eliminated. It serves absolutely no purpose. (By "eliminated", I mean simply removing all references to it; leaving productions otherwise intact.)
It is true that it's existence doesn't preclude the grammar from being LR(0). Similarly, a grammar with an unreachable non-terminal and an ε-production for that non-terminal could also be LR(0).
So it would be more accurate to say that a grammar cannot be LR(0) if it has a productive non-terminal with both an ε-production and some other productive production. But since we usually only consider reduced grammars without pointless non-terminals, I'm not sure that this additional pedantry serves much purpose.

As for your question about ε-free LL(1) grammars, here's a rough outline:
If an ε-free grammar is not LR(0), then there is some state with both a shift and a reduce action. Since the grammar is ε-free, that state was reached by way of a shift or a goto. The previous state must then have had two different productions with the same FIRST set, contradicting the LL(1) condition.


text:
Q: Whats the difference between these git commands? Can anyone tell me the difference between:
git commit -a -m

and
git commit -am

A: The latter requires two keystrokes less. Functionally they are equivalent.

A: It's a pretty standard *NIX convention that single-dash arguments which don't require any parameters, can be combined into a single argument

A: They can be combined as discussed in the gitcli [command line interface] help page git help cli, and in the git rev-parse --help page


text:
Q: Definition of a fractional ideal sheaf Wikipedia, in the article "divisor", defines a fractional ideal sheaf to be a sub-$\mathscr O_X$-module of the sheaf of rational functions $M_X$.
However, Kempf's book Algebraic Varieties defines in page 63 the same notion with the additional requirement that the sheaf be coherent. Is that a true difference? What does it stem from? And why does either of these definitions provide an analog for the usual invertible ideals, as in here?

A: A fractional ideal sheaf is a subsheaf of the sheaf of total quotient rings $\mathcal{K}_X$ which is a coherent $\mathcal{O}_X$-module. Among fractional ideal sheaves, (generalized) divisors are those which are nondegenerate and reflexive as $\mathcal{O}_X$-modules.
See this paper by Harstshorne for a detailed exposition:
R. Hartshorne, Generalized divisors on Gorenstein schemes, K-Theory v. 8, n. 3 (May, 1994): 287-339


text:
Q: Do zero gravitational-force points produce Naked singularities? In between two singularities, does a particle experience gravity?
If a particle is exactly at the midpoint between two singularities, will its net experience of the gravitational force (ignoring the rest of the universe, natch) be zero? I guess it ought to be assumed to be a point particle: I get the feeling that hadrons' internal structures aren't completely uniform and so their quarks would experience slightly different gravitational pulls as they are not quite at the exact same point. Or something like that, blah blah. Anyway, let's go with an electron for argument's sake.
Does the curvature of spacetime at the midpoint return to zero because their effects cancel? Does that mean that, in between two black holes, a region is formed within the event horizons for which the singularities are naked due to the opposing gravitational fields canceling out?
And similarly, with the "ringularity" of a Kerr black hole, is there a singularity that is naked to anything within that disc of spacetime? Though at least that region itself would be contained beyond and hidden by the event horizon, I suppose.
It sounds fun - to observe a naked singularity you just have to be bold enough to pass between two black holes that are sufficiently close.

A: From your comment:

The event horizon is produced by the overwhelming gravitational force warping spacetime so even photons can't escape. If the net force is zero, then spacetime wouldn't be warped at that point.

The Event Horizon is the surface within which nothing can escape.  It doesn't matter if there are zero-force points within the horizon, because even if there is no force at that point there is still too-much-force-to-escape all around it.  So unfortunately, this is not a way to produce a naked singularity (or perhaps, fortunately?!)
Note that an observer which falls into a BH will observe the singularity without a problem --- they'll soon fall into it, as-well.  A singularity is only 'naked' if there is no event horizon surrounding it at all.


text:
Q: AngularComponent with @inject how to test I have the following component in Angular with the following constructor
  constructor(@Inject('CustomersServiceImp') public customerService: CustomersService,
   ) { }

How do I inject the CustomersServiceImp when configuring the testing module.  On top of that CustomersService is an interface and not a concrete class.  I tried the following without any success
  const customersServiceToken = new InjectionToken<CustomersService>(
    "CustomersServiceImp"
  );

TestBed.configureTestingModule({
  declarations: [
   Comp
  ],
  schemas: [NO_ERRORS_SCHEMA],
  providers: [{ provide: customersServiceToken, useValue: {} }],
}).compileComponents();


text:
Q: Please wait until the service objective assignment state for the database is marked as 'Completed' error message We have three databases in Azure SQL that appear to be locked. We run the query
ALTER DATABASE [DBName] MODIFY(EDITION='basic',SERVICE_OBJECTED='basic')

or
ALTER DATABASE [DBName] MODIFY(EDITION='standard',SERVICE_OBJECTED='S2')

and end up with the error message; "A service objective assignment on server '[ServerName]' and database '[DBName]' is already in progress. Please wait until the service objective assignment state for the database is marked as 'Completed'."
They have been sitting in this state, with a little clock next to the Edition for several days now. Any help would be greatly appreciated!

A: You can check the database state using ServiceObjectiveAssignmentState Property before performing any db changes
Rest Api: https://msdn.microsoft.com/en-us/library/azure/dn505708.aspx
Powershell: https://msdn.microsoft.com/library/azure/dn546735.aspx

A: I have just been in the same state, and managed to get access again after running a succesfull export of the database.
I have marked a database to be scaled from S2 to S3, from the web interface it just showed as upgrade in progress for over 40min.
When using powershell i could see the CurrentServiceObjectiveId did not match the RequestedServiceObjectiveId meaning the request was made.
Get-AzureRmSqlDatabase -ResourceGroupName "ResourceGroup_WestEurope" -ServerName "Server-WestEurope" -DatabaseName "TestingAutomatedScaling"

When trying to Set the database back of forth in state using powershell
Set-AzureRmSqlDatabase -ResourceGroupName "ResourceGroup_WestEurope"
-ServerName "server-westeurope" -DatabaseName "TestingAutomatedScaling" -Edition "Standard"
-RequestedServiceObjectiveName "S2"

and -RequestedServiceObjectiveName "S3"
I got

A service objective assignment on server '[ServerName]' and database
  '[DBName]' is already in progress. Please wait until the service
  objective assignment state for the database is marked as 'Completed'

But I could not see the progress state anywhere.
The database was only 15Gb in size... so a 40min+ worktime seems like a blocked state.
Now for the magic part...
After doing an export of the database, first attempt got me an error.
serviceRequestId:47881ba1-5a56-492f-8307-455dbb95c18d statusMessage:{"code":"0","message":"There was an error that occurred during this operation : '<string xmlns=\"http://schemas.microsoft.com/2003/10/Serialization/\">Error encountered during the service operation. ; Exception Microsoft.SqlServer.Management.Dac.Services.ServiceException:Unable to authenticate request; </string>'","target":null,"details":[{"code":"0","message":"There was an error that occurred during this operation : '<string xmlns=\"http://schemas.microsoft.com/2003/10/Serialization/\">Error encountered during the service operation. ; Exception Microsoft.SqlServer.Management.Dac.Services.ServiceException:Unable to authenticate request; </string>'","target":null,"severity":"16"}],"innererror":[]}

Doing it again, the export happened to work.
After the export was successfull the database came back online and was marked as S3. Until further testing I wont know if i just needed to wait or if exporting the database helped unblock. But information might be helpful to anyone else finding the topic.


text:
Q: Android Bluetooth LE not managing 2 simultaneous connections with RN4020 I have a problem trying to connect with 2 Bluetooth LE modules (RN4020) throught native Android Bluetooth LE API and based on the Bluetooth Gatt sample of Android developers (https://developer.android.com/samples/BluetoothLeGatt/index.html). I modified BluetoothLeService.java to hold many connections instead of only one.
This is my process:
1- Start a new service which handle connections
2- Loop to connect devices:
for(String address: addresses) {
    mBluetoothLeService.connect(address)
}

3- Find characteristics I need
4- Send data:
mBluetoothLeService.writeCharacteristic(address, mCharacteristic, dataArray);

The thing is that when I send data to the first module, it receive it  perfect (onCharacteristicWrite() in BluetoothGattCallback() is called), then I send data to the second module and everything OK! But when I try to send data to the first module again, it doesn't receive it (tested in the board and also onCharacteristicWrite() is not called).
I also try with Reliable Write:
btGatt.beginReliableWrite();
characteristic.setValue(bytearray);
btGatt.writeCharacteristic(characteristic);
btGatt.executeReliableWrite();

but the same problem. The callback:
onReliableWriteCompleted(BluetoothGatt gatt, int status)

Status code is 6 (BluetoothGatt.GATT_REQUEST_NOT_SUPPORTED)
I checked connection status to both modules and there were connected every time (no disconnection problem).
Here is the modified class BluetoothLeService.java:
public class BluetoothLeService extends Service {
    private final static String TAG = BluetoothLeService.class.getSimpleName();

    private BluetoothManager mBluetoothManager;
    private BluetoothAdapter mBluetoothAdapter;
//    private String mBluetoothDeviceAddress;
    private Map<String,BluetoothGatt> mBluetoothGatts = new HashMap<>();
    private int mConnectionState = STATE_DISCONNECTED;

    private static final int STATE_DISCONNECTED = 0;
    private static final int STATE_CONNECTING = 1;
    private static final int STATE_CONNECTED = 2;

    public final static String ACTION_GATT_CONNECTED =
            "com.example.bluetooth.le.ACTION_GATT_CONNECTED";
    public final static String ACTION_GATT_DISCONNECTED =
            "com.example.bluetooth.le.ACTION_GATT_DISCONNECTED";
    public final static String ACTION_GATT_SERVICES_DISCOVERED =
            "com.example.bluetooth.le.ACTION_GATT_SERVICES_DISCOVERED";
    public final static String ACTION_DATA_AVAILABLE =
            "com.example.bluetooth.le.ACTION_DATA_AVAILABLE";
    public final static String EXTRA_DATA =
            "com.example.bluetooth.le.EXTRA_DATA";
    public final static String EXTRA_ADDRESS =
            "com.example.bluetooth.le.EXTRA_ADDRESS";

    public final static UUID UUID_HEART_RATE_MEASUREMENT =
            UUID.fromString(SampleGattAttributes.HEART_RATE_MEASUREMENT);

    // Implements callback methods for GATT events that the app cares about.  For example,
    // connection change and services discovered.
    private final BluetoothGattCallback mGattCallback = new BluetoothGattCallback() {
        @Override
        public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) {
            String intentAction;
            if (newState == BluetoothProfile.STATE_CONNECTED) {
                intentAction = ACTION_GATT_CONNECTED;
                mConnectionState = STATE_CONNECTED;
                broadcastUpdate(gatt.getDevice().getAddress(), intentAction);
                Log.i(TAG, "Connected to GATT server. address: " + gatt.getDevice().getAddress());
                // Attempts to discover services after successful connection.
                Log.i(TAG, "Attempting to start service discovery:" +
                        gatt.discoverServices());

            } else if (newState == BluetoothProfile.STATE_DISCONNECTED) {
                intentAction = ACTION_GATT_DISCONNECTED;
                mConnectionState = STATE_DISCONNECTED;
                Log.i(TAG, "Disconnected from GATT server.");
                broadcastUpdate(gatt.getDevice().getAddress(), intentAction);
            }
        }

        @Override
        public void onServicesDiscovered(BluetoothGatt gatt, int status) {

            Log.i(TAG, "--onServicesDiscovered. status: " + status);
            if (status == BluetoothGatt.GATT_SUCCESS) {
                broadcastUpdate(gatt.getDevice().getAddress(), ACTION_GATT_SERVICES_DISCOVERED);
            } else {
                Log.w(TAG, "onServicesDiscovered received: " + status);
            }
        }

        @Override
        public void onCharacteristicRead(BluetoothGatt gatt,
                                         BluetoothGattCharacteristic characteristic,
                                         int status) {
            if (status == BluetoothGatt.GATT_SUCCESS) {
                broadcastUpdate(gatt.getDevice().getAddress(), ACTION_DATA_AVAILABLE, characteristic);
            }
        }

        @Override
        public void onCharacteristicWrite(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) {
            super.onCharacteristicWrite(gatt, characteristic, status);

            Log.i(TAG, "--onCharacteristicWrite: value: " + Arrays.toString(characteristic.getValue()));

        }

        @Override
        public void onReliableWriteCompleted(BluetoothGatt gatt, int status) {
            super.onReliableWriteCompleted(gatt, status);

            Log.i(TAG, "--onReliableWriteCompleted: status: " + status);
        }

        @Override
        public void onCharacteristicChanged(BluetoothGatt gatt,
                                            BluetoothGattCharacteristic characteristic) {
            broadcastUpdate(gatt.getDevice().getAddress(), ACTION_DATA_AVAILABLE, characteristic);
        }
    };

    private void broadcastUpdate(String address, final String action) {
        final Intent intent = new Intent(action);
        intent.putExtra(EXTRA_ADDRESS, address);
        sendBroadcast(intent);
    }

    private void broadcastUpdate(final String address, final String action,
                                 final BluetoothGattCharacteristic characteristic) {
        final Intent intent = new Intent(action);

        // This is special handling for the Heart Rate Measurement profile.  Data parsing is
        // carried out as per profile specifications:
        // http://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.heart_rate_measurement.xml
        if (UUID_HEART_RATE_MEASUREMENT.equals(characteristic.getUuid())) {
            int flag = characteristic.getProperties();
            int format = -1;
            if ((flag & 0x01) != 0) {
                format = BluetoothGattCharacteristic.FORMAT_UINT16;
                Log.d(TAG, "Heart rate format UINT16.");
            } else {
                format = BluetoothGattCharacteristic.FORMAT_UINT8;
                Log.d(TAG, "Heart rate format UINT8.");
            }
            final int heartRate = characteristic.getIntValue(format, 1);
            Log.d(TAG, String.format("Received heart rate: %d", heartRate));
            intent.putExtra(EXTRA_DATA, String.valueOf(heartRate));
        } else {
            // For all other profiles, writes the data formatted in HEX.
            final byte[] data = characteristic.getValue();
            if (data != null && data.length > 0) {
                final StringBuilder stringBuilder = new StringBuilder(data.length);
                for (byte byteChar : data)
                    stringBuilder.append(String.format("%02X ", byteChar));
                intent.putExtra(EXTRA_DATA, new String(data) + "\n" + stringBuilder.toString());
            }
        }

        intent.putExtra(EXTRA_ADDRESS, address);
        sendBroadcast(intent);
    }

    public class LocalBinder extends Binder {
        public BluetoothLeService getService() {
            return BluetoothLeService.this;
        }
    }

    @Override
    public IBinder onBind(Intent intent) {
        return mBinder;
    }

    @Override
    public boolean onUnbind(Intent intent) {
        // After using a given device, you should make sure that BluetoothGatt.close() is called
        // such that resources are cleaned up properly.  In this particular example, close() is
        // invoked when the UI is disconnected from the Service.

        disconnectAll();
        closeAll();

        return super.onUnbind(intent);
    }

    private final IBinder mBinder = new LocalBinder();

    /**
     * Initializes a reference to the local Bluetooth adapter.
     *
     * @return Return true if the initialization is successful.
     */
    public boolean initialize() {
        // For API level 18 and above, get a reference to BluetoothAdapter through
        // BluetoothManager.
        if (mBluetoothManager == null) {
            mBluetoothManager = (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE);
            if (mBluetoothManager == null) {
                Log.e(TAG, "Unable to initialize BluetoothManager.");
                return false;
            }
        }

        mBluetoothAdapter = mBluetoothManager.getAdapter();
        if (mBluetoothAdapter == null) {
            Log.e(TAG, "Unable to obtain a BluetoothAdapter.");
            return false;
        }

        return true;
    }

    /**
     * Connects to the GATT server hosted on the Bluetooth LE device.
     *
     * @param address The device address of the destination device.
     * @return Return true if the connection is initiated successfully. The connection result
     * is reported asynchronously through the
     * {@code BluetoothGattCallback#onConnectionStateChange(android.bluetooth.BluetoothGatt, int, int)}
     * callback.
     */
    public boolean connect(final String address) {
        if (mBluetoothAdapter == null || address == null) {
            Log.w(TAG, "BluetoothAdapter not initialized or unspecified address.");
            return false;
        }

        BluetoothGatt btGatt = mBluetoothGatts.get(address);

        // Previously connected device.  Try to reconnect.
        if ( btGatt != null) {

            Log.d(TAG, "---Trying to use an existing mBluetoothGatt for connection.");
            if (btGatt.connect()) {
                mConnectionState = STATE_CONNECTING;
                return true;
            } else {
                return false;
            }
        }

        final BluetoothDevice device = mBluetoothAdapter.getRemoteDevice(address);
        if (device == null) {
            Log.w(TAG, "---Device not found.  Unable to connect.");
            return false;
        }

        // We want to directly connect to the device, so we are setting the autoConnect
        // parameter to false.
        BluetoothGatt newBtGatt = device.connectGatt(this, true, mGattCallback);
        Log.d(TAG, "---Trying to create a new connection. address: " + address);

        mBluetoothGatts.put(address, newBtGatt);

        mConnectionState = STATE_CONNECTING;
        return true;
    }

    /**
     * Disconnects an existing connection or cancel a pending connection. The disconnection result
     * is reported asynchronously through the
     * {@code BluetoothGattCallback#onConnectionStateChange(android.bluetooth.BluetoothGatt, int, int)}
     * callback.
     */
    public void disconnect(String address) {

        BluetoothGatt btGatt = mBluetoothGatts.get(address);

        if (mBluetoothAdapter == null || btGatt == null) {
            Log.w(TAG, "BluetoothAdapter not initialized");
            return;
        }

        Log.i(TAG, "disconnecting gatt");
        btGatt.disconnect();
    }

    public void disconnectAll() {

        // Connecting all devices
        Iterator it = mBluetoothGatts.entrySet().iterator();
        while (it.hasNext()) {
            Map.Entry pair = (Map.Entry) it.next();
            String address = (String) pair.getKey();

            disconnect(address);
        }
    }

    public int getConnectionState() {
        return mConnectionState;
    }

    /**
     * After using a given BLE device, the app must call this method to ensure resources are
     * released properly.
     */
    public void close(String address, boolean removeFromMap) {

        BluetoothGatt btGatt = mBluetoothGatts.get(address);
        if (btGatt == null) {
            return;
        }

        Log.i(TAG, "closing gatt");
        btGatt.close();

        if (removeFromMap) {
            mBluetoothGatts.remove(address);
        }
    }

    public void closeAll() {

        // Connecting all devices
        Iterator it = mBluetoothGatts.entrySet().iterator();
        while (it.hasNext()) {
            Map.Entry pair = (Map.Entry) it.next();
            String address = (String) pair.getKey();

            close(address, false);
        }
    }

    /**
     * Request a read on a given {@code BluetoothGattCharacteristic}. The read result is reported
     * asynchronously through the {@code BluetoothGattCallback#onCharacteristicRead(android.bluetooth.BluetoothGatt, android.bluetooth.BluetoothGattCharacteristic, int)}
     * callback.
     *
     * @param characteristic The characteristic to read from.
     */
    public void readCharacteristic(String address, BluetoothGattCharacteristic characteristic) {

        BluetoothGatt btGatt = mBluetoothGatts.get(address);

        if (mBluetoothAdapter == null || btGatt == null) {
            Log.w(TAG, "BluetoothAdapter not initialized");
            return;
        }
        btGatt.readCharacteristic(characteristic);
    }

    public void writeCharacteristic(String address, BluetoothGattCharacteristic characteristic,
                                    byte[] bytearray) {

        BluetoothGatt btGatt = mBluetoothGatts.get(address);

        if (mBluetoothAdapter == null || btGatt == null) {
            Log.w(TAG, "BluetoothAdapter not initialized");
            return;
        }

        if (characteristic == null) {
            Log.w(TAG, "Characteristic == null");
        }

        Log.i(TAG, "--> Writing characacteristic: " + Arrays.toString(bytearray) + ", device address: " + address);

//        btGatt.beginReliableWrite();

        characteristic.setValue(bytearray);

//        BluetoothManager bluetoothManager =
//                (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE);
//        Log.i(TAG, "--connection state: " + bluetoothManager.getConnectionState(btGatt.getDevice(), BluetoothGatt.GATT_SERVER));

        btGatt.writeCharacteristic(characteristic);

//        btGatt.executeReliableWrite();

    }

    /**
     * Enables or disables notification on a give characteristic.
     *
     * @param characteristic Characteristic to act on.
     * @param enabled        If true, enable notification.  False otherwise.
     */
    public void setCharacteristicNotification(String address, BluetoothGattCharacteristic characteristic,
                                              boolean enabled) {

        BluetoothGatt btGatt = mBluetoothGatts.get(address);

        if (mBluetoothAdapter == null || btGatt == null) {
            Log.w(TAG, "BluetoothAdapter not initialized");
            return;
        }
        btGatt.setCharacteristicNotification(characteristic, enabled);

        // This is specific to Heart Rate Measurement.
        if (UUID_HEART_RATE_MEASUREMENT.equals(characteristic.getUuid())) {
            BluetoothGattDescriptor descriptor = characteristic.getDescriptor(
                    UUID.fromString(SampleGattAttributes.CLIENT_CHARACTERISTIC_CONFIG));
            descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);
            btGatt.writeDescriptor(descriptor);
        }
    }

    /**
     * Retrieves a list of supported GATT services on the connected device. This should be
     * invoked only after {@code BluetoothGatt#discoverServices()} completes successfully.
     *
     * @return A {@code List} of supported services.
     */
    public List<BluetoothGattService> getSupportedGattServices(String address) {

        BluetoothGatt btGatt = mBluetoothGatts.get(address);

        if (btGatt == null) return null;

        return btGatt.getServices();
    }
}

Any ideas or libraries to handle multiple BLE connections? Thanks!


text:
Q: continuation of the "n-th derivative" function let $D_{\mathbb N}$ be the standard "n-th derivative" function
is it possible to make a continuation of $D_{\mathbb N}$ to non integer values?
i mean a function $D_{\mathbb R}$ such that $D_{\mathbb R}(x,f)=D_{\mathbb N}(n,f)$ for all $x=n\in\mathbb N$
it should be something relevant, linear interpolation usually doesn't make any sense.

A: I think you are looking for something like this: http://en.wikipedia.org/wiki/Fractional_derivative


text:
Q: Storing dictionary data using Python3 and SQLlite Here is my code:
def getDownloaders(dbPATH):
 with sqlite3.connect(dbPATH) as db:
      cursor = db.cursor()
      cursor.execute("SELECT * FROM Downloaders")
      d = cursor.fetchall()

      downloader = {}
      column_names = [s[0] for s in cursor.description]

      for i in range(len(d)):
        for row in d:
            downloader[i] = dict(zip(column_names, row))

 print(downloader)
 return downloader

Here is my data:
[{1, 'lll', 'lll', 'lll', '', '1',  'lobio', 'c:/'},
{2, 'test', 'test3', 'blob', 'blah', '1',  'lio', 'c:/'},
{3, 'ledere', 'copsssss', 'reds', 'server', '0',  'lobio', 'c:/'}]

Here is what I want in a dictionary
{0: {'id': 1, 'Host': 'lll', 'username': 'lll', 'password': 'lll', 'label': 'lll', 'Enabled': 1, 'name': 'lobio', 'file': 'c:/'}, 1: {'id': 2,'Host': 'test', 'username': 'test3', 'password': 'blob', 'label': 'blah', 'Enabled': 1, 'name': 'lio', 'file': 'c:/'}, 2: {'id': 3, 'Host': 'lwderel', 'username': 'copsssss', 'password': 'reds', 'label': 'server', 'Enabled': 0, 'name': 'lobio', 'file': 'c:/'}}

A: You have two nested for loops, for all row indexes, and for all rows, so the innermost line sees all combinations of i and row (3×3), even those where these two do not match.
You have to use a single loop:
cursor.execute("...")
column_names = [s[0] for s in cursor.description]
downloader = {}
i = 0
for row in cursor:
  downloader[i] = dict(zip(column_names, row))
  i += 1

And a dictionary with consecutive numbers as keys is pointless; it would be simpler to use an array as return value:
cursor.execute("...")
column_names = [s[0] for s in cursor.description]
downloader = [dict(zip(column_names, row)) for row in cursor]


text:
Q: Mono-implicit Runge-Kutta-Method I have a question about something from my lecture:

$"$The mono-implicit Runge-Kutta-Method is given as
  $$k_i(u_j,u_{j+1})=f((1-\delta_i)u_j+\delta_iu_{j+1}+h\sum_{v=1}^{i-1}a_{iv}k_v(u_j,u_{j+1}))$$
  $$u_{j+1}=u_j+h\sum_{i=1}^sb_ik_i(u_j,u_{j+1})$$
  with $\delta_i, a_{iv}, b_i \in \mathbb{R}$ and $i=1,...,s$
This equals the regular definition of a Runge-Kutta-Method:
  $$k_i=f(t+c_ih, u+h\sum_{j=1}^{i-1}a_{ij}k_j)$$
  $$u_{j+1}=u_j+h\sum_{i=1}^sb_ik_i$$
  with $b_i, c_i, a_{ij} \in \mathbb{R}"$

My question: How do the methods above equal each other? I've tried to write it down, but I don't see them being similar. Also, something I've been wondering:  What's the point of writing it that way? I don't see any advantages coming from writing it like that.
I appreciate any help.


text:
Q: iOS - Phonegap or WebApp keyboard issue I'm new in iOS programming, and I have a little problem with the keyboard...
That's a webapp, the application shows simply the mobile website.
In this website, there are forms, and in this forms, there are input type file fields. When the user clicks on input type text field, the keyboard appears, logical, isn't it ?
But when the user clicks on input type files fields, the keyboard does some weirds things. Sometimes it's not totally visible, sometimes it's misplaced, and the most of times, that's both... You can view it on this awesome screenshot I've made.
Is there anyone who can help me to fix this issue ?

A: I finally found the solution. I just update Cordova, and the problem was fixed...
So, to all the people which have this problem, simply update Cordova ;-)


text:
Q: error c2059: syntax error: constant in c while reading from a file I want to read and print the first two lines from a text file.
Problem is, I get the error: error c2059: syntax error: constant and it points to the first line in my text file.
Any ideas?
The file.txt:
5
5
3
1 1 1 0 0
0 1 0 0 1
0 1 0 1 0
1 0 1 0 1
1 1 0 1 1

The code:
#include <stdio.h>
#include <stdlib.h>

int main() {
    FILE *fp;
    int line, col, gen;
    fp = fopen("file.txt", "rt");
    fscanf(fp, "%d\n,%d\n", &line, &col);
    printf("line: %d,  col: %d\n", line, col);
    fclose(fp);
    return 0;
}

A: Visual Studio will compile every file in your project. This includes file.txt, if you have added it as a file to your project.
To prevent Visual Studio from compiling this, you need to tell Visual Studio it's a 'Content' file. Take a look at File Properties at Build Action Property.

Content - The file is not compiled, but is included in the Content output group. For example, this setting is the default value for an .htm or other kind of Web file.


text:
Q: Must supply cloud_name in Cloudinary heroku deploy I've declared the CLOUD_NAME, CLOUD_KEY, CLOUD_SECRET in the .env file and when I try to do git push heroku master it shows errors as:
2022-07-14T13:21:28.836730+00:00 app[web.1]: Must supply cloud_name
2022-07-14T13:21:28.836731+00:00 app[web.1]: (Use `node --trace-uncaught ...` to show where the exception was thrown)
2022-07-14T13:21:28.976355+00:00 heroku[web.1]: Process exited with status 1
2022-07-14T13:21:29.107460+00:00 heroku[web.1]: State changed from starting to crashed
2022-07-14T13:21:43.021994+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=react-bank-mysql.herokuapp.com request_id=6d906e55-283a-4669-bc37-b66380d65ba0 fwd="49.36.100.220" dyno= connect= service= status=503 bytes= protocol=https
2022-07-14T13:21:43.334479+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=react-bank-mysql.herokuapp.com request_id=b4c0fd71-4de1-4a95-b7e9-55b86f4c697c fwd="49.36.100.220" dyno= connect= service= status=503 bytes= protocol=https
2022-07-14T13:22:36.489119+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=react-bank-mysql.herokuapp.com request_id=177b60b5-6e3d-4b33-a329-b2b87448235a fwd="49.36.100.220" dyno= connect= service= status=503 bytes= protocol=https
2022-07-14T13:22:36.778798+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=react-bank-mysql.herokuapp.com request_id=5bf1946e-68c4-4d77-85aa-54ea4ac0c873 fwd="49.36.100.220" dyno= connect= service= status=503 bytes= protocol=https

I tried using this by commenting the code as shown and also adding my CLOUDINARY_URL but that didn't worked too
const cloudinary = require("cloudinary").v2;
require("dotenv").config();

//Connect to Cloudinary && Folder
// cloudinary.config({
//   cloud_name: process.env.CLOUD_NAME,
//   api_key: process.env.CLOUD_KEY,
//   api_secret: process.env.CLOUD_SECRET,
//   secure: true,
// });

Anyone with solution would be helpful

A: You need to set the environment variables in Heroku using Heroku's config vars. The .env file is used for your local development and should not be checked into your git repo. When deploying on Heroku, you use config vars.
For example:
heroku config:set CLOUD_NAME=my-cloud-name

You can also set these in the Heroku Dashboard if you prefer that to the CLI.
See the Heroku docs for more info.


text:
Q: Error when trying to parse XML file with escape characters using java I get an error when trying to parse a XML file with escape characters in it using the following java code. Is there a way to handle it while parsing the file here?
private Document parseXmlFile(String fileName) {
            Document doc = null;
            try {
                File fXmlFile = new File(fileName);
                DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
                DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
                doc = dBuilder.parse(fXmlFile);
                doc.getDocumentElement().normalize();
            } catch (ParserConfigurationException | SAXException | IOException ex) {
                System.out.println(ex);
            }
            return doc;

        }

Sample XML
<ResultDetail>
        <ObjectType>APF</ObjectType>
        <ObjectName>dlgCreateNewEmployee</ObjectName>
        AccessModifiers Detected
        <Description>&Original source: private</Description>
</ResultDetail>

A:    <ResultDetail>
    <ObjectType>APF</ObjectType>
    <ObjectName>dlgCreateNewEmployee</ObjectName>
    AccessModifiers Detected
    <Description>&Original source: private</Description>

Alternatively you can use CDATA also


text:
Q: How I can require script from data folder I want to load js file from page and require it in background page.
I try use two copy in lib and in data folder, but have problem with review.
I can load it from lib folder in page, but it uncomfortable for other browsers.
I can load it via loader:
mono = require('toolkit/loader').main(require('toolkit/loader').Loader({
    paths: {
        'sdk/': 'resource://gre/modules/commonjs/sdk/',
        'data/': self.data.url('js/'),
        '': 'resource:///modules/'
    },
    name: self.name,
    prefixURI: 'resource://'+self.id.slice(1, -1)+'/'
}), "data/mono");

But have problem with:
require('net/xhr').XMLHttpRequest

I try use for options it, but have same problems.
require('@loader/options')

Now I use it, but all require objects I send via arguments.
Have ideas?
upd
Now I use this code, it allow require modules and don't store it in memory, as I think. But need to declare all modules previously.
mono = require('toolkit/loader').main(require('toolkit/loader').Loader({
    paths: {
        'data/': self.data.url('js/')
    },
    name: self.name,
    prefixURI: 'resource://'+self.id.slice(1, -1)+'/',
    globals: {
        console: console,
        _require: function(path) {
            switch (path) {
                case 'sdk/timers':
                    return require('sdk/timers');
                case 'sdk/simple-storage':
                    return require('sdk/simple-storage');
                case 'sdk/window/utils':
                    return require('sdk/window/utils');
                case 'sdk/self':
                    return require('sdk/self');
                default:
                    console.log('Module not found!', path);
            }
        }
    }
}), "data/mono");

A: I think this blogpost from erikvold addresses the problem you are facing: http://work.erikvold.com/jetpack/2014/09/23/jp-pro-tip-reusing-js.html


text:
Q: Unable to resolve 'Microsoft.WindowsAzure.Storage (>= 7.2.0)' for '.NETCoreApp,Version=v1.0' I try to use Windows Azure Storage inside my dotnet core system (my first dotnet core project).  I tried the unit test for Azure Storage with dotnet core and it builds well.
But when I try to include the dependency to Azure Storage in my project.json, I receive this message:

Unable to resolve 'Microsoft.WindowsAzure.Storage (>= 7.2.0)' for '.NETCoreApp,Version=v1.0'.

Here is my full project.json file
{
"dependencies": {
    "Microsoft.AspNetCore.Mvc": "1.0.*",
    "Microsoft.AspNetCore.Mvc.TagHelpers": "1.0.*",
    "Microsoft.AspNetCore.Server.IISIntegration":"1.0.*",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.*",
    "Microsoft.AspNetCore.Diagnostics": "1.0.*",
    "Microsoft.Extensions.Configuration.EnvironmentVariables":"1.0.*",
    "Microsoft.Extensions.Configuration.FileExtensions": "1.0.*",
    "Microsoft.Extensions.Configuration.Json": "1.0.*",
    "Microsoft.Extensions.Configuration.CommandLine": "1.0.0",
    "Microsoft.Extensions.Configuration.UserSecrets": "1.0.0",
    "Microsoft.Extensions.Logging":"1.0.*",
    "Microsoft.Extensions.Logging.Console": "1.0.*",
    "Microsoft.Extensions.Logging.Debug": "1.0.*",
    "Microsoft.EntityFrameworkCore": "1.0.*",
    "Microsoft.EntityFrameworkCore.Sqlite": "1.0.*",
    "Microsoft.EntityFrameworkCore.Design": { "version": "1.0.0-preview2-final", "type": "build" },
    "Autofac": "4.0.0-rc3-309",
    "Autofac.Extensions.DependencyInjection": "4.0.0-rc3-309",
    "FluentValidation": "6.4.0-beta3",
    // "Serilog" : "2.0.0",
    // "Serilog.Extensions.Logging" : "1.0.0",
    // "Serilog.Sinks.Console" : "2.0.0"
    "Microsoft.AspNetCore.Authentication.Cookies": "1.0.0",
    "Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.0.0",
    "Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.0.0",
    "Microsoft.AspNetCore.Razor.Tools": { "version": "1.0.0-preview2-final", "type": "build" },
    "Microsoft.AspNetCore.StaticFiles": "1.0.0",
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0",
    "Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
        "version": "1.0.0-preview2-final",
        "type": "build"
    },
    "Microsoft.VisualStudio.Web.CodeGenerators.Mvc": {
        "version": "1.0.0-preview2-final",
        "type": "build"
    },
    "Microsoft.WindowsAzure.Storage": "7.2.0.0-*"
},
"tools": {
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": {
        "version": "1.0.0-preview2-final",
        "imports": "portable-net45+win8+dnxcore50"
    },
    "Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final",
    "Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
    "BundlerMinifier.Core": "2.0.238",
    "Microsoft.Extensions.SecretManager.Tools": "1.0.0-preview2-final",
    "Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
        "version": "1.0.0-preview2-final",
        "imports": [
            "portable-net45+win8"
        ]
    }
},
"frameworks": {
    "netcoreapp1.0": {
        "dependencies": {
            "Microsoft.NETCore.App": {
                "version": "1.0.0",
                "type": "platform"
            }
        },
        "imports": [
            // "dotnet5.6",
            "dnxcore50",
            "portable-net45+win8"
        ]
    }
},
"buildOptions": {
    "define": [ "NETCORE"],
    "emitEntryPoint": true,
    "preserveCompilationContext": true
},
"runtimeOptions": {
    "gcServer": true
},
"publishOptions": {
    "include": [
        "wwwroot",
        "Views",
        "Areas/**/Views",
        "appsettings.json",
        "web.config"
    ]
},
"scripts": {
    "precompile": [ "dotnet bundle" ],
    "prepublish": [ "bower install" ],
    "postpublish": [
        "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%"
    ]
},

"tooling": {
    "defaultNamespace": "Wod6000"
}

}
Do you have an idea on what is wrong?

A: Our package is named WindowsAzure.Storage. Can you try that instead?


text:
Q: Is there any built-in behavior for Command + Delete (delete line right of cursor) in macOS? It is possible to press ⎇ Backspace on macOS in order to delete the previous word (left of the cursor), and ⌘ Backspace to delete the previous line (left of the cursor). If you have an external keyboard with a "delete" key (or the "forward delete key"), or are able to emulate the delete key via software, it is possible to press ⎇ Delete to delete the word to the right of the cursor. However, perhaps surprisingly, it is not possible to press ⌘ Delete in order to delete the line to the right of the cursor.
Now, I have only been able to make this possible by emulating a ⌘⇧→ and then a Backspace with BetterTouchTool. However, I want to avoid doing something like this because BTT does not work at a "low enough level" for me – that is to say, the action is not entirely reliable.
Is there any official macOS way to delete the line to the right of the cursor?

A: Apparently, macOS Supports Emacs style shortcuts...
What you are looking for is this: Control + K
Technically by holding the fn button with the backspace you get the actual Delete key, but on my mac at least it doesn't allow forward delete to the end of the line, but the above shortcut does.
This should work but doesn't:
fn + Command + Backspace
However you've got an answer now...
Source: Apple Questions


text:
Q: How to fix Android compatibility warnings I have an app that is targeting Android 9 and I noticed in the Google Play prelaunch report a new section called Android compatibility. This new section lists warnings or errors related to the usage of unsupported APIs. The following is one of the problems and is listed as a greylisted API. Can someone explain which is the unsupported API in this case? The usage seems to be coming from the Android support library and not my code.
StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V
    at android.os.StrictMode.lambda$static$1(StrictMode.java:428)
    at android.os.-$$Lambda$StrictMode$lu9ekkHJ2HMz0jd3F8K8MnhenxQ.accept(Unknown Source:2)
    at java.lang.Class.getDeclaredMethodInternal(Native Method)
    at java.lang.Class.getPublicMethodRecursive(Class.java:2075)
    at java.lang.Class.getMethod(Class.java:2063)
    at java.lang.Class.getMethod(Class.java:1690)
    at android.support.v7.widget.ViewUtils.makeOptionalFitsSystemWindows(ViewUtils.java:84)
    at android.support.v7.app.AppCompatDelegateImpl.createSubDecor(AppCompatDelegateImpl.java:685)
    at android.support.v7.app.AppCompatDelegateImpl.ensureSubDecor(AppCompatDelegateImpl.java:518)
    at android.support.v7.app.AppCompatDelegateImpl.onPostCreate(AppCompatDelegateImpl.java:299)
    at android.support.v7.app.AppCompatActivity.onPostCreate(AppCompatActivity.java:98)
    at android.app.Instrumentation.callActivityOnPostCreate(Instrumentation.java:1342)
    at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3002)
    at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:180)
    at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:165)
    at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:142)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1816)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:193)
    at android.app.ActivityThread.main(ActivityThread.java:6718)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

A: I suppose there nothing we can do right now, just to wait that they fixed these issues in AndroidX (as Support Library won't be updated anymore).
As mentioned here the methods use reflection, so why the warning.


text:
Q: Vertical text next to Horizontal Text react native? I am basically trying to create something like this:

Two boxes, the red one is vertical text and the blue one is horizontal text. The height of the red box should be the same as the blue box
I know that I can make text sideways like that by doing:
transform: [{ rotate: '-90deg'}]

on it, but I am having issues getting the rest to work correctly and having the boxes be aligned and sized properly. Any help would be greatly appreciated!

A: You should really try playing with the layout of React Native and post what you have tried but here's a sample code
<View style={{ height: 100, flexDirection: 'row'}}>
    <View style={{ flex: 1, backgroundColor: 'red', alignItems: 'center', justifyContent: 'center' }}><Text style={{transform: [{ rotate: '-90deg'}]}}>Value</Text></View>
    <View style={{ flex: 8, backgroundColor: 'blue', alignItems: 'center', justifyContent: 'center'}}><Text>Short Text</Text></View>
</View>

Result:

So little style pointers:

*

*flexDirection is by default column, so if you don't say its a row,
your views will stack vertically

*flex fills your screen in the flexDirection. I have 2 elements in my row with flex, so view1 will take up 1/9th of the space and view2 will take up 8/9th

*Alignitems will align your items in the direction of your flex, so horizontally if it's a row, vertically if it's a column.

*justifyContent aligns item in the crossaxis, so if your flex is a row, it will align items vertically

Ohey its the same as css

A: This fiddle should get you close: https://jsfiddle.net/1f8png0r/4/
I would stay away from styling using JS at all costs - (mainly $.css() and $.transform(), etc) It is much slower than CSS and CSS is much easier to maintain down the road -- especially if you can learn to style your selectors nicely!
To break it down a little - you want to create a .row a .left column and a .right column. Inside the .left column you want some text. You want to transform that text and rotate it -- rotate(90deg). I have never used the flex vs. inline-flex for this before now, but after needing to do horizontal text a handful of times I think it is the most robust IMHO.
The main focus is to create the grid as you need it, and to transform the content in the left column of the grid relative to the column (rather than relative to the row).
Hopefully this helps get you closer, cheers!
HTML

        LEFT

RIGHT

CSS
.row {
    width: 756px;
    height: 100px;
    border: 2px solid green;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
}

.right {
    width: 80%;
    height: 100%;
    background: red;
    display: inline-flex;
    justify-content: center;
    align-items: center;
}

.left {
    width: 20%;
    height: 100%;
    background: blue;
    position: relative;
    display: inline-flex;
    justify-content: center;
    align-items: center;
}

.left .h-text {
    position: absolute;
    transform: rotate(-90deg);
}

A: I implemented this way giving fixed height and some tweak with flex:
<View style={{flex: 1, paddingTop: 40}}>
        <View style={{ flexDirection: 'row', height: 100 }}>
          <View style={{ backgroundColor: 'red', justifyContent: 'center' }}>
            <Text
              style={{
                textAlign: 'center',
                transform: [{ rotate: '-90deg' }],
              }}>
              Value
            </Text>
          </View>

          <View
            style={{
              flex: 1,
              backgroundColor: 'aqua',
              alignItems: 'center',
              justifyContent: 'center',
            }}>
            <Text>Some text here....</Text>
          </View>
        </View>
      </View>

Here is the link to snack if you want to play around. Might have extra unnecessary styles. You can play with it in the snack.
I hope, you got the idea?
https://snack.expo.io/@roshangm1/humiliated-cookies

A: you could do this.
https://codepen.io/anon/pen/yGepmm
This is an aproach using flexbox. I use sass for clear syntax (no ; )
.sass
  div:first-child
    display: flex
    justify-content: center
    align-items: center
    transform: rotate(270deg)
    width: 100px
    background: blue
    color: white
    text-align: center
    vertical-align: middle

  div:nth-child(2)
    display: flex
    padding-left: 2rem
    background: lightgreen
    justify-content: start-end
    align-items: center
    color: grey
    height: 91px
    width: 100%

.html

  Value

  Lorem Ipsum

It's a very less code implementation, you will have to calculate for now, manually the:

*

*height of div:first-child (which it's the width because the
rotation).

*And the height div:nth-child(2).

Hope this helps


text:
Q: Using built-in barcode scanner in an Android app I'm building an app that among other features should be able to scan different barcodes and process the information obtained. The device, this app will be running on(Honeywell CT50) has a built-in scanner. I am aware of ZXing but for this app, it is necessary to be able to use the built-in scanner because it is much faster and easier to handle.
My question is how to properly integrate such a built-in scanner in my app. When the scanner reads a barcode, the corresponding numbers will always be sent to whatever the device is currently doing. This means that for example if I create a textfield and set the focus to it, as soon as I scan something, the numbers will be copy-pasted right into this textfield, meaning that I do not need to somehow programmatically access the scanner. However, this also means that my app will not know when something has been scanned successfully. I want to prevent, having an OK button next to this textfield so I need to tell the app when it should start processing the data entered. I can not do this via a TextChangedListener because basically, the device pastes number by number of the barcode into the textfield instead of pasting the whole thing at once so the event would execute right after the first digit.
I know that it is possible (at least on this device) to define a prefix and a suffix for the built-in scanner so I could for example tell it to always push the ENTER key each time a barcode is read and filter this by using a TextChangedListener. The problem with this is that there are other pre-installed apps on this device too which will not work properly if changes like this are made so unfortunately, this is not an option.
All in all I'm not even sure if I'm approaching this in the right way. It seems like it would be required that I somehow catch certain events fired by the built-in scanner in the program code of my app but I do not know how.

A: I think u need to use their SDK(software):
http://country.honeywellaidc.com/EN-GB/PAGES/Product.aspx?category=&cat=HSM&pid=dolphinct50


text:
Q: is this technique ok with frameworks: storing all texts in seperate plain text file? I am considering to use a php framework (never used one before), I know I have to abandon the way I am used to work (I can deal with this), among many concerns a first thing that comes in my mind is this:
I have two techniques I like to use (have used them for years)..

*

*I always use index.php?somePage.php as href so never loads another page other that index.php, then index.php includes the somePage.php

*I always used to store all texts, any text, titles, button names, link names, stories, articles, anything, in a single (or more) files or in GLOBALS array (depending on size).
I want to ask is this aproach wrong, is there any better way?
Second, from what I have read freamworks have some rules, does my approach create some conflict? I am thinking of KISS_MVC framework cause it declares to be easy for framework beginers.
I have no experience with frameworks and I am concerned, about all this, I can't wait for the day I will feel like home with using a framework.
Thank you all in advance!

A: *

*That pattern is known as front controller - it gets all requests and routes them internally (not based on file loaded). That pattern is fine, it should look like /index.php/whatever to which you can then patch over with .htaccess to make /whatever (Examine $_SERVER['REQUEST_URI']).

*Database is a good place to store large amounts of text. Files you create rarely are - they offer none of the advantages of using a database. $GLOBALS rarely is a good place to store data. You generally should keep as little as possible available globally. You can make a registry class to store global stuff if you need.
The best way to know what does and doesn't work with a framework is to try and get familiar with a popular one such as Zend, Kohana, Yii, etc.


text:
Q: Add images dynamically based on random number I work on a simple mathematics learning programs for my 4 year old daughter with the help of images.
Based on a random number that we can call X, a for loop will run X number of times and print an image X number of times. The image will be selected from the list by a random number also that we can call Y.
If X is 2 the image Y will be printed to the screen 2 times using for loop.
The problem is I do not know how to do. :P
If anyone can help me with this I would be grateful! I'm using python 3.2 and Tkinter.
Here is example code for my image list.
    self.imageListRegular = []
    self.imageListRegular.append(ImageTk.PhotoImage(file="Bilder/Bird-icon.png"))
    self.imageListRegular.append(ImageTk.PhotoImage(file="Bilder/elephant-icon.png"))
    self.imageListRegular.append(ImageTk.PhotoImage(file="Bilder/fish-icon.png"))
    self.imageListRegular.append(ImageTk.PhotoImage(file="Bilder/ladybird-icon.png"))
    self.imageListRegular.append(ImageTk.PhotoImage(file="Bilder/zebra-icon.png"))

Sincerely, Robert

A: use the python random module
import random
image = random.choice(self.imageListRegular) #this is your 'Y' variable
times = random.randint(1, 4) #this is your 'X' variable

Then do you for loop, which I imagine looks something like this (I don't have Tkinter, so I can't test the code. This is derived from a sample here):
import Tkinter
root = Tkinter.Tk()
for i in xrange(times):
    Tkinter.Label(root, image=image).pack()
root.mainloop() # Start the GUI

random.choice returns a random element in a given sequence, so random.choice(["apples", "bananas", "oranges"]) would return either "apples", "bananas", or "oranges"
random.randint(low, high) will return a random integer between low and high, including low and high. So if you wanted to display the image between 1 and 4 times, random.randint(1, 4) would do the trick.


text:
Q: What is the opposite of PyMODINIT_FUNC in Python 2.x C extension modules? I need to import one of the core modules (datetime) inside my C extension module since I want to return a datetime.date from some functions of my module.
It appears that Python C extension modules have no complement for the PyMODINIT_FUNC upon destruction.
Question: What can I do short of importing the required module time and time again in every call inside my C extension module and then dereferencing it at the end of the call(s) again?
Rationale: Basically I fear that this (importing it over and over again) creates an unnecessary overhead, because from my understanding of the documentation dereferencing it means that the garbage collector can come around and collect it, so next time PyImport_ImportModule would have to be called again.
Somewhat related questions:

*

*Import and use standard Python module from inside Python C extension

*Making a C extension to Python that requires another extension


text:
Q: Pageshow loads Google maps only the first time the question is very easy; if I show the page "map1", the google map is loaded only one time. In my web application I changed the value of latitute e longitude, but the map showed is ever the first. Why don't loads a new position every time?
$(document).on('pageshow', '#map1', function () {

    var lat = (localStorage.getItem('lat'));
    var lng = (localStorage.getItem('lng'));

    console.log(lat + ',' + lng);
    alert("!");

    $('#map_canvas2').gmap({
        'center': '' + lat_det + ',' + lng_det + '',
        'zoom': 10,
        'disableDefaultUI': true,
        'callback': function () {
            var self = this;
            self.addMarker({
                'position': this.get('map').getCenter()
            }).click(function () {
                self.openInfoWindow({
                    'content': 'Position'
                }, this);
            });
        }
    });

    map_element2 = document.getElementById("map_canvas2");

    var mapwidth2 = $(window).width();
    var mapheight2 = $(window).height();
    $("#map_canvas2").height(mapheight2);
    $("#map_canvas2").width(mapwidth2);

    google.maps.event.trigger(map_element2, 'resize');

});

A: If I understood you correctly you are doing it in a wrong way.
Your map is created first time pageshow event is triggered and it will stay there unless you remove it manually or change current marker position.
There are 2 possible solutions to this problem.
Solution 1
On map pagehide event remove current map
$(document).on('pagehide', '#map1', function () {
    $.mobile.activePage.find('#map_canvas2').empty();
});

It will be recreated next time you vidit your page.
Solution 2
Less invasive solution would be to save your marker as a global variable and change it (if it exist if not create a new one) like this:
function changeMarkerPosition(marker) {
    var latlng = new google.maps.LatLng(-24.397, 140.644);
    marker.setPosition(latlng);
}

A: Ok, i solved it issues loading map on a externale page by:
<a href="map.html" rel="external" data-ajax="false" >

In this modality the code work perfectly.
Hope this help somebody.


text:
Q: How do I install Java 12 on Mac OSX now that Java 13 is out? I cannot find Java 12 to install anymore, just Java 13. But Gradle does not support Java 13 yet, so I need to use 12 as an alternative for now. When I look in Homebrew using brew search java I find all sort of javas: Java 11, Java 6 (!) and Java, which used to be Java 12 but is now Java 13.
Any idea how I can get Java 12?

A: Solution 1
You can get Java 12 from the AdoptOpenJDK Homebrew tap. (a tap is a formula repository) And the AdoptOpenJDK team maintains different versions of JDK in this repo.
brew tap AdoptOpenJDK/openjdk
brew cask install adoptopenjdk12

Solution 2
java is a formula defined in the repo Homebrew-cask. You can search and find the history file java.rb where Java 12 was defined within, and install Java 12 with the URL to that specific history file.
The following command installs vanilla OpenJDK (not the AdoptOpenJDK) 12.0.2.
brew cask install https://raw.githubusercontent.com/Homebrew/homebrew-cask/26203ad42b40c4bc3baa2f6cfa8469f1245b7fbc/Casks/java.rb


text:
Q: redirect is not working in both php & javascript I had write some script, i tried Header & window.location both for redirection, but in this page redirect is not working...in other pages javascript window.location is working perfectly...
$insertquery = mysql_query("INSERT INTO members(UserName, Password, FirstName, LastName, Address, ContactNo, Url, Birthdate, Gender, profImage,curcity, age, married_status, college_name, batch, qualification, specilization, public_message)VALUES('$login','$password','$fname','$lname','$address','$cnumber','$email','$bday','$gender','$propic','$address','$age','$married_status','$coll','$batch','$qua','$specilization','$public_message')") or die(mysql_error());

 /*$page = "signup-success.php";
echo '';
echo "login success";*/

if($insertquery){
  $from = "admin@doctorskynet.com    "; // sender
  $subject = "Thank You For Registering Doctorskynet.com";
  $message = "Welcome to Doctorskynet.com"."
";
  $message .= "Username:".$login."
";
  $message .= "Password:".$password."
";
  $message = "Please click below link to activate your account
";

  // send mail
  //$mail = mail($email,$subject,$message,"From: $from\n");
  session_start();

  //Create query
  $qry="SELECT * FROM members WHERE UserName='clean($login)' AND Password='$password'";
  $result=mysql_query($qry);

  //Check whether the query was successful or not
  if($result) {
    if(mysql_num_rows($result) > 0) {
      //Login Successful
      session_regenerate_id();
      $member = mysql_fetch_assoc($result);
      $_SESSION['SESS_MEMBER_ID'] = $member['member_id'];
      $_SESSION['SESS_FIRST_NAME'] = $member['FirstName'];
      $_SESSION['SESS_USERNAME'] = $member['FirstName'].'-'.$member['LastName'];
      $_SESSION['SESS_LAST_NAME'] = $member['profImage'];

      $online = 1;
      //Update query
      mysql_query("UPDATE members SET online = $online WHERE member_id='".$_SESSION['SESS_MEMBER_ID'] ."'");

      session_write_close();
      $page = "Home.php";
      echo '';

      /*header("location: Home.php");
      exit();*/
    }
  }
}

A: When using header() you're supposed to specify a full URL and I think Location needs a capital L:
header("Location: http://mydomain.com/Home.php");
exit;

A: The below solution is will help for you


text:
Q: JMenuItem with both ActionListener and MouseListener Well, JMenuItem is designed to work with ActionListener, but sometimes it would be nice to have a right click option as well.
Having both an ActionListener and a MouseListener on a JButton is no problem, but I don't manage to get this done for a JMenuItem. The following code shows a solution to distinguish between left and right click in applying a MouseListener, but I would prefer to handle the left click in a regular ActionListener and only the right click in a MouseListener. Any suggestions?
import java.awt.event.*;
import javax.swing.*;

public class RMBClickOnMenuItem extends JFrame implements ActionListener {
  JMenuItem item1, item2, item3;

  public RMBClickOnMenuItem() {
    super("RMBClickOnMenuItem");
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    setSize(310, 200);
    setLocationRelativeTo(null);
    JMenuBar menuBar= new JMenuBar();
    setJMenuBar(menuBar);
    JMenu menu= new JMenu("Menu");
    menuBar.add(menu);
    item1= new JMenuItem("Standard");
    item1.addActionListener(this);
    menu.add(item1);

    item2= new JMenuItem("MouseListener");
    MouseListener[] allMouseL= item2.getMouseListeners();
    for (MouseListener ml: allMouseL)
      item2.removeMouseListener(ml);
    item2.addMouseListener(new MouseAdapter() {
      public void mouseClicked(MouseEvent e) {
        if (SwingUtilities.isLeftMouseButton(e))
          System.out.println("Left click");
        else if (SwingUtilities.isRightMouseButton(e))
          System.out.println("Right click");
        menu.setPopupMenuVisible(false);
      }
    });
    menu.add(item2);

    item3= new JMenuItem("Action- and MouseListener");
    item3.addActionListener(this);
    allMouseL= item3.getMouseListeners();
    for (MouseListener ml: allMouseL)
      item3.removeMouseListener(ml);
    item3.addMouseListener(new MouseAdapter() {
      public void mouseClicked(MouseEvent e) {
        if (SwingUtilities.isRightMouseButton(e)) {
          System.out.println("Right click on item 3");
        }
        menu.setPopupMenuVisible(false);
      }
    });
    menu.add(item3);
    setVisible(true);
  }

  public static void main(String args[]) {
    SwingUtilities.invokeLater(RMBClickOnMenuItem::new);
  }

  public void actionPerformed(ActionEvent event) {
    JMenuItem menuItem= (JMenuItem)event.getSource();
    System.out.println(menuItem.getText());
  }

}


text:
Q: Decode base64 in python (for example :: Q29ycsOqYQ== into Corrêa) I have base64 encoded values like : Q29ycsOqYQ==
and i tried this code, to decode it to Corrêa.
import base64
encoded = ': Q29ycsOqYQ=='
data = base64.b64decode(encoded)
print(data)

i get this result b'Corr\xc3\xaaa'
but the desired result is Corrêa.

A: ê is not standard ascii encoding. If you actually print the data in python2.7 it will give you what you want.

A: You're printing the bytes. Turn it into a string
import base64
encoded = 'Q29ycsOqYQ=='
data = base64.b64decode(encoded)

s = str(data, encoding='utf-8')
print(s)

Output:
Corrêa