text:
Q: Mother Board does not detect Ethernet Driver I have an Intel motherboard model DH61WW and Intel i3 processor. When I tried to install Windows Server 2008 64 bit Enterprise Edition, I successfully installed it without any errors. After installing it, I tried to connect to the internet with my ethernet jack, then I realized that I didn't have an Ethernet net driver installed ... so I tried to install from INTEL download center, but the driver says that "R" family ethernet is not available where I installed this driver in Windows 7.
I'm stuck ... does anyone have any ideas?
In Windows Server 2008
http://dl.dropbox.com/u/78820127/Windows%20SErver%202008.png

A: Have you tried this
on the intel site for your motherboard.

for your motherboard
the lan driver  PROWin8_64_18.0.exe

Added
It is a question people have on some forums. How to get drivers for Windows 2008 for that motherboard. Looks like, indeed,  Windows 2008 is not listed on the intel site for your Motherboard. But, there's hope.
This link has sreenshots specifically for dealing with the Ethernet driver. It looks from this webpage(on sparebot.com) like the driver is already there in windows server 2008, and it's just a matter of pointing Windows 2008 server to it- Intel 82579LM Gigabit Network adapter.  device manager..right click the ethernet adapter -under "other devices", then..update driver software..pick.. then choose browse rather than search. and network adapters and point to that.
http://sparebot.com/2013/01/20/how-to-manually-install-dh61ww-intel-desktop-board-lan-driver-for-windows-server-2008/

A: Use a new  adapter( ie. D-Link DFE-520TX PCI fast ethernet adapter), connect it via the PCI slot. The system will automatically detect it.


text:
Q: React memo with navigation drawer in react native I am using navigation drawer in react native & on dashboard initial route i have javascript graph & when i navigate to other pages & come back i want to optional refresh it. It depends from which page user is coming from for example if user navigates to detail page & come back graph should not refresh & incase user navigates to come other screen like help screen & come back it should not refresh.
I found a way to not the refresh routes were to put unmountInactiveroutes in drawer options, but then all routes where not refresh which was hard to maintain.
Another option i tried using memo to remember dashboard component state but it is not working.
Any clue will be appreciated.
const Drawer = createDrawerNavigator({
  Home: {
    screen: Home
  },
.....
  SearchResultPage :{
    screen: SearchResultPage
  }
}, {
  initialRouteName: AppConstants.NAV_HOME,
  //unmountInactiveRoutes: true,
  navigationOptions: {
    headerVisible: false
  },
  headerMode: AppConstants.NONE,
  contentComponent: props => <Sidebar {...props}/>
})

const AppNavigator = createStackNavigator({
  Drawer: {
    screen: Drawer,
    navigationOptions: {
      header: null
    }
  }
}, {
  initialRouteName: AppConstants.NAV_DRAWER,
  //unmountInactiveRoutes: true,
  headerMode: AppConstants.NONE
})

let AppContainer = createAppContainer(AppNavigator);

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to uninstall ANDROID CAR EMULATOR Default app I'm trying to uninstall default android car emulator app like Music,Radio,clock and calendar.i'm able to build and lunch the ANDROID CAR EMULATOR.(reference-http://www.embien.com/blog/building-android-car-emulator/)
my question is how to uninstall above mention default app form the android car emulator.

A: I see the car emulator is built as a regular target, so the same rules should apply.
If you need to remove a system app from a target, you need to remove its package name from .mk files, which are sort of make files for AOSP. For example https://android.googlesource.com/device/generic/car/+/refs/tags/android-8.1.0_r65 which adds combos aosp_car_emu_x86-userdebug etc (see vendorsetup.sh there)
aosp_car_x86.mk includes other files:
$(call inherit-product, device/generic/car/common/car.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_x86.mk)

common/car.mk is the main file adding/enabling car-specific things. Most likely the apps are specified in PRODUCT_PACKAGES, not in car.mk but in some other .mk files included via product/aosp_x86.mk - many levels of inclusions there, prepare to be patient.
As far as I know, there is no special feature in AOSP to exclude packages (only to include. there's a feature (I do not remember exactly) to specify in a module that it overrides some other modules (that you want to remove), but generally it may cause some other conflicts).
So you need to find package name to which the app belongs too, and remove it from .mk files (or use some bare/minimalistic target with inclusion of your own apps). Use mgrep command to find where a package is included.
To find package name of an app, you need to find its .mk file, and it is not easy too. resgrep or mangrep may help. See https://elinux.org/Android_Build_System


text:
Q: Bayesian networks: calculating likelihood of data dgiven probabilities and network structure I'm trying to understand how to calculate the likelihood of a combination of binary variables given the network structure and probabilities seen here:
Given a bayesian network as follows:
As far as I understand, the decomposition of the network would be as follows:
$$P(a,b,c,d,e) = P(A) * P(B) * P(C|A, B) * P(D|C) * P(E|C)$$
However applying this to the data set A=0, B=0, C=0, D=0, E=1 (as in the first example) gives me
$$= (1-0.1) * (1-0.2) * (1-0.2) * (1-0.2) * 0.8 = 0.368.$$
Have I mis-represented the equation, or am I mis-reading the probabilities data?
EDIT:
I think I've resolved it: given the data entry was complete (except for A & C) the probability of the dataset did not depend on the values of B, D,E. Therefore the probability of the data vector is P(A) * P(C|A, B). Is this correct?

A: A bit late, but...
You have the network factorisation correct, and so, letting $X$ be the event that one of the four pentuples happens
$$\begin{align}\mathsf P([0,0,0,0,1])&={\small\mathsf P(A{=}0)\,\mathsf P(B{=}0)\,\mathsf P(C{=}0\mid A{=}0,B{=}0)\,\mathsf P(D{=}0\mid C{=}0)\,\mathsf P(E{=}1\mid C{=}0)}\\ &= (1-0.1)\cdot(1-0.2)\cdot(1-0.2)\cdot(1-0.2)\cdot0.1\\&=0.04608\\\mathsf P([0,0,1,0,1])&= (1-0.1)\cdot(1-0.2)\cdot 0.2\cdot(1-0.9)\cdot 0.8\\&= 0.01152\\\mathsf P([1,0,0,0,1])&=0.1\cdot(1-0.2)\cdot (1-0.6)\cdot(1-0.2)\cdot0.1\\&=0.00256\\\mathsf P([1,0,1,0,1])&=0.1\cdot(1-0.2)\cdot0.6\cdot(1-0.9)\cdot0.8\\ &= 0.00384\end{align}$$
Thus $\mathsf P([0,0,0,0,1]\mid X)=\dfrac{0.04608}{0.04608+0.01152+0.00256+0.00384}=0.7200$
And thusly is the last column of the "data" table generated...


text:
Q: how to get the values correctly from the input tag? How would I get input tag values in the follow situation?
I'm having a problem selecting the correct value from the input, currently I'm only getting the first value = text_1, and I do not know why I'm not picking up the others ...
this is a prototype to select values in a panel, in which the user tries to use the mouse to select which is the most interesting for him.
I only want the one value clicked after the button
Can someone help me?

$(document).ready(function(){
    $("#openButton").click(function(){
        alert("Value: " + $("div > :submit").val());
        });
    });
.item {
    flex: 1;
    text-align: center;
    font-size: 1.5em;
}

.flex {
    flex: 0;
}

.imagem-chave{
    padding-top: 100px;
    margin-bottom: 300px;
    display:flex;
    justify-content: space-evenly;
}

.container-grande_img{

    border-top: 2px solid #0000FF;
    border-bottom: 2px solid #0000FF;
    border-left: 2px solid #0000FF;
    border-right: 2px solid #0000FF;
    margin-top: 20px;
    padding-bottom: 5px;
    width: 30%;
    height: 50%;
    display: inline-block;
    justify-content: space-around;
    flex-wrap: wrap;

}
.botao{
    margin-top:-30px;
}

.legend {
    width: 60px;
    font-size:14px;
    -moz-box-sizing: border-box;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    color:#00004d;
}

.label {
    display: inline;
    padding: .2em .6em .3em;
    font-size: 50%;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: .25em;
}

div.inputbutton {
position: relative;
display: inline-block;

}

div.inputbutton input {
background: url('/img/livre.png') no-repeat;
cursor: pointer;
width: 100px;
height: 130px;
border: none;
background-size: 100%;
}

span.text {
position: absolute;
bottom: 10%;
left: 5px;
width: 100%;
font-size: 15px;
color: white;
}
#myNavbar{
    font-size: 15px;
}

                        TEXT_1
                            <input type="submit" class="btTxt submit" value="TEXT_1"  id="TEXT_1">

                        TEXT_2
                            <input type="submit" class="btTxt submit" value="TEXT_2"  id="TEXT_2">

                        TEXT_3
                            <input type="submit" class="btTxt submit" value="TEXT_3"  id="TEXT_3">

                        TEXT_4
                            <input type="submit" class="btTxt submit" value="TEXT_4"  id="TEXT_4">

                    <button type="Liberar" id="openButton" class="btn btn-primary" >open key</button>

A: I was misreading the question. If you're going to use multiple buttons to select an option, you should be using radio buttons:
<input type="radio" name="some_option" value="TEXT_1" id="option_TEXT_1" />
TEXT_1
<input type="radio" name="some_option" value="TEXT_2" id="option_TEXT_2" />
TEXT_2
<input type="radio" name="some_option" value="TEXT_3" id="option_TEXT_3" />
TEXT_3
<input type="radio" name="some_option" value="TEXT_4" id="option_TEXT_4" />
TEXT_4
<button type="Liberar" id="openButton" class="btn btn-primary" >open key</button>

In the JS:
$("#openButton").click(function () {
    alert(document.querySelector(
            'input[name="some_option"]:checked').value);
}

If you really want to use buttons, <input type=submit> elements are not the best tool for this because the user might be clicking a bunch of them on the same page:
<button class="some_option" id="option_TEXT_1">TEXT_1</button>
<button class="some_option" id="option_TEXT_2">TEXT_2</button>
<button class="some_option" id="option_TEXT_3">TEXT_3</button>
<button class="some_option" id="option_TEXT_4">TEXT_4</button>
<button type="Liberar" id="openButton" class="btn btn-primary" >open key</button>

And in the JS:
var option = "";
$("button.some_option").click(function () {
    option = $(this).attr("id");
}

$("#openButton").click(function () {
    alert(option);
}

Original answer, where I thought you were asking for some text:
According to the documentation for val(), it only gets the value from the first element (if you call it on a set of multiple elements).
Consider using each() with a callback.

A:

$(document).ready(function() {
  $("#openButton").click(function() {
    $('input[type="submit"]').each(function() {
      alert("Value: " + $(this).val());
    });
  });
});
body,
h1,
h2,
h5,
p,
ul,
li,
a {
  margin: 0px;
  padding: 0px;
}

body {
  font-family: "Nunito", Helvetica, Arial;
  color: #222222;
}

ul {
  list-style: none;
}

a {
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

* {
  box-sizing: border-box;
}

.menu-bg {
  background: #00004d;
}

.menu {
  max-width: 2000px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  padding-top: 10px;
  align-items: center;
  margin-right: 250px
}

.menu a {
  color: #FFFFFF;
  font-size: 15px;
}

.menu-logo a {
  font-size: 3em;
  font-weight: bold;
  margin: 0 10px;
  float: left;
}

.menu-logo img {
  padding-left: 0px;
  width: 159px;
  height: 24px;
}

.column {
  min-height: 200px;
  flex-direction: column;
}

.flex-start {
  justify-content: flex-start;
}

h1 {
  text-align: center;
  margin: 50px 0 0 0;
  font-size: 1.25em;
  font-weight: normal;
  justify-content: center;
  width: 100%;
}

.center {
  justify-content: center;
}

.container-grande {
  max-width: 1000px;
  max-height: 600px;
  margin: 40px auto;
  display: flex;
  border: 0px solid #ccc;
  padding: 00px 00px 500px 00px;
  background: #F5F5F5;
}

.container-grande item {
  max-width: 420px;
  margin: 0 auto;
  justify-content: center;
}

.container-grande h1 {
  border-bottom: 0px solid #ccc;
  text-align: left;
  flex: 1 1 400px;
  font-size: 1.25em;
}

.container-cor {
  width: 97%;
  border-bottom: 1px solid;
  margin-left: 15px;
}

.item {
  flex: 1;
  text-align: center;
  font-size: 1.5em;
}

.flex {
  flex: 0;
}

.imagem-chave {
  padding-top: 100px;
  margin-bottom: 300px;
  display: flex;
  justify-content: space-evenly;
}

.container-grande_img {
  border-top: 2px solid #0000FF;
  border-bottom: 2px solid #0000FF;
  border-left: 2px solid #0000FF;
  border-right: 2px solid #0000FF;
  margin-top: 20px;
  padding-bottom: 5px;
  width: 30%;
  height: 50%;
  display: inline-block;
  justify-content: space-around;
  flex-wrap: wrap;
}

.botao {
  margin-top: -30px;
}

.legend {
  width: 60px;
  font-size: 14px;
  -moz-box-sizing: border-box;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  color: #00004d;
}

.label {
  display: inline;
  padding: .2em .6em .3em;
  font-size: 50%;
  font-weight: 700;
  line-height: 1;
  color: #fff;
  text-align: center;
  white-space: nowrap;
  vertical-align: baseline;
  border-radius: .25em;
}

div.inputbutton {
  position: relative;
  display: inline-block;
}

div.inputbutton input {
  background: url('/img/livre.png') no-repeat;
  cursor: pointer;
  width: 100px;
  height: 130px;
  border: none;
  background-size: 100%;
}

span.text {
  position: absolute;
  bottom: 10%;
  left: 5px;
  width: 100%;
  font-size: 15px;
  color: white;
}

#myNavbar {
  font-size: 15px;
}

.navbar-header .navbar-toggle {
  background: white;
  margin-right: -50px;
  margin-bottom: -20px;
}

.navbar-header .navbar-toggle .icon-bar {
  background: black;
}

.menu-nav ul li a:hover {
  background: transparent;
  color: grey;
}

.menu-nav ul li a:active {
  background: transparent;
  color: grey;
}

.navbar-default {
  background-color: #00004d;
  border-color: #00004d;
  margin-right: 50px;
}

.navbar-default .navbar-brand {
  color: #ecf0f1;
}

.navbar-default .navbar-brand:hover,
.navbar-default .navbar-brand:focus {
  color: #ecdbff;
}

.navbar-default .navbar-text {
  color: #ecf0f1;
}

.navbar-default .navbar-nav>li>a {
  color: #ecf0f1;
}

.navbar-default .navbar-nav>li>a:hover,
.navbar-default .navbar-nav>li>a:focus {
  color: #ecdbff;
}

.navbar-default .navbar-nav>.active>a,
.navbar-default .navbar-nav>.active>a:hover,
.navbar-default .navbar-nav>.active>a:focus {
  color: #ecdbff;
  background-color: #00004d;
}

.navbar-default .navbar-nav>.open>a,
.navbar-default .navbar-nav>.open>a:hover,
.navbar-default .navbar-nav>.open>a:focus {
  color: #ecdbff;
  background-color: #00004d;
}

.navbar-default .navbar-toggle {
  border-color: #00004d;
}

.navbar-default .navbar-toggle:hover,
.navbar-default .navbar-toggle:focus {
  background-color: #00004d;
}

.navbar-default .navbar-toggle .icon-bar {
  background-color: #ecf0f1;
}

.navbar-default .navbar-collapse,
.navbar-default .navbar-form {
  border-color: #ecf0f1;
}

.navbar-default .navbar-link {
  color: #ecf0f1;
}

.navbar-default .navbar-link:hover {
  color: #ecdbff;
}

.tam {
  height: 50%;
  width: 1200px;
  background-color: powderblue;
  margin: auto;
}

.tam_Cadastro {
  width: 1200px;
  background-color: powderblue;
  margin: auto;
}

.gerarPDF {
  text-align: center;
  margin-bottom: 15px;
  margin-top: 15px;
}

@media (max-width: 825px) {
  .navbar-header {
    float: none;
  }
  .navbar-left,
  .navbar-right {
    float: none !important;
  }
  .navbar-toggle {
    display: block;
  }
  .navbar-collapse {
    border-top: 1px solid transparent;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
  }
  .navbar-fixed-top {
    top: 0;
    border-width: 0 0 1px;
  }
  .navbar-collapse.collapse {
    display: none!important;
  }
  .navbar-nav {
    float: none!important;
    margin-top: 7.5px;
  }
  .navbar-nav>li {
    float: none;
    display: block;
  }
  .navbar-nav>li>a {
    padding-top: 10px;
    padding-bottom: 10px;
  }
  .collapse.in {
    display: block !important;
  }
}

    Text_1
    <input type="submit" class="btTxt submit" value="Text_1" id="Text_1">

    Text_2
    <input type="submit" class="btTxt submit" value="Text_2" id="Text_2">

    Text_3
    <input type="submit" class="btTxt submit" value="Text_3" id="Text_3">

    Text_4
    <input type="submit" class="btTxt submit" value="Text_4" id="Text_4">

  <button type="Liberar" id="openButton" class="btn btn-primary">Open Key</button>

A: Try this in your js:
$(document).ready(function(){
 var lastClicked = null;
 $('.btTxt').click(function(event) {
          lastClicked = event.target
    });

 $("#openButton").click(function(){
    alert("Value: " + $(lastClicked).val());
    });
});


text:
Q: Are the commas compulsory here? There are many similar sentences, such as:

On Christmas Eve, townspeople...
After lunch, he often...
One January morning, we were returning from...

Are the commas compulsory here?
Or can they be omitted?
Or where such information can be found?

A: Purdue Owl suggests that you should not use a comma after an introductory prepositional phrase of fewer than five words. According to this, the commas in your first two examples should be left out.
This length quantification "of fewer than five words" is clearly over-precise. Think of this as a guideline, and use your judgment. Very few people are going to object if you leave out commas on some five-word prepositional phrases, or include them on some three- or four-word phrases.
And note that your last example – "One January morning" – isn't a prepositional phrase and, according to Purdue Owl, needs the comma.


text:
Q: Why wrapping a generic method call with Option defers ClassCastException? Lets say I have an array like this*:
val foo: Any = 1 : Int
Option(foo.asInstanceOf[String])

which fails for obvious reason:
// java.lang.ClassCastException: java.lang.Integer cannot be cast to
// java.lang.String
// ... 48 elided

Next lets consider a following class:
case class DummyRow() {
  val foo: Any = 1 : Int
  def getAs[T] = foo.asInstanceOf[T]
  def getAsOption[T] = Option(foo.asInstanceOf[T])
}

As far as I can tell getAs should behave the same way as the previous apply followed by asInstanceOf.
Surprisingly it is not the case. When called alone it throws an exception:
DummyRow().getAs[String]
// java.lang.ClassCastException: java.lang.Integer cannot be cast to
// java.lang.String
// ... 48 elided

but when wrapped with Option succeeds:
val stringOption = Option(DummyRow().getAs[String])
// Option[String] = Some(1)

DummyRow().getAsOption[String]
// Option[String] = Some(1)

and fails only when I try to access wrapped value:
stringOption.get
// java.lang.ClassCastException: java.lang.Integer cannot be cast to
// java.lang.String
// ... 48 elided

So what happens here? It seems to be limited ClassCastException so I guess it is related to some ugly thing like type erasure.

* Any and asInstanceOf are there to mimic a behavior of the 3rd party code so please lets not dwell on that.
** Tested in Scala 2.10.5, 2.11.7
*** If you're interested in the context you can take a look at Using contains in scala - exception
**** Other relevant questions linked in the comments:

*

*Why does `.asInstanceOf` sometimes throw, and sometimes not?,

*Why asInstanceOf doesn't throw a ClassCastException?

A: Below is a simplified version of your problem with an additional case for Any
def getAs[T] = (1:Int).asInstanceOf[T]

//blows up
getAs[String]

//blows up
def p(s:String): Unit = {}
p(getAs[String])

//works
def p[T](s:T): Unit = {}
p(getAs[String])

//works
def p(s:Any): Unit = {}
p(getAs[String])

Because you create a method with a generic parameter, the runtime doesn't need to "touch" the value because it does not care. Generic will be treated as Any/Object at runtime.

A: Take a look at the following (slightly edited for reading purposes) REPL session:
scala> class Foo(foo: Any) {
     | def getAs[T] = foo.asInstanceOf[T]
     | def getAsString = foo.asInstanceOf[String]
     | }
defined class Foo

scala> :javap Foo
  Size 815 bytes
  MD5 checksum 6d77ff638c5719ca1cf996be4dbead62
  Compiled from "<console>"
public class Foo
{
  public <T extends java/lang/Object> T getAs();
    flags: ACC_PUBLIC
    Code:
      stack=1, locals=1, args_size=1
         0: aload_0
         1: getfield      #11                 // Field foo:Ljava/lang/Object;
         4: areturn
      LocalVariableTable:
        Start  Length  Slot  Name   Signature
               0       5     0  this   LFoo;
      LineNumberTable:
        line 12: 0
    Signature: #35                          // <T:Ljava/lang/Object;>()TT;

  public java.lang.String getAsString();
    flags: ACC_PUBLIC
    Code:
      stack=1, locals=1, args_size=1
         0: aload_0
         1: getfield      #11                 // Field foo:Ljava/lang/Object;
         4: checkcast     #17                 // class java/lang/String
         7: areturn
      LocalVariableTable:
        Start  Length  Slot  Name   Signature
               0       8     0  this   LFoo;
      LineNumberTable:
        line 13: 0
}

You can see in the bytecode of getAsString that a checkcast instruction is executed when casting to a String. On the other hand in getAs[T] no such instruction gets executed even though there is a cast in the code. The reason for that is that T gets erased to Any at runtime, so that would simply become a cast to Any (which would never fail). So casting to a type parameter is only necessary for the compiler's sake, not the JVM's. So no casting has to happen when you wrap that call in Option which is generic too. It's only when you want to get the value out of the Option and treat it as a String that a cast is executed and an exception is thrown.
scala> class Bar() {
     | def getString: String = new Foo(3).getAs[String]
     | def get[T]: T = new Foo(3).getAs[T]
     | }
defined class Bar

scala> :javap Bar
  Size 1005 bytes
  MD5 checksum 4b7bee878db4235ca9c011c6f168b4c9
  Compiled from "<console>"
public class Bar
{
  public java.lang.String getString();
    flags: ACC_PUBLIC
    Code:
      stack=3, locals=1, args_size=1
         0: new           #9                  // class Foo
         3: dup
         4: iconst_3
         5: invokestatic  #15                 // Method scala/runtime/BoxesRunTime.boxToInteger:(I)Ljava/lang/Integer;
         8: invokespecial #19                 // Method Foo."<init>":(Ljava/lang/Object;)V
        11: invokevirtual #23                 // Method Foo.getAs:()Ljava/lang/Object;
        14: checkcast     #25                 // class java/lang/String
        17: areturn
      LocalVariableTable:
        Start  Length  Slot  Name   Signature
               0      18     0  this   LBar;
      LineNumberTable:
        line 13: 0

  public <T extends java/lang/Object> T get();
    flags: ACC_PUBLIC
    Code:
      stack=3, locals=1, args_size=1
         0: new           #9                  // class Foo
         3: dup
         4: iconst_3
         5: invokestatic  #15                 // Method scala/runtime/BoxesRunTime.boxToInteger:(I)Ljava/lang/Integer;
         8: invokespecial #19                 // Method Foo."<init>":(Ljava/lang/Object;)V
        11: invokevirtual #23                 // Method Foo.getAs:()Ljava/lang/Object;
        14: areturn
      LocalVariableTable:
        Start  Length  Slot  Name   Signature
               0      15     0  this   LBar;
      LineNumberTable:
        line 14: 0
    Signature: #51                          // <T:Ljava/lang/Object;>()TT;
}

As you can see checkcast is executed after getAs instead of during, and only in a non-generic context.


text:
Q: How to delete a excel file in Sharepoint Online using VBA As per title, I am trying to write code that deletes an excel file from a sharepoint online folder, using only vba.
Since I am very new to VBA, I have no idea where to begin with

A: Something as the following code should work.
Please note that the Kill function does not move the file to the trash bin. Use with care!
Sub RemoveSharePointFile()

Dim folder As String, file As String, fulladdress As String

folder = "https://example.sharepoint.com/sites/test/"
file = "test.xls" 'must include extension

fulladdress = folder & file
Kill fulladdress

MsgBox "File '" & file & "' was successfully deleted.", vbInformation

End Sub

A: on cmd create a local folder point to sharepoint with "net use" (net use x:\collaborate.yousite.com@SSL\sites...) then
delete the file from the local driver
kill x:\yourfile.pfd


text:
Q: Why probit regression is less interpretable than logistic regression? What I've seen very often, is that people are saying, that logistic and probit regression are giving very similar results, however, logistic regression is more interpretabe. And in this question, I want to understand why.
In the logistic regression, interpretability lies on the log of the odds:
$$\log\left(\frac{p}{1 - p}\right) = \beta_0 + \sum_{i = 1}^n \beta_iX_i,$$
because if we take the derivative with respect to $j-$ th variable, we exactly obtain the $j-$th coefficient:
$$\frac{\partial\log\left(\frac{p}{1 - p}\right)}{\partial X_j} = \beta_j.$$
Because this happens, people are saying, that increase $X_j$ of one unit, increase the odds (i.e. $\frac{p}{1-p}$) of $\exp(\beta_j)$ units.
In the probit regression we can come up with the exactly same thing. We have the following relationship:
$$p = \Phi\left(\beta_0 + \sum_{i = 1}^n \beta_i X_i\right),$$
where $\Phi$ is the PDF of standard normal distribution. From this equation we have that:
$$Q(p) = \beta_0 + \sum_{i = 1}^n \beta_i X_i,$$
where $Q$ is a quantile function of standard normal distribution.
Now if we take the derivative :
$$\frac{\partial Q(p)}{\partial X_j} = \beta_j$$
So can we say the same? What I would like to say, is that increase $X_j$ by one unit, increases quantile function by one unit, and therefore, increase $X_j$ by one unit, increases $p$ by $\Phi(\beta_j)$ units. If that's true, why people are saying, that probit regression is less interpretable?

A: Here's another way to think about this:
Let $\theta = β_0 +\sum_{i=1}^n \beta_i X_i $ be your linear predictor. If $X_j$ increases by one unit, the linear predictor increases by $\beta_j$. What can we say about the corresponding change in probability, $|p(\theta+ \beta_j)-p(\theta)|$?
In a logistic regression model, the probability is given by $p(\theta)=e^\theta/(1+e^\theta)$, the inverse of the logit (log-odds) function. It is straightforward to show that the derivative of this function is maximised at $\theta=0$, and that $p'(0)=1/4$. We deduce that $|p(\theta+ \beta_j)-p(\theta)| < \frac{|\beta_j|}{4}$. In other words, the maximum effect a unit change in the $j$th variable can have on the probability is equal to its coefficient divided by 4.
Can you work out the equivalent for the probit model?

A: Logistic regression is a model for probabilities of binary events. Another concept that is closely related to probabilities is odds, i.e. ratios of probabilities. If the probability of observing a binary event is $p$, the odds of observing it is $\tfrac{p}{1-p}$. It's a fairly simple and commonly understood concept. Logistic regression predicts log-odds. They are "simpler" to interpret because odds are already related to probabilities of binary events, while normal quantiles do not directly translate to them in a meaningful way. If the predicted quantile is $Q(p)$, how "likely" is this to happen? To answer the question, you need to translate the value to probability, while in the case of odds it just re-phrases the question to probability relative to the probability of the opposite event.


text:
Q: What did I do wrong
import sys

super_heroes = {'Iron Man' : 'Tony Stark',
            'Superman' : 'Clark Kent',
            'Batman' : 'Bruce Wayne',
            }

print ('Who is your favorite Superhero?')

name = sys.stdin.readline()

print ('Do you know that his real name is', super_heroes.get(name))

I'm doing a simple code here that should read an input in a dictionary and print it out after a string of letters, but when ran it prints out
"
Who is your favorite Superhero?
Iron Man
Do you know that his real name is None
"
Even Though the input is in my dictionary.

A: Your input is having a newline at the end of the line.
I have tried it online REPL. Check it
try following to resolve it.
name = sys.stdin.readline().strip()

After stripping Check here

A: sys.stdin.readline() returns the input value including the newline character, which is not what you expect. You should replace sys.stdin.readline() with input() or raw_input(), which are really more pythonic ways to get input values from the user, without including the newline character.
raw_input() is preferable to ensure that the returned value is of string type.
To go a little bit further, you can then add a test if name in super_heroes: to perform specific actions when the favorite superhero name is not in your dictionary (instead of printing None). Here is an example:
super_heroes = {'Iron Man' : 'Tony Stark',
                'Superman' : 'Clark Kent',
                'Batman' : 'Bruce Wayne',
               }

print ('Who is your favorite Superhero?')

name = raw_input()

if name in super_heroes:
    print ('Do you know that his real name is', super_heroes[name], '?')
else:
    print ('I do not know this superhero...')

A: sys.std.readline() appends a line break at the end of user input you may want to replace it before getting your Super Hero:
name = name.replace('\n','')


text:
Q: Making canvas fullscreen using Javascript So I was trying to make a fullscreen canvas for a HTML document using Javascript. I have researched on how to create fullscreen canvas and I found a method but it is not perfect fullscreen. There is extra on the sides the bottom which makes the scroll bar come up. The code that I used is:
canvas = document.getElementById("canvas");
canvas.width = window.innerWidth
canvas.height = window.innerHeight

I found out that the bookmark that I have in my browser (Chrome) pushes the canvas and when I remove it doesn't overflow outside. Is there anyway where if I have a bookmark or don't it will always result in a fullscreen canvas with no extra from the sides and the bottom

A: scrollHeight and scrollWidth might help
canvas.width = document.body.scrollWidth
canvas.height = document.body.scrollHeight


text:
Q: Best practice to read and write PDF received from my server I've got a problem during the development of my Android application.
I have a web server storing some PDFs. I wanted, from my application, receive them and save them on the phone storage.
So, I used FileOutputStream and a Intent to open it, I used permissions "WRITE_EXTERNAL_STORAGE", but when I propose my application to Google, they reject it because of "Scoped storage".
I don't know what's the "best practice" to do that.
Can someone help me?
Below a piece of my code
FileOutputStream fos = new FileOutputStream(file);
fos.write(base64ContentOfMyFile);
fos.flush();
fos.close();

System.out.println(file.getAbsolutePath() + " : " + Uri.fromFile(file));

Uri uri = FileProvider.getUriForFile(Objects.requireNonNull(getApplicationContext()),BuildConfig.APPLICATION_ID + ".provider", file);

Intent intentView = new Intent(Intent.ACTION_VIEW);
intentView.setDataAndType(uri, typeFich);
intentView.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intentView.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
intentView.putExtra(Intent.EXTRA_STREAM, uri);
intentView.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
intentView.setDataAndType(uri
        , typeFich);
Intent intentChooser = Intent.createChooser(intentView, "Open with...");
intentChooser.addFlags(Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION);

startActivity(intentChooser);


text:
Q: Why were the comments on this answer deleted? This answer includes a condescending statement:

And if you don't understand the math behind what this illustration is explaining, don't try writing anything that should be cryptographically secure, because it won't be. Just put the mouse down and step away from the keyboard.

Which I found to be quite ironic since he proceeded to embarrass himself making the most egregious mistakes (eg: randomness != cryptography, among others made in the deleted comments referenced by the title).
I understand it might have sparked a flamewar, but disseminating misinformation in cryptography is a dangerous thing. Most people don't really understand crypto and he got a bunch of upvotes anyways, so I think the comments really should be there.

A: I didn't delete the comments, but I can see that the conversation was gathering flags and was well on its way to becoming a flamewar.  Almost always in this situation the only way to prevent this is to delete the comments.  We don't have much in the way of tools to repair a full out comment war.

A: Yes, he got upvotes, but he got an equal number of downvotes (currently +9/-9), so the score on his answer is zero.
I think that's all the comment it needs. People will trust the higher voted answers; that's how this site works. I think people understand this intuitively as soon as they visit the site; we all understand the concepts of ranking and score.
Do you assume everything in every low- or zero- score answer you see is correct?

A: Perhaps you could have edited the comments into something less rude, that retained the warning aspects. Something like:

These concepts are vital to successful [something] because [half a
  sentence]. Trying to write cryptographically secure applications
  without understanding [noun, noun, and noun] is very unlikely to
  succeed.

That way people are not going to be offended but the point is going to be made.


text:
Q: bq.o:server.cpp:(.text+0x20): undefined reference to `__imp_socket' when compiling tcp/ip program in VS Code 2020 I have been trying to learn network programming so I wrote a simple program which checks whether a socket has been created or not. I am running it in Vs Code latest version but it gives
C:\Users\KIIT\AppData\Local\Temp\ccu4j9bq.o:server.cpp:(.text+0x20): undefined reference to `__imp_socket' collect2.exe: error: ld returned 1 exit status

I did check the internet, it says to link ws2_32.dll file but I cannot find an option to do so.
What should i do?
#include <winsock2.h>
#include <ws2tcpip.h>
#include<iostream>
#pragma comment(lib, "Ws2_32.lib")
using namespace std;
int main()
{
    int sc = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
    if (sc)
        cout << "created";
    else
        cout << "not created";
    return 0;
}


text:
Q: Modifying the text of RadCheckedDropDownList I am dynamically adding and populating a RadCheckedDropDownList inside a panel in my Winform application.
The current functionality of the RadCheckedDropDownList is if I select more than one value from the list, the values will be listed in the combo box separated by a separator. Like in the image below

My question is how can I change the displayed value to "Multiple", instead of displaying values separated by separator when multiple values are selected.Preferably the multiple should be read only without the token.

A: To do this, you can add a new element in the editable part of the control, which will be responsible for displaying your text without messing up with the control functionality.
Then you can use the ItemCheckedChanged event which will get triggered when an item is checked, and here you can see how many items are currently checked, and if more than one, show the element with the text and hide the tokens.
Protected Overrides Sub OnLoad(e As EventArgs)
    MyBase.OnLoad(e)

    AddCheckedDropDownList()
    AddHandler radCheckedDropDownList1.ItemCheckedChanged, AddressOf radCheckedDropDownList1_ItemCheckedChanged

    radCheckedDropDownList1.CheckedDropDownListElement.AutoCompleteEditableAreaElement.Children.Add(New LightVisualElement() With { _
        Key .Text = "Multiple" _
    })
    AdjustControlText()
End Sub

Private Sub radCheckedDropDownList1_ItemCheckedChanged(sender As Object, e As RadCheckedListDataItemEventArgs)
    AdjustControlText()
End Sub

Private Sub AdjustControlText()
    If radCheckedDropDownList1.CheckedItems.Count > 1 Then
        radCheckedDropDownList1.CheckedDropDownListElement.AutoCompleteEditableAreaElement.AutoCompleteTextBox.ViewElement.Visibility = Telerik.WinControls.ElementVisibility.Collapsed
        DirectCast(radCheckedDropDownList1.CheckedDropDownListElement.AutoCompleteEditableAreaElement.Children(1), LightVisualElement).DrawText = True
    Else
        radCheckedDropDownList1.CheckedDropDownListElement.AutoCompleteEditableAreaElement.AutoCompleteTextBox.ViewElement.Visibility = Telerik.WinControls.ElementVisibility.Visible
        DirectCast(radCheckedDropDownList1.CheckedDropDownListElement.AutoCompleteEditableAreaElement.Children(1), LightVisualElement).DrawText = False
    End If
End Sub


text:
Q: File upload ZF2 Is there an obvious reason as to why there is no file being crated in ./data/stockhelper. The permissions are correct.
public function uploadAction()
{

    $request = $this->getRequest();

    if($request->isPost()) {

        $files =  $request->getFiles()->toArray();

        $httpadapter = new \Zend\File\Transfer\Adapter\Http();
        $filesize  = new \Zend\Validator\File\Size(array('max' => 100000 )); //1KB
        $extension = new \Zend\Validator\File\Extension(array('extension' => array('xlsx')));

        $httpadapter->setValidators(array($filesize, $extension), $files['file']['name']);
        if($httpadapter->isValid()) {
            // We get here.

// move_uploaded_file($_FILES['file']['tmp_name'], sprintf('./data/stockhelper/%s.%s', sha1_file($_FILES['file']['tmp_name']), 'xlsx')); // <--- this works

            $httpadapter->setDestination('./data/stockhelper');
            if($httpadapter->receive($files['file']['name'])) {
                // We don't get here;
                $newfile = $httpadapter->getFileName();
                var_dump($newfile);
            }

        }
    }

    die();
}

A: I see this just remaining move uploaded file to destination. $httpadapter->receive() just for checking file uploaded or not. It was not purposed for moving uploaded files. You should use Filter for this, and call File\Rename filter.
$httpadapter->setDestination('./data/stockhelper');
$httpadapter->setValidators(array($filesize, $extension), $files['file']['name']);
$httpadapter->addFilter('File\Rename', array('target' => $httpadapter->getDestination() . DIRECTORY_SEPARATOR . sha1_file($files['file']['name']) . '.xls', 'overwrite' => true));

if (!$adapter->receive()) {
    // uploading error
    $messages = $httpadapter->getMessages();
} else {
    $newfile  = $httpadapter->getFileName();
}


text:
Q: Growing an element between two other elements with the container size I'm trying to create a layout that as it grows, does this:

    AB
   AABB
  AAABBB
 AAA==BBB
AAA====BBB

And it's proving tricky.
I've tried two approaches so far, inline-block and, ugh, tables. I can get the growing of A and B to be correct, but I can't get = to grow when the total width reaches a set point.
This is what I've got, also at http://jsfiddle.net/cd7sW/.

yada yada...

yada yada...

#page {
    text-align: center;
    width:100%;
}
#container1 {
    margin: 0 auto;
    border-spacing:0;
}
#a, #b {
    max-width:100px;
}
#a {
    background-color:red;
}
#b {
    background-color:blue;
}
#middle1 {
    width: 0;
}

#container2 {
    display:inline-block;
    margin: 0 auto;
}
#c, #d {
    display:inline-block;
    width:50%;
    height:1em;
    max-width:100px;
}
#c {
    background-color:red;
}
#d {
    background-color:blue;
}
#middle2 {
    display:inline-block;
    width:0;
    min-width: 0;
}

You can see if you type into my second example (it's contenteditable) that A and B grow and stop growing correctly. The first one, I can't get the cells to grow independently of each other.
How can it be done?

A: I hope this is more or less what you had in mind. This is a jQuery implementation.
Working example: http://jsfiddle.net/uK4Vt/1/
HTML
<button>Grow!</button>

Peekaboo!

CSS
.wrap {
    border: 1px green solid;
    width: 60px;
    height: 30px;
    margin: 0 auto;
}

.a {
    background-color: red;
    min-width: 30px;
    max-width: 90px;
    width: 50%;
    height: 30px;
    float: left;
}

.b {
    background-color: blue;
    min-width: 30px;
    max-width: 90px;
    width: 50%;
    height: 30px;
    float: right;
}

.middle {
    background-color: orange;
    overflow: hidden;
    width: 0;
    height: 30px;
    float: left;
    text-align: center;
}

Javascript
$('button').click(function() {
    $(".wrap").css("width", "+=10px");
    $(".middle").css("width", $(".wrap").width() - 180 + 'px');
});


text:
Q: What is a boot volume in reference to Amazon Web Services? What is a 'boot volume' in reference to Amazon Web Services?  How is it different from other volumes? Is 'boot volume' a standard term used by Amazon?
Is Amazon Elastic Block Storage the one always used as 'boot volume'?

A: The boot volume is essentially the working storage being used by the instance to utilize operating system code and other files and applications.
Elastic Block Storage (EBS) is a way of providing this boot volume to be used by your instance. Another way is with "instance storage", though that is probably not as popular now.
EBS is nice because it is separate from the processing aspect of your instance, and you can effectively disassociated an EBS volume from your instance and associate a different one, however you like.
EBS isn't always used as the boot volume except for the Micro EC2 instances where it is required. For all other instance sizes IIRC you can choose between EBS or instance storage. EBS is superior in many respects, most of all for the above stated ability to disconnect a volume and have it persist even if you terminate the instance.

A: In AWS, the boot volume is most often referred to as the "root device". It is analogous to the operating system partition in a standard computer. The term "boot volume" seems to be preferred when talking about importing/exporting VM images in AWS, probably because "root device" is AWS specific, while "boot volume" is more generic. When exporting a VM from AWS, only the boot volume gets exported, not the additional EBS devices.
You can find more information in the AWS EC2 faqs.

A: Amazon Elastic Block Storage (EBS) is not always used as the 'boot volume'.  What Amazon calls the 'local instance store' can be used for boot volume.  This disk space is ephemeral (lost when machine shuts down) but most EC2 instances can be launched with an operating system image using this local instance store.


text:
Q: SAP HANA XSA Node.js Express HTTPS (SHINE) I try to understand, how the HTTPS connection works for the SAP-Shine sample.
https://github.com/SAP-samples/hana-shine-xsa/blob/master/core-node/server.js
For me it looks so different to the standard express logic, where we create a HTTPS server, like this sample:
var key = fs.readFileSync(__dirname + '/../certs/selfsigned.key');
var cert = fs.readFileSync(__dirname + '/../certs/selfsigned.crt');
var options = {
  key: key,
  cert: cert
};
var server = https.createServer(options, app);

In opposite of this known sample above, SHINE is using the following procedure:
https.globalAgent.options.ca = xsenv.loadCertificates();

The npm xsenv-documentation says, that
"this code loads the trusted CA certificates so they are used for all subsequent outgoing HTTPS connections:"
Does it really mean, that we have only after putting the CA certificate to the globalAgent a running outgoing HTTPS connection?
Really, if I would know, I would like to check it for myself. But I only found hints for checking https connection for incoming requests, and rather not for outgoing connections.
Sorry, if my question sounds stupid, but I try to understand!
Please, let me know if I missed something in the configuration for a properly working outgoing HTTPS connection.


text:
Q: Firebase anonymous authentication timing issue I am using Firebase anonymous authentication to read the data from a Firebase database.
The issue is that the code is not consistently reading data from Firebase using readFromFirebase method in onComplete.
Sometimes it is reading and sometimes it is throwing error.

DatabaseError: This client does not have permission to perform this operation

I can see below in logs:

Notifying id token listeners about a sign-out event.
Notifying auth state listeners.
Notified 1 auth state listeners.
Notifying auth state listeners about a sign-out event.

Looks like problem in:
 geoQuery.addGeoQueryEventListener(new GeoQueryEventListener() {

  Task<AuthResult> authResultTask = mAuth.signInAnonymously()
            .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
                @Override
                public void onComplete(@NonNull Task<AuthResult> task) {
                    if (task.isSuccessful()) {
                        // Sign in success, update UI with the signed-in user's information
                        Log.d(TAG, "signInAnonymously:success");
                        FirebaseUser user = mAuth.getCurrentUser();

                        readFromFirebase( techCategory, locLatLng);
                     } else {
                        // If sign in fails, display a message to the user.
                        Log.w(TAG, "signInAnonymously:failure", task.getException());

                    }

                }


text:
Q: Need form to display error if value is greater then another form value I am looking for a way that when a form is submitted it will check if the value entered in "spaces" > "spaces left".  If it is show an error and do not submit form, if value is <= submit the form.
I am 100% lost and do not even know where to start and searching is proving to be little help.
So far the form is php, html and javascript.

A: have you tried using isset and !empty then doing something with the $_POST data?

A: function checkForm(form)
{
var spaces = parseInt(form.spaces.value);
var avbspaces = parseInt(form.avbspaces.value);
 if(form.spaces.value > form.avbspaces.value) {
  alert("Error: There are not enough spaces.");
          return false;

}
return true;

}
Within the form:
<FORM NAME="form" id="form" action="submit.php" onsubmit="return checkForm(this);">


text:
Q: weighted QQ Plot in R I am using the car package in R for a QQ plot with an underlying exponential distribution. I am handing the qqplot() function the vector t (with the values) and specify distribution=exp.
However, is there any way (as possible in SAS) or also in the density function (for sure this is different from qq Plot) to weight the values in the QQ Plot with a vector of weights? Or is there any other way to generate a QQ plot with an exponential expectation and a weighted curve?
Thanks

A: There is a wtd.quantile function in package Hmisc. Or the quantreg package functions will accept a weights argument if you need increased generality. I don't remember that the qqplot uses quantiles directly but I may be wrong about that. (Furthermore, qqplot is in pkg:stats, not in car.)


text:
Q: Reading from text file with ifstream So I am trying to read from a text file. It shows that I can successfully read from the file But when I try to cout the values, it just shows 0, while I have other values in the text file.
#include <iostream>
#include <fstream>
#include <string>

using namespace std;

int main()
{

    std::ifstream file("numbers.txt");
if (file) {
    cout << "Managed to read file successfully. \n";
}else{
    cout << "Unable to read file.";
}

int x, y;

file >> x >> y;

cout << "Num 1: " << x << endl;
cout << "Num 2: " << y << endl;

    return 0;
}

A: The above code will print status of your operation,if you want to read and display contents the you have to write your code like this:
#include<iostream>
#include<fstream>

using namespace std;

int main()
{
            ifstream stream1("D:\\file1.txt");
            char a[80];

            if(!stream1)
            {
                        cout << "While opening a file an error is encountered" << endl;
            }
            else
            {
                        cout << "File is successfully opened" << endl;
            }

            while(!stream1.eof())
            {
                        stream1 >> a;
                        cout << a << endl;
            }

            return(0);
}

A: With the numbers.txt file
45
15

Your code work find with gcc.
int main()
{
     std::ifstream file("numbers.txt");
     if (file)
     {
        cout << "Managed to read file successfully. \n";
        int x, y;
        file >> x >> y;

        cout << "Num 1: " << x << endl;
        cout << "Num 2: " << y << endl;
    }
    else
    {
        cout << "Unable to read file.";
    }
    return 0;
}


text:
Q: slow copy due to disk write issue I am trying to copy a file from /backup/ folder to /backup/abc/ and it is taking a lot of time. The copy operation on performed on other server is pretty fast.
# df -HP
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdc3       482G  351G  107G  77% /
tmpfs           4.2G   74k  4.2G   1% /dev/shm
/dev/sdc1       204M   36M  157M  19% /boot
/dev/sdb3       2.0T  590G  1.3T  32% /data
/dev/sda4       2.0T  705G  1.2T  38% /backup

The write speed of the disks is extremely slow compared to other servers those I have.
What can be the reason behind this?
# hdparm -t /dev/sdc3
/dev/sdc3:
 Timing buffered disk reads:   2 MB in  3.00 seconds = 682.67 kB/sec

# hdparm -t /dev/sdc1
/dev/sdc1:
 Timing buffered disk reads:   2 MB in  4.10 seconds = 499.51 kB/sec

# hdparm -t /dev/sdb3
/dev/sdb3:
 Timing buffered disk reads: read(2097152) returned 4096 bytes

# hdparm -t /dev/sda4
/dev/sda4:
 Timing buffered disk reads:   4 MB in  6.10 seconds = 671.48 kB/sec

Update: More info
# fdisk -l

Disk /dev/sda: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x3b011cfb

   Device Boot      Start         End      Blocks   Id  System
/dev/sda4               1      243201  1953512001   83  Linux
Partition 4 does not start on physical sector boundary.

Disk /dev/sdc: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0000272a

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *           1          26      204800   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sdc2              26        1301    10240000   82  Linux swap / Solaris
/dev/sdc3            1301       60802   477940736   83  Linux


text:
Q: How to turn a subfolder of a repository and its mirros from different branches into an independent repository? Consider that you a have git repository with subfolders:

*

*firstFolder

*secondFolder

*thirdFolder

*...

and the repository has multiple branches:

*

*firstBranch

*secondBranch

*thirdBranch

*...

And you want to turn, for example, the firstFolder and its clones/mirrors across different branches into an independent repository. This is the equivalent of git checkout to every one of those branches and git rm -r the other folders and then git mv the content of that specific folder to the main folder. But I was wondering if there is a more canonical way to do this? One solution would be writing a script to list all the branches and repeat these steps across those; I thought maybe there is a git solution to this.


text:
Q: How to get newly updated data in a cell in a DefaultTableModel I create a table from DefaultTableModel, and then I use table.getModel().setValueAt(value,row,col) to add the 1st value in a cell. However, when I click the mouse on that cell and change the data inside to the 2nd value. and then I get that value back by getValueAt(row,col), it always returns that first value even though on the table the 2nd value is displayed in the cell. What am I wrong?
Hope you understand my messy idea.
Thanks a lot!
//////////////
Thank you for your answer, I have copied the code from the link you gave me and run it. I have a test like this: I modify value at the Cell(0,3) and then try  getting that value out (by click the okButton) But the value is the old, NOT the new one?
Here is the code :
package DialogExample;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
import javax.swing.table.TableModel;

import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

public class SimpleTableDemo extends JPanel implements TableModelListener {
private boolean DEBUG = false;
 JTable table;
 JButton okButton;

public JButton getOkButton() {
    okButton = new JButton("OK");
    okButton.addActionListener(new ActionListener() {

        @Override //// modify value at the Cell(0,3) and then get that value out.
        /// the value is the old, NOT the new one?????
        public void actionPerformed(ActionEvent arg0) {
            int i = (Integer) table.getModel().getValueAt(0, 3);
            System.out.print(i);
        }
    });
    return okButton;
}

public SimpleTableDemo() {
    super(new GridLayout(1, 0));

    String[] columnNames = { "First Name", "Last Name", "Sport",
            "# of Years", "Vegetarian" };

    Object[][] data = {
            { "Kathy", "Smith", "Snowboarding", new Integer(5),
                    new Boolean(false) },
            { "John", "Doe", "Rowing", new Integer(3), new Boolean(true) },
            { "Sue", "Black", "Knitting", new Integer(2),
                    new Boolean(false) },
            { "Jane", "White", "Speed reading", new Integer(20),
                    new Boolean(true) },
            { "Joe", "Brown", "Pool", new Integer(10), new Boolean(false) } };

    table = new JTable(data, columnNames);
    table.setPreferredScrollableViewportSize(new Dimension(500, 70));
    table.setFillsViewportHeight(true);

    if (DEBUG) {
        table.addMouseListener(new MouseAdapter() {
            public void mouseClicked(MouseEvent e) {
                printDebugData(table);
            }
        });
    }

    // Create the scroll pane and add the table to it.
    JScrollPane scrollPane = new JScrollPane(table);

    // Add the scroll pane to this panel.
    add(scrollPane);
    add(getOkButton());
}

public void tableChanged(TableModelEvent e) {
    int row = e.getFirstRow();
    int column = e.getColumn();
    TableModel model = (TableModel) e.getSource();
    String columnName = model.getColumnName(column);
    Object data = model.getValueAt(row, column);

    // Do something with the data...
}

private void printDebugData(JTable table) {
    int numRows = table.getRowCount();
    int numCols = table.getColumnCount();
    javax.swing.table.TableModel model = table.getModel();

    System.out.println("Value of data: ");
    for (int i = 0; i < numRows; i++) {
        System.out.print("    row " + i + ":");
        for (int j = 0; j < numCols; j++) {
            System.out.print("  " + model.getValueAt(i, j));
        }
        System.out.println();
    }
    System.out.println("--------------------------");
}

/**
 * Create the GUI and show it. For thread safety, this method should be
 * invoked from the event-dispatching thread.
 */
private static void createAndShowGUI() {
    // Create and set up the window.
    JFrame frame = new JFrame("SimpleTableDemo");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    // Create and set up the content pane.
    SimpleTableDemo newContentPane = new SimpleTableDemo();
    newContentPane.setOpaque(true); // content panes must be opaque
    frame.setContentPane(newContentPane);

    // Display the window.
    frame.pack();
    frame.setVisible(true);
}

public static void main(String[] args) {
    // Schedule a job for the event-dispatching thread:
    // creating and showing this application's GUI.
    javax.swing.SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            createAndShowGUI();
        }
    });
}

}

A: *

*now could be works,

*have to define TableModel with proper ColumnClass
code
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;

public class SimpleTableDemo extends JPanel implements TableModelListener {

    private static final long serialVersionUID = 1L;
    private boolean DEBUG = false;
    private JTable table;
    private JButton okButton;
    private String[] columnNames = {"First Name", "Last Name", "Sport", "# of Years", "Vegetarian"};
    private Object[][] data = {{"Kathy", "Smith", "Snowboarding", new Integer(5), (false)},
        {"John", "Doe", "Rowing", new Integer(3), (true)},
        {"Sue", "Black", "Knitting", new Integer(2), (false)},
        {"Jane", "White", "Speed reading", new Integer(20), (true)},
        {"Joe", "Brown", "Pool", new Integer(10), (false)}};
    private TableModel model = new DefaultTableModel(data, columnNames) {

        private static final long serialVersionUID = 1L;

        @Override
        public Class<?> getColumnClass(int column) {
            return getValueAt(0, column).getClass();
        }
    };

    private JButton getOkButton() {
        okButton = new JButton("OK");
        okButton.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent ae) {
                int i = (Integer) table.getModel().getValueAt(0, 3);
                System.out.print(i);
            }
        });
        return okButton;
    }

    public SimpleTableDemo() {
        super(new GridLayout(1, 0));
        model.addTableModelListener(this);
        table = new JTable(model);
        table.setPreferredScrollableViewportSize(new Dimension(500, 70));
        table.setFillsViewportHeight(true);
        JScrollPane scrollPane = new JScrollPane(table);
        add(scrollPane);
        add(getOkButton());
    }

    public void tableChanged(TableModelEvent e) {
        int row = e.getFirstRow();
        int column = e.getColumn();
        model = (TableModel) e.getSource();
        String columnName = model.getColumnName(column);
        Object datas = model.getValueAt(row, column);
        System.out.println("Column ---> " + columnName + ", new value is " + datas);
    }

    private static void createAndShowGUI() {
        JFrame frame = new JFrame("SimpleTableDemo");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        SimpleTableDemo newContentPane = new SimpleTableDemo();
        newContentPane.setOpaque(true); // content panes must be opaque
        frame.setContentPane(newContentPane);
        frame.pack();
        frame.setVisible(true);
    }

    public static void main(String[] args) {
        javax.swing.SwingUtilities.invokeLater(new Runnable() {

            public void run() {
                createAndShowGUI();
            }
        });
    }
}

A: Not exactly sure what you are trying to do without an SSCCE, but please read the tutorial about JTables in general and, more specific, model changes first.


text:
Q: AppHarbor doesn't forward Headers with _ on the Header name I'm using AppHarbor and had a problem where none my users where being authenticated due to the fact that the CRSF (Cross-Site-Request-Forgery) check was failing.
I found out that the problem was that the custom CRSF_Header used was not being forwarded to my AppHarbor (even though other custom headers were)
It turns out that the problem is that Headers with _ (underscore) on the name are not forwarded by AppHarbor internal proxies.
The fix was then to rename the header name from CRSF_Header to CRSF-Header.
My question is: Is there another way to do this? or I have to avoid _ on headers when using AppHarbor.
Note that IIS and Cassini had no probs with these headers (so far I only had this problem in AppHarbor)

A: Ok I found this AppHarbor article that confirms it: http://support.appharbor.com/discussions/problems/5442-custom-http-header-not-reaching-the-application
Annoyingly AppHarbor discussion search wasn't working properly when I had this issue since I didn't saw that article when searched for it


text:
Q: What is different about these two pairs of strings that makes this sed script with one and not the other? This question is related to this other question I asked earlier today:
Find and replace text with all-inclusive wild card
I have a text file like this
I want= to keep this
        This is some <text> I want to keep <and "something" in tags that I" want to keep> aff FOO1 WebServices and some more "text" that" should "</be> </deleted>
        <this is stuff in tags I want=to begone> and other text I want gone too. </this is stuff in tags I want to begone>
       A novice programmer walked into a "BAR2" descript keepthis
        and this even more text, let's keep it
    <I actually want this>
    and this= too.`

when I use sed -f script.sed file.txt to run this script:
# Check for "aff"
/\baff\b/    {
# Define a label "a"
:a
# If the line does not contain "desc"
/\bdesc\b/!{
# Get the next line of input and append
    # it to the pattern buffer
    N
    # Branch back to label "a"
    ba
}
# Replace everything between aff and desc
s/\(\baff\)\b.*\b\(desc\b\)/\1TEST DATA\2/
}

I get this as my output:
       I want= to keep this
        This is some <text> I want to keep <and "something" in tags that I" want to keep> aff FOO1 WebServices and some more "text" that" should "</be> </deleted>
        <this is stuff in tags I want=to begone> and other text I want gone too. </this is stuff in tags I want to begone>
       A novice programmer walked into a "BAR2" descript keepthis
        and this even more text, let's keep it
    <I actually want this>
    and this= too.

However, by simply changing the search strings from aff and desc to FOO1 and BAR2:
   # Check for "FOO1"
/\bFOO1\b/    {
# Define a label "a"
:a
# If the line does not contain "BAR2"
/\bBAR2\b/!{
# Get the next line of input and append
    # it to the pattern buffer
    N
    # Branch back to label "a"
    ba
}
# Replace everything between FOO1 and BAR2
s/\(\bFOO1\)\b.*\b\(BAR2\b\)/\1TEST DATA\2/
}

gives the expected output:
I want= to keep this
This is some <text> I want to keep <and "something" in tags that I" want to keep> aff FOO1TEST DATABAR2" descript keepthis
    and this even more text, let's keep it
<I actually want this>
and this= too.`

I am completely stumped about what is going on here. Why should searching between FOO1 and BAR2 work differently from the exact same script with aff and desc?

A: The end marker should be \bdesc instead of \bdesc\b.
Note the \b in the pattern, it matches a word boundary. Your above text contains the word description, but not desc.
Your previous question made me assume that you want that. If you don't care about word boundaries, remove the \b escape sequences completely.


text:
Q: Triple Integrals in Spherical Coordinates, problem with boundaries Calculate
$$\iiint \frac{1}{{x^2+y^2+z^2}}dA$$
Where
$x^2+y^2+(z-2)^2\le1$
I've used spherical coordinates, like this:
$x=\rho\sin\phi\cos\theta$; $y=\rho\sin\phi\sin\theta$; $z=\rho\cos\phi$ and $J=\rho^2\sin\phi$
but then I am having a rough time with the boundaries.
I am stuck at-
$$\rho^2\sin^2\phi\cos^2\theta + \rho^2\sin^2\phi\sin^2\theta +(\rho \cos\phi-2)^2 \le 1$$
$$ \rho^2-4\rho\cos\phi \ +4\le1$$
and I don't know where to go from here.
Thank you

A: By letting $z=2+w$ the problem boils down to computing
$$\iiint_{x^2+y^2+w^2\leq 1}\frac{d\mu}{x^2+y^2+w^2+4w+4} $$
or, by setting $w=\rho\cos\theta,y=\rho\sin\theta\sin\varphi,x=\rho\sin\theta\cos\varphi$,
$$ 2\pi\int_{0}^{1}\int_{0}^{\pi}\frac{\rho^2\sin\theta}{\rho^2+4\rho\cos\theta+4}\,d\theta\,d\rho.$$
Let us focus on the inner integral:
$$ \int_{0}^{\pi}\frac{\rho^2\sin\theta}{\rho^2+4\rho\cos\theta+4}\,d\theta = \frac{\rho}{2}\,\log\left(\frac{2+\rho}{2-\rho}\right) $$
by the tangent half-angle substitution. By integration by parts, the final outcome is $2\pi-\frac{3\pi}{2}\log(3)$.


text:
Q: NodeJs login form with SQL Server user auth I am having an issue with authenticating users using a SQL Server database. I have established the connection with the database and can pull user from the database. However when trying to query the database for authentication I get an "unhandledpromise - connection is closed" error.
app.js file:
var sql = require("mssql");
var express = require("express");
var session = require("express-session");
var bodyParser = require("body-parser");
var path = require("path");

var dbconfig = {
  server: "Server",
  database: "Test",
  user: "########",
  password: "####################",
  port: 1433,
  options : {
    encrypt: false
  }
};

var app = express();
app.use(session({
  secret: 'Secret',
  resave: true,
  saveUninitalized: true

}));

app.use(bodyParser.urlencoded({
  extended: true
}));
app.use(bodyParser.json());

app.get('/', function(request, response) {
  response.sendFile(path.join(__dirname + '/login.html'));
});

app.post('/auth', function(request, response) {
      var username = request.body.username;
      var password = request.body.password;
      var conn = new sql.ConnectionPool(dbconfig);
      var req = new sql.Request(conn);
      if (username && password) {
        conn.connect();
        req.query('Select * from Admin where username = ? and password = ?', [username, password], function(error, results, fields) {
            if (results.length > 0) {
              request.session.loggedin = true;
              resquest.session.username = username;
              response.redirect('/home');
            } else {
              response.send('Username and/or Password not found');
            }
            conn.close();
            response.end();
          });

        } else{
          response.send('Please enter Username and Password');
        }

      });

      app.get('/home', function(request, response){
        if(request.session.loggedin){
          response.send('Welcome back,' + request.session.username + '!');

        }else{
          response.send('Please sign');
        }
        response.end();
      });
      app.listen(3000);
      function getEMP() {
        var conn = new sql.ConnectionPool(dbconfig);
        var req = new sql.Request(conn);

        conn.connect(function(err) {
          if (err) {
            console.log(err);
            return;
          }
          req.query("Select * from Admin", function(err, recordset) {
            if (err) {
              console.log(err)
            } else {
              console.log(recordset)
            }
            conn.close();
          });
        });
      }

      getEMP();

The getEMP function returns all of the admins from the database as expected. This is why I am positive the connection is working. This function was used for testing connection.
Error

UnhandledPromiseRejectionWarning: ConnectionError: Connection is closed.
  at Request._query (///nodeconSQL/node_modules/mssql/lib/base/request.js:447:37)
  at Request._query (///nodeconSQL/node_modules/mssql/lib/tedious/request.js:346:11)
  at shared.Promise (///nodeconSQL/node_modules/mssql/lib/base/request.js:413:12)
  at new Promise ()
  at Request.query (///nodeconSQL/node_modules/mssql/lib/base/request.js:412:12)
  at /home/devops-01/nodeconSQL/app.js:43:13
  at Layer.handle [as handle_request] (///nodeconSQL/node_modules/express/lib/router/layer.js:95:5)
  at next (///nodeconSQL/node_modules/express/lib/router/route.js:137:13)
  at Route.dispatch (///nodeconSQL/node_modules/express/lib/router/route.js:112:3)
  at Layer.handle [as handle_request] (///nodeconSQL/node_modules/express/lib/router/layer.js:95:5)

A: Your function getEMP() uses the callback from conn.connect() in order to wait until the connection is established before trying to execute the query.
The function that tries to login executes the query immediately after attempting to open the connection, however since the connection takes some time to be established, this is why you get the error that your connection is not open.
Put your login query inside the conn.connect(function(err){ /* login code */ }) construct like it is in your getEMP() function. You will then need to make sure that you can access the request and response objects in the callback function, for example by using .bind() on your callback function to put the request and response objects into the this object. Another option is to use closure functions to get data to the callbacks.
Example using closures:
app.post('/auth', function(request, response) {
    var username = request.body.username;
    var password = request.body.password;

    if (username && password) {
        var conn = new sql.ConnectionPool(dbconfig);
        conn.connect((function(){
            var thisConn = conn;
            var req = new sql.Request(thisConn);

            return function(){ //connect callback
            req.query('Select * from Admin where username = ? and password = ?', [username, password],
            (function(){
                var req = request;
                var resp = response;
                var conn = thisConn;

                return function(error, results, fields) { // query callback
                    if (results.length > 0) {
                        req.session.loggedin = true;
                        req.session.username = username;
                        resp.redirect('/home');
                    } else {
                        response.send('Username and/or Password not found');
                    }
                    conn.close();
                    resp.end();
                };
            })());
            };
        })());
    } else {
      response.send('Please enter Username and Password');
    }
});

Example using bind:
...

// Inside your /auth route
// make an object with the data our callback needs, to use with .bind()
var callbackData = {"conn": conn, "request": request, "response": response};
var connectCallback = function(err){
    if (err) {
        console.log(err);
        return;
     }
    req.query('Select * from Admin where username = ? and password = ?',
        [username, password], function(error, results, fields) {
        // 2nd level of callback, query callback
        if (results.length > 0) {
              this.request.session.loggedin = true;
              this.resquest.session.username = username;
              this.response.redirect('/home');
        } else {
              this.response.send('Username and/or Password not found');
        }
        this.conn.close();
        this.response.end();
    }.bind(this)); // pass our 'this' object through to the next level
}.bind(callbackData);

conn.connect(connectCallback);
...


text:
Q: Derivation of the solution of the heat equation I was reading a proof from Evans' book of partial differential equations, until I got stuck.

Until $(6)$ everything is clear, but then he assumes that $v$ is radial and then the ODE completely changes shape. Furthermore, I don't get the successive passages, until $(7)$. Is there anyone that can explain them to me? It would be of great help!

A: The reason for this "guess" is the fact that the laplacian $\Delta$ is rotation invariant, i.e. $\Delta u(x)=\Delta u(Tx)$ for any rotation $T:\Bbb R^n\to\Bbb R^n$, so one can seek a radial (or rotation invariant) solution. He then lets $v(y)=w(|y|)$ and plugs this into the PDE, which reduces to the ODE, now we are at the following part
$$r^{n-1}w'+\frac{1}{2}r^nw=a.$$
We now assume $\lim_{r\to\infty}w'=\lim_{r\to\infty}w=0$, this condition just ensures nice behaviour of the solution at infinity, but if we take this limit in the above equation we see that we must have $a=0$ for this to be true.
Now by rearranging we have a nice easy to solve ODE,
$$\frac{w'}{w}=-\frac{1}{2}r.$$


text:
Q: Programmatically get the default log generated from a SpecRun tests When I run my SpecRun tests, it generates a log of the execution and places it in my TestResults directory. How might I programmatically get the full name of the log that is dynamically generated during a test run?  In my BeforeTest hook I am deleting all files in the TestResults directory, and I would like to exclude the current log for the test run.  Is this the right hook to do this in?  I may select to run 20 tests at once, and I am hoping that the files, previous to the 1st test out of the 20 tests, are being removed only once. After that, no need to delete files after another test that is ran.  So If I multi-select to run 20 tests, remove files from the directory as a precondition before the tests are ran.

A: Best way would be, to exclude the logfile from deleting.
The format of the filename of the logfile is the following: %ProjectName%_%Name%_%Timestamp%.log
%ProjectName%: value from Settings/projectName from the used srProfile file.
%Name%: value from the Settings/name or the filename of the used srProfile file.
%Timestamp%: DateTime.Now with "s"- format string - ':' are removed

Full disclosure: I am one of the developers of SpecFlow+/SpecRun.


text:
Q: css3 prevent vertical image shift I have image display that shows individual images when a radio button is clicked. however the image associated with the radio button shifts vertically down in it position. in the example below is 3 images with 3 associated radio button.I tried setting line-height to 0 and also tried white-space:nowrap in css. but didn't work. any help is appreciated.

        <input type="radio" checked value="Img1"  name="event" id="img-1" >

        <input type="radio"  value="Img1"  name="event" id="img-2" >

        <input type="radio"  value="Img1"  name="event" id="img-3" >

          button1
          button2
          button3

A: Set your input to display: none;, as when use opacity they are invisible but still occupy space, hence pushing the images down.
input[type=radio] {
   display: none;
}

Sample snippet

#imgflow {
    width: 60%;
    overflow: hidden;
    text-align:center;
    margin:0 auto;
}
#imf_holder article img {
    width: 100%;
}
#imf_holder .inner {
    width: 100%;
}
#imf_holder article {
    width: 100%;
}
.img-control {
    display: block;
    text-align: center;
}
input[type="radio"] ~ .ps{
    display:none;
}
input[type="radio"]:checked ~ .ps{
    display:block;

}
input[type=radio] {
   display: none;
}

                <input type="radio" checked value="Img1"  name="event" id="img-1" >

                <input type="radio"  value="Img1"  name="event" id="img-2" >

                <input type="radio"  value="Img1"  name="event" id="img-3" >

      button1
      button2
      button3

A: Just make your inputs absolute like this:
input[type=radio] {
    opacity: 0;
    position:absolute;
}


text:
Q: Why does this evaluation function work in a connect four game in java I am exploring how a Minimax algorithm can be used in a connect four game.  I was looking through a program and found this evaluation function.
private static int[][] evaluationTable = {{3, 4, 5, 7, 5, 4, 3},
                                          {4, 6, 8, 10, 8, 6, 4},
                                          {5, 8, 11, 13, 11, 8, 5},
                                          {5, 8, 11, 13, 11, 8, 5},
                                          {4, 6, 8, 10, 8, 6, 4},
                                          {3, 4, 5, 7, 5, 4, 3}};

//here is where the evaluation table is called
public int evaluateContent() {
        int utility = 128;
        int sum = 0;
        for (int i = 0; i < rows; i++)
            for (int j = 0; j <columns; j++)
                if (board[i][j] == 'O')
                    sum += evaluationTable[i][j];
                else if (board[i][j] == 'X')
                    sum -= evaluationTable[i][j];
        return utility + sum;
    }

And then a MiniMax algo is used to evaluate the possible solutions.
I am not sure how/why this works.  Would anyone be able to explain?

A: The numbers in the table indicate the number of four connected positions which include that space for example:

*

*the 3 in the upper left corner is for one each of horizontal, vertical, and diagonal lines of four which can be made with it.

*the 4 beside it is for two horizontal (one including starting in the corner, one starting on it, one vertical, and one diagonal)

This gives a measurement of how useful each square is for winning the game, so it helps decide the strategy.
I believe that the evaluateBoard function returns a number <0 if

int utility = 128

is a typo - it should be initialized to 138 (since the sum of all the values in the table is 276 = 2 x 138). This would make the evaluateBoard function return:

*

*< 0 if the player whose marker is 'X' is likely to win (has the most strategic places based on the utility function)

*= 0 if the players are equally likely to win

*> 0 if the player whose marker is 'O' is likely to win.

A: This evaluation function is nothing but Gaussian normal distribution centered around the mean position of board. The one with more centered positions gets higher score from this eval func. If you plot this matrix in MATLAB, you'll find that the values form a tent and hence give bias to center position. However I must say there are way better evaluation function than this as this performs total evaluation and doesn't do spatial analysis.
score = board.longest_chain(board.get_current_player_id()) * 10
        # Prefer having your pieces in the center of the board.
        # score boost
        for row in range(6):
            for col in range(7):
                if board.get_cell(row, col) == board.get_current_player_id():
                    score -= abs(3-col)
                elif board.get_cell(row, col) == board.get_other_player_id():
                    score += abs(3-col)

Above is just one example where it applies center oriented idea over spatial analysis result obtained via longest_chain.


text:
Q: Which is more Pythonic calling __str__() method or casting to str()? I have a wrapper class for a dictionary object and I'm curious if one is preferred over the other when implementing the __repr__ method in my class:
class MyClass(object):
  def __init__(self):
    self._obj = dict()
  def __repr__(self):
    return self._obj.__str__()

OR
class MyClass(object):
  def __init__(self):
    self._obj = dict()
  def __repr__(self):
    return str(self._obj)

The second implementation with str() feels right to me. I just want to make sure I'm not missing anything.

A: You are right. You should avoid calling the double underscore methods directly: the built-in functions are the Pythonic way of doing this.
(The same is true for example for len(foo) vs foo.__len__().)

A: Ask yourself this: if __str__ was available, why would people use str?
__str__ is just the overload you can use if you want to modify the default str method. Likewise for __len__.
Would you use this?
print(1.__add__(2))

An answer philosophy: Demonstrate core understanding to the asker, preferably having the asker conclude the correct answer by themselves.


text:
Q: Sencha Touch Horizontal Bar Chart in accordion not rendering in Chrome but is rendered on Firefox Sencha Touch Horizontal Bar Chart in accordion not rendering in Chrome but is rendered on Firefox.there is no error on the logs.Have checked if its a Chrome 29 bug issue, its not.Request your help.Thanks in advance.

A: In some cases, I create a charts on the server by other tools and write it to response as an image. Image is absolutely cross browser :) My favorite chart is Devexpress XtraChart


text:
Q: Entity Framework: List of invalid characters in Entity Name I am working on a designer which is very similar to Edmx designer in Visual Studio. I want to add the same validation that Edmx designer applies to Entity and Property Names. Can someone share what are the validation rules i.e. What characters are allowed and what are not. What might be the length of Entity/Property name and other such rules?

A: Look at the xsds. When loading artifacts (CSDL/MSL/SSDL) there is two step validation 1 - using xsd, 2 internal validation checking additional rules that in most cases cannot be expressed in xsd.
EF6 is open source now but xsd schemas for previous versions have not changed. You can find them here. (Schemas for mapping are in the MappingSpecification folder).
If you look at v3 CSDL schema the name of the property is specified as follows:
<xs:simpleType name="TSimpleIdentifier">
    <xs:restriction base="xs:string">
        <xs:maxLength value="480" />
        <!-- The below pattern represents the allowed identifiers in ECMA specification -->
        <xs:pattern value="[\p{L}\p{Nl}][\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}]{0,}" />
    </xs:restriction>
</xs:simpleType>

If you don't want to bother with xsds and would like to take advantage of the internal validation you can just load your xml to the corresponding item collection. Again in EF6 there have been some overloads added that allows you load artifacts but will not throw an exception if they are invalid but would return null and a list of errors as an out parameter (look for public static factory methods on item collections).


text:
Q: why is contamination delay lower bound? I am taking a course from edX called computation structures: 1.Digital Circuits. When the course explained about CMOS timing, there was propagation delay(tpd) and contamination delay(tcd). I understood that tpd has to be upper bound but I couldn't understand why tcd should be lower bound. Shouldn't tcd be upper bound too?

A: Contamination delay is the time from an input change to when the output starts to change, propagation delay is the time from an input change to when the output has reached a stable, valid level.  During the time between min contamination delay and max propagation delay the output may not be valid.


text:
Q: Implementations of (fully) dynamic connectivity data structures The dynamic connectivity problem for graphs consists in maintaining a graph data structure that allows for adding and deleting edges of the graph.
Moreover, the data structure should support connectivity queries.
Typically, such a query is of the form ''Are the nodes u and v connected in the graph?''
There are variants of the dynamic connectivity problem that also support different connectivity queries like 2-edge-connectivity or biconnectivity.
My question is: Are there existing efficient implementations of dynamic connectivity data structures?
By efficient I mean that data structures with a low amortized operation costs.
In particular, I am NOT interested in trivial implementations with a complexity of O(n) per operation!
Below I describe in more detail what I am looking for an what I already know.
If only edge insertions are allowed the dynamic connectivity problem can be solved by the well known disjoint-set (aka union find) data structure.
For this data structure there are implementations available in many different programming languages.
Unfortunately, this does not seem to be the case for the dynamic connectivity problem that also allows edge deletions.
The situation is even worse for data structures that also allow other connectivity queries like 2-edge- or biconnectivity.
To the best of my knowledge the algorithms presented in Holm et al. (2001) are still state of the art for many dynamic connectivity problems.
This publication was accompanied by an experimental study, however, as far as I can tell the code was never made publicly available. Also, therein only implementations for the regular connectivity problem are discussed, not for 2-edge- or biconnectivity.
The algorithms by Holm et al. (and also by other authors) are highly non-trivial.
Even though the algorithms are described in much detail it requires a lot of expertise to implement these algorithms in practice.
Because of this I am looking for existing implementation of different dynamic connectivity data structures.
The table below summarizes the (currently underwhelming) implementations of different combinations of supported manipulations and queries.

Graph Manipulations
Connectivity
2-edge-connectivity
Biconnectivity

incremental (adding edges)
disjoint-set

decremental (deleting edges)
Rafael Glikis

fully (adding and deleting edges)

I have searched for implementations in different places. I have looked on git-hub, I have looked through the external links in the relevant Wikipedia articles and I have skimmed through a lot of literature without any success.

A: I expect we will need a framework for trying things out so that we can discuss this in concrete terms.
I have implemented a small windows application that accepts user queries to read, build, edit and query the connectivity of a graph, showing the time taken to execute each.
Sample run:
Supported queries
add v1 v2 :     add link to graph
delete v1 v2 :  remove link from graph
reach src dst : find path between vertices
read filepath : input graph links from file
help :          this help display

type query> read ../dat/3elt.graph.seq.txt

4720 vertices 27444 edges

raven::set::cRunWatch code timing profile
Calls           Mean (secs)     Total           Scope
       1        0.539246        0.539246    query

type query> delete 23 20

4720 vertices 27443 edges

raven::set::cRunWatch code timing profile
Calls           Mean (secs)     Total           Scope
       1        0.004432        0.004432    query

type query> add 23 20

4720 vertices 27444 edges

raven::set::cRunWatch code timing profile
Calls           Mean (secs)     Total           Scope
       1        0.0046639       0.0046639   query

The complete application is at https://github.com/JamesBremner/graphConnectivity
To demonstrate how this application can be used, I built it with the graph engine at https://github.com/JamesBremner/PathFinderFeb2023 and ran it on a couple of the test datasets from https://dyngraphlab.github.io/

dataset
edge count
delete
add

3elt.graph.seq.txt
27,443
5ms
5ms

144.graph.seq.txt
2,148,787
13ms
13ms

To get the average time to perform multiple queries, use the random command, like this:
Supported queries
add v1 v2 :     add link to graph
add random n :  add n random links to graph
delete v1 v2 :  remove link from graph
reach src dst : find path between vertices
read filepath : input graph links from file
help :          this help display

type query> read ../dat/3elt.graph.seq.txt

4720 vertices 27444 edges

type query> add random 10

4720 vertices 27454 edges

raven::set::cRunWatch code timing profile
Calls           Mean (secs)     Total           Scope
      10        1.62e-06        1.62e-05        randomAdd


text:
Q: Crear un array por teclado, rellenarlo y saber el mayor Crea un array de números de un tamaño pasado por teclado, el array contendrá números aleatorios entre 20 y 30, indica cuál es el mayor de todos
Me queda saber como hacer que sean numeros aleatorios que entre 20 y 30 y saber cual es el mayor de todos, se poner que el ultimo sea 30 pero no que el primero.
    //variables
    int num2 = 0;
    int num3 =0;

    //creamos las variables
    System.out.println("Inserte el numero de posiciones del array: ");
    num2 = teclado.nextInt();

    int num[]= new int [num2];

    System.out.println("Creado array de: " + num.length);

    System.out.println("El array es el siguiente: ");
    for (int i=0 ; i<num2 ; i++) {

        num[i]= (int)(Math.random()*(30-1+1)+1);
        System.out.println("En la posición: " + i + " se a asignado el numero: " + num[i]);
    }
    //hacemos formula para que segun elijamos x numero saque todos los que elijamos
    System.out.println("Indica el ultimo digito:" );
    num3 = teclado.nextInt();

    for (int x=0 ; x<num.length ; x++) {
        if(num3==num[x]%10) {
            System.out.println("Los numeros que terminan por ese digito son: " + num[x]);

        }

    }
}

}

A: Necesitarias usar una instancia Random() y mediante un for llenarias el tamaño del arreglo con los numeros aleatorios de 20-30 y con un segundo for el mayor de ese arreglo
import java.util.*;

public class random{

public static void main(String[] args) {
    Random numAleatorio = new Random();
    Scanner teclado =new Scanner(System.in);

System.out.println("Inserte el numero de posiciones del array: ");
 int posicion = teclado.nextInt();
 int num[]= new int [posicion];
 int mayor=0;

 for (int i=0;i<num.length;i++ ) {
    num[i]=numAleatorio.nextInt(30-20+1) + 20;//numeros entre 20-30
  //num[i]= (int) (Math.random() * (30-20+1)+20);//otra forma
 }

 for (int j=0;j<num.length;j++ ) {
        if(num[j]>mayor){
          mayor=num[j];
        }
    }

    System.out.println(Arrays.toString(num));
    System.out.println("El mayor de todo es :"+ mayor);
}
}


text:
Q: Tidying code and fixing errors (java) I need to modify the code so that,

*

*its structure is better

*it is more readable

*it uses methods and parameters

*only one statement needs to be changed if a different number of integers is to be input

My new code is at the bottom but it's not working yet, can't quite figure out what else I need to do to it. If anyone could help that would be fab.
Original Code
import java.util.Scanner;

public class MakeMeBetter
{
    public static void main(String[] args)
    {
        int[] a = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
        Scanner b = new Scanner(System.in);

        System.out.println("Please input 10 numbers in the range 1-19 :> ");
        int c = b.nextInt();
        while (c < 1 || c > 19)
        {
            System.out.println("Not in the range 1-19, please try again :> ");
        }
        a[0] = c;

        int d = b.nextInt();
        while (d < 1 || d > 19)
        {
            System.out.println("Not in the range 1-19, please try again :> ");
        }
        a[1] = d;

        int e = b.nextInt();
        while (e < 1 || e > 19)
        {
            System.out.println("Not in the range 1-19, please try again :> ");
        }
        a[2] = e;

        int f = b.nextInt();
        while (f < 1 || f > 19)
        {
            System.out.println("Not in the range 1-19, please try again :> ");
        }
        a[3] = f;

        int g = b.nextInt();
        while (g < 1 || g > 19)
        {
            System.out.println("Not in the range 1-19, please try again :> ");
        }
        a[4] = g;

        int h = b.nextInt();
        while (h < 1 || h > 19)
        {
            System.out.println("Not in the range 1-19, please try again :> ");
        }
        a[5] = h;

        int i = b.nextInt();
        while (i < 1 || i > 19)
        {
            System.out.println("Not in the range 1-19, please try again :> ");
        }
        a[6] = i;

        int j = b.nextInt();
        while (j < 1 || j > 19)
        {
            System.out.println("Not in the range 1-19, please try again :> ");
        }
        a[7] = j;

        int k = b.nextInt();
        while (k < 1 || k > 19)
        {
            System.out.println("Not in the range 1-19, please try again :> ");
        }
        a[8] = k;

        int l = b.nextInt();
        while (l < 1 || l > 19)
        {
            System.out.println("Not in the range 1-19, please try again :> ");
        }
        a[9] = l;

        System.out.println("\nArray contents");
        System.out.print((a[0] < 10 ? " " : "") + a[0] + "  ");
        System.out.print((a[1] < 10 ? " " : "") + a[1] + "  ");
        System.out.print((a[2] < 10 ? " " : "") + a[2] + "  ");
        System.out.print((a[3] < 10 ? " " : "") + a[3] + "  ");
        System.out.print((a[4] < 10 ? " " : "") + a[4] + "  ");
        System.out.print((a[5] < 10 ? " " : "") + a[5] + "  ");
        System.out.print((a[6] < 10 ? " " : "") + a[6] + "  ");
        System.out.print((a[7] < 10 ? " " : "") + a[7] + "  ");
        System.out.print((a[8] < 10 ? " " : "") + a[8] + "  ");
        System.out.print((a[9] < 10 ? " " : "") + a[9] + "  ");
        System.out.println();

        boolean noSwap = false;
        int startAt = 0;
        int stopAt = 9;
        while (startAt < stopAt && noSwap == false)
        {
            noSwap = true;
            for (int m=startAt; m<stopAt; m++)
            {
                if (a[m] > a[m+1])
                {
                    int t = a[m];
                    a[m] = a[m+1];
                    a[m+1] = t;
                    noSwap = false;
                }
            }
            stopAt = stopAt - 1;
        }

        System.out.println("\nArray contents");
        System.out.print((a[0] < 10 ? " " : "") + a[0] + "  ");
        System.out.print((a[1] < 10 ? " " : "") + a[1] + "  ");
        System.out.print((a[2] < 10 ? " " : "") + a[2] + "  ");
        System.out.print((a[3] < 10 ? " " : "") + a[3] + "  ");
        System.out.print((a[4] < 10 ? " " : "") + a[4] + "  ");
        System.out.print((a[5] < 10 ? " " : "") + a[5] + "  ");
        System.out.print((a[6] < 10 ? " " : "") + a[6] + "  ");
        System.out.print((a[7] < 10 ? " " : "") + a[7] + "  ");
        System.out.print((a[8] < 10 ? " " : "") + a[8] + "  ");
        System.out.print((a[9] < 10 ? " " : "") + a[9] + "  ");
        System.out.println();

        double n = (a[0] + a[1] + a[2] + a[3] +
                      a[4] + a[5] + a[6] + a[7] +
                      a[8] + a[9]) / 10;

        System.out.println("The minimum number is: " + a[0]);
        System.out.println("The maximum number is: " + a[9]);
        System.out.println("The average value is: " + n);
        System.out.println("The median is: " + a[4]);
    }
}

New Code
import java.util.Scanner;
import java.math.*;
public class MakeMeBetterImproved {

    public static void main(String[] args) {
        Scanner kybd = new Scanner(System.in);
        int[] numbers = new int[10];
        int array = 0;

        System.out.println("Enter 10 integers: ");
        for (int i = 0; i < numbers.length; i++)  {
            numbers[i] = kybd.nextInt();
            int MyIntArray = array + i;

        }

        System.out.println("The minimum number is: " + math.min);
        System.out.println("The maximum number is: " + math.max);
        System.out.println("The average value is: " + math.average);
        System.out.println("The median is: " + math.median);
    }
}

A: Consider using a more dynamic structure than a primitive array.
I like ArrayLists: http://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html
Reorganize your long code into while or for loops.
An example:
ArrayList<Integer> a = new ArrayList<Integer>();
Scanner b = new Scanner(System.in);

Integer c = null;
while (a.size() != 10) {
    System.out.println("Please input a number in the range 1-19 :> ");
    c = b.nextInt();
    while (c < 1 || c > 19)
    {
        System.out.println("Not in the range 1-19, please try again :> ");
        c = b.nextInt();
    }
    a.add(c);
}

System.out.println("\nArray contents");
for (int i=0; i<10; i++) {
    System.out.print((a.get(i) < 10 ? " " : "") + a.get(i) + "  ");
}

(And so on...)

A: Could you try this? I made a few changes.
package p2;

import java.util.Arrays;
import java.util.Scanner;

public class TicTacToe {

    public static void main(String[] args) {
        Scanner kybd = new Scanner(System.in);
        int[] numbers = new int[10];
        int sum = 0;
        System.out.println("Enter 10 integers: ");
        for (int i = 0; i < numbers.length; i++) {
            numbers[i] = kybd.nextInt();
            sum += numbers[i];
        }

        Arrays.sort(numbers);
        System.out.println("The minimum number is: " + numbers[0]);
        System.out.println("The maximum number is: " + numbers[9]);
        System.out.println("The average value is: " + sum / numbers.length);
        System.out.println("The median is: " + median(numbers));
    }

    public static double median(int[] m) {
        int middle = m.length / 2;
        if (m.length % 2 == 1) {
            return m[middle];
        } else {
            return (m[middle - 1] + m[middle]) / 2.0;
        }
    }
}