text:
Q: How to run 'android' under windows 7 I have installed android sdk under Windows 7. But when I run it, I get the following error saying xcopy is not recognized as an command.
How can I resolve it?
Thank you.
C:\>android.bat
'xcopy' is not recognized as an internal or external command,
operable program or batch file.
Usage: java [-options] class [args...]
           (to execute a class)
   or  java [-options] -jar jarfile [args...]
           (to execute a jar file)

A: Why would you want to call android.bat?
Just start the 'SDK Manager' from the windows start menu.
Or what exactly are you trying to do?


text:
Q: A grid class with preconfigerd dockedItems,features, I want to build a reusable grid class with A grid class with preconfigerd dockedItems,features, viewConfig ,....
How can I make it?
How should I declare object config?
Thanks

A: Have a look at the ExtJS 4 class system guide.
Define classes with:
Ext.define('NewClassName', {
    extend : 'Ext.grid.Panel',
    alias : 'widget.newclassalias',
    dockedItems : myDockedItems,
    ...
});

redpajama_set_name: RedPajamaStackExchange


text:
Q: Is there a function to extract a value from a Singleton? I'm developing a data type which requires an SNat, and would like to have the ability to give the user a Nat instead. Searching on Hoogle has yet to yield results.
That is, is there a function
f :: forall a (x :: a). Sing a x -> a

?

A: You can use fromSing from singletons


text:
Q: Excel VBA - Append .xls to filename to open file I have code to open a file with a variable date, as shown below.  This code will not work without entering m.d.y.xls into the input box.  I want to only have to enter m.d.y into the input box.  Please take a look and let me know what I am missing.  Thanks!
Dim wbkOpen As Workbook
Dim strFilePath As String
Dim strFileName As String
strFilePath = "D:\Users\stefan.bagnato\Desktop\Daily Performance Summary\Agent Group Daily Summary "
strFileName = InputBox("Enter last Friday's date in the format M.D.Y", "Friday's Date")
Set wbkOpen = Workbooks.Open(strFilePath & strFileName, False, True)

A: This is basic string concatentation:
strFilePath & strFileName & ".xls"

You should probably check to ensure the file exists, otherwise there will be an error:
Dim fullFileName As String
strFilePath & strFileName & ".xls"
If Dir(fullFileName) = "" Then
    MsgBox "Invalid filename!"
    Exit Sub
End If
Set wbkOpen = Workbooks.Open(fullFileName, False, True)

Ideally, you can avoid user-input (which is prone to error) altogether:
Const strFilePath As String = "D:\Users\stefan.bagnato\Desktop\Daily Performance Summary\Agent Group Daily Summary "
Dim wbkOpen As Workbook
Dim LastFridayDate As String
Dim fullFileName As String
Dim fdlg as FileDialog
LastFridayDate = Format(Date - (Weekday(Date, vbFriday) - 1), "m.d.yy")
fullFileName = strFilePath & LastFridayDate & ".xls"

If Dir(fullFileName) = "" Then
    If MsgBox("The file named " & fullFileName & " doesn't exist. Would you like to manually locate the file?", vbYesNo) = vbNo Then
        Exit Sub
    Else
        Set fdlg = Application.FileDialog(msoFileDialogOpen)
        '## Opens the fileDialog in the normal folder where these files should exist
        fdlg.InitialFileName = strFilePath
        '## Display the fileDialog to the user
        fdlg.Show
        '## Validate the fileDialog hasn't been canceled
        If fdlg.SelectedItems.Count <> 0 Then
            '## Return the value of the item selected by the user
            fullFileName = fdlg.SelectedItems(1)
        Else:
            MsgBox "No file selected, exiting procedure..."
        End If
    End If
End If
Set wbkOpen = Workbooks.Open(fullFileName, False, True)

Of course allowing the user to manually select the file may ultimately require additional validation and/or error-handling (i.e., what if they select the wrong file? How can the program know which date is the correct date [I'd wager that it can't, without doing an ugly brute force loop which still makes a lot of assumptions which might not always hold] What if they select a PDF or a PPT file instead of an XLS, etc. but those points are entirely out of scope for this question.)
If you have additional follow-ups, please follow proper site etiquette and ask a new question :)


text:
Q: Compiling Flex Projects with Remote Ant I'm having problems compiling applications with remote ant, something similar to this. However the flex compiler seems to have problems with this. When I run the same script on my local compiles everything without any problems but when I try the remote ant it fails without giving more information.

A: Things to look for on the remote machine:

*

*The paths in the build file need to be valid (I'm pretty sure the script file you use to build the project on your computer, will not be good on the remote one because of a possible difference in paths)

*You need the Flex SDK installed

*You need Java JDK installed

*You might also need some environment variables set correctly (like JAVA_HOME)

*ANT binaries on the remote machine (but I assume you already have this, probably coming with the system you're using)

*The sources to be compiled, obviously (I assume you already have these too, probably gotten by your system from a repository)

Also I find it hard to believe it would fail without any error. There should be at least a log file somewhere to give you an idea of what went wrong.


text:
Q: Wiring diagram of aller retour switch with lamp I need to connect a lamp with 2 aller retour switches. In the wiring diagram how many cables will i have between the switches if the lamp is between them?

A: There are three ways to hook them up. (Thanks to Janka for the third)

simulate this circuit – Schematic created using CircuitLab

simulate this circuit
The first or third methods are the preferred ones. As Dave points out, the second leaves the light itself hot half the time and is prone to make before break switch shorting.

A: With SPDT ("three-way" in English) switches, you can't put the load (the lamp) between the switches, at least not electrically. If you want to "fold" the wiring so that the lamp is physically between the switches, you'll have to run extra wires from one of the switches to the load. This does not affect the number of wires "between the switches".
Normal arrangement:

simulate this circuit – Schematic created using CircuitLab
Folded arrangement:

simulate this circuit
Funky German arrangement:

simulate this circuit
Note that the last one requires 4 wires in at least one of the cables, more than either of the other arrangements. It also runs the lamp current through the largest number of wires. I fail to see any advantage to this, other than the fact that in the region between the two switches, you can connect both switched and unswitched loads.

A: Actually if you´re using a three-way you´ll use 1 cable as the hot line, coming from the circuit breaker. This cable gets to the central screw of one of the switches. Done that, 2 wires will leave that switch and meet the other one. Finally, this other switch takes the last wire to the lamp. So counting on the neutral cable, you´d have 1+2+1+1 = 5 wires. If you want to count the earth one it would be 6.


text:
Q: disabling comments causing display issues in wordpress http://www.handheldtesting.com/
When either checking "disable comments" in the back end, or adding 'display:none:'
<div id="respond" class="comment-respond" style="display:none;">

in the code.
1/2 of the content on the page disappears, as the footer moves up.
Any ideas?
Thanks so much,
Ken

A: This piece of CSS seems to be causing the problem:
body.responsive.layout-full #page-wrapper .full-container {
  height: 172px;
}

I'm not sure why that height is explicitly set, seems odd.  You should probably test the affects before totally deleting it...


text:
Q: Why isn't this jQuery script working? <script type="text/javascript">
$(document).ready(function(){
  $("tr.reqDet").hide();

  $("[title='requestType']").change(function(){
    if ($("[title='requestType']").val()!=""){
        $("#reqDet").hide();
    } else {
        $("#reqDet").show();
    }
  });

</script>

I cannot get the if statement in the script to work...
Details: I'm using SharePoint and it renders a dropdown box w/ attribute title="requestType". When the requestType box is NOT set to the initial value, which is "", I'd like for a control with the class "reqDet" to appear.

Anyways, Thanks everyone. here's the solution that worked for me:
<script type="text/javascript">
$(document).ready(function(){
  $("tr.reqDet").hide();

  $("select[title='requestType']").change(function(){
        $(".reqDet").toggle($(this).val()!== "");
  });
 });
</script>

A: Updated answer: Since you mention "the element with the class reqDet", the problem would be that you are using an id selector (#reqDet) instead of the class selector .reqDet.
Also, apart from that, you can make some improvements to your code:

*

*Make your selector more explicit so that it doesn't have to examine every element in the page

*Take advantage of this inside your callback so that you don't have to walk the DOM again

*Use toggle instead of hide and show, enabling you to lose the if
So you can reduce it to this:
$("select[title='requestType']").change(function(){
   $(".reqDet").toggle($(this).val() == "");
});

A: $(document.ready(function() {
    var details = $('tr#reqDet');
    var dropdown = $("select[title='requestType']");
    details.hide();

    dropdown.change(function() {
        details.toggle(dropdown.val() === '');
    });
});

A: Is it intentional that you are hiding tr's with classname reqDet before you add the listener for the change event and then later try to hide an element with an id of reqDet? Also you should to specify what type of element has a title of request type:
<script type="text/javascript">
$(document).ready(function(){
  $("tr.reqDet").hide();

  $("select[title='requestType']").change(function(){
    if ($(this).val()!=""){
        $(".reqDet").hide();// should this be a class or id of reqDet
    } else {
        $(".reqDet").show();  // Change to "." to select class. # is selecting id so it isn't finding it.
    }
  });

</script>

A:
$(document).ready(function(){
  $("tr.reqDet").hide();

  $("select[title='requestType']").change(function(){
    if ($("[title='requestType']").val()!=""){
        $("#reqDet").hide();
    } else {
        $("#reqDet").show();
    }
  });

A: I think the if statement is working fine but the selector inside it is wrong. As you have mentioned the control which you want to show/hide has class reqDet, use the class selector. Try this.
$(document).ready(function(){
   $("tr.reqDet").hide();

   $("[title='requestType']").change(function(){
      if ($(this).val()){
          $(".reqDet").hide();
      } else {
          $(".reqDet").show();
      }
   });
});


text:
Q: Vue.js bind reactive style object px params I'm try do reactive change style HTML element from range input, but there is a problem style params font-size, height, width and more with px
Hi all

var vm = new Vue({
    el: '#app',
    data: {
        myobj: {
            css: {
                color: '#999999',
                fontSize: '18',
            }
        }
    }
})
<input v-model="myobj.css.fontSize" type="range" min="10" max="32" step="1">

but needly - "font-size: 18px, how i can do it? I'm try use filter, but is doesnt work with obj

A: You could use a computed property for your v-model:
computed: {
  fontSize: {
    get() {
      const fontPx = /(<?value>\d+(?:\.\d+)?)px/

      if (!fontPx.test(newValue))
        return 0

      const { groups: { value } } = newValue.match(fontPx)
      return value
    },
    set(newValue) {
      this.myobj.css.fontsize = newValue + 'px'
    }
  }
}

and in your template:
<input v-model="fontSize" type="range" min="10" max="32" step="1">

EDIT - I just re-read your question. I had the get and set flipped around. The edited answer should do what you need.
Alternatively, you could use a computed property for the style instead:
computed: {
  style() {
    const style = { ...this.myobj.css }
    style.fontsize = style.fontsize + 'px'

    return style
  }
}

Hi all


text:
Q: what is 0xFF in C#? What is 0xFF in C++? What should I write if I want to convert that to C#?

A: 0xFF is a hexadecimal integer which is 255 in decimal:
FF16 = 25510
In c# you can use it the same way as in c++, c, ruby, php, objective-c, objective-c++, java and many, many other languages:
int x = 0xFF;
if (x == 255) {
  // will always happen
} else {
  throw unicornNukedProcessingUnitException; // will never happen
}

Hexadecimal numbers are often used to represent octet (byte) values, since you can represent all possible values of an octet with just two hexadecimal digits and surprisingly, the highest value you can represent with two hexadecimal digits is FF, which is 255, which equals the highest value one octet can hold. :)

A: You write it exactly the same way in C# as you do in C++.

A: That's the hexidecimal number FF.  Without proper context it's kind of hard to tell you what exactly it's for or what to do to "convert" it to C#.


text:
Q: How to process files based on the creation/modified time in unix I have files with some random names such as 'HistoryData130818049895663415'. This file was last modified on Monday 24 April 2017 02:41:04 PM IST. Based on the modified time how can i process the file.
for e.g, i want to process all the files which was modified between 01 JAN 2016 to 01 JAN 2017, both dates inclusive.
Did anyone tried similar scenarios to process files??

A: Try something like this -
find /searchdir -type f -newermt 2016-01-01 ! -newermt 2017-01-01 -exec <processing cmds> {} \;

Where you can replace your processing cmd (mv, rm etc) and mt refers modification time of file.


text:
Q: Add count until certain value then reset to zero python I am trying to change the value of x depending on the length of my list
How can x count up by 5 through each iteration and then back to 0 after the 10th round?
list = {"one", "two".....fifty} #example shortened
listLen = len(list) # 50

for i in range (0, listLen) # 0 - 49

    x = ??? # +5 max 45

    ops.update(location=x)

Desired outcome:
0. x = 0
1. x = 5
2. x = 10
...
9. x = 45

10. x = 0
11. x = 5
12. x = 10
...
19. x = 45
...

(0,5,10,15,20,25,30,25,40,45,0,5,10,15,20,25,30,25,40,45
 0,5,10,15,20,25,30,25,40,45,0,5,10,15,20,25,30,25,40,45
 0,5,10,15,20,25,30,25,40,45)

A: Try this
outcome = []
lst = {1,2,3,...,50}
lstLen = range(0, len(lst), 5)

for a in range(len(lst)):
  outcome.append(lstLen[a%10])

print(outcome)

Output
[0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 0, 5, 10, 15, 20, 25, 30, 35, 40, 45,
 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 0, 5, 10, 15, 20, 25, 30, 35, 40, 45,
0, 5, 10, 15, 20, 25, 30, 35, 40, 45]

A: Try this:
ans = []
for i in range (0, listLen): # 0 - 49
    x += 5
    ans.append(x)
    if i % 9 == 0:
        x = 0


text:
Q: Me ajudem com o erro "Undefined index: referrer in " estou com um erro e estou tentando corrigir mas não consigo, alguém pode me ajudar? Obrigado.
O erro é: Notice: Undefined index: referrer in C:\xampp\htdocs\brpg\register_content.php on line 71
o arquivo "register_content.php" é:

<link href="css/login-form.css" type="text/css" rel="stylesheet" />

Register a new account

We are glad you have considered to be a new member and a part of our community and we wish you a wonderful experience here!

                    Please enter the details for your new account below.

Please note that, we do not allow multiple accounts per user and you are hereby creating an MTA game account.

    <form id="register_form" onsubmit="ajax_submit_register();
            return false;" method="post" action="" onkeypress="resetError();">

                    Username:

                    <input type="text" id="reg_username" placeholder="" maxlength="30" required/>

                        Prove you're human:

                        <input type="text" id="reg_captcha" placeholder="Enter the text above" maxlength="5" required style="width: 146px;" />

                    Password:

                    <input type="password" id="reg_password1" placeholder="" maxlength="50" min="6" required/>

                    Re-type Password:

                    <input type="password" id="reg_password2" placeholder="" maxlength="50" min="6" required/>

                    Email Address:

                    <input type="email" id="reg_email" placeholder="" maxlength="200" min="1" required/>

                    Referrer:

                    <?php
                    $referrer = strip_tags($_GET['referrer']);
                    ?>

                    <input type="text" id="reg_referrer" placeholder="Person who invited you" maxlength="30" value="<?php if ($referrer) echo $referrer; ?>" />

                <input type="checkbox" id="terms" required/> I have read and agreed to the terms and conditions.

                <input type="submit" id="submit_reg" value="Register" style="margin-top: 20px; "/>

    </form>

A: Mude a declaração da variável:
if($_GET['referrer']){
  $referrer = strip_tags($_GET['referrer']);
} else{
  $referrer = NULL;
}

Assim, quando o $_GET não for enviado, o erro não vai aparecer, pois a variável estará definida como NULL.
Você também pode usar operadores ternários, o que deixaria o código mais limpo.

A:
coloquei o código, o script agora está assim:
<link href="css/login-form.css" type="text/css" rel="stylesheet" />

Register a new account

We are glad you have considered to be a new member and a part of our community and we wish you a wonderful experience here!

                    Please enter the details for your new account below.

Please note that, we do not allow multiple accounts per user and you are hereby creating an MTA game account.

    <form id="register_form" onsubmit="ajax_submit_register();
            return false;" method="post" action="" onkeypress="resetError();">

                    Username:

                    <input type="text" id="reg_username" placeholder="" maxlength="30" required/>

                        Prove you're human:

                        <input type="text" id="reg_captcha" placeholder="Enter the text above" maxlength="5" required style="width: 146px;" />

                    Password:

                    <input type="password" id="reg_password1" placeholder="" maxlength="50" min="6" required/>

                    Re-type Password:

                    <input type="password" id="reg_password2" placeholder="" maxlength="50" min="6" required/>

                    Email Address:

                    <input type="email" id="reg_email" placeholder="" maxlength="200" min="1" required/>

                    Referrer:

                    <?php
                                   if($_GET['referrer']){
                                   $referrer = strip_tags($_GET['referrer']);
                                   } else{
                                   $referrer = NULL;
                                   }
                    ?>

                    <input type="text" id="reg_referrer" placeholder="Person who invited you" maxlength="30" value="<?php if ($referrer) echo $referrer; ?>" />

                <input type="checkbox" id="terms" required/> I have read and agreed to the terms and conditions.

                <input type="submit" id="submit_reg" value="Register" style="margin-top: 20px; "/>

    </form>


text:
Q: Monitor source SQL code of inserts into table I have a table with rows which should not be there, means the data is wrong according to business logic. And there is a lot of possible sources the insert statement of the "bad" row is coming from. I'm not able to repro this it's just happening from time to time. And I wanna know which exact SQL statement and module (eg. procedure/trigger / ad-hoc statement) is the source of that insert. To catch the culprit.
Using Profiler or Extended Events is not the way - because you don't see the data (just statements) and while I'm not able to repro this I cannot correlate the output with the data.
I've tried collect info from sys.dm_exec_input_buffer(@@SPID,0) inside my after triggering on insert (made for logging purposes, collecting every insert in that table). But this is too wide. It's giving just initial SQL statement, let say outer stored procedure, but the insert statement could be invoked in some nested stored procedure or trigger.
I've tried to collet output of sys.dm_exec_connections CROSS APPLY sys.dm_exec_sql_text(most_recent_sql_handle) - see the whole code below. But this is too narrow in opposite - it is giving me statement of my collecting after trigger.
Is there a way to catch something like it?
SELECT
OuterSQL = CAST(T.text as NVARCHAR(255))
,InnerSQL = CAST((SUBSTRING(t.text,(s.statement_start_offset/2) + 1,
          (CASE
             WHEN s.statement_end_offset = -1
               THEN DATALENGTH(t.text)
             ELSE s.statement_end_offset
           END - s.statement_start_offset)/2 + 1)) as NVARCHAR(255))
FROM sys.dm_exec_connections
    CROSS APPLY sys.dm_exec_sql_text(most_recent_sql_handle) T
    INNER JOIN sys.dm_exec_query_stats s ON sys.dm_exec_connections.most_recent_sql_handle = s.sql_handle
WHERE session_id = @@SPID;

A: You haven't included version or edition info, so if you're running SQL Server 2016 SP1 or higher (or Enterprise Edition for earlier versions), try using SQL Server Audit to trace this information.
You can set up a Database-level Audit to capture INSERT action on that table, then query the audit files to identify the calling application and statements.
SQL Audit: https://learn.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-database-engine?view=sql-server-2017
Audit Action Groups: https://learn.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions?view=sql-server-2017
Also, Profiler and Extended Events should be able to capture this information for you. Which trace events are you capturing?
If you use the template TSQL_Replay trace and filter it appropriately, you should be able to see the calling code, including the explicit values passed to the stored proc or INSERT statement.

A: I am not really sure what you mean by bad rows, Is it something which is junk data coming from external source or from some internal deliberate attempt. In any case, I think you need to be careful about granted access to users at your database. Most of users should be having read access only so that they can't perform any DML operation i.e. insert/update/delete. For those users, who are supposed to be performing DML operations, should be doing it through execute permission on stored procedure/functions and not through direct write access on tables.
I am not sure how is your application architecture however above explains the ideal(effective) way of handling business logic and avoid any issue with bad/wrong data inserts. Sysadmin access will be only with DBA who will not know much about data and their work is more on administration side.
Having said above, if its external party then get your firewalls checked by network administrator, in case its internal - check the access. And if this is coming from legitimate application then raise this with application team and get the business validation in place at application layer instead of finding the source of data after insert at database.
One more thing to note here - if bad data is coming through any user object i.e. procedure/trigger/function that means they need to be enhanced and business logic needs to be in place to error out when data is not updated/inserted in-line with business logic.
I hope above helps.


text:
Q: Is this the correct way to delete an item using redux? I know I'm not supposed to mutate the input and should clone the object to mutate it. I was following the convention used on a redux starter project which used:
ADD_ITEM: (state, action) => ({
  ...state,
  items: [...state.items, action.payload.value],
  lastUpdated: action.payload.date
})

for adding an item - I get the use of spread to append the item in the array.
for deleting I used:
DELETE_ITEM: (state, action) => ({
  ...state,
  items: [...state.items.splice(0, action.payload), ...state.items.splice(1)],
  lastUpdated: Date.now()
})

but this is mutating the input state object - is this forbidden even though I am returning a new object?

A: The ES6 Array.prototype.filter method returns a new array with the items that match the criteria. Therefore, in the context of the original question, this would be:
DELETE_ITEM: (state, action) => ({
  ...state,
  items: state.items.filter(item => action.payload !== item),
  lastUpdated: Date.now()
})

A: No. Never mutate your state.
Even though you're returning a new object, you're still polluting the old object, which you never want to do. This makes it problematic when doing comparisons between the old and the new state. For instance in shouldComponentUpdate which react-redux uses under the hood. It also makes time travel impossible (i.e. undo and redo).
Instead, use immutable methods. Always use Array#slice and never Array#splice.
I assume from your code that action.payload is the index of the item being removed. A better way would be as follows:
items: [
    ...state.items.slice(0, action.payload),
    ...state.items.slice(action.payload + 1)
],

A: You can use the array filter method to remove a specific element from an array without mutating the original state.
return state.filter(element => element !== action.payload);

In the context of your code, it would look something like this:
DELETE_ITEM: (state, action) => ({
  ...state,
  items: state.items.filter(item => item !== action.payload),
  lastUpdated: Date.now()
})

A: Another one variation of the immutable "DELETED" reducer for the array with objects:
const index = state.map(item => item.name).indexOf(action.name);
const stateTemp = [
  ...state.slice(0, index),
  ...state.slice(index + 1)
];
return stateTemp;

A: Deleting an item using redux in different ways.

Method 1: In that case is used createSlice( .. )

const { id } = action.payload; // destruct id
removeCart: (state, action) =>{
                 let { id } = action.payload;
                 let arr = state.carts.filter(item => item.id !== parseInt(id))
                 state.carts = arr;
               }

Method 2: In that case is used switch (... ), spread-operator

const { id } = action.payload; // destruct id

case actionTypes.DELETE_CART:
     return {
        ...state,
        carts: state.carts.filter((item) => item.id !== payload)
      };

For both methods initialized this state:
  initialState: {
      carts: ProductData, // in productData mocked somedata
    }

A: The golden rule is that we do not return a mutated state, but rather a new state. Depending on the type of your action, you might need to update your state tree in various forms when it hits the reducer.
In this scenario we are trying to remove an item from a state property.
This brings us to the concept of Redux's immutable update (or data modification) patterns. Immutability is key because we never want to directly change a value in the state tree, but rather always make a copy and return a new value based on the old value.
Here is an example of how to delete a nested object:

// ducks/outfits (Parent)

// types
export const NAME = `@outfitsData`;
export const REMOVE_FILTER = `${NAME}/REMOVE_FILTER`;

// initialization
const initialState = {
  isInitiallyLoaded: false,
  outfits: ['Outfit.1', 'Outfit.2'],
  filters: {
    brand: [],
    colour: [],
  },
  error: '',
};

// action creators
export function removeFilter({ field, index }) {
  return {
    type: REMOVE_FILTER,
    field,
    index,
  };
}

export default function reducer(state = initialState, action = {}) {
  sswitch (action.type) {
  case REMOVE_FILTER:
  return {
    ...state,
    filters: {
    ...state.filters,
       [action.field]: [...state.filters[action.field]]
       .filter((x, index) => index !== action.index)
    },
  };
  default:
     return state;
  }
}

To understand this better, make sure to check out this article: https://medium.com/better-programming/deleting-an-item-in-a-nested-redux-state-3de0cb3943da


text:
Q: Telnet to Gmail SMTP server timeout I'm doing some testing of SMTP servers. I want to see the capabilities returned by the server in response to a EHLO. Gmail is timing out for SMTP:
$ dig gmail.com mx

; <<>> DiG 9.8.5-P1 <<>> gmail.com mx
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 60432
;; flags: qr rd ra; QUERY: 1, ANSWER: 5, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;gmail.com.         IN  MX

;; ANSWER SECTION:
gmail.com.      3599    IN  MX  20 alt2.gmail-smtp-in.l.google.com.
gmail.com.      3599    IN  MX  5 gmail-smtp-in.l.google.com.
gmail.com.      3599    IN  MX  40 alt4.gmail-smtp-in.l.google.com.
gmail.com.      3599    IN  MX  10 alt1.gmail-smtp-in.l.google.com.
gmail.com.      3599    IN  MX  30 alt3.gmail-smtp-in.l.google.com.

And:
$ telnet gmail-smtp-in.l.google.com smtp
Trying 74.125.29.26...
telnet: connect to address 74.125.29.26: Operation timed out
Trying 2607:f8b0:400d:c04::1a...
telnet: connect to address 2607:f8b0:400d:c04::1a: No route to host
telnet: Unable to connect to remote host

I'm not sure if this is Verizon blocking the connection from a DHCP block, if the problem lies elsewhere, or if Google just does not offer SMTP any longer (perhaps due to all the privacy violations of the US and other governments).
Does Google/Gmail still offer SMTP at port 25?

A: Those are gmail's MX servers, used to receive mail, and they accept connections to port 25 from here:
# telnet gmail-smtp-in.l.google.com smtp
Trying 173.194.65.27...
Connected to gmail-smtp-in.l.google.com.
Escape character is '^]'.
220 mx.google.com ESMTP b6si7271885eem.150 - gsmtp

While they technically are SMTP servers, they're not used to forward clients email, but only to
accept mail from other server to @gmail.com accounts.
To send mail with gmail use smtp.gmail.com, and yes, it responds on port 25 too:
# telnet smtp.gmail.com 25
Trying 173.194.65.108...
Connected to gmail-smtp-msa.l.google.com.
Escape character is '^]'.
220 mx.google.com ESMTP n1sm10228410eey.12 - gsmtp

A: No it doesn't offer cleartext SMTP on 25 anymore, goes on SSMTP on 465.


text:
Q: require('fs') to read/write with vuejs i want to read/write text local file
I'm using fs like this
import * as fs from "fs";
const result = fs.readFileSync("sCode.txt", { encoding: "utf-8" });
console.log(result);

but i got this console error TypeError: fs__WEBPACK_IMPORTED_MODULE_1__.readFileSync is not a function
how can i use fs with vuejs or if there another way to read/write local file


text:
Q: как переделать запрос с insert into на update Подскажите, как переписать этот запрос на update? в  were id=1
конкретно этот
// $sql = "INSERT INTO minutes_for_graf ( block_time, block_reward, difficulty24, nethash, exchange_rate ) VALUES ('".($row['Decred']['block_time'])."','".($row['Decred']['block_reward'])."','".($row['Decred']['difficulty24'])."','".($row['Decred']['nethash'])."','".($row['Decred']['exchange_rate'])."')";

вся функция
<?php
$connect = mysqli_connect("localhost","root","root","forgraf");
$filename = "asic.json";

$data = file_get_contents($filename);
$array = json_decode($data, true);
foreach($array as $row){

// $sql = "INSERT INTO minutes_for_graf ( block_time, block_reward, difficulty24, nethash, exchange_rate ) VALUES ('".($row['Decred']['block_time'])."','".($row['Decred']['block_reward'])."','".($row['Decred']['difficulty24'])."','".($row['Decred']['nethash'])."','".($row['Decred']['exchange_rate'])."')";

    mysqli_query($connect, $sql);
    var_dump($row);
}
?>

A: Есть встроенные функции для конкатенации массива,например implode, но при этом нужно соблюсти порядок ключей и значений при использование INSERT, для этого лучше использовать INSERT SET, а не VALUE, ибо при огромном количестве атрибутов, сложно поддерживать порядок правильного ввода.
В место
INSERT INTO table (a, b, c) VALUES (1,2,3)
Что-то типа:
INSERT INTO table SET a=1, b=2, c=3
Если взять Ваш пример за основу, то:
$sql = "INSERT INTO minutes_for_graf ( block_time, block_reward, difficulty24, nethash, exchange_rate ) VALUES ('".($row['Decred']['block_time'])."','".($row['Decred']['block_reward'])."','".($row['Decred']['difficulty24'])."','".($row['Decred']['nethash'])."','".($row['Decred']['exchange_rate'])."')";
Можно немного модернизировать под следующий код:
$row['Decred'] = [
        'block_time' => '2',
        'difficulty24' => '4'
    ];

if (array_key_exists('Decred', $row)) {
    $rowDecredData = $row['Decred'];

$changedData = array_reduce(array_keys($rowDecredData), function($carryData, $attrName) use($rowDecredData) {
        return array_merge($carryData, ["$attrName=\"$rowDecredData[$attrName]\""]);
    }, []);

$concatenatedToStringData = implode(', ', $changedData);

$insertIntoQuerySql = <<<SQL
    INSERT INTO minutes_for_graf SET $concatenatedToStringData
SQL;
}

Запрос ввода будет выглядеть следующим образом INSERT INTO minutes_for_graf SET block_time="2", difficulty24="4".
Следовательно по данной аналогии остается сделать небольшие изменения в теле запроса:
UPDATE minutes_for_graf SET block_time="2", difficulty24="4" WHERE id=1


text:
Q: Annotation of bar subplots This is the part of the code that plots the bars
x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
...
width=0.7
tonto1 = ax1.bar(x,WRF2,width,alpha=1.0, edgecolor='black',color=colorG)
vonvo1 = ax2.bar(x,WRF1,width,alpha=1.0, edgecolor='black',color=colorG)

tinti = ax1.set_xticks(x)
tinti2 = ax1.set_xticklabels(clusters,rotation=60,fontsize=5)
ax1.set_ylim([0.0,350.0])
ax1.set_ylabel("Time (s)", fontsize=6.0)

vinvi = ax2.set_xticks(x)
vinvi2 = ax2.set_xticklabels(clusters,rotation=60,fontsize=5)
ax2.set_ylabel("Performance (normalized per core)", fontsize=6.0)

plt.tight_layout()
plt.savefig('***', format='png', dpi=300)
plt.show()

What I don't understand is why the annotation is as shown in the image.
Why is it like grouping some and not using x to locate the (xticks)labels? Thanks.

A: The x tick labels are currently center aligned, it just doesn't look that way because the tick labels are very long (look at the center of each label and you can see it lines up). See this post for potential fixes. The simplest is to add ha=right to your set_xticklabels commands.


text:
Q: Not understanding the meaning of Genmask in linux routing table lanix@lanix ~ $ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.0.0.138      0.0.0.0         UG    0      0        0 wlan0
10.0.0.0        0.0.0.0         255.255.255.0   U     9      0        0 wlan0
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 eth0
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0

I am having some difficulty in understanding the 0.0.0.0 entries in the Gateway and Genmask columns.
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    0.0.0.0         10.0.0.138      0.0.0.0         UG    0      0        0 wlan

I understand that the destination (0.0.0.0) is the least specific match meaning packets which do not match the other routes will use this route. However I do not understand the corresponding Genmask entry (0.0.0.0).. Packets which do not match the other routes will be sent to the gateway 10.0.0.138 but what is the subnet mask? 0? 10.0.0.138/0 looks a bit odd. Shouldn't it be something like /32? As in the gateway is a single address..
Thanks.

A: A simple misunderstanding: The netmask refers to the destination address, not to the gateway address, of course. The gateway must be a single address as you cannot send packets to a subnet. I.e. it's 0.0.0.0/0.0.0.0 which (as you already understood) just describes the default route.
You should get used to use ip route instead of route.


text:
Q: HLS player with mooTools 1.4.5 We've bene hired to do some work on a site that uses mooTools 1.4.5 as its javascript framework.
For the sake of this project we need to be able to play HLS video streams on that site. We tried to use videojs 7.0.3 + videojs-contrib-hls 5.14 as we had good experience with this player, but it looks like it conflicts with mooTools, maybe around Function.prototype.bind as suggested by a thread on github (see https://github.com/videojs/video.js/issues/3097 )
I'm attaching a screencapture from the console:Screen capture from the console
Could anybody advice how to solve the problem without breaking either the player or mooTools?
Do you know of any HLS player that will definitely work with mooTools 1.4.5 and not require JQuery?
Thanks for any help


text:
Q: Is there a pseudofinite group with a quantifier-free instance of the order property? Recall that a group $G$ is pseudofinite if every first-order sentence $\varphi$ (in the language of groups) satisfied in $G$ is also satisfied in some finite group. Also recall that an instance of the order property in $G$ is a pair of sequences of finite tuples of elements of $G$, $\{\bar{a}_i\}_{i<\omega}$ and $\{\bar{b}_{j}\}_{j < \omega}$ (with any two $\bar{a}_i$'s the same length and any two $\bar{b}_{j}$'s the same length), together with a formula $\varphi(\bar{x},\bar{y})$ such that for any $i, j < \omega$, $G$ satisfies $\varphi(\bar{a}_i,\bar{b}_j)$ if and only if $i<j$.
I'm curious about the existence of such a thing with $\varphi$ a quantifier free formula. Using some typical arguments, you can show that if such a thing exists, then it exists with $\varphi$ a positive atomic formula, which can further be reduced to an expression of the form $t(\bar{x},\bar{y})=e$, with $e$ the group identity. By rearranging the tuples in question and possibly adding inverses and instances of $e$ in, we can actually assuming that this expression is of the form $\prod_{\ell<n} x_\ell y_\ell = e$. By a compactness argument, this finally reduces to the following question:

Question: Does there exist an $n< \omega$ such that for every $k< \omega$, there is a finite group $H$ together with $n$-tuples $\bar{a}^0,\dots,\bar{a}^{k-1},\bar{b}^0,\dots,\bar{b}^{k-1} \in H$ for which for any $i,j < k$, $\prod_{\ell<n} a^i_\ell b^j_\ell = e$ if and only if $i < j$?

This is pretty likely to be true and also likely to be known, but I'm having difficulty thinking of something or finding a reference. I'm also curious about quantifier-free instances of the independence property and the strong order property, but I wanted to keep this question focused.

A: Short answer: Given a prime $p>2$, an infinite extra-special $p$ group is pseudofinite, and the quantifier-free formula $xy=yx$ witnesses the independence property (and so witnesses the order property too).
Details: I am basically just quoting from the Appendix in Definable envelopes in groups having a simple theory by Milliet. Let $p>2$ be prime. An extra-special $p$ group is a group $G$ such that  $g^p=1$ for all $g\in G$, $Z(G)$ is cyclic of order $p$, and $Z(G)=[G,G]$.
It is well-known that there is a unique countably infinite extra-special $p$-group. In fact, Felgner showed that the theory of infinite extra-special $p$-groups is a well-defined complete $\aleph_0$-categorical first-order theory in the language of groups. The following is a concrete construction of the countable model.
Let $V$ be a vector space over $\mathbb{F}_p$ of dimension $\aleph_0$, and let $\langle\cdot,\cdot\rangle$ be a non-degenerate skew-symmetric bilinear form on $V$. Let $G=V\times\mathbb{F}_p$ and define the group operation
$$
(u,a)\ast (v,b)=(u+v,a+b+\langle u,v\rangle).
$$
Then $(G,\ast)$ is the countably infinite extra-special $p$-group.
Now, since the bilinear form is skew-symmetric, and $p>2$, it follows that $(u,a)\ast(v,b)=(v,b)\ast (u,a)$ if and only if $\langle u,v\rangle=0$. So we can witness the independence property for the formula $\varphi(x,y)$ given by $x\ast y=y\ast x$. Specifically, we fix $n$ and find $g_1,\ldots,g_n\in G$ such that for any $X\subseteq\{1,\ldots,n\}$ there is some $h_X\in G$ so that $g_i\ast h_X=h_X\ast g_i$ if and only if $i\in X$. Let $u_1,\ldots,u_n$ be linearly independent vectors in $V$ and set $g_i=(u_i,0)$. Since the bi-linear form is non-degenerate, the maps $v\mapsto \langle u_i,v\rangle$ are linearly independent. So we can find $v_X\in V$ such that $\langle u_i,v_X\rangle =0$ if $i\in X$ and $\langle u_i,v_X\rangle =1$ if $i\not\in X$. Now let $h_X=(v_X,0)$ and we have the desired elements of $G$.
Note that we are really just using the fact that $G$ interprets the structure $V$ (with the bilinear form), which has the independence property witnessed by the formula $\langle x,y\rangle =0$. (Actually these theories are bi-interpretable.)
Finally, to see that this theory is pseudofinite, one only needs to know that there are arbitrarily large finite extra-special $p$-groups, which is also well-known. Then any non-principal ultraproduct is a model of the theory. Actually this is a $1$-dimensional asymptotic class in the sense of Macpherson and Steinhorn (see Proposition 3.11 of One-dimensional asymptotic classes of finite structures).
Edit. The theory of infinite extra-special $p$ groups is simple, so there is no formula with the strict order property. I don't know an example for SOP. There is no $\aleph_0$-categorical example, since no $\aleph_0$-categorical pseudofinite theory has the strict order property (see Proposition 1.3 this paper by Alex Kruckman).


text:
Q: Unrecognized selector sent to instance, Working with Json Data & OnConnect API In my app, I am calling API from OnConnect and I am having trouble passing key object from JSon data to NSArray to populate tableview.
My breakpoint come to where I pass objectAtIndex to tableview row. Can anyone please suggest me whether I am accessing JSon data shown in the screenshot properly. This is my first try with JSon and API.
Please see my code and API response below for details:
cell.textLabel.text = [[movieslist objectAtIndex:indexPath.row] objectForKey:@"startTime"];

> -[__NSCFDictionary objectAtIndex:]: unrecognized selector sent to instance 0xd673bb0

[{
    "startTime": "2013-08-18T12:10Z",
    "endTime": "2013-08-18T14:35Z",
    "duration": 145,
    "ratings": [{
        "body": "Motion Picture Association of America",
        "code": "PG"
    }],

A: You should print out your moviesList and make sure you are getting what you are expecting.
However you are getting the data, it is returning an NSDictionary and not an NSArray, as you are expecting.
Because it is returning an NSDictionary, there is no objectAtIndex method, and thus you get the error that you see.


text:
Q: if condition wont work in the php script I'm trying to make a message appear only if I click on the button and it sends the email, but before I click the button the message is already there.
I called the PHP script with a submit button that has an action form on the same page, and this is the PHP script that I called:
 if(isset($_POST['envEmail']))
                    {
                      $nome=  $_POST['name'];
                      $emailcliente=  $_POST['emailCliente'];
                      $assunto=  $_POST['assunto'];
                      $menssagem=  $_POST['message'];
                          $to  = 'jun@paconstrushop.com.br'; //can receive notification

                          $subject = $assunto;
                          $message = 'Email enviado por:'.$nome."\n".$menssagem;
                          $headers = 'From:'.$emailcliente. "\r\n" .
                              'Reply-To: jun@paconstrushop.com.br' . "\r\n" .
                              'X-Mailer: PHP/' . phpversion();

                          mail($to, $subject, $message, $headers);

                          echo "

Sent your message successfully!

";
                    }else {
                        echo "

Error
 Sorry there was an error sending your form.
";
                    }

                     ?>

the fisrt echo is always dusplayed, it tried adding another if :
 if( mail($to, $subject, $message, $headers)){
   echo"success";
  }else{
   echo"error";
   }

but it didn't change, could someone tell me how to display if email is successful?
this is the divs and form that call the php script:

                    <form role="form" action="Contato.php" method="post"  >

                             Nome:
                            <input type="text" class="form-control" id="name" name="name" required maxlength="50">

                             Email:
                            <input type="email" class="form-control" id="email" name="emailCliente" required maxlength="50">

                             Assunto:
                            <input type="text" class="form-control" id="name" name="assunto" required maxlength="50">

                             Message:
                            <textarea class="form-control" type="textarea" name="message" id="message" placeholder="Escreva sua mensagem aqui" maxlength="6000" rows="7"></textarea>

                        <button type="submit" name="envEmail" class="botaoEnviar pull-right" id="btnContactUs">Enviar! →</button>
                    </form>
                    <?php

                    if(isset($_POST['envEmail']))
                   {
                     $nome=  $_POST['name'];
                     $emailcliente=  $_POST['emailCliente'];
                     $assunto=  $_POST['assunto'];
                     $menssagem=  $_POST['message'];
                     $to  = 'jun@paconstrushop.com.br'; //can receive notification

                     $subject = $assunto;
                     $message = 'Email enviado por:'.$nome."\n".$menssagem;
                     $headers = 'From:'.$emailcliente. "\r\n" .
                         'Reply-To: jun@paconstrushop.com.br' . "\r\n" .
                         'X-Mailer: PHP/' . phpversion();

                     if(@mail($to, $subject, $message, $headers))
                     {
                         echo "

Sent your message successfully!

";
                     }
                     else
                     {
                       echo "

Error
 Sorry there was an error sending your form.
";
                     }
                   }
                     ?>

A: the problem was in the button that submits the form, instead of button tag  i should have used input tag with type submit, when i made those changes it worked.

A: Did you try this:
  if(isset($_POST['envEmail']))
  {
    $nome=  $_POST['name'];
    $emailcliente=  $_POST['emailCliente'];
    $assunto=  $_POST['assunto'];
    $menssagem=  $_POST['message'];
    $to  = 'jun@paconstrushop.com.br'; //can receive notification

    $subject = $assunto;
    $message = 'Email enviado por:'.$nome."\n".$menssagem;
    $headers = 'From:'.$emailcliente. "\r\n" .
        'Reply-To: jun@paconstrushop.com.br' . "\r\n" .
        'X-Mailer: PHP/' . phpversion();

    if(@mail($to, $subject, $message, $headers))
    {
        echo "

Sent your message successfully!

";
    }
    else
    {
      echo "

Error
 Sorry there was an error sending your form.
";
    }
  }


text:
Q: Proof for The Limit $\lim_{n\to\infty}\frac{3n^2-n}{4n^2+1}=\frac{3}{4},\space n\in\Bbb{N}$ I am revising my knowledge on the topic of real analysis by attempting some simple proofs. The question requires for the proof of the Limit for $\lim_{n\to\infty}\frac{3n^2-n}{4n^2+1}=\frac{3}{4}$ using the definition of convergence: $$\forall\epsilon>0\space\space\exists N\in\Bbb{R}\space s.t\space\space \forall n>N,|s_n-L|<\epsilon$$ Below is my working: $$|\frac{3n^2-n}{4n^2+1}-\frac{3}{4}|<\epsilon$$ $$|\frac{3n^2-n}{4n^2+1}-\frac{3n^2+\frac{3}{4}}{4n^2+1}|=|\frac{-n-\frac{3}{4}}{4n^2+1}|=\frac{|-n-\frac{3}{4}|}{4n^2+1}<\frac{4n}{4n^2}=\frac{1}{n}<\epsilon $$ $$\frac{1}{n}<\epsilon\rightarrow\frac{1}{\epsilon}<n$$ $$\forall n>N=\frac{1}{\epsilon},\space|\frac{3n^2-n}{4n^2+1}-\frac{3}{4}|<\frac{1}{n}<\epsilon$$ By the definition of convergence,$\space\frac{3n^2-n}{4n^2+1}\rightarrow\frac{3}{4}$ as $n\rightarrow\infty.$
Is this correct? Any feedback would be greatly appeciated.

A: I think you need more words, and that as it stands the second line isn't quite right.
I would write
Given $\epsilon>0$ we want to find an $N$ such that for $n>N$ we have
$$|\frac{3n^2-n}{4n^2+1}-\frac{3}{4}|<\epsilon.\tag 1 $$
Let us see how big the left hand side can be:
$$|\frac{3n^2-n}{4n^2+1}-\frac{3n^2+\frac{3}{4}}{4n^2+1}|=|\frac{-n-\frac{3}{4}}{4n^2+1}|=\frac{|-n-\frac{3}{4}|}{4n^2+1}<\frac{4n}{4n^2}=\frac{1}{n},$$
so that (1) will be true for all $n>N:=\frac{1}{\epsilon}$.

A: Check:
With $n=\dfrac1{\epsilon}$,
$$\left|\frac{\dfrac3{\epsilon^2}-\dfrac1{\epsilon}}{\dfrac4{\epsilon^2}+1}-\frac{3}{4}\right|=\left|\frac{3-\epsilon}{4+\epsilon^2}-\frac{3}{4}\right|=\left|\frac{4+3\epsilon}{4(4+\epsilon^2)}\right|\epsilon<\left|\frac{4+3\epsilon}{16}\right|\epsilon<\epsilon.$$

A: Given $\epsilon>0$ be any number.
Now
\begin{align}
&\left|\frac{3n^2-n}{4n^2+1}-\frac{3}{4}\right|\\
&=\left|\frac{-4n-3}{4(4n^2+1)}\right|\\
&=\frac{4n+3}{4(4n^2+1)}\\
&<\frac{n+1}{(4n^2+1)}\\
&<\frac{n+1}{(n^2+1)}\\
&<\frac{n+1}{n^2}<\epsilon\quad &\text{whenever}\quad n^2\epsilon-n-1>0\\
&&\text{i.e whenever}\quad n>\dfrac{1+\sqrt {1+4\epsilon}}{2\epsilon}\\
\end{align}
Now you can take $N=\left[{\dfrac{1+\sqrt {1+4\epsilon}}{2\epsilon}}\right]+1$ and this also allows $N$ to be a positive integer rather than just a real number which, in cases, can be difficult to find out.
Therefore
$\left|\frac{3n^2-n}{4n^2+1}-\frac{3}{4}\right|<\epsilon$ whenever $n>N$


text:
Q: Rails: Couldn`t find #controller with ID of When submitting an answer I get this error:
ActiveRecord::RecordNotFound (Couldn't find Question with ID=answer):
  app/controllers/questions_controller.rb:6:in `show'

From what I understand I either made a error with passing an argument from the form or
didn`t define it correctly in my controller.
Would appreciate some help finding this bug, thanks in advance!
Questions_Controller:
class QuestionsController < ApplicationController
  def index
  end

  def show
      @question = Question.find(params[:id])
      @choices = @question.choices
  end

  def answer
      @choice = Choice.find(:first, :conditions => { :id => params[:id] })
      @answer = Answer.create(:question_id => @choice.question_id, :choice_id => @choice.id)

      if Question.last == @choice.question
        render :action => "thank_you"
      else
        question = Question.find(:first, :conditions => { :position => (@choice.question.position + 1) })
        redirect_to question_path(:id => question.id)
      end
   end
end

views/questions/show.html.erb :

<%= @question.question %>

    <% @choices.each_with_index do |c, i| %>
      <% i = i + 1 %>

        <%= link_to "#{i}. #{c.choice}", answer_questions_path(:id => c.id) %>

    <% end %>

::EDIT::
This happens when I try to select a choice & submit an answer while on the first question.
Started GET "/questions/1" for 127.0.0.1 at Thu Dec 01 01:38:36 -0500 2011
  Processing by QuestionsController#show as
  Parameters: {"id"=>"1"}
  SQL (0.6ms)   SELECT name
 FROM sqlite_master
 WHERE type = 'table' AND NOT name = 'sqlite_sequence'
  Question Load (0.3ms)  SELECT "questions".* FROM "questions" WHERE "questions"."id" = 1 LIMIT 1
  Choice Load (10.8ms)  SELECT "choices".* FROM "choices" WHERE ("choices".question_id = 1)
Rendered questions/show.html.erb within layouts/application (28.8ms)
Completed 200 OK in 424ms (Views: 118.0ms | ActiveRecord: 11.6ms)

Started GET "/questions/answer?id=1" for 127.0.0.1 at Thu Dec 01 01:38:38 -0500 2011
  Processing by QuestionsController#show as
  Parameters: {"id"=>"answer"}
  Question Load (0.1ms)  SELECT "questions".* FROM "questions" WHERE "questions"."id" = 0 LIMIT 1
Completed   in 10ms

ActiveRecord::RecordNotFound (Couldn't find Question with ID=answer):
  app/controllers/questions_controller.rb:6:in `show'

Hope this helps.

A: My best guess is that you don't have a route correctly setup.  Assuming that you're using Rails 3 and you're using resources, you need to do add the following:
resources :questions do
  member do
     put 'answer'
  end
end

This will create a route like /questions/#{id}/answer.
Answer is not an HTTP verb, so using resources in your routes will not create a route to your answer action.
Edit based on comment:
First, if you're updating or creating data, you should use put or post.  It's a bad idea to modify data on the server with a get.  Secondly, I assume that you would be doing an answer per question.  If that is the case, you should do the action on a member, not a collection.  Also, in your answer action, you have params[:id].  You won't get params[:id] if you try to do an action on a collection rather than a member.


text:
Q: ActivityIndicator in xamarin forms not working I am working on Xamarin form. I have xaml page where I want to display ActivityIndicator when button is clicked.
It is working when I set its property IsRunning = True in xaml but not working when i set this property from code.
Here is xaml
<ContentPage.Content>
        <StackLayout VerticalOptions="StartAndExpand">
            <StackLayout>
                <Image Source="imgmain.png" Aspect="AspectFit"></Image>
                <Image Source="Companylogo.png" Aspect="AspectFit"></Image>
            </StackLayout>

            <StackLayout HorizontalOptions="StartAndExpand" Padding="10">
                <Grid Column="2" Row="4">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*" />
                        <RowDefinition  Height="*" />
                        <RowDefinition  Height="*" />
                        <RowDefinition  Height="*" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="2*" />
                    </Grid.ColumnDefinitions>

                    <Entry Placeholder="Username" Grid.Row="0" Grid.Column="1" x:Name="EntryUsername"></Entry>

                    <Entry Placeholder="Password" IsPassword="True"  Grid.Row="1" Grid.Column="1"  x:Name="EntryPassword"></Entry>
                    <Button Text="Login"  Grid.Row="2" Grid.ColumnSpan="2" Clicked="Button_OnClicked"></Button>
                    <ActivityIndicator x:Name="ActivityIndicatorLoading" Grid.Row="3" Grid.ColumnSpan="2" IsRunning="{Binding IsLoading}"  IsVisible="{Binding IsLoading}" Color="DarkBlue"></ActivityIndicator>
                </Grid>
            </StackLayout>
        </StackLayout>

    </ContentPage.Content>

code is as below
public partial class Login : ContentPage, INotifyPropertyChanged
{
    private bool isLoading;
    public bool IsLoading
    {
        set
        {
            if (isLoading != value)
            {
                isLoading = value;

                if (PropertyChanged != null)
                {
                    PropertyChanged(this,
                        new PropertyChangedEventArgs("IsLoading"));
                }
            }
        }
        get { return isLoading; }
    }
    public Login()
    {
        InitializeComponent();
        IsLoading = false;
    }

    public event PropertyChangedEventHandler PropertyChanged;

    public void RaisePropertyChanged(string propName)
    {
        if (PropertyChanged != null)
        {
            PropertyChanged(this, new PropertyChangedEventArgs(propName));
        }
    }

        public void Button_OnClicked(object sender, EventArgs e)
        {
            SetLoader(true);
            IsLoading = true;
            if (string.IsNullOrEmpty(EntryUsername.Text))
            {
                DisplayAlert("Alert", "Please enter username", "Ok");
                IsLoading = false;
                SetLoader(false);
                return;
            }
            if (string.IsNullOrEmpty(EntryPassword.Text))
            {
                DisplayAlert("Alert", "Please enter password", "Ok");
                IsLoading = false;
                SetLoader(false);
                return;
            }

            LoginManager loginManager=new LoginManager();
            User obj = loginManager.ValidateUser(EntryUsername.Text.Trim(), EntryPassword.Text.Trim());
            if (obj == null)
            {
                DisplayAlert("Error", "username/password is incorrect", "Ok");
            }
            else
            {
                Application.Current.Properties["FullName"] = obj.FirstName + " " + obj.LastName;
                Navigation.PushAsync(new MainPage());
            }

            SetLoader(false);
            IsLoading = false;
        }
    }

A: There is no ' PropertyChanged(this, new PropertyChangedEventArgs("IsLoading")); ' in getter of IsLoading property.
Then, there is no way to know its value's changed.
Please look here.
https://developer.xamarin.com/guides/xamarin-forms/xaml/xaml-basics/data_binding_basics/
Edit : Sorry for my first answer.
You need to create a ViewModel class which has a 'IsLoading' property. And assign it to BindingContext property on the ContentPage. And set the PropertyChanged event on the IsLoading property at your ViewModel class. Finally, put boolean value on it, it would work. That's MvvM.


text:
Q: Google map onClick event inside fragment class I have a mapview inside a fragment along with other UI components. When I click on map I want to open a new activity instead of zooming map in this view. Zooming should work on the new activity. Please guide me.

A: you need to use setAllGesturesEnabled(). This will disable pinching and panning.
Please see documentation here:
As for handling a click event on map, see documentation for OnMapClickListener here:
Inside the listener, you may start a new activity with another map view that is zoom-able.


text:
Q: Can anyone point me to a working code or complete concept tut for ViewMetadata in Angular2 I am trying to comprehend and link the concepts of viewmetadata and the basic usage for encapsulation : ViewEncapsulation , ViewEncapsulation.Emulated , and ViewEncapsulation.None https://angular.io/docs/ts/latest/api/core/ViewMetadata-class.html . Can anyone point me to difference of two options cleanly and working code for the same?

A: ViewEncapsulation.None:
No Shadow DOM at all. Therefore, also no style encapsulation.
ViewEncapsulation.Emulated:
No Shadow DOM but style encapsulation emulation.
ViewEncapsulation.Native:
Native Shadow DOM with all it's goodness.
You got a well explained blog post with code samples here:
http://blog.thoughtram.io/angular/2015/06/29/shadow-dom-strategies-in-angular2.html


text:
Q: Using mathematical operators in multi variable parameters I'm wondering if it's possible to include mathematical operators and situations in a multivariable parameter.
In my example, I'm looking to have the freedom to enter 'Overdue' 'Less than one day' or 'More than one day' as @SLA_Days.
Currently, I can enter any of these one variables and it will return a result.
if @sla_days = 'Overdue'
    BEGIN
        SELECT @sql = @sql + 'and sla_days < 0'
    END
ELSE

if @sla_days = 'Less than one day'
    BEGIN
        SELECT @sql = @sql + 'and sla_days <1 and sla_days >0'
    END
ELSE

if @sla_days = 'More than one day'
    BEGIN
        SELECT @sql = @sql + 'and sla_days > 1'
    END

EXEC sp_exectuesql @SQL

I do have a function that I've created that will look a comma delimited string and pull out variables. I do not need help in creating this
What I do need help is, is it possible to enter @SLA_days = 'Overdue,Less than one day,More than one day' and still have it recognize these rules?
Therefore, if I selected Overdue and less than one day, it would return both values where sla_days < 0 and sla days < 1

A: You don't need a function to pull out variables. This will perform much better.
The trick for your specific problem is to use OR instead of AND, because the value in a column could never be, for example, > 0 AND < 0. Also I add commas to each side of the variable so that conditions can be identified in any order. Note, though, that it will not find values if there are spaces between the commas as well - you'll have to adjust for that.
SET @SLA_days = ',' + @SLA_days + ',';

SET @sql = @sql + ' (1=2 '
  + CASE WHEN @SLA_days LIKE '%,Overdue,%'
    THEN ' OR (sla_days < 0)' ELSE '' END
  + CASE WHEN @SLA_days LIKE '%,Less than one day,%'
    THEN ' OR (sla_days < 1 AND sla_days > 0)' ELSE '' END
  + CASE WHEN @SLA_days LIKE '%,More than one day,%'
    THEN ' OR (sla_days > 1)' ELSE '' END + ')';

Finally, do you really need to pass these big ugly strings to the database? Presumably the users are selecting from a multi-select or checking boxes, in which case you could use much tidier coefficients to represent each case.


text:
Q: Access parent item inside a loop in jsrender <select id="Test" TestAttr="{{:LocationId}}">
       {{for #parent.parent.data.Location}}
                  <option value="{{:LocationId}}" {{if LocationId= *#parent.parent.data.LocationId*}}selected{{/if}}>{{:#parent.parent.data.LocationId}}</option>
       {{/for}}
</select>

How to get the parent array's LocationId inside if statement which is mentioned in between **.

A: You can introduce variable which will be visible inside loop
(In official documentation: Setting contextual template parameters, accessible in all nested contexts as ~nameOfParameter)
<select id="Test" TestAttr="{{:LocationId}}">
    {{for #parent.parent.data.Location ~locationId=LocationId}}
       <option value="{{:~locationId}}"...

EDITED POSTSCRIPT:
The above link is to previous documentation, now superceded.
For current documentation, see Accessing parent data.
See also this stackoverflow question


text:
Q: PBI Report Matrix formatting - Values in Grand Total only I have a report requirement and I am using PBI to visualize. The layout required is very similar to the Matrix visual. I am trying to report on Measure (SCADA Volume) by date on the columns. I want some additional measures to print ONLY FOR THE GRAND TOTAL, after all of the dates.
When I add these Measures to the Matrix Values, the measures are printed for every date. How can I apply formatting that will show those Measures only in the Grand Totals?

Solution Update
The "asymetrical columns" solution recommended (by David) was the answer. The solution is to create a Calculation Group with defined calculation for each individual column needed in the matrix.
My case required dynamic reference to trailing dates; That also required some calc columns on the 'Calendar' table to find the correct dates.
Building a Matrix with Asymmetrical Columns and Rows in Power BI - Excelerator BI
(127) REDUCE the # of measures with Calculation Groups In Power BI - YouTube

Calculation Items
{
  "InstanceID": "bae2764b-a0be-4411-82e1-d5c723ec9918",
  "calculationitems": [
    {
  "name": "Wk 1: Sun",
  "expression": "CALCULATE (\n    SELECTEDMEASURE (),\n    ALL ( 'Calendar' ),\n    'Calendar'[WeekDayOffset_Id] = 11\n)",
  "ordinal": 8,
  "modifiedTime": "2022-06-08T13:44:04.866667",
  "formatStringDefinition": {
    "expression": "\"#,0\"",
    "modifiedTime": "2022-06-08T03:33:39.253333"
  }
},
    {
  "name": "Wk 1: Mon",
  "expression": "CALCULATE (\n    SELECTEDMEASURE (),\n    ALL ( 'Calendar' ),\n    'Calendar'[WeekDayOffset_Id] = 12\n)",
  "ordinal": 9,
  "modifiedTime": "2022-06-08T13:44:04.866667",
  "formatStringDefinition": {
    "expression": "\"#,0\"",
    "modifiedTime": "2022-06-08T03:33:39.253333"
  }
},
    {
  "name": "Wk 1: Tues",
  "expression": "CALCULATE (\n    SELECTEDMEASURE (),\n    ALL ( 'Calendar' ),\n    'Calendar'[WeekDayOffset_Id] = 13\n)",
  "ordinal": 10,
  "modifiedTime": "2022-06-08T13:44:04.866667",
  "formatStringDefinition": {
    "expression": "\"#,0\"",
    "modifiedTime": "2022-06-08T03:33:39.253333"
  }
},
    {
  "name": "Wk 1: Wed",
  "expression": "CALCULATE (\n    SELECTEDMEASURE (),\n    ALL ( 'Calendar' ),\n    'Calendar'[WeekDayOffset_Id] = 14\n)",
  "ordinal": 11,
  "modifiedTime": "2022-06-08T13:44:04.866667",
  "formatStringDefinition": {
    "expression": "\"#,0\"",
    "modifiedTime": "2022-06-08T03:33:39.253333"
  }
},
    {
  "name": "Wk 1: Thu",
  "expression": "CALCULATE (\n    SELECTEDMEASURE (),\n    ALL ( 'Calendar' ),\n    'Calendar'[WeekDayOffset_Id] = 15\n)",
  "ordinal": 12,
  "modifiedTime": "2022-06-08T13:44:04.866667",
  "formatStringDefinition": {
    "expression": "\"#,0\"",
    "modifiedTime": "2022-06-08T03:33:39.253333"
  }
},
    {
  "name": "Wk 1: Fri",
  "expression": "CALCULATE (\n    SELECTEDMEASURE (),\n    ALL ( 'Calendar' ),\n    'Calendar'[WeekDayOffset_Id] = 16\n)",
  "ordinal": 13,
  "modifiedTime": "2022-06-08T13:44:04.866667",
  "formatStringDefinition": {
    "expression": "\"#,0\"",
    "modifiedTime": "2022-06-08T03:33:39.253333"
  }
},
    {
  "name": "Wk 1: Sat",
  "expression": "CALCULATE (\n    SELECTEDMEASURE (),\n    ALL ( 'Calendar' ),\n    'Calendar'[WeekDayOffset_Id] = 17\n)",
  "ordinal": 14,
  "modifiedTime": "2022-06-08T13:44:04.866667",
  "formatStringDefinition": {
    "expression": "\"#,0\"",
    "modifiedTime": "2022-06-08T03:33:39.253333"
  }
},
    {
  "name": "TOTAL Wk1",
  "expression": "CALCULATE (\n    SELECTEDMEASURE (),\n    ALL ( 'Calendar' ),\n    'Calendar'[Weeks Back Offset] = 1\n)",
  "ordinal": 15,
  "modifiedTime": "2022-06-08T13:44:54.063333",
  "formatStringDefinition": {
    "expression": "\"#,0\"",
    "modifiedTime": "2022-06-08T03:33:39.253333"
  }
},
    {
  "name": "TOTAL: 2 wks",
  "expression": "CALCULATE (\n    SELECTEDMEASURE (),\n    ALL ( 'Calendar' ),\n    'Calendar'[Weeks Back Offset] >= 1\n        && 'Calendar'[Weeks Back Offset] <= 2\n)",
  "ordinal": 16,
  "modifiedTime": "2022-06-08T13:44:04.866667"
},
    {
  "name": "7-day Avg",
  "expression": "VAR Vol_7dRolling =\n    CALCULATE (\n        SELECTEDMEASURE (),\n        DATESINPERIOD ( 'Calendar'[Date], MAX ( 'Calendar'[Date] ), -7, DAY )\n    )\nVAR Avg7d =\n    DIVIDE ( Vol_7dRolling, 7 )\nRETURN\n    Avg7d",
  "ordinal": 17,
  "modifiedTime": "2022-06-08T13:44:04.866667",
  "formatStringDefinition": {
    "expression": "\"#,0\"",
    "modifiedTime": "2022-06-08T03:33:39.253333"
  }
},
    {
  "name": "PW Avg",
  "expression": "VAR Vol_PW =\n    CALCULATE (\n        SELECTEDMEASURE (),\n        FILTER ( 'Calendar', 'Calendar'[Weeks Back Offset] = 2 )\n    )\nVAR Avg7dPW =\n    DIVIDE ( Vol_PW, 7 )\nRETURN\n    Avg7dPW",
  "ordinal": 18,
  "modifiedTime": "2022-06-08T21:56:11.783333",
  "formatStringDefinition": {
    "expression": "\"#,0\"",
    "modifiedTime": "2022-06-08T03:33:39.253333"
  }
},
    {
  "name": "% Δ PW",
  "expression": "VAR Vol_7dRolling =\n    CALCULATE (\n        SELECTEDMEASURE (),\n        DATESINPERIOD ( 'Calendar'[Date], MAX ( 'Calendar'[Date] ), -7, DAY )\n    )\nVAR Avg7d =\n    DIVIDE ( Vol_7dRolling, 7 ) \n// Prior Week\nVAR Vol_PW =\n    CALCULATE (\n        SELECTEDMEASURE (),\n        FILTER ( 'Calendar', 'Calendar'[Weeks Back Offset] = 2 )\n    )\nVAR Avg7dPW =\n    DIVIDE ( Vol_PW, 7 ) \n// Compare \nVAR ChangeDailyAvg = \n    ( Avg7d - Avg7dPW )\nVAR PctChangeDailyAvg = \n    DIVIDE(ChangeDailyAvg, Avg7d )\nRETURN\n    PctChangeDailyAvg",
  "ordinal": 19,
  "modifiedTime": "2022-06-08T22:03:06.576667",
  "formatStringDefinition": {
    "expression": "\"#,0.0%;-#,0.0%;#,0.0%\"",
    "modifiedTime": "2022-06-08T03:33:39.253333"
  }
},
    {
  "name": "* Week Roll",
  "description": "These are temp columns used for validation. BLANK() return value will exclude this calculated item",
  "expression": "VAR Vol_7dRolling =\n    CALCULATE (\n        SELECTEDMEASURE (),\n        DATESINPERIOD ( 'Calendar'[Date], MAX ( 'Calendar'[Date] ), -7, DAY )\n    )\nVAR Avg7d =\n    DIVIDE ( Vol_7dRolling, 7 )\nRETURN\n    // Vol_7dRolling\n    BLANK()",
  "ordinal": 20,
  "modifiedTime": "2022-06-08T22:05:29.33"
},
    {
  "name": "* PW Roll",
  "description": "These are temp columns used for validation. BLANK() return value will exclude this calculated item",
  "expression": "VAR Vol_PW =\n    CALCULATE (\n        SELECTEDMEASURE (),\n        FILTER ( 'Calendar', 'Calendar'[Weeks Back Offset] = 2 )\n    )\nVAR Avg7dPW =\n    DIVIDE ( Vol_PW, 7 )\nRETURN\n    // Vol_PW\n    BLANK()",
  "ordinal": 21,
  "modifiedTime": "2022-06-08T22:05:29.33"
}
  ]
}

'Calendar' table field calculations
Calendar =
ADDCOLUMNS (
    CALENDARAUTO (),
    "DateKey", FORMAT([Date], "YYYY") & FORMAT([Date], "MM") & FORMAT([Date], "DD")
    , "Year", YEAR([Date])
    , "Mo", MONTH([Date])
    , "day", DAY([Date])
    , "DayName (short)", FORMAT([Date],"ddd")
    , "DayNum", WEEKDAY([Date])
    , "Weeknum", WEEKNUM([Date],1)
    , "Mo Name", FORMAT([Date], "MMM")
    , "Mo-Yr", FORMAT([Date], "MMM") &"-"& FORMAT([Date],"YY")
    , "Mo_startDate", EOMONTH([Date],-1) + 1
    , "Yr_startDate", DATE(YEAR([Date]),1,1)
    , "Qtr", QUARTER([Date])
    , "Qtr Name", "Qtr " & FORMAT([Date], "Q")
    , "Yr Name", "YR " & FORMAT([Date], "YYYY")
    , "Mo_endDate", EOMONTH([Date],0)
    , "SortDesc_YrMo", - DATEDIFF(date(9999, 12, 31), EOMONTH([Date],-1)+1, MONTH)
    , "SortDesc_Date", - DATEDIFF(date(9999, 12, 31), [Date], DAY)
    , "Date (DESC)", [Date]
    , "Mo-Yr (DESC)",  FORMAT([Date], "MMM") &"-"& FORMAT([Date],"YY")
    , "Days Offset", DATEDIFF(TODAY(),[Date],DAY)
    , "Months Offset", DATEDIFF(TODAY(),[Date],MONTH)
    , "Years Offset", DATEDIFF(TODAY(),[Date],YEAR)
    , "Weeks Offset", DATEDIFF(TODAY(),[Date],WEEK)
    , "Weeks Back Offset", DATEDIFF(TODAY(),[Date],WEEK) * -1
    -- WEEK LOOKBACK - Format printed on report lables = "Wk 2: Mon"
    , "Lookback Day Name", "Wk " & DATEDIFF(TODAY(),[Date],WEEK) * -1 & ": " & FORMAT([Date],"ddd")
    -- WEEK LOOKBACK - Concatanate [Weeksback + Daynum] to find the relative date location = "1" weeksback & "1" day = "11" to number = 11..17 and 21..27
    , "WeekDayOffset_Id", CONVERT( CONVERT(DATEDIFF(TODAY(),[Date],WEEK) * -1, STRING) &  CONVERT(WEEKDAY([Date]), STRING), DOUBLE)
    -- WEEK LOOKBACK - Sort the [Lookback Day Name], chronological oldest to newest date
    , "WeekDayOffset_Sort", CONVERT( CONVERT(DATEDIFF(TODAY(),[Date],WEEK), STRING) &  CONVERT(WEEKDAY([Date]), STRING), DOUBLE)
)

A: You need to create what's known as an asymmetric matrix. It is quite an involved process and requires the use of a disconnected table. It is probably a bit much to describe the whole technique here so instead you can follow the guide on this link: https://exceleratorbi.com.au/building-a-matrix-with-asymmetrical-columns-and-rows-in-power-bi/


text:
Q: Python Paste SSL server with TLSv1.2 and Forward Secrecy for a Python app on Mac OS X, I need to setup an HTTPS server with TLSv1.2, Forward Secrecy, and without RC4 ciphers. Using Paste and pyOpenSSL I have write the following code:
from paste import httpserver
from OpenSSL import SSL

context = SSL.Context(SSL.SSLv23_METHOD)
context.use_privatekey_file("/Path/to/my/private.key")
context.use_certificate_chain_file("/Path/to/my/chain-cert.pem")
context.set_options(SSL.OP_NO_SSLv2)
context.set_options(SSL.OP_NO_SSLv3)
context.set_options(SSL.OP_SINGLE_DH_USE)
context.set_cipher_list("EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA384:EECDH+ECDSA+SHA256:EECDH+aRSA+SHA384:EECDH+aRSA+SHA256:EECDH:EDH+aRSA:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS:!RC4")
logger.debug("OPENSSL version: %s" % SSL.SSLeay_version(SSL.SSLEAY_VERSION))

httpserver.serve(app_logged, host=http_host, port=http_port, server_version=server_version, ssl_context=context, use_threadpool=True, threadpool_workers=15, request_queue_size=5)

But Safari, Chrome and OpenSSL client failed to connect to my server with the error "no shared cipher". So, what did I do wrong?
Note: Default OS X versions of Python (2.7.6) and OpenSSL (0.9.8) are not compatible with TLSv1.2, so I had to compile OpenSSL 1.0.2 and Python 2.7.10 from sources.
If I check my OpenSSL ciphers list, it give me this:
$ /usr/local/bin/openssl ciphers -V 'EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA384:EECDH+ECDSA+SHA256:EECDH+aRSA+SHA384:EECDH+aRSA+SHA256:EECDH:EDH+aRSA:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS:!RC4'
0xC0,0x2C - ECDHE-ECDSA-AES256-GCM-SHA384 TLSv1.2 Kx=ECDH     Au=ECDSA Enc=AESGCM(256) Mac=AEAD
0xC0,0x2B - ECDHE-ECDSA-AES128-GCM-SHA256 TLSv1.2 Kx=ECDH     Au=ECDSA Enc=AESGCM(128) Mac=AEAD
0xC0,0x30 - ECDHE-RSA-AES256-GCM-SHA384 TLSv1.2 Kx=ECDH     Au=RSA  Enc=AESGCM(256) Mac=AEAD
0xC0,0x2F - ECDHE-RSA-AES128-GCM-SHA256 TLSv1.2 Kx=ECDH     Au=RSA  Enc=AESGCM(128) Mac=AEAD
0xC0,0x24 - ECDHE-ECDSA-AES256-SHA384 TLSv1.2 Kx=ECDH     Au=ECDSA Enc=AES(256)  Mac=SHA384
0xC0,0x23 - ECDHE-ECDSA-AES128-SHA256 TLSv1.2 Kx=ECDH     Au=ECDSA Enc=AES(128)  Mac=SHA256
0xC0,0x28 - ECDHE-RSA-AES256-SHA384 TLSv1.2 Kx=ECDH     Au=RSA  Enc=AES(256)  Mac=SHA384
0xC0,0x27 - ECDHE-RSA-AES128-SHA256 TLSv1.2 Kx=ECDH     Au=RSA  Enc=AES(128)  Mac=SHA256
0xC0,0x14 - ECDHE-RSA-AES256-SHA    SSLv3 Kx=ECDH     Au=RSA  Enc=AES(256)  Mac=SHA1
0xC0,0x0A - ECDHE-ECDSA-AES256-SHA  SSLv3 Kx=ECDH     Au=ECDSA Enc=AES(256)  Mac=SHA1
0xC0,0x13 - ECDHE-RSA-AES128-SHA    SSLv3 Kx=ECDH     Au=RSA  Enc=AES(128)  Mac=SHA1
0xC0,0x09 - ECDHE-ECDSA-AES128-SHA  SSLv3 Kx=ECDH     Au=ECDSA Enc=AES(128)  Mac=SHA1
0x00,0x9F - DHE-RSA-AES256-GCM-SHA384 TLSv1.2 Kx=DH       Au=RSA  Enc=AESGCM(256) Mac=AEAD
0x00,0x6B - DHE-RSA-AES256-SHA256   TLSv1.2 Kx=DH       Au=RSA  Enc=AES(256)  Mac=SHA256
0x00,0x39 - DHE-RSA-AES256-SHA      SSLv3 Kx=DH       Au=RSA  Enc=AES(256)  Mac=SHA1
0x00,0x88 - DHE-RSA-CAMELLIA256-SHA SSLv3 Kx=DH       Au=RSA  Enc=Camellia(256) Mac=SHA1
0x00,0x9E - DHE-RSA-AES128-GCM-SHA256 TLSv1.2 Kx=DH       Au=RSA  Enc=AESGCM(128) Mac=AEAD
0x00,0x67 - DHE-RSA-AES128-SHA256   TLSv1.2 Kx=DH       Au=RSA  Enc=AES(128)  Mac=SHA256
0x00,0x33 - DHE-RSA-AES128-SHA      SSLv3 Kx=DH       Au=RSA  Enc=AES(128)  Mac=SHA1
0x00,0x9A - DHE-RSA-SEED-SHA        SSLv3 Kx=DH       Au=RSA  Enc=SEED(128) Mac=SHA1
0x00,0x45 - DHE-RSA-CAMELLIA128-SHA SSLv3 Kx=DH       Au=RSA  Enc=Camellia(128) Mac=SHA1

and I know that Safari 8 is compatible with cipher "ECDHE-RSA-AES128-SHA256" for example, so why I have a 'no shared cipher' error?
$ /usr/local/bin/openssl s_client -connect 192.168.0.17:4443 -tls1_2
CONNECTED(00000003)
140735274361680:error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure:s3_pkt.c:1472:SSL alert number 40
140735274361680:error:1409E0E5:SSL routines:ssl3_write_bytes:ssl handshake failure:s3_pkt.c:656:
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 7 bytes and written 0 bytes
---
New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
Protocol  : TLSv1.2
Cipher    : 0000
Session-ID:
Session-ID-ctx:
Master-Key:
Key-Arg   : None
PSK identity: None
PSK identity hint: None
SRP username: None
Start Time: 1439975452
Timeout   : 7200 (sec)
Verify return code: 0 (ok)
---

Alternative: If I change my cipher list to
context.set_cipher_list("HIGH:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS:!RC4:@STRENGTH")

It works, browsers and openssl client are able to establish a secured connection with cipher 'AES256-GCM-SHA384' on protocol TLSv1.2, but it is not an ECDHE cipher (therefore no Forward Secrecy).
EDIT correct answer:
For the DH ciphers, you need a DH parameters file in PEM format, you can generate one with the following command:
$ /usr/local/bin/openssl dhparam 2048 -out dhparams.pem

For the ECDHE ciphers, you will need to set an elliptic curve for the SSL context. You can retrieve the available curves on your system with pyOpenSSL:
OpenSSL.crypto.get_elliptic_curves()

Which give us the correct following python code:
from paste import httpserver
from OpenSSL import SSL
from OpenSSL import crypto

context = SSL.Context(SSL.SSLv23_METHOD)
context.use_privatekey_file("/Path/to/my/private.key")
context.use_certificate_chain_file("/Path/to/my/chain-cert.pem")
context.load_tmp_dh("/Path/to/my/dhparams.pem")
context.set_tmp_ecdh(crypto.get_elliptic_curve("prime256v1"))
context.set_options(SSL.OP_NO_SSLv2)
context.set_options(SSL.OP_NO_SSLv3)
context.set_options(SSL.OP_SINGLE_DH_USE)
context.set_cipher_list("EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA384:EECDH+ECDSA+SHA256:EECDH+aRSA+SHA384:EECDH+aRSA+SHA256:EECDH:EDH+aRSA:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS:!RC4")
logger.debug("OPENSSL version: %s" % SSL.SSLeay_version(SSL.SSLEAY_VERSION))

httpserver.serve(app_logged, host=http_host, port=http_port, server_version=server_version, ssl_context=context, use_threadpool=True, threadpool_workers=15, request_queue_size=5)

A: To have support for DH ciphers (DHE-RSA-...) you need to have a DH params file and specify it:
 context.load_tmp_dh("dhparams.pem")

To create such file you might use OpenSSL
 openssl dhparam -out dhparams.pem 2048

To support ECDH ciphers you need to specify which curve should be used. I don't have a pyOpenSSL version which supports it but according to the documentation it should be
context.set_tmp_ecdh( OpenSSL.crypto.get_elliptic_curve( "prime256v1" ))

A: I'll leave this here, since this works with built in libraries as well.
import ssl
from socket import *

context = ssl.create_default_context()
context.set_ciphers('ECDHE+AESGCM:!ECDSA')
context.load_dh_params("dhparams.pem")
context.set_ecdh_curve("prime256v1")

sock = socket()
sock.connect(('hostname', 443))
sock = context.wrap_socket(sock, server_side=False, server_hostname='hostname')

Since the above answer and question is regarding pyOpenSSL, I know this might not be 100% in the right ball park.
But after a bit of searching around why I get ssl.SSLError: [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:1045) without any details to as why this is happening, this post saved my day.. But I also figured it was possible to do natively via ssl (which I'm sure, probably uses OpenSSL but still thought this might be useful here).


text:
Q: Improve SQL Server conditional join Is correct to put these conditional sentences in join statement in order to improve performance?
I just tried to use same code using one union and cross apply per condition used, but when I use the code in other queries, is too slow.
SELECT u2.fkPropertyID, u2.pkUnitId, u2.UnitCode,
       u2.fkUnitViewID,u2.fkFloorPlanID, u2.fkCalendarTypeID
FROM dbo.tblUnit                u
left join dbo.tblUnitGroup ug  ON ug.fkUnitLogicalID = u.pkUnitID
left JOIN dbo.tblUnit u2  on ((u2.fkUnitGroupID = u.pkUnitID and
    u.ynPhyUnit = 0)
    or
    (u2.pkUnitID = u.pkUnitID and u2.ynPhyUnit =1))
    or
    (u2.pkUnitId = ug.fkUnitPhisicallID and u2.ynPhyUnit = 1)
where u.pkUnitId = 3806

A: Just for fun here is one way you could rewrite this. I suspect if you look at the execution plan it will be identical.
SELECT u2.fkPropertyID
    , u2.pkUnitId
    , u2.UnitCode
    , u2.fkUnitViewID
    , u2.fkFloorPlanID
    , u2.fkCalendarTypeID
FROM dbo.tblUnit u
left join dbo.tblUnitGroup ug  ON ug.fkUnitLogicalID = u.pkUnitID
left JOIN dbo.tblUnit u2  on
    (
        u2.fkUnitGroupID = u.pkUnitID
        and
        u.ynPhyUnit = 0
    )
    or
    (
        u2.pkUnitID in (u.pkUnitID, ug.fkUnitPhisicallID)
        and
        u2.ynPhyUnit = 1
    )
where u.pkUnitId = 3806

A: I get this with best results in execution plan, I am reviewing with other values:
SELECT u2.fkPropertyID, u2.pkUnitId, u2.UnitCode, u2.fkUnitViewID,
           u2.fkFloorPlanID, u2.fkCalendarTypeID
FROM tblUnit                u
left join dbo.tblUnitGroup ug  ON ug.fkUnitLogicalID = u.pkUnitID
outer apply
(
 select uu2.fkPropertyID, uu2.pkUnitId, uu2.UnitCode,
        uu2.fkUnitViewID, uu2.fkFloorPlanID, uu2.fkCalendarTypeID
 from dbo.tblUnit uu2
 where ( ((uu2.fkUnitGroupID = u.pkUnitID) and (u.ynPhyUnit = 0))
         or
         ((uu2.pkUnitID = u.pkUnitID) and (uu2.ynPhyUnit = 1)) )
       or
       ( (uu2.pkUnitId = ug.fkUnitPhisicallID) and (uu2.ynPhyUnit = 1) )
) as u2
where u.pkUnitId = 3806


text:
Q: What is an automorphic representation of CM type ? In a recent paper of BL-Gee-Geraghty: "Sato-Tate for Hilbert modular forms" (JAMS 2011), a theorem is proved for regular algebrai cuspidal automorphic representation of $GL_2(\mathbb A_F)$  with $F$ a totally real field, which is not of CM type.  I could not find any definition or reference for "CM type" in that paper. But I expect it should correspond to CM elliptic curve in the classical modular case.
My question is :

*

*What is the precise definition for "an automorphic representation of CM type", both in the $GL_2$  case here and for general reductive group over number fields.
I prefer a definition "purely" in terms of representation-theory, not of arithmetic-geometry.

*Why is the CM case excluded in that paper ?
Any comments or references will be very welcome. Thanks

A: 1.-- in the $Gl_2$-case, $\pi$ is of CM type if it is the automorphic induction
of a Grossencharacter of a CM extension K of $F$. In terms of the Galois representation
of $Gal(\bar F/F)$ attached to $\pi$, that means that $\pi$ is not the induced representation from a character of a subgroup $Gal(\bar F/K)$ of index $2$, where $K$ is a CM extension of
$F$.
In the general case, the notion of CM stratifies into many different notions. Read things about the Mumford-Tate groups for more about this.
2.-- because already in the $F=\mathbb{Q}$-case, the Sato-Tate conjecture excludes the CM case.


text:
Q: Easy Mock - How to? I am trying easyMock test few classes / interface methods. Methods with parameters, trying to capture the parameter, but getting one or other error. If I manage to only record one expectation, it doesn't even capture anything in the parameter pipe, where if i use the following approach, I am getting error as follows the code.
@Test
public void testFireChannelInitializer() throws Exception
{
    expect(c.pipeline()).andReturn(pipeline).times(1);
    channelListener.fireChannelInitializer(EasyMock.capture(pipe), serverHandler);
    EasyMock.replay(c, pipeline, channelListener);

    initializer.initChannel(c);

    verifyAll();
    assertEquals(4, pipe.getValues().size());
    assertTrue(pipe.getValues().get(0) instanceof LoggingHandler);
    assertTrue(pipe.getValues().get(0) instanceof ObjectEncoder);
    assertTrue(pipe.getValues().get(0) instanceof ObjectDecoder);
    assertTrue(pipe.getValues().get(0) instanceof ServerHandler);
}

Results in Error

testFireChannelInitializer(com.obolus.generic.impl.DefaultChannelListenerTest)
  Time elapsed: 3.812 sec  <<< ERROR! java.lang.IllegalStateException: 2
  matchers expected, 1 recorded. This exception usually occurs when
  matchers are mixed with raw values when recording a method:   foo(5,
  eq(6));   // wrong You need to use no matcher at all or a matcher for
  every single param:   foo(eq(5), eq(6));  // right    foo(5, 6);  // also
  right     at
  org.easymock.internal.ExpectedInvocation.createMissingMatchers(ExpectedInvocation.java:51)
    at
  org.easymock.internal.ExpectedInvocation.(ExpectedInvocation.java:40)
    at org.easymock.internal.RecordState.invoke(RecordState.java:78)    at
  org.easymock.internal.MockInvocationHandler.invoke(MockInvocationHandler.java:40)
    at
  org.easymock.internal.ObjectMethodsFilter.invoke(ObjectMethodsFilter.java:94)
    at
  org.easymock.internal.ClassProxyFactory$MockMethodInterceptor.intercept(ClassProxyFactory.java:97)
    at
  com.obolus.generic.impl.DefaultChannelListener$$EnhancerByCGLIB$$2da02970.fireChannelInitializer()
    at
  com.obolus.generic.impl.DefaultChannelListenerTest.testFireChannelInitializer(DefaultChannelListenerTest.java:63)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  at
  sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at
  sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)     at
  org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
    at
  org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at
  org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
    at
  org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)    at
  org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
    at
  org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)  at
  org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)   at
  org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)     at
  org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)   at
  org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)  at
  org.junit.runners.ParentRunner.run(ParentRunner.java:300)     at
  org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:242)
    at
  org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:137)
    at
  org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  at
  sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at
  sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)     at
  org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
    at
  org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
    at
  org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
    at
  org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
    at
  org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

Any idea whats wrong or How to use easy mock? No good documentation or examples around.

A: The easymock website has a user guide but they redid their website recently and the guide isn't as complete as it used to be.
I think your problem might be you have to do a capture AND an argument matcher.
From the user guide:

Matches any value but captures it in the Capture parameter for later access. You can do and(someMatcher(...), capture(c)) to capture a parameter from a specific call to the method. You can also specify a CaptureType telling that a given Capture should keep the first, the last, all or no captured values.

So you might need to do an and( capture(..), paramMatcher)
Also EasyMock has an annoying API "feature" where if you use one argument matcher in a method call, then all the arguments must also be wrapped in matchers even if it's eq().  I think that's what your exception is complaining about.  So I think those are your two problems.
I'm not sure what your method signature looks like so I will assume it's
void fireChannelInitializer(Object, ServerHandler);

after using static imports to import EasyMock.*
channelListener.fireChannelInitializer(
                and(capture(pipe), isA(Object.class)), //captures the argument to `pipe` Capture object
                  eq(serverHandler));


text:
Q: How can I disconnect clients from a Vino VNC server at will? I have vino set to ask before allowing connections, but I'm unaware of how to disconnect clients once they are connected.
The only way I've found to disconnect them is disable sharing (and then re-enable it).
It seems there should be some sort of connection manager to list and disconnect clients at will, but I'm unable to find anything like this.

A: First of all, you should enable the notification area icon using vino-preferences (Desktop Sharing Preferences). Then, once the icon appears, you can right-click on it and select "Disconnect client-name".
That's all :-)


text:
Q: Apresentações (slidify e Rpres) com caracteres latinos (ç, ã, é...) corrompidos Estou preparando slides no R, mas os caracteres latinos (ç, ã, é  etc...) ficam corrompidos quando a apresentação é compilada. Tentei tanto com o slidify como com o Rpre, mesmo problema. Alguém sabe resolver?
Edição: Se for dentro de uma mesma seção, No R studio, clicar em:
file> "save with encoding" > UTF8
isso resolve os problema na hora de visualizar. Mas surge um novo problema:
Depois de salvar, quando eu reinicio uma nova seção do RStudio e reabro o arquivo o código fonte aparece todo 'corrompido' (ex: "atenção" vira : "atenção"). Entretanto a versão compilada continua correta (aparece "atenção").
Tentei novamente usar o "save with encoding", para continuar ediatando o texto, mas aí ele corrope a visalização (versão compilada) do texto anterior.
Alguém tem idéia como resolver isso?
Systema: Windows 8.1 64bits, R version 3.1.1, RStudio 0.98.1017

A: Descobri como fazer. No R studio, clicar em:
file> "save with encoding" > UTF8
isso resolve os problema na hora de visualizar
Na questão de reabrir o arquivo numa nova seção de RStudio e conseguir vizualizar corretamente e segui adicionando novos conteúdos:

*

*abrir o arquivo

*file > reopen with encoding > UTF8

tudo volta a funcionar

A: O padrão do Windows é latin1 (iso 8859-1) e o Rpres está gerando o arquivo HTML como UTF-8.
Quando você salva o arquivo com o encoding UTF-8, então o HTML e o arquivo fonte vão estar iguais e os caracteres aparecerão corretamente.
Quando você fecha o RStudio e reabre o arquivo, como o default é latin1, mas o arquivo está como UTF-8, os caracteres irão aparecer "errados" ( "atenção" vira : "atenção"). Uma "solução" para isso é reabrir com o encoding UTF-8 (reopen with encoding) para continuar trabalhando.
Uma outra opção é fazer tudo em latin1 normalmente (no começo vai parecer que o html está "errado") e depois que você gerar o html é só mudar o charset: onde tem <meta charset="utf-8">  você muda para <meta charset="latin1">.
Aparentemente não há uma opção de falar para o Rpres qual o encoding do seu HTML. Se houvesse esta opção, bastaria especificá-la para ficar igual ao encoding do arquivo .Rpres ao invés de ir mudar diretamente no HTML.


text:
Q: How do javascript constructors work I'm reading MDN Javascript for beginners and it's saying you can create a constructor function then make object instances based on that constructor. Now you have access to the properties and methods defined in the constructor. However, then they go on to say only properties and methods defined on the constructor prototype property are available to object instances, at least as I understand. Can someone clear this up because the instance seems to have access to these with no prototype property defined in the example. Thank you
function Person(first, last, age, gender, interests) {
    this.name = {
        first,
        last
    };
    this.age = age;
    this.gender = gender;
    this.interests = interests;
    this.bio = function() {
        alert(this.name.first + ' ' + this.name.last +
              ' is ' + this.age + ' years old.'+
              ' He likes ' + this.interests[0] +
              ' and ' + this.interests[1] + '.');
        };
        this.greeting = function() {
            alert('Hi! I\'m ' + this.name.first + '.');
        };
    }

    var person1 = new Person('Bob', 'Smith', 32, 'male', ['music', 'skiing']);

    person1['age']
    person1.interests[1]
    person1.bio()
    // etc.

A: Anything that's attached to the prototype property of a constructor is shared between all instances created using the constructor.  The values are the same in all such objects.
The constructor can also attach individual properties to the object being created.  These are specific to the new instance, and are not shared.

A: So, Javascript objects work A LOT differently than in other programming languages. Well, most mainstream ones anyway.
Here's the deal - a Javascript object is really just a dictionary (aka map). For example:
var x = {}; // creates a new blank object
x.something = 42; // creates a property on the object and assigns value to it
x['something'] = 15; // Alternate syntax. Assigns to the same property we just created.
x['yo, this is valid too!'] = true; // Yes, this is valid too.

See what I mean? It's just a dictionary, you can set whatever you want. And unset too - that's what the delete operator does.
So what about those constructors and prototypes? Well, any function can be used as a constructor. When you go like
var x = new foo();

What really happens is that Javascript creates a new blank object and then calls the foo() while putting the newly created object in this. And lo and behold, it kinda looks like a constructor.
There's actually a little quirk that needs to be mentioned. If the constructor function returns a value, then Javascript uses that instead of the newly created object. So if you do this:
function foo() {
    this.meaning = 42;
}

var a = new foo();

Then a will contain the blank object that Javascript created for you. But if you do this:
function foo() {
    this.meaning = 42;
    return {nope: 3};
}

var a = new foo();

Then a will contain the {nope : 3} object instead. OK, but that's rarely used.
Anyway, where were we? Ah, yes, prototypes. Oh, wait, first another thing needs to be explained. In Javascript EVERYTHING is an object. So, like, these things are completely valid:
var a = 42;
var b = "hello, world";

a.foo = "yay";
b.bar = 10;

And, just to really blow your mind there, functions are objects too. First class citizens, so to speak. This is all valid:
function foo() {
}

foo.bar = "baz";

var x = foo;

Yup, you can treat functions just like any other object. You can put them in variables, pass them to other functions in parameters, assign and delete arbitrary properties to them, you name it. This is a feature rarely found in other languages, so it's probably the hardest thing to wrap your mind around. I know my mind was blown when I first understood this.
Now we can talk about prototypes. You see, every function in Javascript also has a special magical property called prototype. By default, it's set to a blank object. But you can set it to another object. Or you can add/delete properties to the existing blank object. It's just another object, nothing fancy about it.
Furthermore, every object in Javascript has a special magical property called __proto__. Remember that when you call new foo() a new object is created and passed to foo() as this? Well, that new object has its __proto__ set to whatever foo.prototype was at the time.
Now suppose you do this:
function foo() {
    this.a = 42;
}

foo.prototype.b = 15;

var x = new foo();

If you then type x.a then x has such a property and all is well. But if you type x.b then x doesn't have such a property, and that's where the magic happens. Javascript automatically checks if there is a x.__proto__.b and if there is, returns that! And if there isn't, it checks x.__proto__.__proto__.b, etc, until it hits an object with __proto__ == null and then it gives up and just returns undefined since there is no such property.
On the other hand, when you now do this:
x.b = "foobarbaz";

Then the b property is created directly on the x object. The prototype remains unchanged.
So this is how you create "inheritance" in Javascript. With the prototypes. It's different than in your typical class-based language, but no less powerful.
There are some other nuances and tricks that could be mentioned, as well copious amounts of examples to help you grok all this, but... I've run out of juice for today. :) This should answer the question as well as hopefully make more sense of whatever other tutorial you are reading.

A: Jules is right.
To go in further detail:
You have this constructor.
function Person(first, last, age, gender, interests) {
    this.name = {
        first,
        last
    };
    this.age = age;
    this.gender = gender;
    this.interests = interests;
    this.bio = function() {
        alert(this.name.first + ' ' + this.name.last + ' is ' + this.age + ' years old. He likes ' + this.interests[0] + ' and ' + this.interests[1] + '.');
    };
    this.greeting = function() {
        alert('Hi! I\'m ' + this.name.first + '.');
    };
}

Now you can create to instances of it...
var person1 = new Person('Bob', 'Smith', 32, 'male', ['music', 'skiing']);
var person2 = new Person('Anne', 'Smith', 32, 'male', ['music', 'skiing']);

If you access the prototype and change it every other instance will also have this change.
person1.__proto__.attrX = "Hello World"
alert(person2.attX)

All this Javascript prototype inheritance may be very confusing at first but you actually almost never required. I actually wouldn't even recommend it because it is tempting to mess around with. For instance you could have the idea to change the prototypes of basic datatypes in JS. For instance like so:
Person.__proto__.arguments = "";

This is very very bad. Especially if you actually wanted to do this:
Person.prototype.arguments = "";

If you are not aware of the difference between prototype and __proto__.
They are basically the same on different perspectives.

*

*__proto__ refers to the constructor of an instance

*prototype does the same if you use it on constructors

But because a constructor itself is an instance of function you will always refer to the constructor of function if you call __proto__ on a constructor directly. So changing something on the function constructor would change all the function withing JS and this could interfere if you change something so integral to functions such as arguments. You see it becomes very nasty if you dive deeper into it... But you can just avoid those things.

A:
I just learned the javascript object inheritance relationship yesterday and made a graph according to this good description. Hope it is useful to you.