text:
Q: In your Understanding what is the scope of a Toolsmith in Software Development? I've been asked to maintain a few of our software development tools; Clearcase (Views, Streams, Triggers), JIRA, Enterprise Architect and various document based repositories, Confluence, doku Wiki etc..
But as I wonder where does the line is when it comes to the "best practices" and cleanup efforts to make the most of these tools for development teams.
for an SysAdmin perspective it's quite easy; Make sure u maintain the application, network and backup system. but when it's development support and in the term used "Tool's Smith" I believe is half way between a lead developer and system administrator.

A: If they wanted you to be a lead developer, they wouldn't have given you a title of "Tool Smith".  I would view it as a specialized system administrator, more more to the point, application administrator.  You might have some additional development responsibilities but being in charge of maintaining the tools probably doesn't confer any responsibility over how those tools are used.
Just my $0.02.

A: Basically I would view this as someone in charge of proposing a framework enabling the developer to not see those tools, but only the process he/she needs to follow:

*

*declare a new task (behind the scene: open a JIRA ticket)

*associate to a project (UCM snasphot view to a Stream, download the code)

*document the task (new page in the wiki)

*...

The administration of those tools is still there, but a bit of development is needed to help the users (developers) in their daily process without them having constantly to think about the specificities of each tools.


text:
Q: Are there any resources listing current codecs and formats not supported by FFmpeg? We are building a service where we do not know what format/codec a video uploaded by a user is in. Due to the nature of the application, we expect input video formats to be very fragmented, diverse and niche. We are currently using FFmpeg to transcode input formats to a consistent output (e.g. mp4).
Due to the above scenario, I would like to establish a general list of what formats and codecs are not currently supported by FFmpeg. This is so I can research other open source video transcoding tools which I can utilise to fill in the gaps and allow our service to be more reliable for the user.
Are there resources online that can help at least get a general idea of what might not be supported by FFmpeg?

A:
Are there resources online that can help at least get a general idea of what might not be supported by FFmpeg?

You'll have to trawl the FFmpeg bug tracker. You are probably looking for a more in-depth answer, but we don't have an official list of currently unsupported formats (including formats that we may not even be aware of).
If you encounter anything unsupported a bug report and samples are always appreciated.

redpajama_set_name: RedPajamaStackExchange


text:
Q: what is the purpose of setNestedTransactionAllowed in JpaTransactionManager I use the spring boot 1.5.2 RELEASE.
JpaTransactionManager txManager = new JpaTransactionManager();
    txManager.setEntityManagerFactory(ptvEntityManagerFactory);
    txManager.setDataSource(ds);
    txManager.setJpaDialect(hibernateDialect);
    //txManager.setNestedTransactionAllowed(true);

so what does this NestedTransactionAllowed really do?
    I create code like this:
@Transactional
public void testNestTransaction() {
    saveToRepository()
    saveToJdbcTemplate();
    throw new RuntimeException();
}

@Transactional
private void saveToRepository() {
    employeeRepository.save(new MyEntity(xxx,xx,xx));
}

private void saveToJdbcTemplate() {
    transactionTemplate.execute(new TransactionCallbackWithoutResult() {
   // the code in this method executes in a transactional context
        protected void doInTransactionWithoutResult(TransactionStatus status) {
  String sql = "INSERT INTO task (id,create_by,description) VALUES
   (?,?,?)";
          jdbcTemplate.batchUpdate(sql, new BatchPreparedStatementSetter().....

        }
}

Here is the problem. no matter NestedTransactionAllowed is true or false, the runTimeException always rollback both in saveToRepository() and saveToJdbcTemplate(). it default value is false, and there is a chunk of JavaDoc to describ this flag.
But I still do not understand what is the point of the NestedTransactionAllowed??
can you guys helps me with some scenarios to show the difference between this value in true and false?
thanks a lot
BTW: the entity manager is hibernate.
// hibernate adapter
HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();

A: Your setNestedTransactionAllowed is not working as nested transaction support is not available for JpaTransaactionManager. Following excerpt from the official doc -

This transaction manager supports nested transactions via JDBC 3.0
  Savepoints. The "nestedTransactionAllowed" flag defaults to false
  though, since nested transactions will just apply to the JDBC
  Connection, not to the JPA EntityManager and its cached entity objects
  and related context. You can manually set the flag to true if you want
  to use nested transactions for JDBC access code which participates in
  JPA transactions (provided that your JDBC driver supports Savepoints).
  Note that JPA itself does not support nested transactions! Hence, do
  not expect JPA access code to semantically participate in a nested
  transaction.


text:
Q: Split single column data into multiple columns based on leap year in Excel 2013 I have about 100 files of MS Excel which consist of weather data.
I need the data on yearly basis but the file has a single column with data of about 140 years and manually copy-paste is very time consuming. So, is there any way to split the data by using simple commands which can be dragged so that data of 1 years(365 cells) is copied in continuous rows.
Also, there is the leap year problem that data after every 3 years should be 366 cells instead of the rest 365 cells.

A: As you can't seem to get the other macro working per this question, I figured I'd work with the hard facts you've presented here and make it easy for you.
For your specific date range, this macro will work -
Sub test()
'fill dates
Application.ScreenUpdating = False
Dim NumCells As Integer
NumCells = [counta(A:A)]
Columns("A:A").Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove

Cells(1, 1) = "1/1/61"
Range(Cells(1, 1), Cells(NumCells, 1)).DataSeries

'move data
Dim c As Range
Dim cCol As Integer
cCol = 4
label:
For Each c In Range("A:A")
If c.Value = "" Then Exit Sub

    For i = 1 To 366
        If Not Right(c, 4) = Right(c.Offset(i), 4) Then
         GoTo label2
        End If
    Next
label2:
        Range(c, c.Offset(i - 1, 1)).Copy
        Cells(1, cCol).PasteSpecial Paste:=xlPasteValues
        Range(c, c.Offset(i - 1, 1)).Delete xlShiftUp
        Range(Cells(1, cCol), Cells(366, cCol)).NumberFormat = "mm/dd/yyyy"
        cCol = cCol + 3
        GoTo label

Next
Application.ScreenUpdating = True
End Sub

A: Try this macro
Sub Button1_Click()

Dim row As Integer
row = 1

Dim otherRow As Integer
otherRow = 1

Dim year As Integer
year = 1

Dim column As Integer
column = 66 ' start on B

Dim preColumn As Integer
preColumn = 64

Do While (True)

If Range("A" & row).Value = "" Then
    Exit Do
End If

If (column > 90) Then
    preColumn = preColumn + 1
    column = 65
End If

If (preColumn = 64) Then

Range(Chr(column) & otherRow).Value = Range("A" & row).Value

Else

Range(Chr(preColumn) & Chr(column) & otherRow).Value = Range("A" & row).Value

End If

Dim addition As Integer
addition = 0

If (year = 4) Then
    addition = 1
End If

If (otherRow = 365 + addition) Then
column = column + 1
otherRow = 0

year = year + 1

End If

If (year > 4) Then
 year = 1
End If

row = row + 1
otherRow = otherRow + 1

Loop

End Sub

Fairly useless screen shot of it working:

Please try it on a copy of your data... I'm not responsible for breaking everything. You will also need to test it properly and ensure all data is present, but I think it's fine.


text:
Q: Asynchronous Client Side Java Socket So I am implementing a simple Java Socket Chat program, but the problem I encountered is that in the Code below. Currently my client code will first read from socket then output to the screen , then read from console then output to socket input. But this way Im unable to print messages from socket when it is reading from console untill the user hits enter What would be the best way to solve this problem, is it Multithreading (if so can i get an example?), or is there any other conventional way of dealing with this.
        while(true){
            //read from socket, -> output to screen
            String line = sockin.readLine();
            System.out.println(line);

            //read console, -> write to socket
            String consolein = consoleReader.readLine();
            sockout.println(consolein);
        }

A: Yes, you should be using Multithreading. You need to spawn two threads, one for reading input from user and another for reading output from server/another client. But, one concern while using Multithreading for console based chat application is: separation of the output from server and input from user.
Sample Multithreaded Client
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;
import java.net.UnknownHostException;

public class ThreadedClient {

    public static void main(String[] args) {
        if (args.length != 2) {
            System.err.println(
                    "Usage: java ThreadedClient <host name> <port number>");
            System.exit(1);
        }

        String hostName = args[0];
        int portNumber = Integer.parseInt(args[1]);

        try {
            Socket serverSocket = new Socket(hostName, portNumber);
            ClientServerOutputReader csor = new ClientServerOutputReader(serverSocket);
            csor.start();
            ClientUserInputReader cuir = new ClientUserInputReader(serverSocket);
            cuir.start();
        } catch (UnknownHostException e) {
            System.err.println("Don't know about host " + hostName);
            System.exit(1);
        } catch (IOException e) {
            System.err.println("Couldn't get I/O for the connection to " +
                    hostName);
            System.exit(1);
        }
    }

}

class ClientServerOutputReader extends Thread {
    Socket serverSocket;
    public ClientServerOutputReader(Socket serverSocket){
        this.serverSocket = serverSocket;
    }

    public void run() {
        try {
            BufferedReader in = new BufferedReader(
            new InputStreamReader(serverSocket.getInputStream()));

            String outputFromServer="";
            while((outputFromServer=in.readLine())!= null){
                //This part is printing the output to console
                //Instead it should be appending the output to some file
                //or some swing element. Because this output may overlap
                //the user input from console
                System.out.println(outputFromServer);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}

class ClientUserInputReader extends Thread {
    Socket serverSocket;
    public ClientUserInputReader(Socket serverSocket){
        this.serverSocket = serverSocket;
    }
    public void run(){
        BufferedReader stdIn = new BufferedReader(
                 new InputStreamReader(System.in));
        PrintWriter out;
        try {
            out = new PrintWriter(serverSocket.getOutputStream(), true);
            String userInput;

            while ((userInput = stdIn.readLine()) != null) {
                out.println(userInput);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

To run: java ThreadedClient localhost 1982
Sample echo server
import java.net.*;
import java.io.*;

public class EchoServer {
    public static void main(String[] args) throws IOException {

        if (args.length != 1) {
            System.err.println("Usage: java EchoServer <port number>");
            System.exit(1);
        }

        int portNumber = Integer.parseInt(args[0]);

        try (
            ServerSocket serverSocket =
                new ServerSocket(Integer.parseInt(args[0]));
            Socket clientSocket = serverSocket.accept();
            PrintWriter out =
                new PrintWriter(clientSocket.getOutputStream(), true);
            BufferedReader in = new BufferedReader(
                new InputStreamReader(clientSocket.getInputStream()));
        ) {
            String inputLine;
            while ((inputLine = in.readLine()) != null) {
                out.println("From Server:"+inputLine);
                Thread.sleep(2000);
                out.println("Server status on");
            }
        } catch (IOException e) {
            System.out.println("Exception caught when trying to listen on port "
                + portNumber + " or listening for a connection");
            System.out.println(e.getMessage());
        } catch (InterruptedException ie) {
             ie.printStackTrace();
        }
    }
}

In the server program above, manual sleep and custom message is added to simulate the output from server when there is an user input happening in client.
To run: java EchoServer 1982


text:
Q: Powershell, Tying 2 variables together in one script I have the following script.  It is getting me a system array.  I need to tie the $id variable and the $upn variable together with each iteration.  I am at a loss on how to get the loop to continue through and tie the 2 variables together.  Any help would be appreciated.
$adroles = get-mgdirectoryrole | select displayname,Id
$upn = foreach ($id in $adroles.id) {
    Get-mgdirectoryrolemember -DirectoryRoleId $id |
        select-object -expandproperty additionalproperties |
            foreach-object -membername userPrincipalName
}
}

A: I believe you're looking to merge the output from Get-MgDirectoryRole with the output from Get-MgDirectoryRoleMember, if that's the case this is how you can do it:
Get-MgDirectoRyrole | ForEach-Object {
    foreach($upn in (Get-MgDirectoryRoleMember -DirectoryRoleId $_.Id).additionalProperties.userPrincipalName) {
        [pscustomobject]@{
            DisplayName       = $_.DisplayName
            Id                = $_.Id
            UserPrincipalName = $upn
        }
    }
}


text:
Q: Index files load more than once I use angularjs in my project and I include all files needed in the project index file but I noticed that it takes too long to load the website the first time, after observing the network I found that many files is loading more than once and also the console gives me WARNING: Tried to load angular more than once.
I wonder what is the reason for this kind of problems or this is just normal?
Here is my index:

<!DOCTYPE html>

<html lang="en" ng-app="app">

<head>

<meta charset="utf-8"/>
<title>Environ</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta content="width=device-width, initial-scale=1.0" name="viewport"/>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8">
    <meta content="" name="description"/>
    <meta content="" name="author"/>
    <!-- BEGIN GLOBAL MANDATORY STYLES -->

    <script src="http://maps.googleapis.com/maps/api/js?sensor=false&libraries=places,drawing"></script>
     <link href="http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700&subset=all" rel="stylesheet" type="text/css"/>

    <link href="static/assets/global/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
    <link href="static/assets/global/plugins/simple-line-icons/simple-line-icons.min.css" rel="stylesheet" type="text/css"/>

    <link ng-href="static/assets/global/plugins/bootstrap/css/{{currentBootstrap}}" rel="stylesheet" type="text/css"/>

    <link href="static/assets/global/plugins/uniform/css/uniform.default.css" rel="stylesheet" type="text/css"/>
    <link href="static/assets/global/plugins/bootstrap-switch/css/bootstrap-switch.min.css" rel="stylesheet" type="text/css"/>

    <link href="static/assets/global/plugins/fancybox/source/jquery.fancybox.css"
     rel="stylesheet" type="text/css"/>
      <link rel="stylesheet" href="static/assets/global/css/selectize.css">
      <link rel="stylesheet" href="static/assets/global/css/clockface.css">
      <link rel="stylesheet" href="static/assets/global/css/bootstrap-datepicker3.css">
      <link rel="stylesheet" href="static/assets/global/css/bootstrap-switch.min.css">
      <link rel="stylesheet" href="static/assets/global/css/simple-line-icons.min.css">
      <link rel="stylesheet" href="static/assets/global/css/custom.css">
      <link rel="stylesheet" href="static/assets/global/css/dataTables.bootstrap.css">
    <link href="static/assets/global/plugins/bootstrap-toastr/toastr.min.css" rel="stylesheet" type="text/css"/>
    <link href="static/assets/global/css/daterangepicker-bs3.css" rel="stylesheet" type="text/css"/>
    <link rel="stylesheet" type="text/css" href="static/assets/global/plugins/angularjs/plugins/ui-select/select.min.css">
    <link id="ng_load_plugins_before"/>
    <link href="static/assets/admin/pages/css/inbox.css" rel="stylesheet" type="text/css"/>
    <link ng-href="static/assets/global/css/{{currentComponents}}" id="style_components" rel="stylesheet" type="text/css"/>
    <link ng-href="static/assets/global/css/{{currentPlugins}}" rel="stylesheet" type="text/css"/>
    <link ng-href="static/assets/admin/layout/css/{{currentLayout}}" rel="stylesheet" type="text/css"/>
    <link id="style_color" ng-href="static/assets/admin/layout/css/themes/{{currentDarkblue}}" rel="stylesheet" type="text/css"/>
    <link rel="stylesheet" type="text/css" href="static/assets/global/plugins/select2/select2.css"/>
    <link rel="stylesheet" type="text/css" href="static/assets/global/plugins/bootstrap-wysihtml5/bootstrap-wysihtml5.css">
    <link rel="stylesheet" type="text/css" href="static/assets/global/plugins/bootstrap-editable/bootstrap-editable/css/bootstrap-editable.css"/>
     <link ng-href="static/assets/admin/layout/css/{{currentCustom}}" rel="stylesheet" type="text/css"/>
    <!-- END THEME STYLES -->
    <link rel="shortcut icon" href="favicon.ico"/>
</head>

<body ng-class="{
    'login': $state.current.name.split('.')[0] === 'login',
    'page-header-fixed page-quick-sidebar-over-content': $state.current.name.split('.')[0] === 'home'
}" ui-view style="background-color:#2B3643;">

<!-- BEGIN PAGE SPINNER -->
<span us-spinner ng-spinner-bar></span>
<!-- END PAGE SPINNER -->

 <script src="static/js/lib/socket.js" type="text/javascript"></script>
 <script src="static/js/node-scripts.js" type="text/javascript"></script>
 <script src="first.min.js" type="text/javascript"></script>

<script type="text/javascript" src="second.min.js"></script>
<script type="text/javascript" src="static/js/lib/angular-translate.min.js"></script>
<script type="text/javascript" src="static/js/routes.js"></script>
<script type="text/javascript" src="static/js/config.js"></script>

<!-- Classes -->
<script src="node_modules/angular-spinner/node_modules/spinjs/spin.js"></script>
<script src="node_modules/angular-spinner/angular-spinner.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.js"></script>
<script type="text/javascript" src="static/js/classes.js"></script>
<script type="text/javascript" src="static/js/datatable.js"></script>
<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/rollups/pbkdf2.js"></script>

<script type="text/javascript" src="models.controllers.min.js"></script>

<script src="third.min.js" type="text/javascript"></script>
<script src="fourth.min.js" type="text/javascript"></script>

</body>
<!-- END BODY -->
</html>

And here is a screenshot for the network:


text:
Q: Angular 1.5: Self enclosing component stops the page from continue rendering I'm using Angular@1.5.0-beta.2 and I used a tutorial to start using component function:
angular.module('app', [])
  .controller('CountCtrl', function CountCtrl() {
    this.count = 10;
  })
  .component('counter', {
      bindings: {
      count: '='
    },
    controller: function TestCtrl() {
      TestCtrl.prototype.increment = function() {
        this.count += 1;
      };
      TestCtrl.prototype.decrement = function() {
        this.count -= 1;
      }
    },
    template:
      ['
',
      '<input type="text" ng-model="counter.count">',
      '<button type="button" ng-click="counter.decrement();">-</button>',
      '<button type="button" ng-click="counter.increment();">+</button>',
    '
'
  ].join('')
})
;

My html is:

    <counter count="vm.count"/>
    <counter count="10"/>

But only the first counter element is being rendered until I'm closing it like this<counter></counter>.
What seem to be the problem and is there any way working around this?


text:
Q: how do i print this sentence in brackets and with quotation marks around each word? sentence = input("Please enter a sentence:")

words = sentence.split()

position= [0]

myList = []

[myList.append(x) for x in words if x not in myList]

a =(" ".join(myList))

print (a)

This piece of code allows the user to input a sentence and it removes duplicated words. When the program outputs the sentence it outputs the sentence like this:
For example, if my sentence was 'I like python' my program would print
I like python onto the screen
What I need help with is that I want the program to output:
['I', 'like', 'python']

Any suggestions please

A: you just need to print myList in your program.
sentence = input("Please enter a sentence:")
words = sentence.split()
position= [0]
myList = []
[myList.append(x) for x in words if x not in myList]
print(myList)

Blockquote

A: Do this:
def removeDuplicates(oldList):
    newList = []
    for i in oldlist:
      if i not in newlist:
        newlist.append(i)
    return newList

And use it like this:
sentence = input("Please enter a sentence: ")

words = removeDuplicates(sentence.split())

A: Quick one-liner. Split by spaces and set finds the unique values:
words = list(set(sentence.split(' ')))
print words

A: Doesn't words yield your desired result?
In [9]: sentence = input("Please Enter as sentence: ")
Please Enter as sentence: 'I like Python'

In [10]: words = sentence.split()

In [11]: words
Out[11]: ['I', 'like', 'Python']

A: you can use set command to remove duplicates
sentence = input("Please enter a sentence:")
set(sentence.split())


text:
Q: Default TaskCreationOptions in Task.Run Why the default value for CreationOptions of a Task created using Task.Run is DenyChildAttach rather than None?
Has it anything to do with making work with the new async and await in C# 5.0 simpler (by preventing you from escaping current scheduler of current context I guess)?

A:
Why the default value for CreationOptions of a Task created using
  Task.Run is DenyChildAttach rather than None?

There is no (default or other) options in creating a task using Task.Run Method.
Citing from Task.Run vs Task.Factory.StartNew (by Stephen Toub - MSFT):

*

*Task.Run "should simply be thought of as a quick way to use Task.Factory.StartNew without needing to specify a bunch of parameters.  It's a shortcut"

*Task.Run(someAction); is exactly equivalent to:
Task.Factory.StartNew
    (   someAction
        , CancellationToken.None
        , TaskCreationOptions.DenyChildAttach
        , TaskScheduler.Default
     );

*"In this way, Task.Run can and should be used for the most common cases"

MSDN article Nested Tasks and Child Tasks (for .NET 4.0, i.e. without any equivokes for C# 5.0/.NET 4.5) states:

"in most scenarios, we recommend that you use nested tasks because the
  relationships with other tasks are less complex. That is why tasks
  created inside other tasks are nested by default, and you must
  explicitly specify the AttachedToParent option to create a child task"

which explains why CreationOptions.DenyChildAttach was chosen for the shortcut's most common and simplest option.

A: Stephen Toub explains this well in his blog post on the subject.
Parent and child tasks are somewhat common when using Tasks in a parallel fashion. Note that when a parent Task has a child, the parent's completion semantics change subtly.
Parent/child tasks are almost never used when using Tasks in an async fashion. In the async world, you have a sort of "logical parent/child relationship" when one async method calls another, but it is not actually implemented using parent/child tasks.
Usually a Task intended for use in async code is not expecting to have its completion semantics changed by a child task attaching to it. Thus, the new default for Task.Run is DenyChildAttach, which prevents any child tasks attempting to attach.


text:
Q: Javascript - generate control and append I am trying to generate controls in java script and  append it to a div.
Its working perfectly for textbox and checkbox. But its not working while generating dropdownlist.

now when this code gets executed, its creating a problem while evaluation of that tag.
when i checked in console,
The tag is getting generated as follows -
var tag = '

<input id="CategoryMasterNewModel_15__GroupName" name="CategoryMasterNewModel[15].GroupName" type="hidden" value="Manual Override" />Manual Override
' +
    '
<input data-val="true" data-val-number="The field ID must be a number." data-val-required="The ID field is required." id="CategoryMasterNewModel_15__ID" name="CategoryMasterNewModel[15].ID" type="hidden" value="390" /><input data-val="true" data-val-number="The field ParentID must be a number." id="CategoryMasterNewModel_15__ParentID" name="CategoryMasterNewModel[15].ParentID" type="hidden" value="207" /><input id="CategoryMasterNewModel_15__Type" name="CategoryMasterNewModel[15].Type" type="hidden" value="Select" /><select id="390" name="CategoryMasterNewModel[15].Result"><option value="yes">yes</option>
<option value ="no" > no < /option>
<option value = "others" > others < /option>
</select>

 '

Now because of those last three line are not coming inside that tag, hence its not successfully evaluating  this tag.
Is there any way we can bring all these in on tag only?

A: You can try like this way by creating your own script template:


text:
Q: Adding a "clickable item" in PreferenceDialog in Xamarin Android I have lost some hours trying to figure out how to use this correctly...
I already have a functional PreferenceDialog in my project. I'm using some CheckBoxPreference's and ListPreference's and managing the functionalities using OnSharedPreferenceChange.
Now I have added a simple  item in my PreferenceScreen (to work as an "About" button), but I can't add a ClickListener to this item.
In my prefs.xml:
<Preference
android:title="Sobre"
android:summary="Sobre o aplicativo"
android:key="botaoSobre" />

I've searched and found many tips to add using Java, but I can't find one for Xamarin Android. For Java, I can use OnPreferenceClickListener like this:
Preference myPref = findPreference( "MY_PREF" );
    myPref.setOnPreferenceClickListener( new OnPreferenceClickListener()
    {
        public boolean onPreferenceClick( Preference pref )
        {
              // Run your custom method
        }
    } );

But I don't know how to use it in Xamarin. I've tried any possibly way I know, but just doesn't work.
Someone knows how can I do this?

A: Nevermind. Actually I've figured out how to fix.
I've re-looked how a button works and got the right way to add a functionality to  item. Just use this:
Preference button = (Preference)FindPreference("YOUR_BUTTON");
            button.PreferenceClick += delegate {
                        // YOUR CODE GOES HERE
            };


text:
Q: could someone give an example for "operator.index ()"? I understand the operation as converting sth., which is not an integer, to integer. do I understand it correctly?
my attempt to implement the function "operator.index ()":
import operator
a = float (1.0)
print (a)
print (type (a))
print (type (operator.index (a)))

I have expected:
1.0
<class 'float'>
<class 'integer'>

actual output:
1.0
<class 'float'>
TypeError: 'float' object can not be interpreted as an integer

A: The __index__ can only be used to losslessly interpret an object as an integer index value. From the documentation for the hook:

Called to implement operator.index(), and whenever Python needs to losslessly convert the numeric object to an integer object (such as in slicing, or in the built-in bin(), hex() and oct() functions). Presence of this method indicates that the numeric object is an integer type. Must return an integer.

A float is not an integer type, even if a subset of float values are whole numbers.
In the standard library, only the int and bool types currently implement that hook. The hook exists for custom classes in your own code or defined in 3rd-party libraries to be useable when indexing sequences.
It is distinct from __int__ because that hook does allow for lossy conversion; int(3.9) gives you 3, but you would not expect listobject[3.9] to work (what should that return, the element at index 3 or 4?). You can't use int() to coerce floats into integers when indexing, or only accept whole floats (that'd be inconsistent and confusing).
You'd only use operator.index() if you need to support arbitrary int-like types in your own Python code:
class SequenceObject:
    # ...
    def __getitem__(self, idx):
        idx = operator.index(idx)  # convert to a valid integer index value
        # ...

The __index__ special method was added to Python with PEP 357, so you can use the numpy project integers (which are a different type) in slicing and indexing, so this works:
>>> import operator
>>> import numpy as np
>>> number1 = np.int8(1)
>>> type(number1)
<class 'numpy.int8'>
>>> type(operator.index(number1))
<class 'int'>
>>> l = [17, 42, 81]
>>> l[number1]
42

and __index__ to allow your class to be used in indexing:
>>> class EnglishNumber:
...     # lets pretend this is a number that automatically shows
...     # as the English name, like the https://pypi.org/p/inflect would
...     def __init__(self, name, value):
...         self._value = value
...         self._name = name
...     def __repr__(self): return f"<EnglishNumber {self._name}>"
...     def __str__(self): return self._name
...     def __index__(self): return self._value
...
>>> number2 = EnglishNumber("two", 2)
>>> number2
<EnglishNumber two>
>>> operator.index(number2)
2
>>> l[number2]
81


text:
Q: How to get privileges set for a report by obiee webservice or How to Judge a user whether have privilege to access a report? I want to integrate obiee with MIS. I can view catalog of report through obiee's web service,and can explore reports.
The question is how to judge a user whether he has privileges to access a certain report? if he has, list the report. This is to say, I will list reports which a user has access privileges.
Please tell me the methods (by obiee web services),thanks!
Rockfiller(from changsha city,Hunan province,China)

A: This one:
http://download.oracle.com/docs/cd/E21764_01/bi.1111/e16364/methods.htm#i1010167
You will get:
http://download.oracle.com/docs/cd/E21764_01/bi.1111/e16364/methods.htm#i1010167
Which give you the ACL list.
No ?
Cheers
Nico


text:
Q: Echoing result of multiple shell command outputs in bash I am trying to return the result of multiple commands into a single output line. The issue is it seems to output the commands on top of each other, only when the variables are commands.
Example 1:
Provider=$(adb shell getprop gsm.operator.alpha)
Model=$(adb shell getprop ro.product.model)
pM=$Provider $Model
echo $pM + " is connected"

Output: is connected
Expected: T-Mobile Nexus 5 is connected
echo
a='hello '
b='world'
c=$a$b
echo $c " its pretty outside."

Works as expected, output: hello world its pretty outside.
I appreciated any assistance!

A: Change the third line to
pM="$Provider $Model"

A: Lines in the output of adb shell commands are terminated by \r\n, so you have to remove the \r.
There are many ways of doing it, here you are one (and some other corrections):
Provider=$(adb shell getprop gsm.operator.alpha | tr -d \\r)
Model=$(adb shell getprop ro.product.model | tr -d \\r)
pM="$Provider $Model"
echo $pM " is connected"


text:
Q: Minimum between gamma and exp For $X_1,X_2 \sim Exp(\gamma_i)$
it is known that $ Min\{X_1,X_2\} \sim Exp(\gamma_1 + \gamma_2) $
and  $ \Pr(X_1 < X_2) = \dfrac{\gamma_1}{\gamma_1+\gamma_2} $
Can we say something similar when one of the variables is distributed gamma?
For $X \sim Exp(\gamma_1)$ and $Y \sim Gamma(\alpha,\gamma_2)$
$ \Pr(Y < X) =? $
is it true that $ \Pr(Y < X) = \left( \dfrac{\gamma_2}{\gamma_1+\gamma_2} \right)^{\alpha} $

A: Almost so, just need to change the indices.
${\text Pr}(Y<X)=\left(\dfrac{\gamma_2}{\gamma_1+\gamma_2}\right)^\alpha$.
Indeed,
$$
{\text Pr}(Y<X)= \int_0^\infty f_Y(y) {\text Pr}(X>y)dy = \int_0^\infty \dfrac{\gamma_2^\alpha}{\Gamma(\alpha)}y^{\alpha-1}e^{-\gamma_2y} e^{-\gamma_1y}dy = \left(\dfrac{\gamma_2}{\gamma_1+\gamma_2}\right)^\alpha.
$$
One cannot see the similar results for minimum between exponential and gamma. The CDF of minimum is
$$
{\text Pr}(\min(X,Y)\leq x) = 1-(1-F_X(x))(1-F_Y(x))=1-e^{-\gamma_1x}(1-F_Y(x)).
$$
Take $\alpha=2$ for example. Then $1-F_Y(x)=e^{-\gamma_2x}(1+\gamma_2x)$, and
$$
{\text Pr}(\min(X,Y)\leq x) = 1-e^{-(\gamma_1+\gamma_2)x}(1+\gamma_2x),$$
which is not CDF of gamma distribution.


text:
Q: Posting JSON request and reading EventStreams in Angular11 Tried following the article below to read eventstreams. Instead of using formData like it is done in the article, I'm using Json to post. It works smoothly with a 200 response. Even tells that some kb of data was sent over the wire, but the eventstream tab shows nothing. The same curl works on my terminal.
https://medium.com/swlh/how-do-server-sent-events-sse-or-eventsource-work-in-angular-e9e27b6a3295

A: As shown in the article
    return Observable.create((observer) => {
      const eventSource = this.sseService.getEventSourceWithPost(url, data);
      // Launch query
      eventSource.stream();
      // on answer from message listener
      eventSource.onmessage = (event) => {
        this.zone.run(() => {
          observer.next(event.progress);
        });
      };
      eventSource.onerror = (error) => {
        this.zone.run(() => {
          observer.error(error);
        });
      };
    });

Changing this part to
    return Observable.create((observer) => {
      const eventSource = this.sseService.getEventSourceWithPost(url, data);
      // Launch query
      eventSource.stream();
      // on answer from message listener
      eventSource.addEventListener('EVENT_NAME_FROM_STREAM', (event) => {
        this.zone.run(() => {
          observer.next(event.data);
        });
      };
    });

Got the data to show up. But in the network tab I still don't see the events.


text:
Q: How to display custom message in WebView of android? I'm trying to display web page using WebView in android, when a particular page doesn't load, it displays error message with URL, saying that abcd.com is not available, how do I replace the error message with my custom message instead of displaying the URL?
    storeLocator.setWebViewClient(new WebViewClient(){

        @Override
        public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
            storeLocator.loadUrl("file:///assets/error.html");

        }
        });
        storeLocator.loadUrl("http://goog.c");

A: You can create the html page whatever you want to show whenever the error comes or your page is not available ,the code is given here-
webview.setWebViewClient(new WebViewClient() {
            public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
                webview.loadUrl("file:///android_asset/myerrorpage.html");

            }
        });


text:
Q: Delete or Reuse after create media player My code has many memory leakage.I create media players continuously and I need to delete or reuse . The core problem is that I create a position_slider and I did not destroyed or reuse it.I also change play button state and did't delete or reuse it.How can I delect or reuse them? Here is my current code.
connect(listWidget_dirList, & QListWidget::currentRowChanged,[listWidget_dirList,directory,listWidget_main,this](int currentRow)

{
    //listWidget_dirList->setEnabled(false);
    listWidget_main->show();
    listWidget_main->clear();

    QListWidgetItem *item = listWidget_dirList->item(currentRow);
    QDir dir = directory.absolutePath() + '/'+item->text()  ;
    dir.setNameFilters({"*.mp4" , "*.avi" , "*.flv" , "*.mwv"});

    for(const QFileInfo & finfo: dir.entryInfoList()){
        QMediaPlayer *mediaPlayer = new QMediaPlayer();
        mediaPlayer->setMedia(QUrl::fromLocalFile(finfo.absoluteFilePath()));
        videoItem = new QGraphicsVideoItem;
        videoItem->setSize(QSize(320,240));
        QGraphicsScene *scene = new QGraphicsScene(this);
        QGraphicsView *graphicsView = new QGraphicsView(scene);
        mediaPlayer->setVideoOutput(videoItem);

        QPushButton *m_playButton = new QPushButton();
        m_playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay));

        connect(m_playButton, &QAbstractButton::clicked, [mediaPlayer]() {
            switch (mediaPlayer->state()) {
            case QMediaPlayer::PlayingState:
                mediaPlayer->pause();
                break;
            default:
                mediaPlayer->play();
                break;
            }
        });

        connect(mediaPlayer, &QMediaPlayer::stateChanged, [m_playButton, this](QMediaPlayer::State state) {
            switch(state) {
            case QMediaPlayer::PlayingState:
                m_playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPause));
                break;
            default:
                m_playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay));
                break;
            }
        });

        QSlider *m_positionSlider = new QSlider(Qt::Horizontal,this);
        m_positionSlider->setRange(0,mediaPlayer->duration() / 1000);

        connect(mediaPlayer, &QMediaPlayer::positionChanged ,[m_positionSlider, this](qint64 position){

            m_positionSlider->setValue(position);
        });

        connect(mediaPlayer, &QMediaPlayer::durationChanged ,[m_positionSlider, this](qint64 duration){

            m_positionSlider->setRange(0,duration);
        });

        connect(m_positionSlider ,&QAbstractSlider::sliderMoved, [mediaPlayer ,this] (int position){

            mediaPlayer->setPosition(position);
        });

    }
});
});


text:
Q: Add button like "New Mail" button of Gmail app I want to add a button like the "New Mail" button in the Gmail app (The circle button bottom of right with pen icon), which is floating on the screen.
Can someone show me how to do this? is it possible to do this without the Material Design guidelines?

A: This library: https://github.com/futuresimple/android-floating-action-button
seems to do a decent job of replicating the Floating Action Button, as well as some of the menu interactions if you're interested in those.

A: Or just import the official Google FAB sample in Android Studio:
File > Import Sample > search for FloatingActionButtonBasic.
The FloatingActionButton library is part of The Android Open Source Project


text:
Q: Stray points plotted when using HighlightGraph to visualize DegreeCentrality When I use HighlightGraph to visualize the directed edges of a digraph and its DegreeCentrality, stray points are plotted which do not appear to be part of the original directed edge dataset.
Here is an MWE with Presidential Inaugural addresses:
inaugural =
  SortBy[ResourceData["Presidential Inaugural Addresses"], "Date"];
washington = inaugural[[1]]["Text"];
washingtonwords =
  WordStem@TextWords@ToLowerCase@DeleteStopwords@washington;
washingtonDE =
 DirectedEdge @@@
  Partition[washingtonwords, 2, 1];(*directed edges*)dcWashington =
 DegreeCentrality[Graph[washingtonDE]];
gWashington = Graph[washingtonDE];
HighlightGraph[gWashington, VertexList[gWashington],
 VertexSize ->
  Thread[VertexList[gWashington] -> Rescale[dcWashington]]]

The outcome of HighlightGraph is below and it shows these stray dots all over the place.  These dots disappear when I size the graph with my mouse (see this GIF).

Version and OS information: I am using Mathematica 13.0.0.0 for Linux x86 64.
Is this a Linux/Mathematica issue or an error in how I am doing this?


text:
Q: Finding element Selenium driver java use xpath on Hi i have html code and  use selenium driver for ui tests

           111
            a

              222
               b

and if use
 findElement(By.cssSelector("div[class*='all']")).getText();

I get all, but i need only one element only one(111).Help me please

A: Please try with :
findElement(By.cssSelector("div[class*='all'] > div ")).getText();

A: Using xpath this should be pretty easy:
 findElement(By.xpath("//div[@class='abc'][1]")).getText();

A:

           111
            a

              222
               b

Answer to get 111
//div[contains(@class,"all")]//span[contains(text,"a")]/preceding-sibling::strong

A: Try this below mentioned xpath
//div[@class='abc']/strong[text()= '111']

Explanation of xpath:- Use class attribute of
 tag and move ahead with  tag along with text method.


text:
Q: Nonbinary Tree Traversal Method I am trying to create a python nonbinary tree class with methods that will allow me to get specific nodes, and apply other methods to those found nodes.
I have started with code from this very nice example: https://www.youtube.com/watch?v=4r_XR9fUPhQ
I have added a method that accepts a string that corresponds to the node ("/" separated, skipping the root) I am looking for, recursively searches the tree, and in theory, returns the node using "self" so I can apply another method on it.
However, when I return(self) it gives me a nonetype back instead of the node.
Advice on how to fix this, or a suggestion of another way to go if this is a bad way to structure things would be greatly appreciated!
Thanks in Advance.
Note: this is only set up to match on leaves so far, but I can fix that if I can get the darn thing to return the node I want.
Code Below:
class TreeNode:
    def __init__(self, data):
        self.data = data
        self.children = []
        self.parent = None
        self.forecast = None

    def get_level(self):
        level = 0
        p = self.parent
        while p:
            level += 1
            p = p.parent

        return level

    def print_tree(self):
        spaces = ' ' * self.get_level() * 3
        prefix = spaces + "|__" if self.parent else ""
        print(prefix + self.data)
        if self.children:
            for child in self.children:
                child.print_tree()

    def get_node(self, path):
        segs = path.split('/')
        sep = "/"
        print(self.return_child_names())
        if self.children:
            for child in self.return_child_names():
                if segs[0] == child:
                    found_child = segs.pop(0)
                    break
            self.children[self.return_child_names().index(found_child)].get_node(sep.join(segs))
        else:
            print("Found the node!")
            print(self)
            print(self.data)
            return(self)

    def return_child_names(self):
        return([c.data for c in self.children])

    def add_child(self, child):
        child.parent = self
        self.children.append(child)

def build_product_tree():
    root = TreeNode("Electronics")

    laptop = TreeNode("Laptop")
    laptop.add_child(TreeNode("Mac"))
    laptop.add_child(TreeNode("Surface"))
    laptop.add_child(TreeNode("Thinkpad"))

    cellphone = TreeNode("Cell Phone")
    cellphone.add_child(TreeNode("iPhone"))
    cellphone.add_child(TreeNode("Google Pixel"))
    cellphone.add_child(TreeNode("Vivo"))

    tv = TreeNode("TV")
    tv.add_child(TreeNode("Samsung"))
    tv.add_child(TreeNode("LG"))

    root.add_child(laptop)
    root.add_child(cellphone)
    root.add_child(tv)

    root.print_tree()

    return(root)

product_tree = build_product_tree()

product_tree.get_node("Laptop/Mac").print_tree()

A: The problem is in the function get_node: you are not always returning a value. Notably in the following block there is no return, and therefore the function can return None:
if self.children:
    for child in self.return_child_names():
        if segs[0] == child:
            found_child = segs.pop(0)
            break
    self.children[self.return_child_names().index(found_child)].get_node(sep.join(segs))

The value you get from the recursive call to get_node is neglected. You should actually return it:
    return self.children[self.return_child_names().index(found_child)].get_node(sep.join(segs))


text:
Q: Grouping values together I am trying to group my data in such a way that the first value of each dataset, followed by the second value of each dataset, and then the third value of each dataset. Here is what I have done, and what each dataset looks like:
#datasets created
newmax <- sapply(unstack(subset), function(r){max(values(r))})
newmax1 <- sapply(unstack(subset5), function(r){max(values(r))})
newmax2 <- sapply(unstack(subset18), function(r){max(values(r))})

> newmax
[1] 285.9906 287.6668 276.2251 247.1718 254.9781 308.1921 234.6858 235.7213 242.0865 247.1022
233.6528 243.9972 297.6855
[14] 264.3488 251.2206 249.4745 242.8481 241.2680 347.7225 241.0539 359.7334 256.2414 343.5733
270.5300 237.6458 260.9076
[27] 281.6629 273.9240 237.9238 237.8657 274.8282 254.7619 274.5488 240.1335 288.5369 263.7763
256.8988 237.8154 335.7295
[40] 251.1009 268.0298 284.0815 335.7390 260.6265 261.9585 245.4095 317.5088 326.1608 301.0854
256.6393 261.7769 248.8044
[53] 316.8620 285.2788 291.7393 282.7814 295.2238 263.5885 293.1581 323.0423 275.8465 321.7197
267.7597 260.1087 300.4011
[66] 289.7009 312.8771 247.2548 310.7060 293.6764 294.6003 301.9609 274.3764 324.2272 326.5802
312.4825 306.0726 271.3173
[79] 292.4768 270.7873 287.0801 363.9818 256.2259 282.1166 305.7313 276.7374 356.4052 296.8313
355.2177 360.6911

> newmax1
[1] 159.0246 133.6294 153.0331 160.4190 148.2776 142.6571 172.3195 157.7454 148.3942 165.9219
139.6812 140.4338 161.9404
[14] 136.1558 222.1469 160.5796 146.9243 146.8993 138.4256 181.2822 180.0468 136.2687 149.4805
169.0774 156.5708 197.8407
[27] 191.2747 171.9067 302.4844 161.1594 166.2600 150.5847 171.2477 153.5008 176.8167 164.1645
202.1044 185.5567 159.5147
[40] 188.2911 157.7030 159.3245 168.7951 145.3923 184.0441 169.1975 152.4814 157.8601 218.1362
181.0313 241.6280 145.9474
[53] 181.1191 197.6868 160.4712 166.6491 182.9139 202.4592 164.4607 192.3751 216.7510 155.9616
223.6624 170.2424 192.1529
[66] 166.4860 162.0195 231.3395 178.0869 212.7882 172.4338 174.4920 196.2973 195.0461 232.1316
160.4764 235.2968 248.9072
[79] 164.1591 193.9029 173.5751 233.6983 160.4132 178.4975 238.9297 184.6619 202.9835 244.6498
225.4075 180.8024

> newmax2
[1] 240.5591 200.7394 215.9244 211.9053 194.3641 243.4610 185.3560 224.9627 191.5551 202.0553
219.7212 182.8306 218.4132
[14] 226.3639 234.4197 216.8123 225.2460 192.8765 257.7413 197.9228 213.0739 271.9188 192.6500
195.1350 194.0970 203.7642
[27] 179.7267 216.7133 199.1632 223.2381 248.6822 211.2326 241.4532 197.2935 194.6268 189.2713
198.8254 217.6894 227.3989
[40] 218.0017 198.4878 271.2049 225.8836 195.0280 235.8415 269.6207 177.6220 218.8525 238.0074
231.2968 206.1418 251.5883
[53] 195.4047 176.4463 265.4490 274.9973 262.3909 214.1287 348.5859 272.7213 230.3467 208.9446
247.6072 246.7016 225.6779
[66] 213.9412 279.3386 229.7833 270.4096 235.7482 211.5287 235.5385 200.0058 221.8117 210.8134
252.3336 214.9943 262.2128
[79] 217.4706 211.3952 216.3089 227.9274 282.2023 232.6686 239.9312 209.6954 238.7950 284.0325
233.5386 232.6486

To isolated the first, second and third values, I tried this:
combined <- cbind(newmax[1],newmax1[1], newmax2[1], newmax[2], newmax1[2], newmax2[2],
newmax[3], newmax1[3], newmax2[3])

> combined

     [,1]     [,2]     [,3]     [,4]     [,5]     [,6]     [,7]     [,8]     [,9]
[1,] 285.9906 159.0246 240.5591 287.6668 133.6294 200.7394 276.2251 153.0331 215.9244

That's exactly what I wanted (i.e. all the first values, then the second values and third values lined up). However, I want the data arranged like in the original datasets (i.e. newmax, newmax1, newmax2)  - using "cbind" seemingly creates columns? Also, would there be a faster way to arrange the values the same way, or is what I have done the only way?
Thank you, and any help would be greatly appreciated!

A: Give something like
sapply(x,`[` , c(1,2,3))
which will apply indexing to your object x a shot;
Or something like
lapply(X = x, FUN = subset, select=c(1,2,3))
in case of columns, not sure judging from your data what exactly fits you.
PS: rbind will do row binding just like cbind does column binding


text:
Q: brew install mysql on snow leopard not quite working I installed mysql via brew, looks like the install went ok. Mysql will not let me set root password, even if I get tricky. Appears as though tables are missing altogether.
Detailed output below.
jb:~ jb$ brew install mysql
==> Downloading http://mysql.mirrors.pair.com/Downloads/MySQL-5.1/mysql-5.1.55.tar.gz
######################################################################## 100.0%
==> Downloading patches
==> Patching
patching file scripts/mysqld_safe.sh
Hunk #1 succeeded at 384 (offset 1 line).
patching file scripts/mysql_config.sh
==> ./configure --without-docs --without-debug --disable-dependency-tracking --prefix=/usr/local/Cellar/mysql/5.1.55 --l
==> make install
==> Caveats
Set up databases with:
    unset TMPDIR
    mysql_install_db

If this is your first install, automatically load on login with:
    mkdir -p ~/Library/LaunchAgents
    cp /usr/local/Cellar/mysql/5.1.55/com.mysql.mysqld.plist ~/Library/LaunchAgents/
    launchctl load -w ~/Library/LaunchAgents/com.mysql.mysqld.plist

If this is an upgrade and you already have the com.mysql.mysqld.plist loaded:
    launchctl unload -w ~/Library/LaunchAgents/com.mysql.mysqld.plist
    cp /usr/local/Cellar/mysql/5.1.55/com.mysql.mysqld.plist ~/Library/LaunchAgents/
    launchctl load -w ~/Library/LaunchAgents/com.mysql.mysqld.plist

Note on upgrading:
    We overwrite any existing com.mysql.mysqld.plist in ~/Library/LaunchAgents
    if we are upgrading because previous versions of this brew created the
    plist with a version specific program argument.

Or start manually with:
    mysql.server start
==> Summary
/usr/local/Cellar/mysql/5.1.55: 220 files, 42M, built in 17.6 minutes
jb:~ jb$ echo $TMPDIR
/var/folders/uL/uLRuoWTeFi86v2TkZkknLU+++TI/-Tmp-/
jb:~ jb$ unset TMPDIR
jb:~ jb$ echo $TMPDIR

jb:~ jb$ mysql_install_db
Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/local/Cellar/mysql/5.1.55/bin/mysqladmin -u root password 'new-password'
/usr/local/Cellar/mysql/5.1.55/bin/mysqladmin -u root -h jb.local password 'new-password'

Alternatively you can run:
/usr/local/Cellar/mysql/5.1.55/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr/local/Cellar/mysql/5.1.55 ; /usr/local/Cellar/mysql/5.1.55/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /usr/local/Cellar/mysql/5.1.55/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/local/Cellar/mysql/5.1.55/bin/mysqlbug script!

jb:~ jb$ cp /usr/local/Cellar/mysql/5.1.55/com.mysql.mysqld.plist ~/Library/LaunchAgents/
jb:~ jb$ launchctl load -w ~/Library/LaunchAgents/com.mysql.mysqld.plist
jb:~ jb$ /usr/local/Cellar/mysql/5.1.55/bin/mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

MADNESS ENSUING...
I made sure I owned usr/local:
jb:~ jb$ sudo chown -R `whoami` /usr/local
jb:~ jb$ which mysql
/usr/local/bin/mysql

I even tried starting mysql with 'skip grant tables' and setting the password:
jb:~ jb$ launchctl unload -w ~/Library/LaunchAgents/com.mysql.mysqld.plist
jb:~ jb$ killall mysqld
No matching processes belonging to you were found
jb:~ jb$ mysqld_safe --skip-grant-tables
110314 15:09:01 mysqld_safe Logging to '/usr/local/var/mysql/jb.local.err'.
110314 15:09:01 mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql

Then in another terminal window:
jb:~ jb$ mysql -u root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.55 Source distribution

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> UPDATE mysql.user SET Password=PASSWORD('pretend_strong_password_here') WHERE User='root'; FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.02 sec)
Rows matched: 0  Changed: 0  Warnings: 0

Query OK, 0 rows affected (0.03 sec)

mysql>

What the heck, shouldn't that affect a row? It is like the tables did not get made?
Should I have ran mysql_install_db with sudo?
PS: I probably brought this all on myself by cavalierly ignoring that the brew formula failed on downloading mysql-5.1.54 and I edited it to dl 5.1.55. But, aside from that, is there anything you can see that I have done wrong here?
Edit:
http://forums.mysql.com/read.php?10,277700,280261#msg-280261
and
http://palmeradev.blogspot.com/2010/12/fix-bug-mysql-root-user-not-created.html
indicate a couple of mysql queries to create the root user on the mysql.user table.
Those queries don't work for me, I get an error.
    mysql> INSERT INTO user VALUES ('localhost','root',password('newpassword'),'Y','Y ','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y', 'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','' ,'','','',0,0,0,0);
ERROR 1136 (21S01): Column count doesn't match value count at row 1

A: Looks like user table wasn't created properly. You should run mysql_install_db as a root user as probably you don't have a write access to /usr/local/var/mysql/


text:
Q: Show location details in Google maps javascript api v3 I am displaying the google map using javascript api v3. I am now able to display the title on mouse over of the pin.But I want to display the details in a div on mouse over of the pin.Can anyone suggest a method for doing so?

A: Assuming details holds the information to display, marker is the pin to click and map is your map:
var contentDetails = "<div>" + details + "</div>"
var infowindow = new google.maps.InfoWindow( {content: contentDetails});
google.maps.event.addListener(marker, 'mouseover', function() {
  infowindow.open(map,marker);
});


text:
Q: Php loop through an array I have this array . I would like to archive the following and display each package name and the due date
   1.CLASSIC ASIA PLUS (2015-10-25)
   2.NEW SMART (2017-10-18)

Here is the array
    Array
(
    [0] => Array
        (
            [subid] => 618341
            [currentpackage] => CLASSIC ASIA PLUS
            [lastpackage] => CLASSIC ASIA PLUS
            [duedate] => 2017-10-25
            [dueamount] => 54499
            [balance] => 443034
            [subclient] => ZukuSatUg
        )

    [1] => Array
        (
            [subid] => 618341
            [currentpackage] => NEW SMART
            [lastpackage] => NEW SMART
            [duedate] => 2017-10-18
            [dueamount] => 399
            [balance] => 1
            [subclient] => ZukuSatKe
        )

)

This is what I have tried so far
 foreach ($package as $key => $val) {
        return $package[$key]['currentpackage']." [". $package[$key]['duedate']."]";
    }

The results am getting is this
CLASSIC ASIA PLUS [2017-10-25]

Only for the 1st one.

A: I found out solutions
  $list = null;
    foreach ($package as $key => $val) {
        $list.= $package[$key]['currentpackage']." [". $package[$key]['duedate']."] \n";
    }

    return $list;

out put is
CLASSIC ASIA PLUS [2017-10-25]
NEW SMART [2017-10-18]


text:
Q: Jquery:- listview not refreshing Problem:-
Here my problem is that when I am assigning $('#ulmember').attr( 'data-filter','true');. Even I am not getting search-bar in my listview.Even when I am displaying listview data-filter property in alert then I am getting true.Even this attribute not applying
on listview.And This attribute I am applying on memsearch click.I want to assign data-role="true" by jquery code. so if somebody have any idea about my problem so please help me.
My Example is Here
source code:-

Member List

Member 1

Member 2

Member 3

Member 4

Jquery Code :-
$(document).ready(function(){

    $("#memsearch").click(function(){

       alert($("#ulmember").attr("data-filter"));

        $('#ulmember').attr( 'data-filter','true');

        alert($("#ulmember").attr("data-filter"));
        $("#ulmember").listview('refresh');
    });
});

A: Its working as expected. Do it this way:
HTML:

        Show/Hide Filter

Member 1

Member 2

Member 3

Member 4

Member 5

Member 6

JS:
$("#ulmember").filterable({
    filterReveal: false
});
$(".ui-filterable").addClass("ui-screen-hidden");
$(".toggle").on("click", function () {
    $(".ui-filterable").toggleClass("ui-screen-hidden");
    $("ul li").removeClass("ui-screen-hidden");
    $("#ulmember").listview("refresh");
});

You can check it on: JSFIDDLE


text:
Q: Upper bound on the probability of a length $m$ run of heads in $n$ tosses of a coin? Let $m = \log_2 n + k$. I am trying to find an upper bound on the probability that there is at least one run of exactly $m$ consecutive heads in $n$ tosses of a fair coin. Let $M_i$ be the event that the coins $i, \cdots, m+i$ turn up heads. Clearly I can bound the probability of interest by $$P(\cup_i M_i) \leq \sum_{i=1}^{n-m} P(M_i) = \frac{n-m}{2^m} = \frac{n - \log_2n - k}{n \cdot 2^k} \leq \frac{1}{2^k}.$$
How can I improve this bound? Could someone please provide a hint about other strategies to try? Does the problem simplify if instead I require a bound on the probability of at least one run of at least $m$ consecutive heads?


text:
Q: View category in the preview of Theme Customizer I am building a theme which Theme customizer changes colors, sizes, etc. and has also the option to choose a category and style that category specifically.
How can I display that category in the preview (only when the user is changing the corresponding options) instead of the default home/front page displayed by default?
EDIT
I can access the preview window with customize_preview_init, but I can not apply wp_redirect, which I guess could be a way.

A: If I understand you goal correctly, then will you a select inside the Customizer, there list the Categories and the User can use this for save in your theme settings.
If you will enhance the Customizer for categories, then use this class from this repo here. Include the file and enhacne the default class. You can easy implement a select for the categories of the install. Inside the readme of this repo are two links to gist with a example use, but for other class of the repo. I think is clear and the same way on all extensions for the Customizer.

A: Here's an approach I used to show things to users while they are viewing the site through the Theme Customizer previewer:
global $wp_customize;
if( is_user_logged_in() && isset($wp_customize) ) {
  // Show "categories" or things in the Customizer Previewer only
}

It makes your templates a bit more messy but, as you've probably discovered, there isn't much documentation/development on Theme customizer :/

A: Just add a javascript that activating only in live preview and redirect:
http://www.jquery4u.com/snippets/jquery-redirect-web-page/
as advanced solution, you can create asynchronously working js function with using wp.customize. You can inspect my theme http://theme.firmasite.com/ for example usage.

A: I ended up with this solution:
1.Require an extra file that will contain the hooks only in the theme preview
function mytheme_customizer_live_preview() {
    require_once('library/preview.php');
}
add_action( 'customize_preview_init', 'mytheme_customizer_live_preview' );

2.What I had to do is modify the query as I would normally do in the page, so just do it in the preview (inside preview.php):
function modify_query($query) {

    $category = get_theme_mod( 'mytheme' )['categories'][0];

    $query->set('cat', $category);

    return $query;

}
add_filter('pre_get_posts', 'modify_query', 10);


text:
Q: MetalLB unable to reach external IP address I have a 3 nodes Rancher RKE custom cluster deployed on Rocky Linux VMs on vSphere.
I deployed MetalLB on the cluster and define IP pool from my node network.
When I create a LoadBalancer service everything looks fine and I'm getting external IP address from the pool, however I cannot reach this IP address from the node ip network, I can't even reach it from the nodes themselves, when I try to curl to the external IP address from one of the nodes I'm getting no where (No route to host).
Curl to the cluster IP or to the pod itself works fine.
Also if I create a NodePort service to the pod I can reach it with no issue from outside the cluster.
Any ideas?


text: Q: Visual Studio C# automatically add code to abstract method is it possible to replace the throw new NotImplementedException(); automatically with an this.workThread.Start() or something else if a specific method has been overriden?


text:
Q: Get network usage for each process (Windows) So I've been searching for the past few hours for this and I can't get around this "issue".
Here's what I need to do:
I need to get a list of current processes and their network activity  (total MB Sent/Received since the application started). I also need to keep a record of what's been logged so far. So for instance, if I have a process named hello.exe with PID 2500, that currently downloaded 25MB and uploaded 300GB and said process gets closed, I'd like to keep it in the interface or at least save these data in a log file.
Originally I wanted to do it with PowerShell, but it seems like there's no easy way or anything out there that could point me in the right direction.
So, I checked other software like NetBalancer, Process Hacker and Process Explorer and they all don't keep an history. Process Hacker keeps the history of what process started and stopped, but nothing about the extra info I need. I'm able to set the Network received bytes and the Network send bytes, I just don't think any of these applications will keep the history.
The reason why I'd like the history is because I have a few scripts running at different time of the day and their process will eventually end and I'll never know how much data they actually transferred.
Are you aware of any 3rd party application that can help me out?
Thanks


text:
Q: How to change JBoss eap 6.1 deployment folder I'm trying to change deployment folder for JBoss without success.
Regarding some information which I've found on google I was trying to change standalone.xml configuration file. I've added following lines after <extensions> node :

<system-properties>
<property name="deploydir" value="/home/Artur"/>
</system-properties>

And I've changed <subsystem xmlns="urn:jboss:domain:deployment-scanner:1.1"> as following:

    <subsystem xmlns="urn:jboss:domain:deployment-scanner:1.1">
        <deployment-scanner path="deployments" relative-to="deploydir" scan-interval="10000"/>
    </subsystem>

I have the following path /home/Artur/deployments on my system.
But when i try to run JBoss server I always get an error :

09:05:21,283 ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 2) JBAS014612: Operation ("add") failed - address: ([
      ("subsystem" => "deployment-scanner"),
      ("scanner" => "default")
  ]): java.lang.IllegalArgumentException: JBAS014847: Could not find a path called 'deployments'

I was trying to configure it with different paths on my system, I was checking also for spelling in every case. But nothing helps. Does anyone have and idea how to properly configure path for deployment folder in JBoss ? (version as in title)

A: OK I solved this issue. To change deployment directory it's needed to specyify path to this directory in block :

<paths>
  <path name="deploydir" path="/home/Artur"/>
 </paths>

instead of

  <system-properties>
    <property name="deploydir" value="/home/Artur"/>
  </system-properties>

which I mentioned about earlier. So i conclusion we need to specify <path> node in standalone.xml configuration file and change <subsystem xmlns="urn:jboss:domain:deployment-scanner:1.1"> to point on newly created path (in this case to "deploydir")


text:
Q: /bin/sh: can't access tty; job control turned off I have been following the commands from the book "Mastering embedded linux programming" by Chris Simmonds. I have created the toolchain, kernel zImage and busybox file system. When I combine these together to run on QEMU, It should display a root shell prompt.
When I run the command, I get the following.
/bin/sh: can't access tty; job control turned off
input: ImExPS/2 Generic Explorer Mouse as /devices/platform/amba/amba:fpga/10007000.kmi/serio1/input/input2

When I press enter, I am able to see the root shell prompt and I am able to execute simple shell commands.
However, when I press exit, I get the following error.
Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000000

CPU: 0 PID: 1 Comm: sh Not tainted 4.9.13 #1
Hardware name: ARM-Versatile (Device Tree Support)
[<c001b5a4>] (unwind_backtrace) from [<c0018860>] (show_stack+0x10/0x14)
[<c0018860>] (show_stack) from [<c00737f4>] (panic+0xb8/0x230)
[<c00737f4>] (panic) from [<c0024e24>] (do_exit+0x8e8/0x938)
[<c0024e24>] (do_exit) from [<c0025cf8>] (do_group_exit+0x38/0xb4)
[<c0025cf8>] (do_group_exit) from [<c0025d84>] (__wake_up_parent+0x0/0x18)
---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000000

How do I resolve this
EDIT:
The following is the QEMU command that I ran
QEMU_AUDIO_DRV=none \qemu-system-arm
-m 256M -nographic
-M versatilepb
-kernel ~/linux-4.9.13/arch/arm/boot/zImage
\-append "console=ttyAMA0,115200 rdinit=/bin/sh"
-dtb ~/linux-4.9.13/arch/arm/boot/dts/versatile-pb.dtb
-initrd ~/busybox/initramfs.cpio.gz

A: (You don't say what your QEMU command line is.)
These error messages generally are what you should expect if you tell the kernel to run /bin/sh directly as its process 1 (eg with "init=/bin/sh" on the kernel command line). First the shell complains that it doesn't have a tty, but it can continue anyway with some facilities disabled. Then, when you eventually tell the shell to exit, because the shell itself is process 1 the kernel complains. (Usually process 1 is supposed to be an "init" program, which runs forever and deals with starting other processes in the system. If "init" ever dies the kernel has nothing else it can do.)
If you were intending to run /bin/sh as your process 1, then this is all normal. If you didn't want to do that, then you have an issue with either your root filesystem or with your command line which means that it isn't properly starting an /sbin/init in the guest, and you should look at why.


text:
Q: Call external API from SharePoint online using javascript I am having HTML file for user input and use REST API for update into SharePoint list.
we have a requirement to get value from external API.
I am able run the below script from normal HTML form, and get the result
$(document).ready(function () {

    $("#btn_getEmpID").click(function () {
        // getUserInfo();
        // alert("vg:test ->" + localStorage.getItem("submittedID"));
        debugger;

        $.ajax({
            asynch: false,
            url:"http://dummy.restapiexample.com/api/v1/employees",
            method: "GET",
            headers: {
                "Accept": "application/json; odata=verbose"
            },
            success: function (data) {
                debugger;
                alert("test:SUCCESS");
            },
            error: function (x, y, z) {
                debugger;
                alert(JSON.stringify(x) + '\n' + JSON.stringify(y) + '\n' + JSON.stringify(z));
            }
        });
    });
})

while using in SharePoint online, I am getting error.
What would be the best option to access the external API in SharePoint online page?
thanks
GV

A: If we call this rest api directly,it reports this error.

Soluation:
https://developer.mozilla.org/en-US/docs/Web/Security/Mixed_content/How_to_fix_website_with_mixed_content
Updated code:
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script>

$(document).ready(function () {
        $.ajax({
            url:"https://dummy.restapiexample.com/api/v1/employees",
            method: "GET",
            headers: {
                "Accept": "application/json; odata=verbose"
            },
            success: function (data) {
                console.log(data);
            },
            error: function (error) {
                console.log(error);
            }

    });
})
</script>

Test Result:


text:
Q: Visual Studio 2012. Load testing. How to determine the maximum number of virtual users? I have 2 GB of RAM and a 1.8 GHz processor. I conduct load testing site using Visual Studio 2012. How to determine the maximum number of virtual users based on the capacity of the computer (RAM and CPU), which will be tested and the width of the Internet channel (8 megabits per second)?

A: The number of Virtual Users depends only on your tests and on the target web site.
In some tests, a virtual user needs to execute only a simple request whereas in others tests it can invoke multiple pages and services. Sometimes, the target Web Site is simply too slow.
Personnaly, I prefer to use a goal based pattern. It resembles the step pattern but adjusts the user load based on performance counter thresholds versus periodic user load adjustments. So, I generally run load tests with a CPU on the web server between 40% and 60%.


text:
Q: ghc 7.4.1 not producing stub.o files I'm running the default installation of Haskell platform on Ubuntu and when I run this example http://www.haskell.org/haskellwiki/Calling_Haskell_from_C "ghc -c -O Safe.hs" is not producing the Safe_stub.o file. I have checked this on a separate installation of Ubuntu on a friends box and on both 32 bit and 64 bit Ubuntu installs.
Can somebody confirm if this is specific to ghc-7.4.1 or Ubuntu installs only?
Thanks!

A: It's a ghc-7.4 (ghc >= 7.2 actually) thing. That doesn't need and produce *_stub.o (or *_stub.c) files anymore. However, the command line for the final compilation has to change
$ ghc -no-hs-main -optc-O test.c Safe.o  -o test

You have to tell GHC that the main is not a haskell call.


text:
Q: Expression to look up certain character and store it in SSIS variable In SSIS 2008 I have a variable called @[User::EANcode] It contains a string with a product eancode like '1234567891123'. The value is derived from a filename like'1234567891123.jpg' via a foreach loop.
However, sometimes the filenames contain an extra '_1', '_2' etc. at the end like '1234567891123_1.jpg' resulting in a value '1234567891123_1' in the EANcode variable.
This happens when there is more than one image for the same EANcode (product). The _N addition is always a number and it is always at the end of the name/string.
What is the expression to find/cath the '_1' (or_2 or_N etc) so you can store it in another variable called @[User::Addition]?
If there is no addition, the variable stays empty which is fine.
The reason I need to get this _N addition into a separate variable is that I later on need it to rename the filename but paste the addition back at the end.
Thanks!

A: I think you're looking for CHARINDEX() in conjunction with SUBSTRING().  With that, you can split off that _# to another variable like this  (copy/pasta and execute to see.  Play with the @temp1 variable to see the limitations of the code):
declare @temp1 varchar(20), @temp2 varchar(20)
set @temp1 = '1234567891123_12'

IF CHARINDEX('_', @temp1) > 1
set @temp2 = SUBSTRING(@temp1,CHARINDEX('_', @temp1),LEN(@temp1)-CHARINDEX('_',@temp1)+1)

select @temp1, @temp2

Hope it helps!


text:
Q: How do I use the median of 3 rules to find the pivot point? Suppose I have a list of numbers like this:
2 23 19 3 5 28 31 67 44 35 6 33 19 45

How do I find the pivot point using the median of 3 method?
I thought it involves adding the first and last numbers,and then dividing it by 2, but apparently that's wrong.


text:
Q: What do you call the practice of using (overly) complex words specific to a subject? What do you call the practice of using (overly) complex words specific to a subject? I am thinking of scientific or academic fields where the common terminology used in the field is very unapproachable to someone not in the field. The situation I am imagining is when one professor gives a lecture using field specific language and the topic seems very difficult to approach to the lay person. On the other hand, another professor may give a lecture conveying the same information using terminology and phrasing easily understood by outsiders.
Is there a word to describe this difference in style practice?

A: If the topic is not natively impossible to understand, but the speaker is choosing overly-complex words, consider "sesquipedalian". ("Sesquipedalian" has a negative connotation.)
from vocabulary.com

Sesquipedalian can also be used to describe someone or something that overuses big words, like a philosophy professor or a chemistry textbook. If someone gives a sesquipedalian speech, people often assume it was smart, even if they don't really know what it was about because they can't understand the words. Each of those long words is referred to as a sesquipedalia.

If you feel like this choice of overly-complex words is more a product of their education and scholarly background and less a product of their ego, you may use 'erudite', although this doesn't necessarily imply that the lecture was difficult to follow. I believe that 'erudite' is neutral-positive in connotation.
Merriam-Webster:

having or showing knowledge that is learned by studying

If you think that the topic material itself is the primary source for their use of jargon, then you can just call it 'technical'. The following sources refer to this exact type of material as 'technical', and they appear to be using the word 'technical' to describe what you are describing.
blog post about how you should 'clarify' instead of 'dumbing down' technical details
different blog post about how to explain 'technical' things to non-technical people

A: Consider "esotericism".  The word "esoteric" is defined by oxforddictionaries.com as

Intended for or likely to be understood by only a small number of
  people with a specialized knowledge or interest

A: To describe such pedantic style, consider jargon.

From dictionary.com:

*

*the language, especially the vocabulary, peculiar to a particular
  trade, profession, or group, e.g. medical jargon.

*unintelligible or meaningless talk or writing; gibberish. any talk or writing that one does not understand.

*language that is
  characterized by uncommon or, pretentious vocabulary and convoluted
  syntax and is often vague in meaning.

Example: Use technical terms and Jargon to impress the customer!

A: If the first professor is deliberately using obscure terminology in order to confuse people, then you could call that obfuscation, from the verb obfuscate.

From http://www.thefreedictionary.com/obfuscate:

*

*To make so confused or opaque as to be difficult to perceive or understand: "A great effort was made ... to obscure or obfuscate the truth" (Robert Conquest).

*To render indistinct or dim; darken: The fog obfuscated the shore.

If the professor is not deliberately trying to confuse people who aren't expert in the field, then obfuscation is NOT the right word. In that case, as others have already pointed out, jargon is the best word to use. "His explanation was full of jargon, and I was lost immediately. The other guy did a much better job of explaining it."

A: The most appropriate term for the use of unnecessarily complex language or jargon in order to convey a message is convoluted.

(esp. of expression in speech or writing) having a complicated structure and therefore difficult to understand
Convoluted sentences, explanations, arguments, etc. are unreasonably long and difficult to understand:

Example:

"His grammar explanations are terribly convoluted."

Cambridge

A: Definitions of "abstruse"
adjective difficult to penetrate; incomprehensible to one of ordinary understanding or knowledge
"the professor's lectures were so abstruse that students tended to avoid them"
synonyms:deep, recondite
esoteric
confined to and understandable by only an enlightened inner circle

A: Officialese is the word that describes jargon not used only by academics but in general by all sorts of posers. Especially in state offices.
See Garner on Language and Writing (page 92).


text:
Q: C++ DirectX CreateDevice From Full Window Game I am trying to capture a screen from a full screen DirectX game.
I managed to take a screen shot from windowed games but when I try to create a device from a full screen game, it throws an exception.
This is my code :
#include "stdafx.h"
#include <d3d9.h>
#include <d3dx9.h>
#include "DirectXTools.h"

LPDIRECT3D9 directX;
LPDIRECT3DDEVICE9 directXDevice;

void initDevice(HWND myWindow);
void ConvertCharToWC(char* src, wchar_t* target);

void DirectXTools::CaptureWindow(const char* windowName)
{
    Sleep(5000);
    HWND windowHandle = GetForegroundWindow();
    initDevice(windowHandle);
}

void initDevice(HWND myWindow) {
    D3DDISPLAYMODE  ddm;
    D3DPRESENT_PARAMETERS   d3dpp;
    IDirect3DSurface9* g_pSurface;

    if((directX=Direct3DCreate9(D3D_SDK_VERSION))==NULL)
    {
        throw "";
    }

    if(FAILED(directX->GetAdapterDisplayMode(D3DADAPTER_DEFAULT,&ddm)))
    {
        throw "";
    }

    ZeroMemory(&d3dpp,sizeof(D3DPRESENT_PARAMETERS));

    d3dpp.Windowed=FALSE;
    d3dpp.Flags=D3DPRESENTFLAG_LOCKABLE_BACKBUFFER;
    d3dpp.BackBufferFormat=ddm.Format;
    d3dpp.BackBufferHeight=ddm.Height;
    d3dpp.BackBufferWidth=ddm.Width;
    d3dpp.MultiSampleType=D3DMULTISAMPLE_NONE;
    //  d3dpp.SwapEffect=D3DSWAPEFFECT_DISCARD;
    d3dpp.SwapEffect=D3DSWAPEFFECT_COPY;
    d3dpp.hDeviceWindow=myWindow;
    d3dpp.PresentationInterval=D3DPRESENT_INTERVAL_DEFAULT;
    d3dpp.FullScreen_RefreshRateInHz=D3DPRESENT_RATE_DEFAULT;

    if(FAILED(directX->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,myWindow,D3DCREATE_SOFTWARE_VERTEXPROCESSING ,&d3dpp,&directXDevice)))
    {
        throw "";
    }

    if(FAILED(directXDevice->CreateOffscreenPlainSurface(ddm.Width, ddm.Height, D3DFMT_A8R8G8B8, D3DPOOL_SCRATCH, &g_pSurface, NULL)))
    {
        throw "";
    }

    directXDevice->GetFrontBufferData(0, g_pSurface);
    D3DXSaveSurfaceToFile("temp.bmp",D3DXIFF_BMP,g_pSurface,NULL,NULL);
}

The directX->CreateDevice function fails, it doesn't throw an exception but it returns error D3DERR_DEVICELOST.
Anyone has any experience with these kind of thing? maybe I am missing present parameters?

A: When an application is fullscreen - only 1 device may be linked to it.
Since a device is already linked to the application (the one who ran the application) our application can't create another device


text:
Q: Extjs 6.2.0 Combobox ValueField id and displayField name not working I am trying to search from the combo by the name field and when I select the choosen text. I want that the id of the name field to be selected on the combo not the name.
When I save the id is saved but not loaded in the combo.
enter image description here
I wrote this code which is working on Extjs 4.2.2 but not on Extjs 6.2.0.
        xtype: 'combo',
        name: 'keyword_id',
        value: Ext.isDefined(keyword_id) ? keyword_id:'',
        valueField: 'id',
        fieldLabel: 'Keyword id',
        itemId : "Keyword_id",
        displayField: 'name',
        margin: '10 0 0 20',
        width: 350,

        store : Ext.create('Ext.data.Store', {
            autoLoad: this.autoLoad,
            sorters: { property: "name", direction: "ASC"},
            fields:[
                    {name:'id', mapping:'id'},
                    {name:'name', mapping:'name'}
                   ],
            proxy: {
                type: 'ajax',
                url: 'proxy/proxy.php',
                reader: {
                    type: 'json',
                    rootProperty: 'data'
                }
            }
        }),
        minChars: 1,
        hideTrigger: true,
        editable: true,
        queryParam: 'name_like'


text:
Q: How to merge 2 tables with user and timestamp in python I need to merge 2 tables of millions of records. The common fields are user and timestamp. The problem is that the timestamp is different in both tables, so I need to create a new variable or establish a range of 5 seconds to find a perfect coincidence between tables 1 and 2.
I am trying to use lookup or function y.  I am not an expert, so I really need your help.
I know that it seems easy for an expert. Thank you very much!!!

A: Might I suggest pandas merge_asof function:
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.merge_asof.html
I believe the argument direction='nearest' might solve your problem.


text:
Q: Multi select filter option for MySQL data using AJAX I am learning JSON and AJAX and need help on this tutorial.

Here the results (from search.php) are showing in a table but I want all the data in a div. Please help me on this issue.


text:
Q: Hybris navigation component anatomy I've created CMSLinkComponent and CMSNavigationNode with the following:
$contentCatalog=myContentCatalog
$contentCV=catalogVersion(CatalogVersion.catalog(Catalog.id[default=$contentCatalog]),CatalogVersion.version[default=Staged])[default=$contentCatalog:Staged]

INSERT CMSLinkComponent;$contentCV[unique=true];uid[unique=true];name;linkName[lang=en];url;&linkRef;target(code)[default='newWindow']
;;linkToOutOne;Link To Out One Name; "Link one name"; "https://google.com"; l1
;;linkToOutTwo;Link To Out Two Name; "Link two name"; "https://wikipedia.com"; l2
;;linkToOutThree;Link To Out Three Name; "Link three name"; "https://microsoft.com"; l3

INSERT CMSNavigationNode;uid[unique=true];$contentCV[unique=true];name;title[lang=en];parent(uid, $contentCV);links(&linkRef);&nodeRef
; testNavNode; ; Test Nav Node; "Node name"; NavBarNode; l1,l2; n1

Where NavBarNode is a root navigation node for the navigation component.
Import is successful and content catalog sync passes, but I can not see two links related to category in WCMS nor SmartEdit.
WCMS (Linked items is empty):

Similar in SmartEdit. Also, category and links are not visible on storefront navigation bar.
If I also import following with the above:
INSERT_UPDATE CMSNavigationEntry;uid[unique=true];$contentCV[unique=true];name;navigationNode(uid, $contentCV);item(CMSLinkComponent.uid,CMSLinkComponent.$contentCV);
;testNavEntry; ; Test Nav Entry; testNavNode; linkToOutThree

Category and link (linkToOutThree = microsoft) are now visible. I expected testNavNode to have links to google.com and wikipedia.com not microsoft.com
My questions are:

*

*what is the purpose of links attribute(definied by CMSLinksForNavNodes relation) on CMSNavigationNode since those links are not displayed.

*if CMSNavigationEntry is used to store "links" for navigation node, how to attach multiple links to same navigation node(it's navigation entry)

FYI: I'm using marketplace accelerator(client's request)


text:
Q: Raid 1 Hardware Failure - new hardware MDADM - How to recover I had a NAS, and the hardware failed. I put it in a totally brand new machine and hardware - this is software raid on a standard sata port with MDADM. Moved both disks - Raid1. There are about a billion posts on this, but most seem opinion.
Debain OMV 6
This is the state:
mdadm --assemble --scan
mdadm: No arrays found in config file or automatically

df
Filesystem     1K-blocks    Used Available Use% Mounted on
udev            16215324       0  16215324   0% /dev
tmpfs            3246744    2780   3243964   1% /run
/dev/nvme0n1p2 981876212 2164156 929761748   1% /
tmpfs           16233712       0  16233712   0% /dev/shm
tmpfs               5120       0      5120   0% /run/lock
/dev/nvme0n1p1    523248    3484    519764   1% /boot/efi
tmpfs           16233712       0  16233712   0% /tmp
tmpfs            3246740       0   3246740   0% /run/user/1000

lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda           8:0    0   7.3T  0 disk
└─md127       9:127  0   7.3T  0 raid1
sdb           8:16   0   7.3T  0 disk
└─md127       9:127  0   7.3T  0 raid1
nvme0n1     259:0    0 953.9G  0 disk
├─nvme0n1p1 259:1    0   512M  0 part  /boot/efi
├─nvme0n1p2 259:2    0 952.4G  0 part  /
└─nvme0n1p3 259:3    0   977M  0 part  [SWAP]

mdadm --detail /dev/md127
/dev/md127:
           Version : 1.2
     Creation Time : Tue May 25 12:04:21 2021
        Raid Level : raid1
        Array Size : 7813894464 (7451.91 GiB 8001.43 GB)
     Used Dev Size : 7813894464 (7451.91 GiB 8001.43 GB)
      Raid Devices : 2
     Total Devices : 2
       Persistence : Superblock is persistent

     Intent Bitmap : Internal

       Update Time : Thu Mar  3 07:04:07 2022
             State : clean
    Active Devices : 2
   Working Devices : 2
    Failed Devices : 0
     Spare Devices : 0

Consistency Policy : bitmap

              Name : helios64:H64
              UUID : 50a5d620:6b4f3ca9:624622fd:7b786dff
            Events : 35118

    Number   Major   Minor   RaidDevice State
       0       8        0        0      active sync   /dev/sda
       1       8       16        1      active sync   /dev/sdb

cat /proc/mdstat
Personalities : [raid1] [linear] [multipath] [raid0] [raid6] [raid5] [raid4] [raid10]
md127 : active (auto-read-only) raid1 sdb[1] sda[0]
      7813894464 blocks super 1.2 [2/2] [UU]
      bitmap: 0/59 pages [0KB], 65536KB chunk

blkid
/dev/nvme0n1p1: UUID="7DAA-51D0" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="589937f6-c05c-4b6b-b3a7-c4a069e7c752"
/dev/nvme0n1p2: UUID="603d2633-6e9f-48f0-b9ac-25f4e0009404" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="c93a0c02-c9cb-4d2c-a945-83b548da7176"
/dev/nvme0n1p3: UUID="096b416d-447c-475e-9f3a-feb38405ed52" TYPE="swap" PARTUUID="2d539d95-f0b9-4f57-86db-a98f7c081b85"
/dev/sda: UUID="50a5d620-6b4f-3ca9-6246-22fd7b786dff" UUID_SUB="fa9dbb6b-980d-c393-12b0-6ef6b0f9da17" LABEL="helios64:H64" TYPE="linux_raid_member"
/dev/sdb: UUID="50a5d620-6b4f-3ca9-6246-22fd7b786dff" UUID_SUB="23ccb86c-9517-2574-c8dd-78f588517fa6" LABEL="helios64:H64" TYPE="linux_raid_member"
/dev/md127: LABEL="H64" UUID="42a00ab6-37fb-4d90-bba4-5d1d2321d75a" BLOCK_SIZE="4096" TYPE="ext4"

From OMV

OK - to me if feels like the only thing I need to do is mount the drive? I don't want to stuff up, these are the results from just plugging them in.
Cheers

A: everything looks fine to me, there is nothing to do but to create a mount point directory and mount the RAID volume to it. Something like:
# mkdir /srv/data
# mount /dev/md127 /srv/data

If the system is intended to serve as a network share, than you need to configure and run some nework filesystem.
If you want to make the raid permanently mounting at boot, you have to write your new record into /etc/mdadm/mdadm.conf (read the man page for mdadm) and then run
# update-initramfs -u

This make the raid array avilable immediately after reboot, and you can add the mount record into the /etc/fstab , something like:
LABEL=H64 /srv/data ext4 rw,realtime 0 0

If something goes wrong, consult the /var/log/syslog first.
If you are in doubt of the consistency of RAID1 there may be some check done as described in this answer.


text:
Q: "Caching is not supported by the ItemCountDAOSolr as it is not really needed, Solr is faster!" I am using Dspace. currently I want to update index using the command ./dspace index-lucene-update. but the exception comes "Caching is not supported by the ItemCountDAOSolr as it is not really needed, Solr is faster!" . my question is whether index is built. or how to correct the execption. I have changed some places in dspace.cfg files but can not able to eliminate the error,inform me

A: You're likely on DSpace 4. This error message has been fixed in DSpace 5.
Nevertheless, I recommend to take a look at the latest definitions of the different indexing operations:
https://wiki.duraspace.org/display/DSDOC5x/Command+Line+Operations
The lucene index is hardly being used, and if you're on DSpace 4 or 5 there are only a few reasons why you want to keep that updated.
You most likely want to run and use ./dspace index-discovery


text:
Q: Mysql Trigger update another table's quantity by 1 Hi I'm trying to create a trigger that adds 1 to the quantity of insert's id in a helper table holding the codes for the id's. Here are my 2 tables.
     Animal
   ----------
   AnimalId
   Breedcode

   Breed_codes
  ------------
   Breedcode
   breed
   Quantity

     CREATE TRIGGER `updater` AFTER INSERT ON `Animal`
     FOR EACH ROW UPDATE breed_codes
     SET Quantity = Quantity + 1
     WHERE Breedcode = Animal.Breedcode

However it states that the Animal Breed code isn't found. Can anyone please help me fix my trigger. Thank you

A: In your UPDATE query you can use:

*

*Column names from the table(s) you are updating,

*Column names from the table you define trigger for with NEW.column (insert and update triggers) or OLD.column (update and delete triggers).

In your case instead of Animal.Breedcode you should use New.Breedcode.


text:
Q: Inheritance: Evaluating In Derived Class's Scope? Is there a design pattern in any mainstream language for a derived class to inherit code from a base class and evaluate that code in the derived class's scope?  For example (using pseudo-C++ syntax):
class Base {
    // (How) can this be modified to be evaluated
    // in the derived class's scope so that it
    // prints the size of the derived class?
    void printSize() {
        cout << sizeof(*this) << endl;
    }
};

class Derived : public Base {
    void* dummy;
};

int main() {
    Base base;
    Derived derived;
    base.printSize();
    derived.printSize();  // Should be > base.printSize().
    return 0;
}

I realize this can be done with macros, but that requires the macro to be explicitly instantiated in the derived class's scope.
EDIT:    To clarify, the whole point of this post is that I don't want to manually re-implement printSize() or anything similar in every derived class.  I'm looking for a clever pattern to make the compiler/interpreter (I'm interested in knowing whether any language has a solution for this even though I used C++ in my example) do this for me.
EDIT # 2:  I guess this is pretty easy in dynamic languages.  I'm more interested in solutions for statically typed languages, mostly C++, Java and D.
EDIT # 3: The pattern should work on the runtime type, not the compile time type.  Therefore, D's template this parameters are not a solution.

A: If by "mainstream", you include mainstream scripting languages such as Perl or Python, then yes.  Perl methods are generally "evaluated" in the most-derived scope, since a Perl "object" is generally a hash-map and all variables from all levels of the inheritance tree are in the same "scope" (that is, keys into the same hash-map).  Something similar happens for Python classes, although (IIRC) Python has a way of creating a symbol that will be mangled so that it will be distinct based on the class the code is written in.  Of course, neither of these languages has a "sizeof" concept per se, so your particular example wouldn't be particularly relevant.
In C++, the concept of deciding the current class for a member function based on the type it's called through like your example doesn't (as far as I know) really work.  However, you might be able to get close to what you're describing using templates.  For example, something like this:
template<typename T>
void printSize( T &t ) {
    cout << sizeof(t) << endl;
}
int main() {
    Base base;
    Derived derived;
    printSize(base);
    printSize(derived);
}

(Side note: In C++, since your Base is empty, there's actually no guarantee that sizeof(Base) > sizeof(Derived) --- the empty base optimization may be employed such that a normal Base is (perhaps) the size of a pointer, but the Base part of a Derived is actually empty.  Most platforms probably allocate 1 byte to such empty classes, and pointers are usually bigger than that, but it's not specified.)

A: D comes for the rescue. Template mixins are exactly the tool intended for being evaluated in target context and you don't need any special type hierarchy (you can still add one if you want of course):
http://dpaste.1azy.net/eec411e8
mixin template SizePrinter()
{
    static void printSize()
    {
        import std.stdio;
        writeln(__traits(classInstanceSize, typeof(this)));
    }
}

class Tested1
{
    int[64] dummy;
    mixin SizePrinter;
}

class Tested2
{
    int[16] dummy;
    mixin SizePrinter;
}

void main()
{
    Tested1.printSize();
    Tested2.printSize();
}

Application output:
272
80

A: In C++, I think the closer you'll get to that is the Curiously Recurring Template Pattern (CRTP) but it has serious limitations:
template<typename T>
class Base {
    void printSize() {
        std::cout << sizeof(T) << std::endl;
    }
    void doSomething() {
        T::member_variable = 3;
        T::doSomethingElse();
    }
};

class Derived : public Base<Derived> {
public:
    int member_variable;
    void doSomethingElse() { ... }
};

You could also use virtual methods but they require you to reimplement the method in each and every derived class, so I guess this is not what you want.
To really achieve what you have in mind, you'll probably need a dynamic language (eg. Python). No guarantees though, this is such an unusual "feature request" and I don't know dynamic languages very well...

A: There is a better solution in D that uses Template This Parameter.
Code: http://dpaste.1azy.net/78810a79
import std.stdio;

class Base {
  int[64] dummy1;
  final static size_t getSize(this T)() {
    return __traits(classInstanceSize, T);
  }
}

class Derived : Base {
  int[16] dummy2;
}

void main() {
  writeln(Base.getSize());    // prints: 272
  writeln(Derived.getSize()); // prints: 336
}

Edit: Ops, this will only work for the static type. Not the solution to your problem.


text:
Q: R2 from Statsmodels VAR Is there an easy way to extract R2 from Statsmodels' VAR package?
Following the example in statsmodels' documentation:
http://www.statsmodels.org/dev/vector_ar.html
from statsmodels.tsa.api import VAR
model = VAR(data)
results = model.fit(2)
results.summary()

Summary of Regression Results
==================================
Model:                         VAR
Method:                        OLS
Date:           Tue, 28, Feb, 2017
Time:                     21:38:11
--------------------------------------------------------------------
No. of Equations:         3.00000    BIC:                   -27.5830
Nobs:                     200.000    HQIC:                  -27.7892
Log likelihood:           1962.57    FPE:                7.42129e-13
AIC:                     -27.9293    Det(Omega_mle):     6.69358e-13
--------------------------------------------------------------------
.
.

It then goes on to show the coefficients for each equation and, at the end, a correlation matrix of the residuals. However, it does not show R-square for each of the equations.
Does anyone know if there is an easy way to extract the R-square from statsmodels VAR without having to work it out from scratch?

A: Using sklearn.metrics.r2_score for each equation would work (unfortunately going outside of statsmodels). The example code assumes that there is a column named 'foobar' in the dataframe data, and this will be the equation R2 we extract; obviously the VAR() and fit() methods should be adapted for your particular case
import statsmodels.api as sm
import sklearn.metrics as skm
estVAR = sm.tsa.VAR(data).fit(1)
skm.r2_score(estVAR.fittedvalues['foobar']+estVAR.resid['foobar'],
  estVAR.fittedvalues['foobar'])

The reason for adding the fitted values to the residuals is to get back the actual data for which the VAR could construct fitted values (instead of the whole sample, some observations of which did not have fitted values constructed due to the need for lagged observations on the right hand side). Incidentally, we can confirm that this is the R2 we want, say by doing this
y = estVAR.fittedvalues['foobar']+estVAR.resid['foobar']
R2 = 1 - np.sum(estVAR.resid['foobar'].values**2)/np.sum((y.values-y.mean())**2)


text:
Q: What is the purpose of the PHP_DEBUG Constant? This is probably a stupid question, but I couldn't find any other info on this topic. What exactly is the purpose of PHP_DEBUG and the majority of other Predefined Constants?
When I echo PHP_DEBUG I just see a 0. I'm not sure what significance this has .. ?

A: I found this, maybe that helps?
Not sure what the point of it is, versus actually defining something similar yourself...
It might also mean that PHP was compiled with debugging symbols enabled (--enable-debug).

A: PHP_DEBUG is an indication of whether your PHP binary was compiled in a debug configuration. If all you are doing with PHP is writing PHP programs then it's useless to you.
You can see from the source that the PHP constant PHP_DEBUG mirrors the value of the macro with the same name in the C sources, which in turn affects how PHP is built.