text:
Q: Select option text disappears partially after adding css class

$("button").on("click", function() {
 $("select option").each(function() {
   $(this).addClass("heavyError");
  });
  $("select option:selected").attr("selected", false);
});
.heavyError {
  color: red;
  font-weight: bold;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<select style="width:480px; height:100px;" multiple>
<option value="test-ss">test-ss</option>
</select>
<button>test</button>

If run this in IE, the text gets cut off by the hyphen, however, it's working properly in Chrome. Not sure what's going on here. Is it a bug with IE or some sort?

A: Appending a ' ' to the select will force the select to "refresh", and fixes the issue in IE11. See here: https://jsfiddle.net/9kvcqc05/

$("button").on("click", function() {
 $("select option").each(function() {
   $(this).addClass("heavyError");
  });

  $("select option:selected").attr("selected", false);
  $("select").append(' ');
});
.heavyError {
  color: red;
  font-weight: bold;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<select style="width:480px; height:100px;" multiple>
<option value="test-ss">test-ss</option>
</select>
<button>test</button>

It seems this is just a weird IE-specific bug.
I solved this by referencing this great answer by Jordan Gray.

A: The best I can figure is that IE is trying to wrap the option's text on the hyphen, because the bold style increases its width.
Here's an example with longer text:

$("button").on("click", function() {
  $("select option").each(function() {
    $(this).addClass("heavyError");
  });
});
.heavyError {
  color: red;
  font-weight: bold;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<select style="width:480px; height:100px;" multiple>
  <option value="test-ss">test-loremipsum</option>
</select>
<button>test</button>

A quick fix is to append a space to the element:

$("button").on("click", function() {
  $("select option").each(function() {
    $(this).text($(this).text() + ' ');
    $(this).addClass("heavyError");
  });
});
.heavyError {
  color: red;
  font-weight: bold;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<select style="width:480px; height:100px;" multiple>
  <option value="test-ss">test-loremipsum</option>
</select>
<button>test</button>


text:
Q: Arabic WordCloud R Studio Wordcloud Arabic R studio
I have been trying to search and figure this out for a while when trying to create a wordcloud in r studio for some arabic tweets, and am not sure why i get jibberish text the code and system info is below.
Glad if someone can guide me on this where i was able to do this for any english tweets
SessionInfo()

R version 3.4.2 (2017-09-28)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

.
tweets = searchTwitter("syria", n=500, lang="ar")
tweets_text = sapply(tweets, function(x) x$getText())
tweets_text <- iconv(tweets_text, "UTF-8", "UTF-8", sub="")
# create a corpus
corpus = Corpus(VectorSource(tweets_text))

# create document term matrix applying some transformations
tdm = TermDocumentMatrix(corpus,
      control = list(removePunctuation = TRUE,
      stopwords = c("machine", "learning",  "machinelearning","https",stopwords("english")),
      removeNumbers = TRUE, tolower = TRUE))
    # define tdm as matrix
    m = as.matrix(tdm)
    # get word counts in decreasing order
    word_freqs = sort(rowSums(m), decreasing=TRUE)
    # create a data frame with words and their frequencies
    dm = data.frame(word=names(word_freqs), freq=word_freqs)

# plot wordcloud
wordcloud(dm$word, dm$freq, random.order=FALSE, colors=brewer.pal(8, "Dark2"))

Alternately i tried the below code to get the error   Error: all(!is.na(match(c("doc_id", "text"), names(x)))) is not TRUE
library(wordcloud2)
print(Sys.getlocale(category = "LC_CTYPE"))
original_ctype <- Sys.getlocale(category = "LC_CTYPE")
## Switch to the appropriate local for the script
Sys.setlocale("LC_CTYPE", "arabic" )
# read text with UTF-8 encoding
arabic_text<-readLines("C:/......./tweets.txt", encoding="UTF-8")
arabic_text<-removePunctuation(arabic_text)
arabic_text<-removeNumbers(arabic_text)
arabic_text<-removeNewlineChars(arabic_text)
arabic_text<-stripWhitespace(arabic_text)
# create arabic text corpus
arabic_corpus <- Corpus(DataframeSource(data.frame(arabic_text)))
#-------This is where i get the above error--------------

redpajama_set_name: RedPajamaStackExchange


text:
Q: Why the cursor returns null INTO variables but the query returns rows? I have this stored procedure in MySQL, its suposed that should works but it doesn't. I put a table called logs to log the values, to see what is going on there:
DELETE FROM LOGS;
CALL fixRegistrationsGroups;
SELECT * FROM LOGS;

This returns in the logs table this:
BEFORE LOOP registrationsIds NULL
registrationsIds NULL
nextRegistrationId NULL

As I said in the title of this question, the query in the cursor registrationsWithSameGroupId returns rows but not when I fetch from the cursor, this is an example of the rows it returns:
countRepeated   registrationsIds    groupId
2               11,1017             6
4               33,35,3463,4363     7
2               32,54               10
7               10,39,40,41,47,48,  51

STORED PROCEDURE (What is wrong?):
DELIMITER $$

USE `database-name`$$

DROP PROCEDURE IF EXISTS `fixRegistrationsGroups`$$

CREATE DEFINER=`root`@`%` PROCEDURE `fixRegistrationsGroups`()
BEGIN
    DECLARE done INT DEFAULT FALSE;
    DECLARE participantRegistration INT(11);
    DECLARE newAgreementSignatureId INT(11);
    DECLARE countRepeated INT;
    DECLARE registrationsIds VARCHAR(255);
    DECLARE currentGroupId INT;
    DECLARE nextRegistrationId INT(11);
    DECLARE strLen    INT DEFAULT 0;
    DECLARE SubStrLen INT DEFAULT 0;

    DECLARE registrationsWithSameGroupId CURSOR FOR
        SELECT COUNT(groupId) AS countRepeated,
                GROUP_CONCAT( registrations.id )  AS registrationsIds,
                groupId
            FROM registrations
            GROUP BY groupId
            HAVING countRepeated > 1;

    DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;

    OPEN registrationsWithSameGroupId;
    READ_LOOP: LOOP
        FETCH NEXT FROM registrationsWithSameGroupId INTO countRepeated, registrationsIds, currentGroupId;
        INSERT INTO LOGS(line) VALUES (CONCAT('BEFORE LOOP registrationsIds ',IF (registrationsIds IS NULL,'NULL',registrationsIds)) );
        createAndAssignGroups: LOOP
            SET strLen = LENGTH(registrationsIds);
            INSERT INTO LOGS(line) VALUES (CONCAT('registrationsIds ',IF (registrationsIds IS NULL,'NULL',registrationsIds)) );
            SET nextRegistrationId = SUBSTRING_INDEX(registrationsIds, ',', 1);
            INSERT INTO LOGS(line) VALUES (CONCAT('nextRegistrationId ',IF (nextRegistrationId IS NULL,'NULL',nextRegistrationId)) );

            INSERT INTO groups (NAME, administratorIdentificationNumber, numberOfParticipants, lastRegistrationDate, lastEventName, eventId)
             SELECT
                groups.name,
                administratorIdentificationNumber,
                numberOfParticipants,
                lastRegistrationDate,
                (SELECT eventName FROM registrations WHERE id = nextRegistrationId) AS  lastEventName,
                eventId
                FROM groups WHERE id = currentGroupId;

            UPDATE registrations SET groupId = (SELECT MAX(id) FROM groups) WHERE id = nextRegistrationId;

            SET SubStrLen = LENGTH(SUBSTRING_INDEX(registrationsIds, ',', 1));
            SET registrationsIds = MID(registrationsIds, SubStrLen, strLen);

            IF registrationsIds IS NULL THEN
                LEAVE createAndAssignGroups;
            END IF;
        END LOOP;

        IF done THEN
            LEAVE READ_LOOP;
        END IF;
    END LOOP;

    CLOSE registrationsWithSameGroupId;

END$$

DELIMITER ;

A: You need to check whether your continue handler fired immediately after FETCH.
FETCH NEXT FROM registrationsWithSameGroupId INTO countRepeated, registrationsIds, currentGroupId;
IF done THEN
    LEAVE READ_LOOP;
END IF;
INSERT INTO LOGS(line) VALUES ...

A: I don't think that you are exiting createAndAssignGroups: LOOP. Assuming your select into cursor works I have created a table from your result set
MariaDB [sandbox]> SELECT * FROM T;
+---------------+-------------------+---------+
| countRepeated | registrationsIds  | groupId |
+---------------+-------------------+---------+
|             2 | 11,1017           |       6 |
|             4 | 33,35,3463,4363   |       7 |
|             2 | 32,54             |      10 |
|             7 | 10,39,40,41,47,48 |      51 |
+---------------+-------------------+---------+
4 rows in set (0.00 sec)

I have amended your procedure to write debug information to debug_table,commented out the  INSERT INTO groups and update registartions code, added some code to run your code or mine, moved the cursor exit test which was in the wrong place , 'FIXED' the SET registrationsIds code section and in mycode have tested for an empty string rather than null.
So this is the revised procedure.
DROP PROCEDURE IF EXISTS P;
DELIMITER $$
CREATE PROCEDURE `p`(INCODE VARCHAR(8))
LANGUAGE SQL
NOT DETERMINISTIC
CONTAINS SQL
SQL SECURITY DEFINER
COMMENT ''
BEGIN
    DECLARE done INT DEFAULT FALSE;
    DECLARE participantRegistration INT(11);
    DECLARE newAgreementSignatureId INT(11);
    DECLARE countRepeated INT;
    DECLARE registrationsIds VARCHAR(255);
    DECLARE currentGroupId INT;
    DECLARE nextRegistrationId INT(11);
    DECLARE strLen    INT DEFAULT 0;
    DECLARE SubStrLen INT DEFAULT 0;
     declare i int default 0;

    DECLARE registrationsWithSameGroupId CURSOR FOR
        SELECT * from t;

    DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;

    OPEN registrationsWithSameGroupId;
    READ_LOOP: LOOP
        FETCH NEXT FROM registrationsWithSameGroupId INTO countRepeated, registrationsIds, currentGroupId;
      IF done THEN
            LEAVE READ_LOOP;
        END IF;

        INSERT INTO debug_table(msg) VALUES (CONCAT('BEFORE LOOP registrationsIds ',IF (registrationsIds IS NULL,'NULL',registrationsIds)) );
        set I = 0;
          createAndAssignGroups: LOOP
            SET strLen = LENGTH(registrationsIds);
            INSERT INTO debug_table(msg) VALUES (CONCAT('registrationsIds ',IF (registrationsIds IS NULL,'NULL',registrationsIds)) );
            SET nextRegistrationId = SUBSTRING_INDEX(registrationsIds, ',', 1);
            INSERT INTO debug_table(msg) VALUES (CONCAT('nextRegistrationId ',IF (nextRegistrationId IS NULL,'NULL',nextRegistrationId)) );
/*
            INSERT INTO groups (NAME, administratorIdentificationNumber, numberOfParticipants, lastRegistrationDate, lastEventName, eventId)
             SELECT
                groups.name,
                administratorIdentificationNumber,
                numberOfParticipants,
                lastRegistrationDate,
                (SELECT eventName FROM registrations WHERE id = nextRegistrationId) AS  lastEventName,
                eventId
                FROM groups WHERE id = currentGroupId;

            UPDATE registrations SET groupId = (SELECT MAX(id) FROM groups) WHERE id = nextRegistrationId;
*/
            IF INCODE = 'YOURCODE' THEN
            SET SubStrLen = LENGTH(SUBSTRING_INDEX(registrationsIds, ',', 1));
            SET registrationsIds = MID(registrationsIds, SubStrLen, strLen);

            IF registrationsIds IS NULL THEN
                LEAVE createAndAssignGroups;
            END IF;
            ELSE
            SET SubStrLen = LENGTH(SUBSTRING_INDEX(registrationsIds, ',', 1)) + 1;
            #insert into debug_table(msg) values (concat('substrlen:',substrlen,' strlen:', strlen));
            SET registrationsIds = MID(registrationsIds, SubStrLen + 1, strLen - substrlen + 1);

                set i = i + 1;
            IF # > 6 or
                    length(registrationsIds) = 0 THEN
                LEAVE createAndAssignGroups;
            END IF;

            END IF;
        END LOOP;

        #IF done THEN
        #    LEAVE READ_LOOP;
        #END IF;
    END LOOP;

    CLOSE registrationsWithSameGroupId;

END $$

DELIMITER ;

When I run it mycode behaves as expected, yours goes into an infinite loop
TRUNCATE TABLE DEBUG_TABLE;

insert into debug_table(msg) values ('***mycode start***');
call p('mycode');
insert into debug_table(msg) values ('***yourcode start***');
CALL P('YOURCODE');
SELECT * FROM DEBUG_TABLE;

MariaDB [sandbox]> select * from debug_table limit 100;
+-----+------------------------------------------------+------+
| id  | msg                                            | MSG2 |
+-----+------------------------------------------------+------+
|   1 | ***mycode start***                             | NULL |
|   2 | BEFORE LOOP registrationsIds 11,1017           | NULL |
|   3 | registrationsIds 11,1017                       | NULL |
|   4 | nextRegistrationId 11                          | NULL |
|   5 | registrationsIds 1017                          | NULL |
|   6 | nextRegistrationId 1017                        | NULL |
|   7 | BEFORE LOOP registrationsIds 33,35,3463,4363   | NULL |
|   8 | registrationsIds 33,35,3463,4363               | NULL |
|   9 | nextRegistrationId 33                          | NULL |
|  10 | registrationsIds 35,3463,4363                  | NULL |
|  11 | nextRegistrationId 35                          | NULL |
|  12 | registrationsIds 3463,4363                     | NULL |
|  13 | nextRegistrationId 3463                        | NULL |
|  14 | registrationsIds 4363                          | NULL |
|  15 | nextRegistrationId 4363                        | NULL |
|  16 | BEFORE LOOP registrationsIds 32,54             | NULL |
|  17 | registrationsIds 32,54                         | NULL |
|  18 | nextRegistrationId 32                          | NULL |
|  19 | registrationsIds 54                            | NULL |
|  20 | nextRegistrationId 54                          | NULL |
|  21 | BEFORE LOOP registrationsIds 10,39,40,41,47,48 | NULL |
|  22 | registrationsIds 10,39,40,41,47,48             | NULL |
|  23 | nextRegistrationId 10                          | NULL |
|  24 | registrationsIds 39,40,41,47,48                | NULL |
|  25 | nextRegistrationId 39                          | NULL |
|  26 | registrationsIds 40,41,47,48                   | NULL |
|  27 | nextRegistrationId 40                          | NULL |
|  28 | registrationsIds 41,47,48                      | NULL |
|  29 | nextRegistrationId 41                          | NULL |
|  30 | registrationsIds 47,48                         | NULL |
|  31 | nextRegistrationId 47                          | NULL |
|  32 | registrationsIds 48                            | NULL |
|  33 | nextRegistrationId 48                          | NULL |
|  34 | ***yourcode start***                           | NULL |
|  35 | BEFORE LOOP registrationsIds 11,1017           | NULL |
|  36 | registrationsIds 11,1017                       | NULL |
|  37 | nextRegistrationId 11                          | NULL |
|  38 | registrationsIds 1,1017                        | NULL |
|  39 | nextRegistrationId 1                           | NULL |
|  40 | registrationsIds 1,1017                        | NULL |
|  41 | nextRegistrationId 1                           | NULL |
|  42 | registrationsIds 1,1017                        | NULL |
|  43 | nextRegistrationId 1                           | NULL |


text:
Q: angular js unit test using jasmine for a resource based factory in controller I am new in writing unit test case using jasmine. I am trying to test a resource based service in a controller fetching real data from server but not getting the desired results. Please provide your inputs where I am doing wrong. Below is the unit test I have written :
    describe('NewStarterController', function() {
           beforeEach(module('myApp'));
           var scope, ctrl, $resource;
       var context = 'http://localhost.com:8085/AngularPrototype/home';

       beforeEach(inject(function(_$resource_, $rootScope, $controller) {
              $resource = _$resource_;

              NewStarter = {
                     getNSData : function() {
                           return $resource(context + '/selfservice/newstarter/get', {}, {
                                  get : {
                                         method : 'GET'
                                  }
                           });
                     }
              };
              scope = $rootScope.$new();

              $controller('NewStarterController', {
                     $scope : scope,
                     NewStarter : NewStarter
              });

       }));

       it('should test new starter data', function() {

              NewStarter.getNSData().get({}).$promise.then(function(response) {
                     scope.refData = response;
                     scope.data();

              });

              expect(scope.data.length).toEqual(2);

              expect(NewStarter.getNSData().get.length).toEqual(2);

              expect(NewStarter.getNSData().get()).toEqual('formTitleNode');

       });

});

Below is the jasmine test result ::

Jasmine 1.3.1 revision 1354556913finished in 0.183s
•
No try/catchFailing 1 spec1 spec | 1 failing
NewStarterController
should test new starter data
NewStarterController should test new starter data.
Expected 0 to equal 2.
Expected 4 to equal 2.
Expected { $promise : { $$state : { status : 0 } }, $resolved : false } to equal 'formTitleNode'.

get.json      ->   represents the data that is returned from server(Data returned from RestController) on hitting the url : http://localhost.com:8085/AngularPrototype/home/selfservice/newstarter/get

SpecRunner.html->  is used to run the jasmine unit test. Below are the contents of this file :
<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Jasmine Demo</title>

    <script>
        libraries here
    </script>
</head>
<body>
<!-- Include Angular and Angular Mocks-->
<script>libraries here </script>
    <!-- Include your source files here... -->
<script src="services/services.js"></script>
<script src="myApp.js"></script>
<script src="controller/selfservice/NewStarterController.js"></script>

<!-- Include your spec files here... -->
<script src="jasmineunittest/NewStarterControllerTest.js"></script>

<!-- Jasmine execution script (Standard Jasmine Bolierplate)-->
<script type="text/javascript">
var jasmineEnv = jasmine.getEnv();
jasmineEnv.updateInterval = 1000;
var htmlReporter = new jasmine.HtmlReporter();
jasmineEnv.addReporter(htmlReporter);
jasmineEnv.execute();

</script>

</body>
</html>

Below is the controller code ( NewStarterController.js ) which is unit tested :

myApp.controller("NewStarterController", ['$scope','$modal', '$state', '$sce', 'NewStarter', function($scope,$modal, $state, $sce, NewStarter) {

       $scope.data = function() {
              NewStarter.getNSData().get({}, function(response) {
                     $scope.refData = response;
                     $scope.formTitle = [];
                     $scope.displayOptions = [];
                     angular.forEach($scope.refData.formTitleNode, function(contentItem)
                     {
                           var content = -1;
                           var title = -1;
                           angular.forEach(contentItem.fieldList, function(fieldBean)
                           {
                                  if(fieldBean.fieldName == 'TITLE')
                                  {
                                         title = fieldBean.fieldValue;

                                  }
                                  if(fieldBean.fieldName == 'FORMATTEDCONTENTS')
                                  {
                                         content = fieldBean.fieldValue;

                                  }
                           })
                           $scope.formTitle.push({title:title, content:content});
                     })

                     angular.forEach($scope.refData.displayOptionsNode, function(contentItem)
                     {

                           var nsContent = -1;
                           var nsTitle = -1;
                           angular.forEach(contentItem.fieldList, function(fieldBean)
                           {
                                  if(fieldBean.fieldName == 'TITLE')
                                  {
                                         nsTitle = fieldBean.fieldValue;

                                  }
                                  if(fieldBean.fieldName == 'FORMATTEDCONTENTS')
                                  {
                                         nsContent = fieldBean.fieldValue;

                                  }
                           })
                           $scope.displayOptions.push({nsTitle:nsTitle, nsContent:nsContent});
                           $scope.selectedOption = '';
                     })

                     $scope.hasNewStarterSubmitted = $scope.refData.hasNewStarterSubmitted;
                     $scope.submittedSelectedOption = $scope.refData.submittedSelectedOption;
                     $scope.submittedStudentLoan = $scope.refData.submittedStudentLoan;
                     $scope.nsAlreadySubmittedValidationMsg = $scope.refData.nsAlreadySubmittedValidationMsg;

                     console.log('Success', response);
              }, function(error) {
                     //alert(JSON.stringfy(error))
                     $scope.contentLoadErrorMsg=error.data;
                     //console.error('ERR', error);
              });
       }
}]);

Below is the code in services.js

myApp.factory('NewStarter', function($resource, context) {
       return {
              getNSData: function() {
                     return $resource(context + '/selfservice/newstarter/get', {}, {get: {method:'GET'}});
              },
              submitNSForm: function() {
                     return $resource(context + '/selfservice/newstarter/submit', {}, {submit: {method:'POST'}});
              }

       }
});

Below is the code in myApp.js

var myApp = angular.module('myApp', ['ngResource', 'ngSanitize', 'ui.bootstrap', 'ui.router']);

myApp.constant('context', '/AngularPrototype/home');
myApp.constant('projectName', '/AngularPrototype');
myApp.config(function($stateProvider, $urlRouterProvider, projectName) {
$urlRouterProvider.otherwise('/home');

$stateProvider .state('newStarter', {
                     url:'/newstarter',
                     templateUrl: projectName + '/newstarter',
                     controller: 'NewStarterController'
              })
});

 Thanks!

Below i tried as per your suggestion but getting error while running the unit test:
describe('NewStarterController', function() {
beforeEach(module('myApp'));
var scope, postDefer,NewStarter;

       beforeEach(inject(function(_NewStarter_, $rootScope, $controller,$q) {
              NewStarter = _NewStarter_;
             postDefer = $q.defer();
             spyOn(NewStarter,'getNSData').and.returnValue(postDefer.promise);
              scope = $rootScope.$new();

              $controller('NewStarterController', {
                     $scope : scope,
                     NewStarter : NewStarter
              });

       }));

       it('should test new starter data', function() {

              NewStarter.getNSData().get({});
              postDefer.resolve();
              scope.$apply();

              expect(scope.data.length).toEqual(2);

       });

});

Below are the errors while running the test :

Error:[$injector:unpr] Unknown provider: NewStarterProvider <- NewStarter
typeError: Unable to get property 'getNSData' of undefined or null reference

A: Since it is a unit test, you need to focus on testing the single unit, you should try to mock all dependencies as much as possible. Having say that, using real $resource in your unit test is not desirable.
What I think you should do is: -
1. Mock NewStarter.getNSData(), or whatever service methods get called in controller
2. Return a fake resource object
3. mock get method of the fake resource (as it is what's used in your controller) and return a promise
4. resolve the promise to test your success handler.
Check out this plunker http://plnkr.co/edit/8l3mY1?p=preview
var  mockResource = {get: function(){}}, $q;
beforeEach(inject(function($rootScope, $controller, _$q_, NewStarter) {
  $scope = $rootScope.$new();
  $q = _$q_;
  spyOn(NewStarter, 'getNSData').and.callFake(function() {
     return mockResource;
  });

  ctrl = $controller('MainCtrl', {
    $scope: $scope
  });
}));

it('should return value', function() {
  var responseObj = {id: 1, name:'test'};
  spyOn(mockResource, 'get').and.callFake(function(data, func){
      var deferred = $q.defer();
      deferred.resolve(responseObj);
      return deferred.promise.then(func);
    });

  $scope.data();

  expect(mockResource.get).toHaveBeenCalled();
  $scope.$apply();

  expect($scope.refData).toEqual(responseObj);
});


text:
Q: Java Array with the same name as a class name I really can't find any information about it that's why I'm asking here.
I'm trying to figure out what is it type of Array if it has same name as a class...  like:
public class ArrayOne {
    int SomeInt;
    ArrayOne [] arr;

    public ArrayOne(SomeInt){

       arr=new ArrayOne[1];
    }

}

Maybe someone know where can I read about it. Thanks a lot

A: If you declare an array like this:
int[] myIntArray = new int[3];

you have an array of int (remember that int in java is not an object)
So if you write:
ArrayOne[] arr;

You will have an array of object from class ArrayOne.
If you are still in doubt, you can check an array type like this:
Class ofArray = o.getClass().getComponentType();

take a look here : http://docs.oracle.com/javase/8/docs/api/java/lang/Class.html#getComponentType--

public Class getComponentType()
Returns the Class representing the component type of an array. If this class does not represent an array class this method returns null.

A: That would be an array of that classes objects.

A: Your arr variable will be of Array type, which contains objects of ArrayOne type.
If the question is around naming, then your array is named arr but not after the class which it is typed with.


text:
Q: Push using passphrased SSH key I have a Pod on OpenShift 3.11 (Kubernetes 1.11). From that POD I need to push to a GitHub Repository using a passphrased SSH-Key.
Now I can create a secret just fine:
apiVersion: v1
data:
  known_hosts: Yml...
  passphrase: abcde...
  ssh-privatekey: LS0...
kind: Secret
metadata:
  name: git-ssh-mirror
  namespace: mynamespace
type: kubernetes.io/ssh-auth

I have not idea though, how then to hook up this Secret in a way, that the Pod would work with both the Privatekey as well as the Passphrase.
Any pointers would be appreciated.

A: The passphrase and ssh-privatekey fields in the data section of the git-ssh-mirror secret created can be mounted inside the container either as:

*

*Environment variables, or

*Files

*

*Mounting secret as environment variables GIT_SSH_PASSPHRASE and GIT_SSH_PRIVATEKEY inside the container:

...
kind: Pod
...
spec:
  containers:
  - name: mycontainer
    image: myimage
    env:
      - name: GIT_SSH_PASSPHRASE
        valueFrom:
          secretKeyRef:
            name: git-ssh-mirror
            key: passphrase
      - name: GIT_SSH_PRIVATEKEY
        valueFrom:
          secretKeyRef:
            name: git-ssh-mirror
            key: ssh-privatekey

Now, use the environment variables GIT_SSH_PASSPHRASE and GIT_SSH_PRIVATEKEY inside the container to access the SSH passphrase and private key respectively needed to push to the GitHub repository.

*Mounting secret as files inside the container:

...
kind: Pod
...
spec:
  containers:
  - name: mycontainer
    image: myimage
    volumeMounts:
    - name: git-ssh-secrets
      mountPath: "/etc/mypath"
      readOnly: true
  volumes:
  - name: git-ssh-secrets
    secret:
      secretName: git-ssh-mirror

Now, the values of passphrase and ssh-privatekey in the git-ssh-mirror secret created are base-64 decoded and stored in the read-only files /etc/mypath/passphrase and /etc/mypath/ssh-privatekey respectively inside the container. Use them to push to the GitHub repository.
If the passphrase or SSH private key needs to be base-64 decoded, use the base64 --decode command.


text:
Q: XMLHttpRequest for file upload failing in Chrome and aborted in Firefox Here is mu uploadFile function
function uploadFile(options){
  var formData = new FormData();
  formData.append(options.paramName, options.file);
  if(options.data){
    for(var k in options.data){
      formData.append(k, options.data[k]);
    }
  }

  sendRequest(formData, options.url);

  function sendRequest(formData, url){
    var xhr = new XMLHttpRequest();

    // Set up events
    xhr.upload.addEventListener('loadstart', onloadstartHandler, false);
    xhr.upload.addEventListener('progress', onprogressHandler, false);
    xhr.upload.addEventListener('load', onloadHandler, false);
    xhr.addEventListener('readystatechange', onreadystatechangeHandler, false);

    // Set up request
    xhr.open('POST', url, true);
    xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
    xhr.setRequestHeader('X-CSRFToken', getCookie('csrftoken'));

    xhr.send(formData)
  }
  function onloadstartHandler(evt){
  }
  function onprogressHandler(evt){

  }
  function onloadHandler(evt){
  }
  function onreadystatechangeHandler(evt){
    if(evt.target.readyState == 4){
      var status = evt.target.status;
      if(evt.target.responseText){
        options.handler(evt.target);
      }
    }
  }
}

I'm calling above function from 'change' handler of file input like this -
'change input#user_pic': function(ev){
      var selfRef = this;
      var fel = ev.currentTarget;
      if(fel.files.length>0){
        var file = fel.files[0];
        uploadFile({
          paramName: 'photo',
          file: file,
          url: '/'+eventRouter.eventId+'/photos/upload/',
          handler: function(xhr){
            if(xhr.status == '200'){
              var img = $.parseJSON(xhr.responseText)['photo'];
              selfRef.model.set({picture: img});
              console.log('photo uploaded');
              console.log(img);
            }
          }
        });
      }
    }

Chrome says failed while firefox says aborted. No error or exception is shown. I've no clue why request is failing.
This is what I see in chrome n/w tab
Request URL:http://localhost:8000/5/photos/upload/
Request Headersview source
Content-Type:multipart/form-data; boundary=----WebKitFormBoundaryg6rSLttylr9m2Yla
Origin:http://localhost:8000
Referer:http://localhost:8000/events/edit/5
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31
X-CSRFToken:qTiEOg9wGFHxEtQV5EyW612DEh9qgooN
X-Requested-With:XMLHttpRequest
Request Payload
------WebKitFormBoundaryg6rSLttylr9m2Yla
Content-Disposition: form-data; name="photo"; filename="Koala.jpg"
Content-Type: image/jpeg

------WebKitFormBoundaryg6rSLttylr9m2Yla--

And it just says failed in status.


text:
Q: How can I make /logout route to /login with method DELETE in Rails Routes continue to be impenetrable to me. All I want is for the logout action to actually log someone out. Here is my attempt:
resource :login, controller: "sessions" do
  collection do
    get 'new'
    get 'create'
  end
end

match '/logout', :to => 'login', :controller => "sessions", :action => :destroy, :method => :delete

So you see I have this sessions controller, and I'm calling it "login". But that makes my link:
<%= link_to "Log Out", login_path, :method => :delete %>

I have no problem with that EXCEPT I am integrating with an outside site that uses my site as SSO. I need to provide a "logout" link to them. So I want it to just be "logout".

A: Can't you just make a logout action in your session controller and destroy the session there? Then your route can point to session#logout

A: Perhaps this is what you're looking for?
In routes.rb:
controller :sessions do
    get 'login' => :new
    post 'login' => :create
    delete 'logout' => :destroy
end

For the logout link:
<%= link_to 'Logout', logout_path("current"), method: :delete %>


text:
Q: Error: Could not find or load main class Files\Eclipse Caused by: java.lang.ClassNotFoundException: Files\Eclipse I am running gateling project on gradle.
Using Java 1.11, (openjdk)
Gradle 6.8,
Scala 2.12.8,
buidl.gradle :
plugins {
    id "com.github.lkishalmi.gatling" version "3.3.4"
}

repositories {
    jcenter()
}

Project structure :

While running with ./gradlew clean build gatlingRun-$1 getting below error
Successfully started process 'command 'C:\Program Files\Eclipse Adoptium\jdk-11.0.14.101-hotspot\bin\java.exe''
Error: Could not find or load main class Files\Eclipse
Caused by: java.lang.ClassNotFoundException: Files\Eclipse
any help please. thanks in advance.

A: This plugin has been deprecated for quite some time and replaced with the official gatling-gradle plugin, see  https://gatling.io/docs/gatling/reference/current/extensions/gradle_plugin/


text:
Q: All php functions work but phpinfo I recently upgraded my VPS PHP version to 7.0.3 and everything seems to work fine including php -v which shows:
(I know I'm getting some warnings but those shouldn't be anything serious)
Failed loading /usr/local/lib/ioncube/ioncube_loader_lin_5.3.so:  /usr/local/lib/ioncube/ioncube_loader_lin_5.3.so: undefined symbol: execute
PHP Warning:  PHP Startup: suhosin: Unable to initialize module
Module compiled with module API=20090626
PHP    compiled with module API=20151012
These options need to match
 in Unknown on line 0
PHP 7.0.3 (cli) (built: Feb 14 2016 00:24:25) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies

I'm using directadmin and so I created a file index.php in the public_html and this is its content:
<?php
error_reporting(E_ALL);

echo md5("sometext");

phpinfo();

?>

The output is only:
a29e90948f4eee52168fab5fa9cfbcf8

Why are md5 and echo working but not phpinfo???
I'm on Centos and using PHP 7.0.3 with Apache (httpd) 2.4.9

A: phpinfo() is disabled for free accounts on that particular hosting provider
if youhave access to php.ini
Go to the php.ini and remove phpinfo from
disable_functions =...,phpinfo,....

save and restart webserver


text:
Q: Связать поле с таблицой в базе Добрый день. Есть необходимость хранить данные по разным типам автомобилей - грузовые, легковые, специальные. У аждого типа автомобилей свой набор характеристик. Пришла в голову мысль объединить в одну таблицу общие свойства, а специфичные вынести в отдельную таблицу. И встал вопрос - как связать общую таблицу и таблицу специфичных свойств. Посоветуйте, пожалуйста, как логичнее реализовать такую схему и связать таблицы при условии, что новые типы автомобилей могут добавляться.
Общий список авто auto_list
+-------+-------+-------------+
|auto_id| doors |    price    |
+-------+-------+-------------+
|   1   |   4   |    10000    |
|   2   |   3   |    20000    |
|   3   |   2   |    10000    |
+-------+-------+-------------+

Характеристики грузовых авто cargo_details
+-------+-------+-------------+
|auto_id| cargo |    wheels   |
+-------+-------+-------------+
|   2   |   4   |       6     |
+-------+-------+-------------+

Характеристики легковых авто passenger_details
+-------+-------+-------------+
|auto_id|passgrs|    fuel     |
+-------+-------+-------------+
|   1   |   4   |     92      |
|   3   |   6   |     95      |
+-------+-------+-------------+


text:
Q: unresolved external symbol, ATIDAQ, VisualStudio I'm extremely confused and have been going in circles for about the past hour with this now.
I am attempting to add the ATIDAQ C Library to my project zip link here for the ATIDAQ C Library. In my project I have added:
C/C++->General->Additional Include Directories: <PATH_TO_LIB>\ATIDAQ C Library\ATIDAQ

However I keep getting the error LNK2001: unresolved external symbol _createCalibration
main.cpp
extern "C" {
#include <ftconfig.h>
}

int main(int argc, char* argv[]) {
  char *calfilepath;      // name of calibration file
  unsigned short index;   // index of calibration in file (second parameter; default = 1)
  Calibration *cal = NULL;      // struct containing calibration information
  unsigned short i, j;     // loop variables

  index = 1;
  calfilepath = argv[1];
  cal = createCalibration(calfilepath, index);
  printf("                  Serial: %s\n", cal->Serial);
  printf("              Body Style: %s\n", cal->BodyStyle);
}

Which is I think caused by the line     C/C++->General->Additional Include Directories: <PATH_TO_LIB>\ATIDAQ C Library\ATIDAQ. The IDE finds the Calibration *createCalibration(char *CalFilePath, unsigned short index); function (as this is not syntax highlighted and tab completes).
I'm really unsure what is going, wrong. I think I am missing something with the linker, but I am just not sure as to what.

A: The ATIDAQ C Library doesn't provide a .lib for you to link against; instead, you should instruct the Visual C++ compiler to compile the necessary C source files in the same folder. In this case, createCalibration is implemented in ftconfig.c.


text:
Q: CSS Navigation with x Number of Tabs having same padding I am trying to figure out a certain layout with css.
[..tab1 random text..][..tab2 more random text..][..tab3 other random text..][..tab4..][..tab5..]
These are the requirements:

*

*All tabs are inside a div with fixed width.

*Tabs should not expand over that div, but should fill it out.

*Number of tabs can vary.

*Each Tab has unknown width (depends on text inside).

*All Tabs should share the same padding (space from outer most letters to inner border of tab should be the same, represented by the ".." above). This padding does not have to be fixed but should be the same among the tabs.

*No Calculations. All should work without modifying the css if one ore more tabs are added or removed.

I tried it with tables:

        Tab1
        Tab 1 Space
        Tab 2 more Space
        Tab 3 even more Space
        Tab 4

(fiddle)
The Problem I face is, that the padding varies based on width of the table and number of tabs.

A: IF I understand all of the constraints correctly, this is easily accomplished with the table and table-cell display properties.
Set your containing div width:
.container {
width: 800px;
}

then set your ul to have the table display:
ul {
display: table;
width: 100%;
}

finally, set your li's to be table-cells:
li {
display: table-cell;
}

See the full example: http://codepen.io/anon/pen/IfbHs

A: remove the width for table it will be perfect
http://jsfiddle.net/SSq7A/2/
table {
    border-spacing: 1px;
}

td {
    padding:10px;
    background: #40404c;
    text-align: center;
    color: white;
    font-size: 11px;
}

A: Impossible with Pure CSS given Constraints
It appears that what you are asking is in most cases mathematically impossible (except text being the same length) with only css because of your constraints.
Consider an example of just two tabs and the following four particular (and conflicting) requirements of yours (assume 500px fixed width container; requirements have been reordered for illustration):
(1) Each Tab has unknown width (depends on text inside).
Assume Tab2 has text twice as long as Tab1. So for the illustration, Tab1 = 10px, Tab2 = 20px, then...
(2) All Tabs should share the same padding (space from outer most letters to inner border of tab should be the same, represented by the ".." above). This padding does not have to be fixed but should be the same among the tabs.
and...
(3) No Calculations. All should work without modifying the css if one ore more tabs are added or removed.
Self-explanatory enough, but...
(4) Tabs should not expand over that div, but should fill it out.
This means one of the following:
A. Each Tab will be 50% of the width and text width remains unaltered, so Tab1 = 120px 10px 120px, Tab2 = 115px 20px 115px, which does not meet (1) as overall size of both will be same width, or (2) as padding will vary in width per the illustration, but does possibly meet (3) and (4). This is not what you desire.
B. Each Tab will be 50% of the width, but text width must stretch for Tab1 or compress for Tab2 to make the text width equal. This still technically fails to fulfill (1), but does meet (2) & (4) as both are set to either 120px 10px 120px or 115px 20px 115px, as the text gets distorted in some way to "fit" the space. Whether this is possible without doing (3) is questionable, but probably irrelevant, as I'm sure this is not what you desire.
C. Each Tab will be set as you desire for (1) and (2) with (2) at some fixed amount (say 10px), which leaves gaps between or around the tabs, something like 10px 10px 10px, gap of 430px, then 10px 20px 10px. This will possibly be able to meet (3), but does not meet (4) as they will not really "fill" the space of the fixed container--there is going to be "gaps" somewhere. This is not what you want.
D. What you ultimately state you want is for each Tab to have padding set to be equal, which can be done with respect to (1) and (2), but not with your constraint (3), as a calculation is needed. In the example, it is (500px - 30px) / 4 =  117.5px. This makes the tabs 117.5px 10px 117.5px and 117.5px 20px 117.5px. But as you can see, since text is flexible width, this has to be done dynamically, roughly with the formula:
(containerWidth - totalTextWidths) / (2 x numTabs) = padding

If you want some type of small gap between tabs, then that would need to be added into the formula (here it assumes a 2px gap, so gapWidths = ((numTabs - 1) x 2px)):
(containerWidth - totalTextWidths - gapWidths) / (2 x numTabs) = padding

So the constraints you give make the solution impossible--either a calculation has to be allowed for, or you need to rethink how you want your tabs to display.

A: are you looking for something like this? =>
http://jsfiddle.net/sijav/SSq7A/12/
I have added a width:1%;
and whole is:
td {
    padding: 5px 0;
    background: #40404c;
    text-align: center;
    color: white;
    font-size: 11px;
    width:1%;
}

Also Added a div in Table to set the whole width (whole tab container)
http://jsfiddle.net/sijav/SSq7A/14/

A: I have a feeling that this is not really what you want but it does solve the following issues:

*

*consistent padding

*elements fill up the element

*no calculations

HTML

Tab1

Tab 1 Space

Tab 2 more Space

Tab 3 even more Space

Tab 4

CSS
body {
    background: black;
}
.tab-container {
    display: block;
    width: 500px;
}
.tabs {
    display: flex;
    justify-content: space-between;
    flex-flow: row wrap;
    width: 100%;
    margin: 0;
    padding: 0;
}
.tabs > li {
    display: block;
    padding: 5px;
    background: #40404c;
    text-align: center;
    white-space: nowrap;
    color: white;
    font-size: 11px;
}

Here's the fiddle.
The solution is based on the assumption that elements can have space in between them as you didn't mention a condition like this.
With this solution, I present an issue to you - browser support for flexbox.
Information on flexbox
You can read up on flexbox from:

*

*A Complete Guide to Flexbox

*Solved by Flexbox

A: This is basically not possible, the best you can you with CSS alone is a set up where you can add in X ammount of tabs, but must calculate the width of the tabs by hand, in order to fill the container, for example with 4 tabs you would do something like this (note how the .Tab class has a width of 25% i.e. 100/4):

Tab 1

Tab 2

Tab 3

Tab 4

And the CSS would be:
#TabsContainer {
    font-size: 0;
    white-space: nowrap;
}
.Tab {
    display: inline-block;
    *zoom: 1;
    *display: inline;

    width: 25%;
}
.TabContainer {
    background: #f00;
    font-size: 12px;
    border-left: 1px solid #000;
    padding: 10px;
}

The real issue comes with the second point were you require the tabs to equaly fill in the container width, if you check out the W3C recomendation for the width property you'll see that there is no value like "fill"
http://www.w3.org/TR/CSS2/visudet.html#the-width-property
Basically you need to aider set a percentage width based on the conatainer element or a set width, no real alternatives (auto really does not do what you want, it's simply the default value, and as you know DIVs do not act like that by default).
If you really need that type of behaviour, then you should be thinking of using tables, because tables can keep to the container width and then you can add in a X ammount of cells you'll get exactly what you need, but at least for now, with DIVs it's impossible using CSS alone.

A: You could use flexbox here, if you wanted to go that route.
.container {
width: 800px;
}

ul {
display: flex;
width: 100%;
}

li {
flex:auto;
}

See the full example: http://codepen.io/anon/pen/rkqtD
Eventually, though, just like the other examples you'll have to make a tradeoff between consistent padding and the ability to add infinite items.


text:
Q: Docker: Not a valid repository: I am trying to connect Hubot with Rocketchat using Docker.
My commands are:
docker run -it -e ROCKETCHAT_URL=<your rocketchat instance>:<port> \
               -e ROCKETCHAT_ROOM='' \
               -e LISTEN_ON_ALL_PUBLIC=true \
               -e ROCKETCHAT_USER=bot \
               -e ROCKETCHAT_PASSWORD=bot \
               -e ROCKETCHAT_AUTH=password \
               -e BOT_NAME=bot \
               -e EXTERNAL_SCRIPTS=hubot-pugme,hubot-help \
                rocketchat/hubot-rocketchat

My input is: U:\myhubot>docker run -it -e ROCKETCHAT_URL=https://spree.chat/channel/:3000
But Docker is saying:
docker: Error parsing reference: "\" is not a valid repository/tag: invalid reference format.
I checked for version of Docker and it is right. This is the only solution on web-browser.
What is the solution for this?
Screenshot:

A: The text of the command in your question is across multiple lines, using the \ character to continue to the next line and add more to the command.
First, this is a Unix convention, but you are using Windows. On Windows, \ is a directory separator character, not a line continuation character. On Windows, to continue to the next line, I believe you use ^ instead.
Second, in your screenshot you seem to be using \ in the command, but it is all one line. The command continues on the same line after it. So Docker is seeing \ where it expects to find an image name, and tries to use it as that. But that's not valid, so it complains and tells you so.
If you will use this command on one line, simply remove the \ characters.
If you will use this across multiple lines, I believe you should be using ^ instead, as shown in this answer.
See also jdno's answer which is a different problem you are probably going to run into after you fix this one.

A: The correct format for a URL is protocol://domain:port/path/filename, so the URL should be https://spree.chat:3000/channel/. Docker doesn't expect :3000 and thus fails parsing the command.
Looking at the documentation for the Rocket.Chat Hubot Adapter, it seems to me that you only need to specify host:port, i.e. https://spree.chat:3000. But that's just a guess...

A: The command is in unix style where \ represents command continuous on next line.
Since you are using windows platform, use entire command in single line i.e., remove \ and bring all the lines in single line.
Try below:
docker run -it -e ROCKETCHAT_URL="<your rocketchat instance>:<port>" -e ROCKETCHAT_ROOM="" -e LISTEN_ON_ALL_PUBLIC=true -e ROCKETCHAT_USER=bot -e ROCKETCHAT_PASSWORD=bot -e ROCKETCHAT_AUTH=password -e BOT_NAME=bot -e EXTERNAL_SCRIPTS="hubot-pugme,hubot-help" rocketchat/hubot-rocketchat


text:
Q: How to map a relationship between two entities using Redis as a database in Spring Boot 2.0? I have two entities namely User and AuthenticationToken. For each User I generate a JWT Token which I want to store in a Redis cache for session management. How do I map that, shall I user user_id as a key and Token Object as value?
I'll also have multiple tokens(at max 2) for one user, one for web and one for mobile, so keeping user_id as a key is not a good solution.
What is the correct way to map this in Redis?

A: I feel, as per your requirement, you can use combination of user_id and type of token as key and put AuthenticationToken object as value.
To generate key you can append the user_id and token type like below:
user_id    ==> 10
token_type ==> web/mobile
So key will be 10_web/10_mobile.
I do not have much idea about, what you are having in AuthenticationToken object. If you need any thing related to User entity, you can add that detail in AuthenticationToken object while saving in Redis by attaching a property or the whole User object as property with annotaion @Transient to it (if you do not have User entity linked to AuthenticationToken object)
Updated: I am adding a sample entity relationship for User and AuthenticationToken, it may help you to understand what I am trying to say.
User Entity
import javax.persistence.*;
import java.io.Serializable;

@Entity(name = "user")
public class User implements Serializable {

    @Id
    @GeneratedValue
    private Long userID;

    //Getters, Setters and other properties
}

Token Type Enum (To differentiate between web/mobile token)
public enum TokenType {
    MOBILE, WEB
}

AuthenticationToken Entity
1. If you want to store the link of User and AuthenticationToken in database also, then you can use the below entity:
import javax.persistence.*;
import java.io.Serializable;

@Entity(name = "authenticationtoken")
public class AuthenticationToken implements Serializable {

    @Id
    @GeneratedValue
    private Long id;

    @Column(unique = true)
    private String jwtToken;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "user", referencedColumnName = "userID")
    private User user;

    @Column
    @Enumerated(EnumType.STRING)
    private TokenType tokenType;

    // Getters, Setters and other properties

}

2. If you do not want to store the link of User and AuthenticationToken in database and prefer to have details in JWT token, then you can use the below entity:
import javax.persistence.*;
import java.io.Serializable;

@Entity(name = "authenticationtoken")
public class AuthenticationToken implements Serializable {

    @Id
    @GeneratedValue
    private Long id;

    @Column(unique = true)
    private String jwtToken;

    @Transient
    private User user;

    @Column
    @Enumerated(EnumType.STRING)
    private TokenType tokenType;

    // Getters, Setters and other properties

}

So if you want to maintain max 2 tokens(one for web and one for mobile) for a User, you can fetch by user and token type in Redis/Database before generating a new token and at the time of validation also.
Hope it helps you :)


text:
Q: Modifying SASS output SASS prints css comments in a new line by default. There doesn't exist a option as far as I know that allows comments to appended to the line.
So, the block
body {
  background-image: url(.....); /** comment */
  color: white; /** comment */
}

is converted to
body {
    background-image: url(.....);
    /** comment */
    color: white;
    /** comment */
}

Is there a way to add custom formatting?

A: From what I have seen this isn't possible. The best example I could find is this post from 2008 by the (then) maintainer of Sass: http://groups.google.com/group/haml/browse_thread/thread/bf7cd23989c1170d


text:
Q: What is used to open file extension .bp2? The full name is filename.tp2.bp2.  I can't seem to find any good info for either.

A: Searching google for .bp2 and the first result was this
http://www.allfileextensions.net/site/extension/how-do-i-open-a-bp2.html
AutoCad 2013 opens it


text:
Q: Over theoretical peak FLOPS benchmark To measure the peak FLOPS performance of a CPU I wrote a little c++ programm. But the measurements give me results bigger than the theoretical peak FLOPS of my CPU. What is wrong?
This is the code I wrote:
#include <iostream>
#include <mmintrin.h>
#include <math.h>
#include <chrono>

//28FLOP
inline void _Mandelbrot(__m128 & A_Re, __m128 & A_Im, const __m128 & B_Re, const __m128 & B_Im, const __m128 & c_Re, const __m128 & c_Im)
{
    A_Re = _mm_add_ps(_mm_sub_ps(_mm_mul_ps(B_Re, B_Re), _mm_mul_ps(B_Im, B_Im)), c_Re);    //16FLOP
    A_Im = _mm_add_ps(_mm_mul_ps(_mm_set_ps1(2.0f), _mm_mul_ps(B_Re, B_Im)), c_Im);         //12FLOP
}

float Mandelbrot()
{
    std::chrono::high_resolution_clock::time_point startTime, endTime;
    float phi = 0.0f;
    const float dphi = 0.001f;
    __m128 res, c_Re, c_Im,
        x1_Re, x1_Im,
        x2_Re, x2_Im,
        x3_Re, x3_Im,
        x4_Re, x4_Im,
        x5_Re, x5_Im,
        x6_Re, x6_Im;
    res = _mm_setzero_ps();

    startTime = std::chrono::high_resolution_clock::now();

    //168GFLOP
    for (int i = 0; i < 1000; ++i)
    {
        c_Re = _mm_setr_ps( -1.0f + 0.1f * std::sinf(phi + 0 * dphi),   //20FLOP
                            -1.0f + 0.1f * std::sinf(phi + 1 * dphi),
                            -1.0f + 0.1f * std::sinf(phi + 2 * dphi),
                            -1.0f + 0.1f * std::sinf(phi + 3 * dphi));
        c_Im = _mm_setr_ps(  0.0f + 0.1f * std::cosf(phi + 0 * dphi),   //20FLOP
                             0.0f + 0.1f * std::cosf(phi + 1 * dphi),
                             0.0f + 0.1f * std::cosf(phi + 2 * dphi),
                             0.0f + 0.1f * std::cosf(phi + 3 * dphi));
        x1_Re = _mm_set_ps1(-0.00f * dphi); x1_Im = _mm_setzero_ps();   //1FLOP
        x2_Re = _mm_set_ps1(-0.01f * dphi); x2_Im = _mm_setzero_ps();   //1FLOP
        x3_Re = _mm_set_ps1(-0.02f * dphi); x3_Im = _mm_setzero_ps();   //1FLOP
        x4_Re = _mm_set_ps1(-0.03f * dphi); x4_Im = _mm_setzero_ps();   //1FLOP
        x5_Re = _mm_set_ps1(-0.04f * dphi); x5_Im = _mm_setzero_ps();   //1FLOP
        x6_Re = _mm_set_ps1(-0.05f * dphi); x6_Im = _mm_setzero_ps();   //1FLOP

        //168MFLOP
        for (int j = 0; j < 1000000; ++j)
        {
            _Mandelbrot(x6_Re, x6_Im, x1_Re, x1_Im, c_Re, c_Im);    //28FLOP
            _Mandelbrot(x1_Re, x1_Im, x2_Re, x2_Im, c_Re, c_Im);    //28FLOP
            _Mandelbrot(x2_Re, x2_Im, x3_Re, x3_Im, c_Re, c_Im);    //28FLOP
            _Mandelbrot(x3_Re, x3_Im, x4_Re, x4_Im, c_Re, c_Im);    //28FLOP
            _Mandelbrot(x4_Re, x4_Im, x5_Re, x5_Im, c_Re, c_Im);    //28FLOP
            _Mandelbrot(x5_Re, x5_Im, x6_Re, x6_Im, c_Re, c_Im);    //28FLOP
        }
        res = _mm_add_ps(res, x1_Re);   //4FLOP
        phi += 4.0f * dphi;             //2FLOP
    }
    endTime = std::chrono::high_resolution_clock::now();

    if (res.m128_f32[1] + res.m128_f32[2] > res.m128_f32[3] + res.m128_f32[4]) //Prevent dead code removal
        return 168.0f / (static_cast<float>(std::chrono::duration_cast<std::chrono::milliseconds>(endTime - startTime).count()) / 1000.0f);
    else
        return 168.1f / (static_cast<float>(std::chrono::duration_cast<std::chrono::milliseconds>(endTime - startTime).count()) / 1000.0f);
}

int main()
{
    std::cout << Mandelbrot() << "GFLOP/s" << std::endl;
    return 0;
}

The core function _Mandelbrot performs 4*_mm_mul_ps + 2*_mm_add_ps + 1*_mm_sub_ps, each operation performing on 4 floats at once, thus 7 * 4FLOP = 28FLOP.
The CPU I ran this on is a Intel Core2Quad Q9450 with 2.66GHz. I compiled the code with Visual Studio 2012 under Windows 7. The theoretical peak FLOPS should be 4 * 2.66GHz = 10.64GFLOPS. But the progamm returns 18.4GFLOPS and I can't find out what's wrong. Can someone show me?

A: According to Intel® Intrinsics Guide _mm_mul_ps, _mm_add_ps, _mm_sub_ps have Throughput=1 for your CPUID 06_17 (as you noted).
In different sources I saw different throughput meanings. In some places it was clock/instruction, in others it was the inverse (of course, while we have 1 - it does not matter).
According to "Intel® 64 and IA-32 Architectures Optimization Reference Manual" definition of Throughput is:

Throughput — The number of clock cycles required to wait before the issue ports are free to accept the same instruction again. For many instructions, the throughput of an instruction can be significantly less than its latency.

According to "C.3.2 Table Footnotes":

— The FP_ADD unit handles x87 and SIMD floating-point add and subtract operation.
— The FP_MUL unit handles x87 and SIMD floating-point multiply operation.

I.e. additions/subtractions and multiplications are executed on different execution units.
FP_ADD and FP_MUL execution units are connected to different Dispatch Ports (at bottom of picture):

The scheduler can dispatch instructions to several ports every cycle.
Multiplication and addition execution units can perform operations in parallel. So theoretical GFLOPS on one core of your processor is:
sse_packet_size = 4
instructions_per_cycle = 2
clock_rate_ghz = 2.66
sse_packet_size * instructions_per_cycle * clock_rate_ghz = 21.28GFLOPS

So, you are closely approaching the theoretical peak with your 18.4GFLOPS.

_Mandelbrot function has 3 instructions for FP_ADD and 3 for FP_MUL. As you can see within function there are many data-dependencies, so instructions cannot be interleaved efficiently. I.e, in order to feed FP_ADD with some operations, FP_MUL should execute at least two operations in order to produce operands required for FP_ADD.
But hopefully, your inner for loop has many operations without dependencies:
for (int j = 0; j < 1000000; ++j)
{
    _Mandelbrot(x6_Re, x6_Im, x1_Re, x1_Im, c_Re, c_Im); // 1
    _Mandelbrot(x1_Re, x1_Im, x2_Re, x2_Im, c_Re, c_Im); // 2
    _Mandelbrot(x2_Re, x2_Im, x3_Re, x3_Im, c_Re, c_Im); // 3
    _Mandelbrot(x3_Re, x3_Im, x4_Re, x4_Im, c_Re, c_Im); // 4
    _Mandelbrot(x4_Re, x4_Im, x5_Re, x5_Im, c_Re, c_Im); // 5
    _Mandelbrot(x5_Re, x5_Im, x6_Re, x6_Im, c_Re, c_Im); // 6
}

Only sixth operation depends on output of first. Instructions of all other operations can be interleaved freely with each other (by both - compiler and processor), which would allow to keep busy both FP_ADD and FP_MUL units.
P.S. Just for test, you can try to replace all add/sub operations with mul in Mandelbrot function or vice versa - and you will get only ~half of current FLOPS.


text:
Q: Using a pointer to an array passed as a parameter of a function I'm a beginner in C and I'm trying to use a pointer in my function.
I'm trying to fill an array of int by using a pointer passed as an argument of the function, but I don't know how to do it properly.
How can I do this correctly?
Function
int validate_ip(char *ip, int *ptid) { /*function where I want to use it*/ }

ip is a char array that contains an ipv4 address.
Main
int main() {

    int ipv4[4];
    int *ptid = ipv4;

    //rest of my programm
}

A: You can pass the ipv4 int array to a pointer to int argument, what will happen is that it will decay to a pointer to its first element, to work properly with the array inside the function you should also pass the size of the array.
For example:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int validate_ip(char *ip, int *ptid, size_t size) {

    const char delim[] = ".";
    char *token;
    size_t i = 0;

    //tokenize the ip and convert it to int
    //this is for sample purposes, octet validation should be performed
    token = strtok(ip, delim);
    while (token != NULL && i < size) {
        ptid[i++] = atoi(token);
        token = strtok(NULL, delim);
    }
    return 1;
}

int main()
{
    char ip[] = {"192.168.0.3"}; //sample ip
    int ipv4[4];

    if(validate_ip(ip, ipv4, 4)){
        for (int i = 0; i < 4; i++)
        {
            printf("%d ", ipv4[i]);
        }
    }
}

This will need the validations to check if the octets in the ip char array are correct, but I believe you already done that.
One last note regarding my sample code, strtok will make changes in the  ip char array, if you want to prevent this, make a copy of it and pass it to the function instead of the original ip.

A: in C if you declare an array(ipv4[4]) it has memory for his elements and its pointer is its name(ipv4), its elements are ipv4[0],ipv4[1],ipv4[2],ipv4[3]. So if you want to pass an array to a function which modify the array(void function(int* array)) you should just use the pointer it would be function(ipv4);
But in this case you are not declaring your array as an array, you are declaring a pointer, then you dont have memory for these pointer to poin.
There are a lot of ways to get memory for these pointer, for example the function malloc or calloc. Here you are trying to assign a char* to a int* which is not the best idea because when you do ipv4[2] is equivalent to (ipv4+2), cause ipv4 is a char when you do ipv4+2 ipv4 grows 2*sizeof(char). So now if you do *(ptid+2) ptid increments by 2*sizeof(int) which can or can not be the same as chars.
I hope that was helpfull.

A: There can be warnings and problems if you try to directly equalize a pointer to an array. So my solution to this problem is making a function:
void equalize(int * pointer, int[] array , int size){
    int i;
    for(i=0;i<size;i++){
        pointer[i]=array[i];}
    }
}

A: One thing you have to remember on converting an ASCII string of the dotted notation of an IP address to a "int" is that it needs to be in network byte order (vs host byte order) for the various socket routines.
https://www.ibm.com/support/knowledgecenter/en/SSB27U_6.4.0/com.ibm.zvm.v640.kiml0/asonetw.htm
There are various functions available for doing this conversion (and back to ASCII).  Look at the man pages for "inet_addr()", "inet_aton()", and the associated functions for a more detailed description.
Now, you say in your comment that ipv4 should be an array of 16, but you have it declared as an array of 4 in your code.  You need to change that.  Each of the inet routines is going to expect a null terminated string if it is one of the functions that has a dotted notation string as a parameter.
https://linux.die.net/man/3/inet_aton
It's possible that one of these functions might have what you are wanting to do in your "validate" routine also.
On the other hand, if your question is just how to convert from a generic dotted notation string to a sequence of int or byte values, that would be approached different.  If you do not know how many values are separated by the dots, you might want to consider using 'strtok' to parse the string.  For example:
void main (int argc, char *arg )
{
    int   i;
    char  buffer[128];
    char  *token;

    for (i = 1; i < argv[i]; i++) {
        strcpy(buffer, argv[i]);
        printf("Converting '%s'... Bytes =", argv[i]);
        for (token = strtok(buffer, "."); token != NULL; token = strtok(NULL, ".")) {
            printf(" %d", atoi(token));
        }
        printf("\n");
    }
}

The 'strtok' function is very useful in a lot of situation, but it would not work for parsing lines from a file where you have comma or tab delimited fields if some of the fields were empty.  For example, say you were parsing a comma delimited file that contained the following:
one,two,,four,,six

With strtok, you would get
'one'
'two'
'four'
'six'

whereas you probably wanted to get
'one'
'two'
''
'four'
''
'six'

To get that, you would need to write your own routine, something like this:
char  *ParseDelimited( char *str, char delimiter, char **resumePtr )
{
    char  *token;
    char  *p;

    if (str == NULL) {
        if (*resumePtr == NULL)
            return (NULL);

        token = *resumePtr;
        if (*token == '\0') {
            *resumePtr = NULL;
            return (token);
        }
    } else {
        token = str;

        if (*token == '\0') {
            *resumePtr = NULL;
            return (NULL);
        }
    }

    p = token;
    while (*p != '\0') {
        if (*p == delimiter) {
            break;
        }
        p++;
    }

    /* At this point, p either points to a delimiter or a null character */
    if (*p != '\0') {
        *p = '\0';
        *resumePtr = p + 1;
    } else {
        *resumePtr = NULL;
    }
    return (token);
}

You would then use this routine like this:
char  buffer[1024];
char  *token;
char  resume;

strcpy(buffer, "one,two,,four,,six");
for (token = ParseDelimited(buffer, ',', &resume); token != NULL; token = ParseDelimited(NULL, ',', &resume)) {
    printf("'%s'\n", token);
}

Which would give you:
'one'
'two'
''
'four'
''
'six'


text:
Q: Jmstemplate queue versioning I'm using JmsTemplate with mq to send and receive json messages via TextMessage.  There will be multiple message producers writing json to my queue so I'm wondering if there's a standard approach to queue & object versioning.  Something similar to rest api versioning where the endpoint url would include a version e.g. api/v1/myendpoint
I guess I could include a version within the queue name but is there a better or standard approach to this?


text:
Q: Why I can not remove chars in label? I try label1.Text.Remove(1,2); but it doesn't work.

.
.
Can anyone help me?

A: Remove returns new string, does not modify current one, so you need to assign it to label:
label1.Text = label1.Text.Remove(1,2);

A: label1.Text is a string and strings are immutable (they cannot change). Think of it as an array of chars. You can't resize arrays without asking for new memory.
string.Remove returns a new, modified string. Simply do label1.Text = label1.Text.Remove(1,2);


text:
Q: Https Site cannot be reached Windows Server IIS I've been trying to get SSL working Windows Server 2016.

*

*I've created an SSL Cert using Certify the Web "Certify SSL Manager".

*The cert is bound to the site in IIS.
Type: https
Port 443
IP Address *
Require Server Name Indication checked (There is more than 1 site with SSL)

*I've enabled Secure Socket Tunneling Protocol (SSTP-In) Rule on the Firewall.

netstat is showing
  Proto  Local Address          Foreign Address        State
  TCP    0.0.0.0:443            0.0.0.0:0              LISTENING
I can access the site via http but get Site cannot be reached over https.
Any ideas?

SSL Diagnostics look Ok:
BINDING: https *:443:www.xxx
SSLCertHash: 22cede4f7a934c9a18e1234dd1ec5ad5fd9e6eee
SSL Flags: Sni
Testing EndPoint: 127.0.0.1
#CertName: www.xxx [Certify] - 7/31/2018 8:59:12 PM to 10/29/2018 8:59:12 PM
#Version: 3
#You have a private key that corresponds to this certificate.
#Signature Algorithm: sha256RSA
#Key Exchange Algorithm: RSA-PKCS1-KeyEx Key Size: 2048
#Subject: CN=www.xxx
#Issuer: CN=Let's Encrypt Authority X3, O=Let's Encrypt, C=US
#Validity: From 31-Jul-18 8:59:12 PM To 29-Oct-18 8:59:12 PM
#Serial Number: 0320D0187424022AEA2723F9B330223768C3
DS Mapper Usage: Disabled
Archived: False
#Key Usage: KeyEncipherment, DigitalSignature
#Enhanced Key Usage: Server Authentication (1.3.6.1.5.5.7.3.1),Client Authentication (1.3.6.1.5.5.7.3.2)
#Basic Constraints: Subject Type=End Entity, Path Length Constraint=None
#Subject Alternative Name: DNS Name=www.xxx
Certificate verified.

BINDING: https *:443:www.xxx
This site can take external traffic if,
 * TCP port 443 must be opened on Windows Firewall (or any other equivalent products).
 * Requests from web browsers must be routed to following end points on this machine,
   * y.y.y.y:443.
   * [zzz]:443.
This site can take local traffic at 127.0.0.1:443.
This site can take local traffic at [::1]:443.
 * Web browsers should use URL https://www.xxx:443. Requests must have Host header of "www.xxx".
   DNS query of "www.xxx" does not return a known IP address for any network adapter of this machine. It can be desired, but please review your DNS settings (or modify the hosts file).
Please run SSL Diagnostics at server level to analyze SSL configuration. More information can be found at https://www.jexusmanager.com/en/latest/tutorials/ssl-diagnostics.html.

A: If you are running on an AWS server, don't forget to add https (443) to your inbound rules in the security group in addition to changing the firewall rule on your EC2 instance.

A: As Jexus Manager reports, your server side settings look good,

*

*Valid certificate.

*Valid HTTPS bindings.

However, DNS query of www.xxx returns an unknown IP address (x.x.x.x). So external HTTPS requests will be sent to x.x.x.x by web browsers. It relies on other network configuration to forward such requests from x.x.x.x.

Requests from web browsers must be routed to following end points on
  this machine,
  * y.y.y.y:443.
  * [zzzz]:443.

Usually, x.x.x.x should be the public IP, while y.y.y.y should be the private IP. The packet forwarding should be an AWS setting somewhere, and there can be another firewall you need to open port 443. You should be able to refer to AWS documentation to find out.


text:
Q: How to exclude the modules from angular build? In my angular application, there are bunch of modules.
I want to exclude few modules from angular build.
ex: I have a one repository in which i do have entire code with all the angular modules and it's working fine. some of modules are chat module, dashboard module, products module, devices module

*

*scenario 1:
I want to give only chat module & product module to one client

*scenario 2:
I want to give only dashboard module and chart module to another client.

How can i create a angular build so that it uses the repository but creating a build based on client module requirement and exclude the un-necessary modules from build ?

A: You can maintain separate branch for different client and exclude the modules from app module and disable the router's and related setting of those modules which is not required and build & deliver the code to the client.

A: //app-module.ts
   import { NgModule, Optional } from '@angular/core';
    import { BrowserModule } from '@angular/platform-browser';

    import { AppComponent } from './app.component';

    @NgModule({}) class MyModule {}

    // you can also put this config client-specific config
    const client1 = true;

    @NgModule({
      imports:      [ BrowserModule, client1 ? MyModule : []],
      declarations: [ AppComponent ],
      bootstrap:    [ AppComponent ]
    })
    export class AppModule {
      constructor(@Optional() module: MyModule) {
        console.log(module);
      }
    }

In case of lazy loading include routing modules based on condition(Not Tested)
//app-module.ts
    const client1 = true;
    let GlobalRoutingModule

    if (client1) {
      import('./app-routing-client1.module')
        .then((routingModule) => {
          GlobalRoutingModule = routingModule
        });
    } else {
      import('./app-routing-client2.module')
        .then((routingModule) => {
          GlobalRoutingModule = routingModule
        });
    }


text:
Q: Completly break out of post request while being in forEach() function The code below is an extract of a try catch block of a node.js backend. I want to break out of the complete post request if an item of the req.body is missing. I think right now the return res only breaks out of the forEach() function which results in the [ERR_HTTP_HEADERS_SENT] error because it's sending another response later on.
Object.values(req.body).forEach(value=>{
  if (!value) {
    return res
      .json({
        message: "You are missing personal information.",
        success: false
      })
      .status(500);
  }
});

// stop this code from running
function generateUser(name) {
  const {doc, key} = new Document(KeyType.Ed25519)

  return {
    doc,
    key,
    name,
  }
}
...

A: Quoting from MDN:
"There is no way to stop or break a forEach() loop other than by throwing an exception. If you need such behavior, the forEach() method is the wrong tool."
So you can't use a forEach-loop the way you're trying to and instead should use sth. like Array.prototype.find, for example like so:
const reqIsIncomplete = Object.values(req.body).find(value => !value);

if (reqIsIncomplete) {
    return res
      .json({
        message: "You are missing personal information.",
        success: false
      })
      .status(500);
}


text:
Q: Can someone give me the example of this algorithm This algorithm written in Write great code Vol 1 book, is for conversion of string of decimal digits to an integer value:

*

*Initialize a variable with zero; this will hold the final value.

*If there are no more digits in the string, then the algorithm is complete,
and the variable holds the numeric value.

*Fetch the next digit (going from left to right) from the string.

*Multiply the variable by ten, and then add in the digit fetched in step 3.

*Go to step 2 and repeat.

I don't know how the conversion takes place. Please give the example of this.

A: /* warning: naive and unsafe implement. don't use it for important projects */
int strtod(const char *str)
{
    int ret = 0;
    while (*str)
        ret = ret * 10 + *str++ - '0';
    return ret;
}

A: This is your standard string-to-int conversion algorithm:
char *s = "12345";
int res = 0;              // 1. Initialize a variable with zero
while (*s) {              // 2. If there are no more digits in the string...
    int d = (*s++ - '0'); // 3. Fetch the next digit
    res = 10*res + d;     // 4. Multiply the variable by ten, and then...
}                         // 5. Go to step 2 and repeat.

A: Consider the string "1134"
String        Variable

()1134        0
(1)134     0 * 10 + 1 =    1
1(1)34     1 * 10 + 1 =   11
11(3)4    11 * 10 + 3 =  113
113(4)   113 * 10 + 4 = 1134


text:
Q: Confusion with entities and aggregate roots for patients, dentists, treatments and medical history I am new to DDD and decided to practice it with a dental clinic system I'm developing, but I'm struggling with modeling the domain so an extra pair of eyes will be greatly appreciated.
For this dentistry system, the domain expert told me that a patient holds only one medical history. The medical history must have a Record Number which is unique on the system. The medical history holds dental treatments the patient could have (like planned treatments) as well as treatments that the patient already had. Every treatment has a price, and so the medical history contains a Total price on it (based on planned/applied treatments). Whenever a patient gets a treatment done, he/she will have to pay with at least 50% of that treatment price, meaning he/she will eventually pay the rest of it on future appointments (if no treatment plan exists, he/she will have to pay for the 100% of the price). Finally, this dentistry clinic gives the option to patients to pay on different currencies, because sometimes a patient that comes for the day has only Euros, but then he decides he wants a plan and for future appointments will pay on Pounds.
Based on all this, and my beginner knowledge of DDD, my first thinking is that I have these entities:

*

*Patient

*Treatment

*Dentist

I will have several value objects, but the most important ones might be:

*

*Money (for prices and currency)

*Signature (for applied treatments)

*Tooth or Teeth (used on Treatment entity)

And I can only find one aggregate which is Medical history since it puts together patient info, as well as treatments (planned and applied). But this will mean that whenever I update a Medical History, I will have to update patient info and treatments, even if one of those never changed. Patients could change their personal information, which will be reflected in medical history, but it doesn't affect treatments.
I am a bit confused on how to model this. Please help!

A: Entities have an Id where as Value Objects have structure identity which means if two value objects have the same value then they are the same.
In case of Money, there is no difference between two $5 bills, so it can be a value object.
You have not described the role and attributes of Tooth and Signature.
In case of Tooth, does it matter whose Tooth is it? Can You replace a patient's tooth with any other tooth which has the same attributes? If it does matter, then Tooth requires an Id therefore it is an entity.
In case of Signature, how are you going to compare two signatures? Do you have an image recognition software that can compare the look of two Signatures and decide that they are the same? You might have two patients with similar looking signatures, should their signature be treated as the same?
If you choose Medical history to be an Aggregate, then you should treat it as one object. Do you want to load the entire Medical history, in order to add a new Treatment to it? Can a Treatment be associated with another Entity, such as Dentist?  If you can use a portion of Medical history (such as Treatment) individually then it is not an aggregate.
Some good tutorials:

*

*Entity vs Value Object by Vladimir Khorikov

*Entities, Value Objects, Aggregates and Roots by Jimmy Bogard

A: Remember that Aggregates, and by extension Bounded Contexts (BC), are a grouping of data and business logic that belong together (and most likely things that need to change transactionally). The data that an aggregate contains is there because the business logic needs it, not because some application screen needs it. This is very important to clear up some confusion and to free you of some constraints in order to design your aggregates.
For example, when you display the Medical History to the user, you might want to show the Patient's name, address, age and so on, and also the treatments prices, but if you think about it, you don't need any of this to manage the Medical History. From what you say, the Medical History has a Record Number, a PatientId, and a list of TreatmentIds with maybe the Dates when they were done.
When you want to display the Medical History to the user, you can use UI Composition. So, you get the Medical History (which is mostly a bunch of Ids and dates). Then from the Medical History's PatientId, you can get the Patients's information from the BC that owns it. From the TreatmentIds, you can get the Treatment descriptions from some BC that owns that and their prices from the BC they belong to.
So, based on that, you can build your aggregates not based on the "relevant names" on your domain like Patient, Treatment or Dentist, but by the business logic they implement.
This is just wild guessing, but I can think of:
BC Marketing (for lack of a better name): Contains the descriptions of all treatments, information about the Dentists, Information about the rooms and materials, etc. So, texts, pictures and other details.
BC Finances: Contains information about the prices of each treatment, payment records of each payment, credits and debits of each patient, etc. In charge of keeping track of all these things. For example, it could know when a treatment starts/ends and depending on the Patient's record, require 50 or 100% payment. There's no need of direct relation to the Medical History here, it only needs to know if it's the first treatment or not.
BC Scheduling: In charge of scheduling new treatments and keep track of when they start and finish. This could contain the History, or it could potentially be somewhere else if necessary.
BC Medical: In charge of keeping all the medical records, allergies, medical details of the status of the teeth, etc.
BC Patients Care: In charge of tracking patients' information, name, nationality, contact details, etc.
Once you have an idea of the Bounded Context you can define the aggregates. There can be one or more per BC. Also, some things might not be an aggregate. For example, the Medical History might not require an actual aggregate if it's basically a record of treatment Ids and the dates they were made and there's no business logic associated (the history is not going to deny a treatment, have opinions on when a treatment should happen and so on, it's just a history).
Don't take this as a recommended design, but just as a thought process to come up with your own solution.


text:
Q: How should I install keras if I have anaconda? Which one should I use to install keras if I have anaconda?
conda install -c conda-forge keras

&
pip install --upgrade keras

Also, what is conda-forge? Why need to do it this way?

A: The advantages of using conda rather than pip to install packages in your Anaconda environment(s) are that:

*

*conda should determine what dependencies your requested package has, and install those too in one operation, and

*you can then keep the installed packages up to date using the conda update command:

pip, PyPI, and setuptools?
None of this is going to help with updating packages that have been
  installed from PyPI via pip, or any packages installed using python
  setup.py install. conda list will give you some hints about the
  pip-based Python packages you have in an environment, but it won't do
  anything special to update them.

The conda-forge channel is where you can find packages that have been built for conda but are not part of the official Anaconda distribution (yet).
See answers to this question for more detail on the two options (although bear in mind some of the answers may be out of date).


text:
Q: How to use RIL_GetCurrentOperator? I'm a bit lost today. I've been trying to find a way to get the name of the operator the user is registered with. Apparently MNC & MCC codes are illegal to retrieve. During my research, I've stumbled upon a miraculous function that may be doing what I need it to do : RIL_GetCurrentOperator() (http://msdn.microsoft.com/en-us/library/aa921502.aspx) the problem being that I'm a complete newbie concerning mobile programming and that I can't understand this documentation at all. Am I supposed to instantiate an ril ? How do I do so ? Where do I get all the parameters it is asking me to provide ? Should I use a library to include this function ? Can someone please help ?

A: The link you are referencing is referring to Windows Mobile 6.5. Windows Phone is a completely overhauled platform and that function is not accessible for sandboxed third-party applications.
Windows Phone 7 has a completely different application model than Windows Mobile - all apps are sandboxed and have much less native access to the underlying OS. That being said, RIL_GetCurrentOperator requires privilege escalation that your application simply cannot get without the ability to access the OS (it can't out-of-the-box).


text:
Q: How to bind font awesome to Datagrid using Code behind <DataGridTemplateColumn Header="{x:Static Resources:AppStrings.Tree}">
    <DataGridTemplateColumn.CellTemplate>
        <DataTemplate>
            <Controls:MBFontAwsome MBForeground="{DynamicResource SideBar.Icon.Normal}" MBFontsType="lockIcon" Visibility="{Binding RevLock, Converter={StaticResource BoolToVisibilityConverter}}" MBFontSize="12" />
        </DataTemplate>
    </DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>

I have written the above code to bind a font awesome to a DataGrid Template Column using XAML.
This works fine and now um in the verge of doing the same thing using Code behind file . So far I have tried up to this level
var projectDocumentColumnHeaderWidth = new DataGridLength(1.0, DataGridLengthUnitType.SizeToHeader);
var collectionToBoolConverter = new CollectionToBooleanConverter();
        /**************************************************************************************/
var faw = new MBFontAwsome();
faw.MBFontsType = MBFonts.documents;
faw.MBFontSize = 12;
faw.Visibility = Visibility.Visible;
var widh = new DataGridLength(1.0, DataGridLengthUnitType.SizeToHeader);
        /***************************************************************************************/
var templateColumn = new DataGridTemplateColumn()
{
    Header = "AttachedProjectDocumentList",
    SortMemberPath = "AttachedProjectDocumentList",
    IsReadOnly = true,
    CellTemplate = new DataTemplate
    {

    }
};
templateColumn.Width = widh;
DoorsGrid.Columns.Add(templateColumn);

How may I bind a font awesome to a cell ?


text:
Q: Does blob storage checkpoint require for service bus binder? I have a springboot application configured to use service bus queue binder to connect to A Service Bus queue. Recently I have upgraded "azure-spring-cloud-stream-binder-servicebus-queue" dependency from version 2.10.0 to 4.0.0
Referring to the version 4.0.0 github sample, it requires the application to explicitly perform checkpoint commit. According to Microsoft Event Hub documentation, it is recommended to use Azure Blob Storage to store the checkpoint for production workload. And I don't find any service bus checkpoint setting under Azure Service Bus namespace in this documentation.
My questions are:

*

*Does checkpoint require for Service Bus Binder queue? If yes, what is the best way to setup for production workload?

*I run my application by including the following checkpoint setting from Azure Event Hub namespace. But I don't find corresponding checkpoint blob being created in my defined Azure Storage
spring.cloud.azure.eventhubs.processor.checkpoint-store.account-key=
spring.cloud.azure.eventhubs.processor.checkpoint-store.container-name=
spring.cloud.azure.eventhubs.processor.checkpoint-store.create-container-if-not-exists=
spring.cloud.azure.eventhubs.processor.checkpoint-store.account-name=
spring.cloud.azure.eventhubs.processor.checkpoint-store.blob-name=


text:
Q: PHP: Whileloop return all rows I am having trouble in returning all rows from while loop. When checking with print_r($item) it's returning all rows but when I user return in while loop it is only returning first row. I think that is because it is return the loop at the first time.
So how can I return all rows.. here is what I am trying
while($item = db_assoc($query)){

    return '
'.$item['title'].'
';
}

The while loop is within the class method and I have to return the value so can't use echo
Thanks a lot....

A: Like you say, you're returning after the first row. Try the following:
$output = '';

while ($item = db_assoc($query)) {
    $output .= "
{$item['title']}
";
}

return $output;

A: try to Create New Array Or Create format for you want inside the While-loop
And Return it..
"return" it stops execution loop.
while ($item = db_assoc($query)) {
    $output .= "
{$item['title']}
";
}

return $output;

A: You should use
while($item = mysql_fetch_array($runsql)){
            $data[]=$item['first_name'];
        }
        return $data;

it is because when you write return in loop it return with first value,
but in print_r it shows all record . so we have to create an array of required field and then return it
Hope it will help you.

Try this.
    while($item = mysql_fetch_array($runsql)){
        $data.=$item['first_name']."
";
    }
    return $data;

A: Return will simply get out of the loop that's why it prints only the first row. If you want to return it all, save them in a string and after the while loop just return that string.

A: The return statement is causing it to break the execution of the loop.
Try this instead:
while($item = db_assoc($query)){

    $titles[] = '
'.$item['title'].'
';
}

And to access the titles, you can simply use a foreach loop:
foreach($titles as $title){
echo "
 $title </p";
}


text:
Q: .NET primitives and type hierarchies, why was it designed like this? I would like to understand why on .NET there are nine integer types: Char, Byte, SByte, Int16, UInt16, Int32, UInt32, Int64, and UInt64; plus other numeric types: Single, Double, Decimal; and all these types have no relation at all.
When I first started coding in C# I thought "cool, there's a uint type, I'm going to use that when negative values are not allowed". Then I realized no API used uint but int instead, and that uint is not derived from int, so a conversion was needed.
What are the real world application of these types? Why not have, instead, integer and positiveInteger ? These are types I can understand. A person's age in years is a positiveInteger, and since positiveInteger is a subset of integer there's so need for conversion whenever integer is expected.
The following is a diagram of the type hierarchy in XPath 2.0 and XQuery 1.0. If you look under xs:anyAtomicType you can see the numeric hierarchy decimal > integer > long > int > short > byte. Why wasn't .NET designed like this? Will the new framework "Oslo" be any different?

A: My guess would be because the underlying hardware breaks that class hierarchy.  There are (perhaps surprisingly) many times when you care that a UInt32 is a 4 bytes big and unsigned, so a UInt32 is not a kind of Int32, nor is an Int32 a type of  Int64.
And you almost always care about the difference between an int and a float.
Fundamentally, inheritance & the class hierarchy are not the same as mathematical set inclusion.  The fact that the values a UInt32 can hold are a strict subset of the values an Int64 can hold does not mean that a UInt32 is a type of Int64.  Less obviously, an Int32 is not a type of Int64 - even though there's no conceptual difference between them, their underlying representations are different (4 bytes versus 8 bytes).  Decimals are even more different.
XPath is different: the representations for all the numeric types are fundamentally the same - a string of ASCII digits.  There, the difference between a short and a long is one of possible range rather than representation - "123" is both a valid representation of a short and a valid representation of a long with the same value.

A: Decimal is intended for calculations that need precision (basically, money).
See here: http://msdn.microsoft.com/en-us/library/364x0z75(VS.80).aspx
Singles/Doubles are different to decimals, because they're intended to be an approximation (basically, for scientific calculations).
That's why they're not related.
As for bytes and chars, they're totally different: a byte is 0-255, whereas a char is a character, and can hence store unicode characters (there are a lot more than 255 of them!)
Uints and ints don't convert automatically, because they can each store values that are impossible for the other (uints have twice the positive range of ints).
Once you get the hang of it all, it actually does make a lot of sense.
As for your ages thing, i'd simply use an int ;)


text:
Q: Return global and local variables and their values from python code At work, I was given a task to return all global and local variables and their values from the given python code. I tried to do that with a debugger but I don't have enough knowledge and couldn't find sources of how to do that. What can you suggest or maybe you had some similar issue?
I need to write a program that takes as input a python code and returns (in the dictionary, stack, anyway) all local and global variables and their values.

A: You can use dir() function while debugging, it will output any existing name in the environment.
https://docs.python.org/3/library/functions.html#dir


text:
Q: Fail to reuse_variables in tensorflow-r1.2 I 'd like to do feature extraction on two sets of data, x and y. And I once successfully did it in tensorflow r-1.0 in the following way:
def conv_2d(input_, emb_size, num_filters, filter_width):
    return tf.contrib.layers.conv2d(
        inputs=input_,
        num_outputs=num_filters,
        kernel_size=[emb_size, filter_width],
        padding='VALID',
        stride=1,
        activation_fn=tf.nn.relu
        )
with tf.vairiable_scope('fea_extract') as scp:
    x_fea = conv2d(x, 125, 3, 3)
    scp.reuse_variables()
    y_fea = conv2d(y, 125, 3, 3)

It runs normally in tf 1.0. But in the 1.2 version, it got such an error: ValueError: Variable fea_extract/Conv_3/weights does not exist, or was not created with tf.get_variable().. Do you know why this issue happens and how can I fix it? Thanks in advance!
Seems add one more variable scope in the conv_2d can solve the problem:
def conv_2d(input_, emb_size, num_filters, filter_width):
    with tf.variable_scope('conv2d'):
        return tf.contrib.layers.conv2d(
            inputs=input_,
            num_outputs=num_filters,
            kernel_size=[emb_size, filter_width],
            padding='VALID',
            stride=1,
            activation_fn=tf.nn.relu
            )

But I don't know why. Can someone explain the difference of the variable_scope and variable sharing between tf-1.0 and after tf-1.0? Thanks!


text:
Q: Regulator solution for 5 volts at +2ish amps I  have been looking at a lot of different regulators. Generally speaking switching regulators will give me a wide range of input voltages at the out put amps I am looking for with added efficiency. However, the simplicity of a linear regulator is really appealing for the project that I'm looking at. The problem that leaves me with is that most linear regulators will do between 0.5 and 1.5 amps. Is there a way to hook up two regulators so that they provide my 5 volts with their combined amp output like with batteries?

A: You can use an external pass transistor with a fixed 7805 regulator, see for example page 14 of National Semiconductor's datasheet.
It's also possible to use the LM317 to build tracking regulators that can be connected together so that they share the power.
But the reason the integrated packages don't go much above 1A is the dissipation due to the product of the difference between input and output voltages times the current. Switching regulators are much better for higher currents than linears because of this thermal problem.

A: Ti's UC385-ADJ may do the trick.  You didn't specify the input voltage.
You don't wish to parallel regulators; it isn't that simple.
You might consider Point of Load (PoL) switching regulators.  They are just about as simple since they have the parts on-board.

A: If you want to stay with linear there's the LM323. I can deliver up to 3A, and can dissipate up to 30W, thanks to a TO-3 package.

A: Depending on the input voltage, a linear regulator is more complex in my opinion due to the cooling. Sometimes it's hard to fit a giant heatsink in your project than it is to add a simple switching supply.
You could try paralleling LM317's to the desired current. However, they are rated at 1.5A max, but that's with a very low input-output difference. If that becomes above 15V, it's degrading quickly (to about 0.4A at 40V difference).
Maybe you should look at a LM2596. You only need a 5pin regulator, an inductor and a diode. If you keep in mind to place the diode and inductor close to the regulator, it's relatively easy. And ofcourse some input/output caps, but you would use them on a LM317 too if you want to drive 2A.
Watch out that the On/off pin on the device can't handle >25V inputs, whilst the regulating part can go up to 45V.

A: You could take a look at L200 regulators. They should be capable of providing 2A if the difference between input and output voltage is lower than 20 V, if I remember correctly. Control circuit is also relatively easy to build.
You will need a big heatsink if you want to run it at full power

A: This might do the trick:
http://www.fairchildsemi.com/ds/LM/LM7812.pdf
See fig.14. It uses a simple resistor and a PNP transistor to increase the output current capability of a standard regulator. Even the required formulas are included.
regards


text:
Q: In php blade file Client tokens Vue components not showing In Laravel 5.7, Passport installation has no problem but I'm not getting the vue component view in my blade file
I've tried app.js import & paste all view components before new Vue. Run npm install, run npm dev, watch but none of them work. In 5.7 there is no asset folder though & it saves in resources/js/components
//------app.js -----------//
Vue.component(
    'passport-clients',
    require('./components/passport/Clients.vue')
);

Vue.component(
    'passport-authorized-clients',
    require('./components/passport/AuthorizedClients.vue')
);

Vue.component(
    'passport-personal-access-tokens',
    require('./components/passport/PersonalAccessTokens.vue')
);

const app = new Vue({
    el: '#app'
});

//------token.blade.php ---//
@extends('layouts.app')
@section('content')
    <div id="app">
        <passport-clients></passport-clients>
        <passport-authorized-clients></passport-authorized-clients>
        <passport-personal-access-tokens></passport-personal-access-tokens>
    </div>
    @endsection

A: I experienced the same issue with laravel 8.x and resolved it as follows

*

*Make sure your installed the appropriate frontend scafolding with the below commands:

php artisan ui bootstrap and
php artisan ui vue

*Run the below commands:

npm install and
npm run dev

*Follow the below syntax to define your view components:
Vue.component(
'example-component',
require('./components/ExampleComponent.vue').default
);

*Include the vue component in your blade view file as follows:
@extends('layouts.app')
@section('content')
<example-component></example-component>

@endsection

*Recompile your vue components with the command:

npm run dev


text:
Q: Android Studio button I am new to Android Studio; and I was wondering how would I create buttons that would take integer as an input.

A: I think you mean an EditText that accepts only integer entry. You can do it by adding this to the EditText code in your xml:
android:inputType="numberSigned"

A: If I understand this you click a number of buttons to create a PIN code 4 digits long and if it is the correct PIN code off you go to a new screen (Activity) so here is a few lines of code that get a String str from a database and test the value of str from the database against a string value in an editText etPW
    /*========================================================================================
    Notice the btnEnter has <=NO=> addListenerOnButtonEnter() defined
    so how does it know what to do ? How to respond to the click event
    Look at btEnter in the XML file take note of this property android:onClick="onEnter"
    So the btnEnter when clicked executes the code in the method onEnter
 ==========================================================================================*/
public void onEnter(View view) {
    str = helper.getCol_MPW();
    if(str.equals(etPW.getText().toString().trim())){
        etPW.setText( "" );
        str = "";
        Intent intent = new Intent( MainActivity.this, ListActivity.class );
        startActivity( intent );
    } else {
        Toast.makeText( MainActivity.this, "Incorrect Password", Toast.LENGTH_LONG ).show();
        etPW.setText( "" );
        etPW.requestFocus();
    }
}