text:
Q: how to force Eclipse CDT to add -stdc++11 flag on every project I have a problem in that Eclipse with C++ support doesn't use C++11 (or 14) with the default project settings, I have to go to:
Project Settings > C/C++ Build > Settings > GCC C++ Compiler > Dialect > Language standard > ISO C++11
Is there any way to change the default project so that it ALWAYS adds the -stdc++11 flag be default? I always make a project with Hello World C++ Project and use MinGW GCC.
I've read some previous questions talking about a makefile something, but no step-by-step guide.
Versions:
Windows 10
Eclipse Luna 20150109-0600
MinGW with C++11 support 100% (maybe even C++14) 4.8.1

A: The CDT-based Cevelop C++ IDE provides what you need. It's essentially CDT Mars with many plugins that help you write better C++11/14 code.
It features a Plug-in called "Elevenator", which automatically configures projects to use C++11.
You can find the Elevenator documentation Here
If you don't want to use cevelop, you can also install Elevenator manually from this updatesite: http://www.cute-test.com/updatesite/mars
It is located in the category CUTE optional features.


text:
Q: Windows 8, Python 2.7 and lxml in a virtualenv I'm using python 2.7.3  It is the prepackaged version that comes with ArcGIS.  In order to contaminate my ArcGIS Python I'm trying to set up a virtual environment to use for non ArcGIS development.  This worked well and there's an excellent tutorial here:
http://www.tylerbutler.com/2012/05/how-to-install-python-pip-and-virtualenv-on-windows-with-powershell/
on setting up virtualenv using powershell.
A specific library I do want to install in the virtual environment is lxml and trying to use pip to install it in my virtual environment throws the error:
unable to find vcvarsall.bat
I realise this is a pretty common error but I have the added complexity of using the ArcGIS packaged version of Python.  So far of the available fixes aare working as they are either for Windows 7, or Windows 8 but Python 3.3.
So far I've installed MS Visual C++ 2008 but windows couldn't find the vcvarsall.bat in multiple searches.  I've also tried downloading libxml2 but am unsure where to place it to avoid conflict with ArcGIS and is what I'm trying to do even possible with the ArcGIS distributed version of Python?

A: Okay I worked it out.  It remains to be seen what happens regarding ArcGIS but so far it's coping.
First up I removed the reference in windows Environments> Paths to the C:\Python27\ArcGIS10.x
I then downloaded the latest version of Python 2.7.x nd installed it to C:\Python276
I changed the Environments>Paths to C:\Python276 and C:\Python276\Scripts
Next up I set up a virtual environment for development using this excellent guide.
lxml still wasn't working but I found this which was the only solution for lxml I've found that works.
To get around the problem of ArcGIS and pathways etc I returned the paths to C:\Python27\ArcGIS10.x and removed the reference to C:\Python276
As I don't want to be installing / updating / messing around with ArcGIS's Python install I then changed the Powershell profile file (see the end of the first tutorial).  To change powershell's path to "C:\Python276;C:\Python276\Scripts;" I added the following to the profile file:
$ENV:PATH = $ENV:PATH -replace "C:\\Python27\\ArcGIS10.2;$" , "C:\\Python276;C:\\Python276\\Scripts"

This temporarily changes the Python path when in a Powershell session but when it ends ArcGIS can run as usual.

redpajama_set_name: RedPajamaStackExchange


text:
Q: how to check if the input value matches any value within an array how am i going to do this with if..else, do..while?
this program should prompt the user to input college name and output the ranking of the college, and if the user input an incorrect name, the program should output a message that an incorrect name has been entered.
#include <iostream>
#include <string>
using namespace std;

int main()
{
    string college[] = {"Baylor", "Colorado", "Iowa State",
                        "Kansas", "Kansas State", "Missouri",
                        "Nebraska", "Oklahoma", "Oklahoma State",
                        "Texas", "Texas A&M", "Texas Tech"};
    int conferenceRanking[] = {12, 11, 10, 9, 5, 8,
                                3, 2, 7, 1, 6, 4};

    for (if)
    {
        cout << "Enter the name of a Big Twelve College: " << college[count]
         << college << "\n's ranking is " << conferenceRanking[count]
         << "\n" << endl;
    }

    return 0;
}

[sample] This is the output what i want to come up with
Enter the name of a Big Twelve College: Nebraska
Nebraska's ranking is 3

A: I would go a little more complex way and use a map for holding the data and for getting the college from the command line std::getline, because it detects spaces and puts them in the string. After reading the name it iterates over the already created map to find the college we are looking for. It then checks the iterator if it was found or not! You should check some C++ Tutorials or a good book to learn the basics of C++.
(this approach is using C++11 standard, so be sure your compiler is compatible)
#include <iostream>
#include <string>
#include <map>

int main()
{
        std::map<std::string, int> colleges = {
            {"Baylor", 12},
            {"Colorado", 11},
            {"Iowa State", 10},
            {"Kansas", 9},
            {"Kansas State", 5},
            {"Missouri", 8},
            {"Nebraska", 3},
            {"Oklahoma", 2},
            {"Oklahoma State", 7},
            {"Texas", 1},
            {"Texas A&M", 6},
            {"Texas Tech", 4}
        };

        std::cout << "to end enter: exit";

        bool p = true;
        while(p){
            std::string name;

            std::cout << "Enter the name of a Big Twelve College: ";
            std::getline(std::cin, name);

            if(name == "exit"){
                    p = false;
                    break;
            }

            std::map<std::string, int>::iterator it = colleges.find(name);
            if (it != colleges.end()){
                    std::cout << it->first << "'s ranking is " << it->second << "!" << std::endl;
            }else{
                    std::cout << "No college found!, try again!" << std::endl;
            }
        }

        return 0;
}

A: You can use a map to save your ranks, which will later help you access your ranks by name really easily.
You can also keep a boolean variable indicating whether the current user input exists in you list, and use it to decide whether the user should get his/her answer, or be prompted again for some college name.
Here is an example main function that demonstrates:
#include <iostream>
#include <string>
#include <unordered_map>
using namespace std;

int main()
{
 std::unordered_map<std::string, int> collegeRanks = {
    {"Baylor",12},
    {"Colorado",11},
    {"Iowa State",10}
};
//etc...

bool finished = false;
string userInput;

while(!finished){

    cout << endl << "Enter the name of a Big Twelve College: ";
    getline (std::cin,userInput);
    std::unordered_map<std::string,int>::const_iterator nameAndRank = collegeRanks.find (userInput);
    if ( nameAndRank == collegeRanks.end() ){
        // Not found :(
        finished = false;
        cout << endl << userInput << " does not exist in our database... try another college name!" << endl;
        userInput = "";
    }
    else{
        // Found :)
        finished = true;
        cout << userInput << "'s rank is " << std::to_string(nameAndRank->second) << endl;
    }

}

return 0;
}

A: You can do this simply with the arrays you have without using a map (if you want to). Consider the code below.
bool has = false;
cout << "Enter college name\n";
string name;
cin >> name;
for(int i=0; i<12; i++){
    if(college[i].compare(name) == 0){
        has = true;
        cout << "Ranking of " << college[i] << " is " << conferenceRanking[i];
    }
}
//check if the name entered by user exists
if(has == false)
cout << "The college name entered does not exist";

The bool variable has determines whether the college name entered by user exists in the array college[] or not. If a match is found, value of has is changed to true.


text:
Q: How to implement the Export to excel function in SAPUI5? I have one Table element and I would like to download this table data with the download to excel function. I am deploying it  locally so no backend implementation is possible ? Is this possible ?
Regards,
Mayank Saxena

A: When the data comes from an oData service, then you can request the data in xlsx format by adding the parameter $format=xlsx to the URL. Just redirect the user to the oData-URL directly. It will appear to the user like a regular download.
You can redirect the user to a different URL with sap.m.URLHelper.redirect(url,true);

A: Download to excel only works with backendimplementation.
You have to check you Backend Metadata for
sap:supported-formats="atom json". There must be something like xlxs. If you use a smarttable the download to excel button is shown automatically

A: You can use the export function with the following config.

exportType: new sap.ui.core.util.ExportTypeCSV({
          separatorChar: "\t" ,
          mimeType: "application/vnd.ms-excel" ,
          charset: "utf-8",
          fileExtension: "xls"
}),


text:
Q: REGEXP_COUNT FIND > [ ] < OCCURRENSE IN ORACLE I have a string which is: 'ShippingInstructions.Phone[2].type.field[5].name' like:
SELECT 'ShippingInstructions.Phone[2].type.field[5].name' FROM DUAL;

I want to find how many [...] occurreses I have into mentioned string.
The response must to be 2.
Mine idea is:
each pair of [...] counts per 1.
I used the REGEXP_COUNT expression but it doesn't work because [] uses like a list of possibilities.
How can I find the strict occurrenses?

A: This?
SQL> with test (col) as
  2    (select 'ShippingInstructions.Phone[2].type.field[52].name' from dual)
  3  select regexp_count(col, '\[\d+\]') result
  4  from test;

    RESULT
----------
         2

SQL>

A: You can escape the brackets using \ and use:
SELECT REGEXP_COUNT( value, '\[\d+\]' ) AS num_brackets,
       value
FROM   table_name

Which, for the sample data:
CREATE TABLE table_name ( value ) AS
SELECT 'ShippingInstructions.Phone[2].type.field[5].name' FROM DUAL UNION ALL
SELECT 'a.b[1].c[2].d[3].e[4].f[5].g[6].h[7].i[8].j[9].k[10].name' FROM DUAL;

Outputs:

NUM_BRACKETS
VALUE

2
ShippingInstructions.Phone[2].type.field[5].name

10
a.b[1].c[2].d[3].e[4].f[5].g[6].h[7].i[8].j[9].k[10].name

db<>fiddle here

A: You can use
SELECT REGEXP_COUNT(col, '\[[^][]+]')

The \[[^][]+] will match any non-empty [...] substrings. If they can be empty, like [], use \[[^][]*] regex.
The [^][] part matches any char but a ] and [ chars.
Details

*

*\[ - a [ char, escaped since the [ is a special regex metacharacter

*[^][]+ - a negated (^ after [ expresses negation) bracket expression that matches any chars other than ] and [ (note the ] is not escaped as it is the first char in the bracket expression)

*] - a ] char (it is not special when outside a bracket expression, hence unescaped).


text:
Q: How to research unmanaged memory leaks in .NET? I have a WCF service running over MSMQ.  Memory gradually increases over time, indicating that there is some sort of memory leak.  I ran the service locally and monitored some counters using PerfMon.  Total CLR memory managed heap bytes remains relatively constant, while the process' private bytes increases over time.  This leads me to believe that there is some sort of unmanaged memory leak.  Assuming that unmanaged memory leak is the issue, how do I address the issue?  Are there any tools I could use to give me hints as to what is causing the unmanaged memory leak?  Also, all my service is doing is reading from the transactional queue and writing to a database, all as part of a DTC transaction (handled under the hood by requiring a transaction on the service contract).  I am not doing anything explicitly with COM or DllImports.
Thanks in advance!

A: You can use Windbg to analyze the process Heap. There are some articles and cheat sheets showing how to do this, like Memory Leak Detection Using Windbg

A: This blog will help you if you are willing to learn about windbg (http://www.microsoft.com/whdc/devtools/debugging/default.mspx).
http://blogs.msdn.com/tess/default.aspx

A: Make sure that you close the service client after using it. something like
try {
... do work ...
Close();
} ... exception handling ... {
Abort();
}

A: Ants Profiler is worth considering. As far as I can remember, you can download a trial version.


text:
Q: User Form und MultiPage I Have a UserForm anwith a Multipage (2 Sides) I have also a worksheet called DATA. The User Form as weell as the ListBox has labels and textboxes. Some Textboxes goteNames (for ex. Me.Name). Also the Labels for ex Label 87 got the Name "Number". I also have a cmd Buttons (espec.2 buttons) One finds Datas in the Sheet DATA the other changes the CHnages made in a Textbox as well in Listbx as in Data sheet. See Code. But this code does not work. Whats my fault?
Private Sub UserForm_Initialize()
  Dim i As Integer

  With tbl_DATA
    'Überschrift der Userform aus Zelle A1 holen
    Me.Caption = .Range("A1").Value

    For i = 1 To 10
      Me.Controls("Label" & i).Caption = .Cells(2, i).Value
    Next i

    'Überschrift der ListBox aus Tabelle holen
    For i = 1 To 8
      Me.Controls("Label" & i + 10).Caption = .Cells(2, i).Value
    Next i
  End With

  'ListBox einstellen
  With Me.ListBox1
    .ColumnCount = 10                    'Spaltenanzahl festlegen
    .ColumnWidths = "80;80;80;80;80;80;80;80;80;10" 'Spaltenbreiten definieren
  End With

  'Cursor standardmäßig in die erste TextBox setzen
  Me.TextBox1.SetFocus

End Sub


text:
Q: Canvas Of HTML5 While Using Phonegap Too Slow On Android Using a Galaxy S4 (Android 4.3) to run a Phonegap 3.4 app which has a HTML5's canvas running animations.
When I run the app normally, it works fine with 'ok' FPS while drawing stuff on the canvas..
When I want to turn the app to be using the max possible screen resolution of the smart-phone, adding the code below:
public void onCreate(Bundle savedInstanceState) {
    //... some code
    appView.getSettings().setLoadWithOverviewMode(true);
    appView.getSettings().setUseWideViewPort(true);
    //... more code
}

Than yes the screen resolution is OK, but the animations move at around 1 FPS.. which is very bad.
How can I improve performance ?
Am I getting to the max screen resolution (code I posted) doing the right way ?

A: If your app is full screen, you can try the Adobe FastCanvas plugin instead of the regular Canvas, it should be much faster.


text:
Q: Very Basic Node Removal in Swift I found some other questions about node removal in swift, but none of them seemed to be quite relevant to my issue.
I just want to do a basic node removal, for example:
override func touchesBegan(touches: NSSet, withEvent event: UIEvent){

let covernode1 = SKSpriteNode(imageNamed: "tester")

covernode1.position = CGPointMake(100.0, 600.0)

for touch: AnyObject in touches {

if self.nodeAtPoint(location) == self.fake {

button1++
button2++
}

if(button1 == 1 && button2 == 1){

addChild(covernode1)

}

if(button1 == 2 && button2 == 2){
//THIS IS WHERE I WANT TO REMOVE THE NODE
}

I have tried
covernode1.removeFromParent()

but to no avail.
The code runs the addChild part fine, but removal seems to be a problem. I even tried just changing the position of the node so it's off screen, with something like
covernode1.position = CGPointMake(-100.0, -600.0)

This did not work either.
Thank you.

A: Unfortunately I don't have enough reputation to comment on your original question, so this may not be an "answer" per se, but I'll try and diagnose what I think is going on, and hopefully you can clear up some points for me.
The covernode1 that you are trying to remove from the parent view in your if statement may be a different node than the one you added to the view when you called addChild(covernode1)
I think this is the case because when you say you are using covernode1.position = CGPointMake(-100.0, -600.0) and it still does not work, that makes me think that is a completely different SKNode object.
Instead, try declaring covernode1 outside of the function as a class variable.  That way, when you actually instantiate it and refer to it in the function, it is grabbing the correct node you are looking for.  Let me know if any of this helps.  I'll edit the answer when I know a bit more from your response.
Also, are your button1 and button2 vars originally set to 1?
EDIT: Another question: Are you receiving any error when calling .removeFromParent() or is just "not doing anything"?

A: One simple thing you could do (kind of cheating but it will work) is to hide the node using
covernode1.hidden = true

Note
Also make sure the if statement actually runs because I don't know why the things you tried should not work. To test that, place a println("log") in the if block.
Hope that helps :)

A: From button1 and button2, I think you are trying to do this: On the first click, you add a SKNode. On the second click, you want to remove the SKNode.
Thus on the second click your let covernode1 = SKSpriteNode(imageNamed: "tester") is a different instance although it has the same variable name ! Thus the instance on the second click is not removable since it was not added to anything.
Try this,
if(button1 == 1 && button2 == 1){
    addChild(covernode1)
    self.tempChildCount = count(self.children) //tempChildCount is an integer
}

if(button1 == 2 && button2 == 2){
    let childNode = self.children[self.tempChildCount - 1 ] as! SKNode
    self.removeChildrenInArray([childNode])
}


text:
Q: Python read API with json 2020 EDIT: The API is broken and you can no longer use it.
How would I use a JSON api to get a random colour and put it into a variable.
For now I have tried the following code
The API returns:
{"colors": [], "schemes": [{"timestamp": 1463921041, "colors": ["3f1401", "481f00", "876746", "e6e6e6"], "id": "17375", "tags": [{"id": "13311", "name": "what"}]}], "matching_schemes": ["17375"], "schemes_history": {"17375": [{"d_count": 0, "id": "13311", "a_count": 1, "name": "what"}]}, "success": true, "colors_history": {}, "messages": []}

and I wish to put name into a variable.
import requests
from json import *
def getcolor():
   colrjson = requests.get("http://www.colr.org/json/scheme/random")
   thing = colrjson.text
   aaa = loads(thing)
   print(aaa["name"])
getcolor()

The error I am getting is:
=================== RESTART: /home/pi/Desktop/test/main.py ===================
Traceback (most recent call last):
  File "/home/pi/Desktop/test/main.py", line 10, in <module>
    getcolor()
  File "/home/pi/Desktop/test/main.py", line 8, in getcolor
    print(aaa["name"])
KeyError: 'name'
>>>

A: If I do
import requests
print(requests.get("http://www.colr.org/json/scheme/random/1").text)

I get
'{"colors": [], "schemes": [], "schemes_history": {}, "success": true, "colors_history": {}, "messages": [], "new_scheme_id": "-1"}\n'

So clearly there is no "name" key in the dictionary. That's why you get that error.

A: The key name is inside not in the first level of your JSON so to access it you have to write : name = aaa["schemes"][0]["tags"][0]["name"] because "schemes" key and "tags" key return arrays.

A: I just tried the original url provided into my browser and it yielded an empty json, with no real content: I have adjusted your function as follows:
import requests
from json import *

def getcolor():
    colrjson = requests.get("http://www.colr.org/json/scheme/random").content
    json_file = loads(colrjson)
    print(json_file["schemes"][0]["tags"][0]["name"])
getcolor()

Here the "colrjson" takes the content of the json file, which is then assigned to variable "json_file" = loads(colrjson). The "loads" method from the json library takes file contents as a string so you are left with the dictionary which you can then traverse using keys and the indices of the inner lists as you provided.
I got the value as: "aurora"


text:
Q: No puedo guardar numeros par o impar en X vector tengo una consulta con respecto al siguiente codigo :
public static void main(String[] args) {
    Scanner leer = new Scanner(System.in);
    int numero_inicial;

    int Npar = 0, Nimpar = 0;

    System.out.println(" Digita el numero : \n");
    numero_inicial = leer.nextInt();

    while(numero_inicial <= 20)
    {
     numero_inicial++;

    if(numero_inicial%2==0)
    {
    Npar++;

    int [] vectorpar = new int[Npar];

    vectorpar[Npar] = numero_inicial;

    System.out.println(vectorpar[Npar]);

    }else
    {
    int [] vectorimpar = new int[Nimpar];
    Nimpar++;

    vectorimpar[Nimpar] = numero_inicial;

    System.out.println(vectorimpar[Nimpar]);

    }

    }

}

Estoy haciendo un trabajo donde inicio en un numero menor a 20 y dependiendo del contador incrementara las variables Npar o Nimpar para crear espacios en los vectores y así poder guardar los números, el problema es que cuando ejecuto el programa e inicio desde el 1 me tira un error


text:
Q: Can't use Data Profiling Queries and Charts using airflow sqlite DB? Installed airflow and am using the default sqlite DB. Finding that the Data Profiling Ad Hoc Query and Charts features do not work. Eg. in the Ad Hoc Query UI, setting the interpreter to sqlite_default and doing something like
select * from task_instance;

throws

Execution failed on sql ' SELECT * FROM ( select * from task_instance ) qry LIMIT 100000 ': no such table: task_instance
No data

and attempting to view the chart with label "Airflow task instance by type" throws
SELECT state, COUNT(1) as number FROM task_instance WHERE dag_id LIKE 'example%' GROUP BY state

SQL execution failed. Details: 'NoneType' object has no attribute 'get_pandas_df'

(clicking the pen icon in this screen just takes me to the mushroom cloud error screen).
Anyone know what is happening with this and how to fix while still using sqlite DB?

A: Be sure to put '/Users/{your_name}/airflow/airflow.db' in the host field of the Admin -> Connections.


text:
Q: Summing weekly data in excel by dragging down formula Imagine the following excel worksheet:
I have consecutive dates in Column 'A' with 'A1' being the header 'Dates' and 'A2' being the first date, continuing indefinitely down the column.
In column 'B' I have my data values, with 'B1' being the header 'Value' and 'B2' being the first value of data, continuing indefinitely down the column.
In a separate worksheet I want to have the same header cells; 'Dates' in 'A1' and 'Value' in 'B1', but group my data weekly.
In cell 'A2' I have the first date, cell 'A3' contains the date one week later and so on. I can simply input the first two weekly start dates and then select both and drag down.
I attempted to use the following formula in 'B2' =SUM(Sheet1!B2:B8)
And this in 'B3' =SUM(Sheet1!B9:B15)
I then tried selecting both cells and dragging down, but it does not pick up on the 7 day increments in the formula for both the first cell and last cell in the range.
Why does this not work, how do I get Excel to correctly increase both the start and end cells in this formula by 7 days?

A: Try Home>Fill>Series and set step value to 7


text:
Q: NSOutlineView, using item: AnyObject I'm creating a NSOutlineView. When implementing the Data Source, although I'm able to create the top hierarchy I can not implement the childHierarchy. The reason is that I can't read the item: AnyObject? which prevents me from returning the right array from the dictionary.
 //MARK: NSOutlineView
var outlineTopHierarchy = ["COLLECT", "REVIEW", "PROJECTS", "AREAS"]
var outlineContents = ["COLLECT":["a","b"], "REVIEW":["c","d"],"PROJECTS":["e","f"],"AREAS":["g","h"]]

//Get the children for item
func childrenForItem (itemPassed : AnyObject?) -> Array<String>{
    var childrenResult = Array<String>()
    if(itemPassed == nil){ //If no item passed we return the highest level of hirarchy
        childrenResult = outlineTopHierarchy
    }else{

        //ISSUE HERE:
        //NEED TO FIND ITS TITLE to call the correct child
        childrenResult = outlineContents["COLLECT"]!  //FAKED, should be showing the top hierarchy item so I could return the right data

    }
    return childrenResult
}

//Data source
func outlineView(outlineView: NSOutlineView, child index: Int, ofItem item: AnyObject?) -> AnyObject{
    return childrenForItem(item)[index]
}

func outlineView(outlineView: NSOutlineView, isItemExpandable item: AnyObject) -> Bool{
    if(outlineView.parentForItem(item) == nil){
        return true
    }else{
        return false
    }
}

func outlineView(outlineView: NSOutlineView, numberOfChildrenOfItem item: AnyObject?) -> Int{
    return childrenForItem(item).count
}

func outlineView(outlineView: NSOutlineView, viewForTableColumn: NSTableColumn?, item: AnyObject) -> NSView? {

    // For the groups, we just return a regular text view.
    if (outlineTopHierarchy.contains(item as! String)) {
        let resultTextField = outlineView.makeViewWithIdentifier("HeaderCell", owner: self) as! NSTableCellView
        resultTextField.textField!.stringValue = item as! String
        return resultTextField
    }else{
        // The cell is setup in IB. The textField and imageView outlets are properly setup.
        let resultTextField = outlineView.makeViewWithIdentifier("DataCell", owner: self) as! NSTableCellView
        resultTextField.textField!.stringValue = item as! String
        return resultTextField
    }

}

}
I used this as a reference, although it's Objective-C implemented

A: You need to cast the item to the correct type for your outline. Generally you'd want to use a real data model, but for your toy problem with exactly two levels in the hierarchy, this suffices:
func childrenForItem (itemPassed : AnyObject?) -> Array<String>{
    if let item = itemPassed {
        let item = item as! String
        return outlineContents[item]!
    } else {
        return outlineTopHierarchy
    }
}


text:
Q: GREL round up number and be divisible by 5 In OpenRefine I have a data set and I would like to round the number to the closest value and can be divided by 5 (divisible by 5).
For example:
1.35 would be 1.50
1.70 would be 2.00

I have looked into the documentation but couldn't figure out how to achieve that.

A: If your numbers are all integers, you could do:
floor((value+4)/5)*5

If it's possible that you'll get floating point numbers too, you could modify it along the lines of:
floor((value+4.999)/5)*5


text:
Q: Splitting string elements of an array in python to characters I'm still new in Python and solution might be simple however I feel stuck. I have an array likes this:
array([['one two'],
       ['three four'],
       ['five six'],
       ['seven eight']], dtype='<U9')

I can't figure out how to split it to make it look like this:
array([['o', 'n', 'e', 't', 'w', 'o'],
       ['t', 'h', 'r', 'e', 'e', 'f', 'o', 'u', 'r'],
       ['f', 'i', 'v', 'e', 's', 'i', 'x'],
       ['s', 'e', 'v', 'e', 'n', 'e', 'i', 'g', 'h', 't']])

I tried splitting it while converting this array to a list however I couldn't figure it out how to convert it back to an array like the one above. Thank you in advance for the help!

A: It's quite uncommon to see array used in vanilla python - list is much more widespread. But with lists you would have done a = list([list(item[0]) for item in a]).
list("abc") == ["a", "b", "c"], since string is an iterable of its characters. array should work almost the same, except you should handle the dtype attribute as well.


text:
Q: multiple div having dynamic height and also to keep 2 divs that are side by side I want to display the div content (having different heights) one after the other, with 2 divs side by side. I have tried to do this but I am getting space between divs having different heights.
Here is the code:

content

content

content

content

content

.ItemView {
    width: 46%;
    float:left;
    background: #fff;
    margin: 10px 10px 0px 10px;
    border: solid 1px #aaa;
    text-align: left;
    -moz-border-radius: 6px;
    -webkit-border-radius: 6px;
    border-radius: 6px;
    -moz-box-shadow: 2px 2px 2px #ddd;
    -webkit-box-shadow: 2px 2px 2px #ddd;
    box-shadow: 2px 2px 2px #ddd;
    min-height: 90px;
    padding: 0;
}

Current output:

A: You should seperate the 2 columns and put all elements of a column in a floated container.
See this FIDDLE
HTML :

content

        ...

content

        ...

CSS :
.ItemView {
    width: 100%;
    background: #fff;
    margin: 10px 0 0;
    border: solid 1px #aaa;
    text-align: left;
    -moz-border-radius: 6px;
    -webkit-border-radius: 6px;
    border-radius: 6px;
    -moz-box-shadow: 2px 2px 2px #ddd;
    -webkit-box-shadow: 2px 2px 2px #ddd;
    box-shadow: 2px 2px 2px #ddd;
    min-height: 90px;
    padding: 0;
}
.col{
    float:left;
    width:46%;
    margin: 0 10px;
}
.big {
    height:200px;
}


text:
Q: Determine if key pressed is writing something - Javascript I want to run an action only if the key pressed is writing something, so it ignores arrow keys, shift key or enter key etc.
I am using the following script, but I would like to find an alternative to Improve it.
$('body').on('keyup', 'input', function(e) {
  if (e.keyCode >= 48 && e.keyCode <= 57 || e.keyCode >= 65 && e.keyCode <= 90 || e.keyCode >= 97 && e.keyCode <= 122) {
      // do something
  }
});

A: From the comments:

the problem is my script include only the Number, Alphabet upper case and Alphabet lower case.I want to run action only if input content change

In order to trigger an event when text changes in the input, you need to define a global variable holding the previous data of the input.
Then when a keyup event is fired, you can check whether the input_data==new_input_data, then do whatever you want.

var input_data, new_input_data;
input_data = $("#myinput").val();
new_input_data="";
$('body').on('keyup', 'input', function(e) {
  new_input_data = $("#myinput").val();
  if(input_data!=new_input_data){
      alert("text changed");
      input_data = new_input_data;
    }
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input id="myinput" />


text:
Q: grpc StatusRuntimeException on Dataflow I have a dataflow pipeline in which I consume pubsub messages, treat them, and then publish to pubsub.
Whenever I have too many calculations (ie I increase the amount of treatment for each message) I get an Exception.
:
java.util.concurrent.ExecutionException: org.apache.beam.vendor.grpc.v1p13p1.io.grpc.StatusRuntimeException: CANCELLED: cancelled before receiving half close
What causes this error? How can I avoid it?
Full stacktrace:
org.apache.beam.vendor.grpc.v1p13p1.io.grpc.StatusRuntimeException: CANCELLED: call already cancelled
        org.apache.beam.vendor.grpc.v1p13p1.io.grpc.Status.asRuntimeException(Status.java:517)
        org.apache.beam.vendor.grpc.v1p13p1.io.grpc.stub.ServerCalls$ServerCallStreamObserverImpl.onNext(ServerCalls.java:335)
        org.apache.beam.sdk.fn.stream.DirectStreamObserver.onNext(DirectStreamObserver.java:98)
        org.apache.beam.sdk.fn.stream.SynchronizedStreamObserver.onNext(SynchronizedStreamObserver.java:46)
        org.apache.beam.runners.fnexecution.control.FnApiControlClient.handle(FnApiControlClient.java:84)
        org.apache.beam.runners.dataflow.worker.fn.control.RegisterAndProcessBundleOperation.start(RegisterAndProcessBundleOperation.java:254)
        org.apache.beam.runners.dataflow.worker.util.common.worker.MapTaskExecutor.execute(MapTaskExecutor.java:77)
        org.apache.beam.runners.dataflow.worker.fn.control.BeamFnMapTaskExecutor.execute(BeamFnMapTaskExecutor.java:125)
        org.apache.beam.runners.dataflow.worker.StreamingDataflowWorker.process(StreamingDataflowWorker.java:1283)
        org.apache.beam.runners.dataflow.worker.StreamingDataflowWorker.access$1000(StreamingDataflowWorker.java:147)
        org.apache.beam.runners.dataflow.worker.StreamingDataflowWorker$6.run(StreamingDataflowWorker.java:1020)
        java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        java.lang.Thread.run(Thread.java:745)


text:
Q: MapBox for iOS, custom style I created new map style with Mapbox Studio, then I uploaded it to my account (so I see it in styles tab), then I added StyleID to my iOS MGLMapView
but when I run app it throws error
[ERROR] {Map}[Setup]: loading style failed: HTTP status code 404

If I don't use my style, map is working correctly.

A: Try this in viewDidload:
mapView.styleURL = NSURL(string: "asset://styles/dark-v7.json")

Update 1:
For this moment it is not possible to use custom map style with Mapbox GL for iOS.
'First steps with Mapbox GL for iOS':
Changing the map style
At the moment, Mapbox GL comes bundled with a handful of map styles. That'll all change in a few months, but for now let's change the map style to Mapbox Dark...


text:
Q: Posting status on Facebook via Easy Facebook SDK Android I cant find way to post new status on Facebook via Easy Facebook SDK.
Im logging in, everythings is ok. Then trying to fire up this line of code
       Status facebookStatus;
       /* some code */
       facebookStatus.setMessage("Some text");

aaaand im getting force close dialog :S
Site: http://www.easyfacebookandroidsdk.com/
Reference: http://www.easyfacebookandroidsdk.com/doc/com/easy/facebook/android/data/Status.html#setMessage%28java.lang.String%29

A: I guess that you haven't created the Status object. If that's the case, then change the first line to:
Status facebookStatus = new Status();


text:
Q: Using React.js to render JSON I'm using react to create a frontend for my application in spring and i've used a manytomany relationship to may employees to shifts. When I run the localhost, the employeeID and name is returned but the shifts are left blank.
This is the Json Output:
{
"_embedded" : {
"employees" : [ {
  "employeeID" : "0001",
  "name" : "John Mitchell",
  "id" : 1,
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/api/employees/1"
    },
    "employee" : {
      "href" : "http://localhost:8080/api/employees/1"
    },
    "shifts" : {
      "href" : "http://localhost:8080/api/employees/1/shifts"
    }
  }

}
{
"_embedded" : {
"shifts" : [ {
  "shifts" : "Sunday Evening",
  "id" : 1,
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/api/shifts/1"
    },
    "shift" : {
      "href" : "http://localhost:8080/api/shifts/1"
    }
  }
}, {
  "shifts" : "Monday Day",
  "id" : 2,
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/api/shifts/2"
    },
    "shift" : {
      "href" : "http://localhost:8080/api/shifts/2"
    }
  }
}, {
  "shifts" : "Tuesday Night",
  "id" : 3,
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/api/shifts/3"
    },
    "shift" : {
      "href" : "http://localhost:8080/api/shifts/3"
    }
  }
} ]

This is my react code:
class App extends React.Component {

constructor(props) {
    super(props);
    this.state = {employees: []};
}

componentDidMount() {
    client({method: 'GET', path: '/api/employees'}).then(response => {
        this.setState({employees: response.entity._embedded.employees});
    });
}

render() {
    return (
        <EmployeeList employees={this.state.employees}/>
    )
}

}
class EmployeeList extends React.Component{
render() {
    var employees = this.props.employees.map(employee =>
        <Employee key={employee._links.self.href} employee={employee}/>
    );
    return (

                    Employee ID
                    Name
                    Shift

                {employees}

    )
}

}
class Employee extends React.Component{
constructor(props) {
    super(props);
    this.state = {shifts:[]};
}
componentDidMount() {
    client({method: 'GET', path: '/api/employees._links.shifts.href'}).then(response => {
        this.setState({shifts: response.entity._embedded.shifts});
    });
}

render() {
    const shifts = this.state.shifts.map(shift =>

{shift.shifts}

    );

    return (

            {this.props.employee.employeeID}
            {this.props.employee.name}
            {shifts}

    )
}

}
ReactDOM.render(
<App />,
document.getElementById('react')

All I simply want to do is to return the shift (E.g: "shifts" : "Sunday Evening") for each employee when I run the localhost.
Any help would be greatly appreciated, thanks in advance.
EDIT
A 404 error is returned when trying to get shifts in the employee class

A: You have circular login in your Shift class, you want to render the Shift but in your render function more Shifts are created wich will then create more in the render function and so on. I don't see any need of the Shift class unless you want to reuse it or for estetic reasons.
class Employee extends React.Component{

    constructor() {
        // set the initial state of you will get an error in the render function
        this.state = { shifts: [] };
    }

    // load the shifts when the component is ready
    componentDidMount() {
        client({method: 'GET', path: this.props.employee._links.shift.href}).then(response => {
            this.setState({shifts: response.entity._embedded.shifts});
        });
    }

    render() {
        const shifts = this.state.shifts.map(shift =>

{shift.shifts}

        );

        return (

                {this.props.employee.employeeID}
                {this.props.employee.name}
                {shifts}

        )
    }
}


text:
Q: Plotting multiple normal curves with ggplot2 without hardcoding means and standard deviations I have a vector of means and standard deviations, and I would like to plot the densities corresponding to these means and standard deviations in the same plot using ggplot2. I used mapply and gather to solve this problem, but it's quite a lot of lines of code for something which I think should be trivial:
library(dplyr)
library(tidyr)
library(ggplot2)

# generate data
my_data <- data.frame(mean =  c(0.032, 0.04, 0.038, 0.113, 0.105, 0.111),
                      stdev = c(0.009, 0.01, 0.01, 0.005, 0.014, 0.006),
                      test = factor(c("Case_01", "Case_02", "Case_03", "Case_04",
                                      "Case_05", "Case_06")))

# points at which to evaluate the Gaussian densities
x <- seq(-0.05, 0.2, by = 0.001)

# build list of Gaussian density vectors based on means and standard deviations
pdfs <- mapply(dnorm, mean = my_data$mean, sd = my_data$stdev, MoreArgs = list(x = x),
               SIMPLIFY = FALSE)

# add group names
names(pdfs) <- my_data$test

# convert list to dataframe
pdfs <- do.call(cbind.data.frame, pdfs)
pdfs$x <- x

# convert dataframe to tall format
tall_df <- gather(pdfs, test, density, -x)

# build plot
p <- ggplot(tall_df, aes(color = test, x = x, y = density)) +
  geom_line() +
  geom_segment(data = my_data, aes(color = test, x = mean, y = 0,
                                   xend = mean, yend = 100), linetype = "dashed") +
  coord_cartesian(ylim = c(-1, 100))
print(p)

This is very similar to:
Plot multiple normal curves in same plot
and as a matter of fact, the accepted answer uses mapply, so that confirms me that I'm on the right track. However, what I don't like of that answer is that it hard-codes means and standard deviations in the mapply call. This won't work in my use case, because I read the real data from disk (of course, in the MRE I skipped the data reading part for simplicity). Is it possible to simplify my code, without sacrificing readability, and without hard-coding the mean and standard deviation vectors in the mapply call?
EDIT maybe the call to mapply may be avoided by using the package mvtnorm, but I don't think that affords any real simplification here. Most of my code comes after the call to mapply.

A: You can save some coding using purrr::pmap_df, which does the row binding automatically after constructing a data frame for each mean-stdev pair:
Assume my_data has the input columns in the order or mean, stdev, test and test is of character class.
library(purrr)
tall_df2 <- pmap_df(my_data, ~ data_frame(x = x, test = ..3, density = dnorm(x, ..1, ..2)))

With data:
my_data <- data.frame(mean =  c(0.032, 0.04, 0.038, 0.113, 0.105, 0.111),
                      stdev = c(0.009, 0.01, 0.01, 0.005, 0.014, 0.006),
                      test = c("Case_01", "Case_02", "Case_03", "Case_04", "Case_05", "Case_06"),
                      stringsAsFactors = F)

Plot:
p <- ggplot(tall_df2, aes(color = factor(test), x = x, y = density)) +
      geom_line() +
      geom_segment(data = my_data, aes(color = test, x = mean, y = 0,
                                       xend = mean, yend = 100), linetype = "dashed") +
      coord_cartesian(ylim = c(-1, 100))

print(p)

gives:


text:
Q: how to step forward a simulink model programmatically I have a simulink model, I want to step forward it programatically. is there any way to do it? I tried set_param('model','SimulationCommand','step') but it didn't work.

A: The only way I can see to do this is to run the simulation in debugging mode using sldebug. For more information, see Debugging in the Simulink documentation.

A: I wanted to step forward it only once(to start the simulation and pause it at 0 second) SO I tried
set_param('model','SimulationCommand','start','SimulationCommand','pause');
It worked fine for me.


text:
Q: CodeIgniter - adds an extra class to my URL when i click on a link I'm new in CI as well in php. I have a problem that's bugging me for two days now:
when i click on a link in my admin header(say: Articles) it takes me to: www.example.com/admin/articles, which is ok. If now i try to click on another link in the header (say: Add articles), the url becomes: www.example.com/admin/admin/add_articles - it adds an extra admin to my url. if i click again on Articles, the url will be: www.example.com/admin/admin/admin/articles, and so on.
Do you have any idea why is this happening?
Thanks

A: You have 2 choice, the first is that you wrote in every link base_url()
OR
you can use a built in helper:
anchor('route','label','attributes')

in your example:
anchor('admin/add_article','Add an article',array('class' => 'link'))

Then that will create this HTML code:
Add an article

A: use absolute urls not relative, use $config['base_url'] before every link

A: Don't use
$config['base_url] . 'controller/action',

use the function:
site_url('controller/action');

Or use the anchor function @András Rátz suggested.


text:
Q: Algorand - is approving a logicsig a transaction on the chain? Just wondering what happens when I approve a logicsig. I don't see a transaction on Algorand and curious what is going on there.
It gives me a TEAL Address but AlgoExplor-ing that address doesn't show anything like an App created on behalf of my acct, etc

A: When you sign a LogicSig, it produces a delegate signature which can be used as your address as the sender.
Smart signatures don't exist on-chain, but they can be pulled from previous transactions and reused by anyone.


text:
Q: A fatal error has been detected by the Java Runtime Environment when running .\import.io I have download import.io as per the link,
https://import.io/download/linux. As it says, I have extracted and get inside the folder import.io in terminal. But when I tried running ./import.io, I am getting this error(Given below). Kindly advice me to resolve this issue. I appreciate your help.
I am using Ubuntu 12.04.
Java version
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
Error
Starting application...
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0xdedda7e4, pid=12312, tid=4149622464
#
# JRE version: 7.0_09-b05
# Java VM: Java HotSpot(TM) Client VM (23.5-b02 mixed mode linux-x86 )
# Problematic frame:
# C  [libdbus-1.so.3+0x277e4]
[error occurred during error reporting (printing problematic frame), id 0xb]
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /home/user/import.io/hs_err_pid12312.log
# [ timer expired, abort... ]
Aborted (core dumped)

This is the log
!SESSION 2014-04-25 14:25:17.199 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.7.0_09
java.vendor=Oracle Corporation
BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=en_IN
Command-line arguments:  -os linux -ws gtk -arch x86

!ENTRY org.eclipse.osgi 4 0 2014-04-25 14:25:17.712
!MESSAGE Application error
!STACK 1
org.eclipse.swt.SWTError: No more handles [gtk_init_check() failed]
    at org.eclipse.swt.SWT.error(SWT.java:4387)
    at org.eclipse.swt.widgets.Display.createDisplay(Display.java:914)
    at org.eclipse.swt.widgets.Display.create(Display.java:900)
    at org.eclipse.swt.graphics.Device.<init>(Device.java:156)
    at org.eclipse.swt.widgets.Display.<init>(Display.java:498)
    at org.eclipse.swt.widgets.Display.<init>(Display.java:489)
    at org.eclipse.swt.widgets.Display.getDefault(Display.java:1634)
    at com.importio.builder.bootstrap.ui.SwtUI.<init>(SwtUI.java:74)
    at com.importio.builder.bootstrap.ui.SwtUI.run(SwtUI.java:41)
    at com.importio.builder.bootstrap.BootstrapApplication.start(BootstrapApplication.java:35)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:353)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1438)

Edit
Here is my Error when I tried running script as suggested by Anone Mosh in Comments section. Please see the log also.
Log
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0xded37b12, pid=5628, tid=3739306816
#
# JRE version: 7.0_09-b05
# Java VM: Java HotSpot(TM) Client VM (23.5-b02 mixed mode linux-x86 )
# Problematic frame:
# C  [libdbus-1.so.3+0x29b12]

A: Java is having problems calling dbus to detect any HTTP proxies you may have setup. Do you have any proxies? If not you can turn this detection off by adding the following line to the following file:
<where you extracted the application to>/import.io/import.io.ini
This is the line you need to add to the file:
-Dupdate.useSystemProxy=false

A: The reason for the errors is because you are using linux version that is 64bits. Follow the instruction through and you wont experience any error. http://support.import.io/knowledgebase/articles/254346-linux-installation-notes.

A: This solution work for me:
Edit the file /eclipse/eclipse.ini.
Insert the line:
-Dorg.eclipse.swt.browser.DefaultType=m


text:
Q: How to pass parameters in angular-translate I have created a function that does some error checkings and will be used in different input fields. My function code is below:
errorChecks = (element, minlength) => {
   if (element.$dirty) {
      if (element.$error.required == true) {
         this.errorMessage = "REQUIRED";
         return;
      } else if (element.$viewValue.length < minlength) {
          this.errorMessage = "MINLENGTH" // MINLENGTH error with parameters here
          return;
      } else {
          this.errorMessage = null;
          return;
      }
   }
}

I am using the angularjs translate for my error messages.
"MINLENGTH": "{{ element }} must be at least {{ value }} characters",

I wanted to dynamically change my error message by passing a parameter to the translations like so:
errorChecks(username, 5);

If I enter 1 character to the username field the error would say: username must be at least 5 characters.
Is what I am trying to do even possible?

A: You can also use $translate.instant('MINLENGTH', { element: element, value: minlength })

A: This worked fine for me:
{{'commisionMessage' | translate : {fee:fee} }}|

Json File
"commisionMessage": "BLA {{fee}} BLA BLA"

A: It'll probably be best if you translate inside the controller for this one, unless you want to pass element and minlength to the template.
Firstly you'll need inject $translate into your controller. Then to generate your message:
this.errorMessage = $translate('MINLENGTH', { element: element, value: minlength });

This method is also outlined here.
To do this in the template (outlined here):
{{ MINLENGTH | translate : { element: element, value: minlength } }}

A: For anyone wondering how the syntax is, for using methods to retrieve the input for translation, this worked for me:
   {{ MINLENGTH | translate : { x: table.getShownCount(), y: table.getTotalCount() } }}

A: You can also do this in the template like this.


text:
Q: Can I get sensible labels for lm-sensors output for "applesmc-isa-0300"? 2011 8,3 Macbook Pro running 64bit 11.10.
When I run sensors from the lm-sensors package, I get a lot of information, but no way to understand it:
coretemp-isa-0000
Adapter: ISA adapter
Physical id 0:  +53.0°C  (high = +86.0°C, crit = +100.0°C)
Core 0:         +53.0°C  (high = +86.0°C, crit = +100.0°C)
Core 1:         +52.0°C  (high = +86.0°C, crit = +100.0°C)
Core 2:         +50.0°C  (high = +86.0°C, crit = +100.0°C)
Core 3:         +49.0°C  (high = +86.0°C, crit = +100.0°C)

applesmc-isa-0300
Adapter: ISA adapter
Left side  : 2001 RPM  (min = 2000 RPM)
Right side : 2001 RPM  (min = 2000 RPM)
TB0T:         +33.2°C
TB1T:         +33.2°C
TB2T:         +29.0°C
TC0C:         +52.8°C
TC0D:         +47.2°C
TC0E:         +51.8°C
TC0F:         +53.0°C
TC0J:          +1.0°C
TC0P:         +44.5°C
TC1C:         +52.0°C
TC2C:         +52.0°C
TC3C:         +52.0°C
TC4C:         +52.0°C
TCFC:          +0.2°C
TCGC:         +51.0°C
TCSA:         +52.0°C
TCTD:          +0.0°C
TG0D:         +44.5°C
TG0P:         +43.2°C
THSP:         +37.5°C
TM0S:         +57.5°C
TMBS:          +0.0°C
TP0P:         +50.0°C
TPCD:         +55.0°C

The core temp info is really useful and I'm pretty sure that Left/Right Side refers to the two fans within, but otherwise, I have no idea what this information means.
Is there something I can use to normalize this information?

A: You will need to install some additional software to get the MacBook to do what you want. the Ubuntu Wiki page here provides you all the info you need but essentially;

*

*Add coretemp to the list of modules loaded during the boot process.

*It is highly recommended to use the fan controller daemon that is included in the mactel-support ppa called macfanctl

A: The codes you see in sensors' output are called SMC (System Management Controller) codes. From Wikipedia's article for System Management Controller:

The SMC has roles in controlling thermal and power management, battery charging, video mode switching, sleep and wake, hibernation, and LED indicators. It also enables enforcement of the macOS End User License, allowing macOS to identify when it is running on non-Apple hardware.

There is a similar question for the output of sensors on Super User: Interpreting sensor names
From the (now archived) link that ruief provided in their answer, you can find the following correspondence between the output of sensors and the meaningful names for most of the keys:

sensors output
Meaningful key name

TB0T
Battery TS_MAX

TB1T
Battery 1

TB2T
Battery 2

TC0C

TC0D
CPU 1 Package

TC0E
CPU 1

TC0F
CPU 1

TC0J

TC0P
CPU 1 Proximity

TC1C
CPU Core 1

TC2C
CPU Core 2

TC3C
CPU Core 3

TC4C
CPU Core 4

TCFC

TCGC
PECI GPU

TCSA
PECI SA

TCTD

TG0D
GPU Die

TG0P
GPU Proximity

THSP

TM0S
Mem Module A1

TMBS

TP0P
PCH Proximity

TPCD
PCH Die


text:
Q: How to change state when a function runs using ui.router? I'm building a search service in my application which is using angularjs. I'm using ui-router too. Now the problem I'm facing is -
When a user types on the input (suppose) - xyz and hits enter, I dont know how to change the state.
Like from - abcd.com, he/she should move to abcd.com/search?q=xyz
which will be a different page altogether.
I have never worked on search before so please help me figure it out.
On the basis of comment below i decided to first try state.go for changing my state when clicked on a button -
Heres my controller -
app.controller('myCtrl', function($state){
var search = this;
search.changeState = function () {
$state.go('abcd');

};
});
here's my html -
<body ng-app="mySearch" ng-controller="myCtrl as app" >

        <button ng-click="app.changeState">asd</button></div>

<ui-view></ui-view>

Still the url isnt changing


text:
Q: How to capture changes to y1 via y1summary? world,
I want to get more familiar with the Tensorboard API.
I studied the script I found here:
https://www.tensorflow.org/code/tensorflow/examples/tutorials/mnist/mnist_with_summaries.py
It runs well on my laptop.
Much of it makes sense to me.
So, I wrote a simple tensorflow demo:
import tensorflow as tf

sess = tf.Session()

with tf.name_scope('scope0'):
  y1 = tf.Variable(1.1)
  # I should intialize:
  sess.run(tf.initialize_all_variables())
  tf.scalar_summary('y1summary', y1)

merged       = tf.merge_all_summaries()
train_writer = tf.train.SummaryWriter('/tmp/tb4',sess.graph)
step_i       = 0

summary,out1 = sess.run([merged,y1])
train_writer.add_summary(summary, step_i)

step_i += 1
y1   = y1 - 1.1
summary,out1 = sess.run([merged,y1])
train_writer.add_summary(summary, step_i)

step_i += 1
y1   = y1 + 2.1
summary,out1 = sess.run([merged,y1])
train_writer.add_summary(summary, step_i)

train_writer.close()

So, I run the above script with this shell command:
python tensorboard_demo4.py

And it runs with no error.
Next I run Tensorboard:
tensorboard --log=/tmp/tb4

It runs with no error.
But when I look at the events tab,
Tensorboard shows a constant value for y1summary.

So, I do not understand something fundamental about Tensorboard.
How to enhance the above script so that Tensorboard displays changes to y1 via y1summary?

A: Try this
import tensorflow as tf

sess = tf.Session()

with tf.name_scope('scope0'):
  y1 = tf.Variable(1.1)
  # I should intialize:
  sess.run(tf.initialize_all_variables())
  tf.scalar_summary('y1summary', y1)

merged       = tf.merge_all_summaries()
train_writer = tf.train.SummaryWriter('/tmp/tb4',sess.graph)
step_i       = 0

summary,out1 = sess.run([merged,y1])
train_writer.add_summary(summary, step_i)

step_i += 1
sess.run(y1.assign(y1 - 1.1))
summary,out1 = sess.run([merged,y1])
train_writer.add_summary(summary, step_i)

step_i += 1
sess.run(y1.assign(y1 + 2.1))
summary,out1 = sess.run([merged,y1])
train_writer.add_summary(summary, step_i)

train_writer.close()

Basically, you need to assign the new value to the variable(y1 in this case) you are capturing the summary of.


text:
Q: Apache Camel - Mock REST endpoint returns NullPointerException I would like to mock responses from a REST endpoint so that I can test my route. I am following the Camel in Action book and have adapted the REST testing example implementation as follows:
    @Override
    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                from("jetty://http://localhost:9080/SERVICECALL")
                        .transform().message(m -> "endpoint")
                        .to("mock:endpoint");
            }
        };
    }

    @Test
    public void shouldCallRedaction() throws Exception {
        MockEndpoint mock = getMockEndpoint("mock:endpoint");
        mock.expectedBodiesReceived("endpoint");
        mock.whenAnyExchangeReceived(e -> e.getIn().setBody("endpoint"));

        String url = "http://localhost:9080/SERVICECALL";
        String response = template.requestBody(url, "test", String.class);
        assertEquals("endpoint", response);

        assertMockEndpointsSatisfied();

    }

The getMockEndpoint method returns a NullPointerException. When I run in debug I can see that the CamelContext is null, hence the exception. My intended behaviour is to instead receive plain text response "endpoint" when the endpoint SERVICECALL is called.
I'm confused as to why I am getting this exception (should I define the context for the mock somewhere?) and how I should correctly implement the mock endpoint to test the route.


text:
Q: Apache: how to block access to files like Gruntfile.js, package.json, etc? I have Gruntfile.js and package.json and folders node_modules and .git.
I want to block access to those files and folders. In the app I have index.php as the door to every non file/folder request
Here is in my .htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]*)$ index.php?page=$1

and in index.php
if (isset($_GET['page'] && !file_exists($views.$_GET['page'])) {
    header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found', true, 404);
    include $views.'404.php';
}

So It would be better if those private files were shown as 404 with the respective view

A: My solution was to use a simple RewriteRule to redirect to 404 view from index.php for every private file and folder
RewriteEngine On
RewriteRule ^Gruntfile\.js$ index.php?page=404 [L]
RewriteRule ^package\.json$ index.php?page=404 [L]
RewriteRule ^.git/.*$ index.php?page=404 [L]
RewriteRule ^node_modules/.*$ index.php?page=404 [L]

Though I think that these kind of files need to be in a root folder, and the index.php in a subfolder like public_html which is the only public
This solution even works with uppercase and mixed letters. i.e.:
pacKagE.json
gruntfile.js
.GIT/


text:
Q: How many bytes does a BigQuery Date require I've got a timestamp column in BigQuery, and now I realize I could have used a date data type to represent this column instead (I don't need fine time granularity).  My table is large and expensive to query so I'm wondering whether I'll save money by converting it to a new column of type DATE instead.
However, the official BigQuery documentation on data types doesn't seem to indicate how many bytes a date object requires.  Does anyone here know?

A: DATE and TIMESTAMP both require 8 bytes
You can see more details at Data size calculation


text:
Q: Query based on contain for Date I am trying to view the query based on months and years selected:
I have already got selected date which is as declared (    //dateselectedStr = "2016-11"
)
and the storing date in the online database contain the updatedAt the same 2016-11, how can i search the query based on having .contain ? This is my trails
query.order(byDescending: "updatedAt")
if PFUser.current() != nil {

query.whereKey(CARD_UPDATED_AT, contains: dateselectedStr)

query.findObjectsInBackground { (objects, error)-> Void in
    if error == nil {
        self.recipesArray = objects!
        // Reload CollView
        self.recipesCollView.reloadData()
        let counter = (objects!.count)
        print(counter)
        self.title = "\(counter) JOB CARDS"
        self.hideHUD()

        // Hide/show the nothing found Label
        if self.recipesArray.count == 0 { self.nothingFoundLabel.isHidden = false
        } else { self.nothingFoundLabel.isHidden = true }

    } else {
        self.simpleAlert("\(error!.localizedDescription)")
        self.hideHUD()
}}

A: AFAIK, this is the only solution possible
For year 2016,

updatedAt >= 01-01-2016 & updatedAt <= 31-12-2016

For month January,

updateAt >= 01-01-2016 & updatedAt <= 31-01-2016

Hope this helps :)


text:
Q: Flutter without keyboard and keep focus Is there a way to have a text field which when having the focus does not show the virtual keyboard? I need this to be able to capture the result delivered by a physical barcode reader built into the smartphone.
I've seen solutions that recommend passing focus to another node, but that way it couldn't capture the barcode, and I've also seen that it can be used:
SystemChannels.textInput.invokeMethod ('TextInput.hide');

But for some reason it doesn't hide the keyboard.

A: Use this library flutter_barcode_listener
It works like the following.

*

*listen for physical keyboard raw key up event

*filter out only 'REAL'
characters (ASCII codes lower than 256, without special characters
except enter)

*on each new key check if previous key is older than
bufferDuration, if it's older clear internal buffer

*check if new key is enter key, if it is call onBarcodeScanned callback
and clear buffer

*if it's not enter key just append it to internal buffer;

In your code you can wrap the widgets that depends on the scanner data with the BarcodeKeyboardListener and it will look something like this:
child: BarcodeKeyboardListener(
        bufferDuration: Duration(milliseconds: 200),
        onBarcodeScanned: (barcode) {
          if (!visible) return;
          print(barcode);
          setState(() {
            _barcode = barcode;
          });
        },
        child: SomeWidget(


text:
Q: How to add a legend to the motion chart I use this script that creates a motion chart (see the original source code and a simplified fiddle). I wonder if it's possible to add the legend to this chart that would show the meaning of each color. The meaning should correspond to the field name from the input JSON.
Normally I create a legend as follows:
var colors = ["#F0E5FF","#E1CCFF","#C499FF","#AC79F2","#8D4CE5","#6100E5","#C94D8C"];
var colorScaleDomain = [300, 1000, 2000, 5000, 10000, 20000, 50000];

var colorScale = d3.scale.quantile()
                   .domain(colorScaleDomain)
                   .range(colors);

However, not sure how to adapt it to my current case when I use colorScale = d3.scale.category10().

A: Since d3.scale.category10() operates in a first-come first-served basis, that is, it adds values to the domain as new data comes in, you just need to pass the name in the same order that you painted the circles.
However, for this to work, you'll have to change your function color():
function color(d) {
    return d.name;
}

Now, both the circles and the legends will have the same domain in the color scale.
Now, create the legends:
var legendGroup = svg.append("g")
    .attr("transform", "translate(600,50)");

var legend = legendGroup.selectAll(".legend")
    .data(SPX.map(d => d.name))
    .enter()
    .append("g")
    .attr("transform", (d, i) => "translate(0," + 20 * i + ")")

var legendRects = legend.append("rect")
    .attr("width", 10)
    .attr("height", 10)
    .attr("fill", d => colorScale(d));

var legendText = legend.append("text")
    .attr("x", 14)
    .attr("y", 8)
    .text(d => d);

Here is your fiddle, I put the legends in the top-right corner: http://jsfiddle.net/8yd04e0p/


text:
Q: get several values separated by , and save line by line in the database I have an input, and I want to extract several numbers separated by , and store each number on each new line in the database.
model - CouponDocument
<?php

namespace App\Models;

use App\Http\Controllers\CouponDocumentController;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;

class CouponDocument extends Model
{
    use HasFactory, SoftDeletes;

    protected $table = "coupons_document";

    protected $fillable = [
        "id",
        "cpf",
        "coupon_id"
    ];

    protected $hidden = [

        'deleted_at',
        'created_at',
        'updated_at'
    ];

    public function coupon()
    {
        return $this->belongsTo(Coupon::class, 'coupon_id', 'id')->withTrashed();
    }

}

Controller
class CouponDocumentController extends Controller
{

    static public function store($request)
    {
        $data = [];
        foreach ($request->input('cpf') as $cpf) {
            $data[] = [
                'cpf' => trim($cpf),
                'coupon_id' => 61
            ];
        }

        foreach ($data as $item) {

            $couponDocument = new CouponDocument();
            $couponDocument->fill($item);
            $couponDocument->save();
        }
    }

}

Resources
class CouponsDocument extends Resource
{
    use SearchesRelations;

    public static $displayInNavigation = false;

    public static $model = \App\Models\CouponDocument::class;

    public static $title = 'id';

    public static $search = [
        'id',
        'cpf',
        'coupon_id'
    ];

    public static function label()
    {
        return __('modules.couponDocument.button');
    }

    public static function singularLabel()
    {
        return __('modules.couponDocument.button');
    }

    public function fields(Request $request)
    {
        return [
          Text::make(__('fields.couponDocument.name'), "cpf")
          ->sortable(),

        ];
    }

where the resource is called
 HasMany::make
 __("fields.couponDocument.name"),
 "documentRelationship",
CouponsDocument::class

I tried to do it with the standard functions of nova, but it ended up not working, I would like to know if there is any other solution


text:
Q: What is the preferable way for passing Bean dependencies in Spring When reading through the documentation of the Spring framework, I stumbled upon two different styles of passing Bean dependencies in factory methods. The first one is like this (directly using the factory method of the dependency):
@Configuration
public class MessagingConfiguration {

    @Bean
    public ConnectionFactory connectionFactory() {
        CachingConnectionFactory connectionFactory = new CachingConnectionFactory("localhost");
        connectionFactory.setUsername("guest");
        connectionFactory.setPassword("guest");
        return connectionFactory;
    }

    @Bean
    public RabbitTemplate rabbitTemplate() {
        return new RabbitTemplate(connectionFactory());
    }

}

The second one looks like this (injecting the dependency as a parameter in the factory method):
@Configuration
public class MessagingConfiguration {

    @Bean
    public ConnectionFactory connectionFactory() {
        CachingConnectionFactory connectionFactory = new CachingConnectionFactory("localhost");
        connectionFactory.setUsername("guest");
        connectionFactory.setPassword("guest");
        return connectionFactory;
    }

    @Bean
    public RabbitTemplate rabbitTemplate(ConnectionFactory connectionFactory) {
        return new RabbitTemplate(connectionFactory);
    }

}

I would like to know what are the PROs and CONs of the two solutions and which one is preferable?

A: I don't believe you'll get consensus on "preferrable" on this.
A PRO for the second style is that it'll work, as-is, regardless of where the dependent bean is defined.
For example, if the two beans in question were defined in two separate @Configuration classes, style one would become this:
@Configuration
public class MessagingConfiguration1 {

    @Bean
    public ConnectionFactory connectionFactory() {
        CachingConnectionFactory connectionFactory = new CachingConnectionFactory("localhost");
        connectionFactory.setUsername("guest");
        connectionFactory.setPassword("guest");
        return connectionFactory;
    }

}

@Configuration
public class MessagingConfiguration2 {

    @Autowired
    ConnectionFactory connectionFactory;

    @Bean
    public RabbitTemplate rabbitTemplate() {
        return new RabbitTemplate(this.connectionFactory);
    }

}

While the second style would remain unchanged:
@Configuration
public class MessagingConfiguration1 {

    @Bean
    public ConnectionFactory connectionFactory() {
        CachingConnectionFactory connectionFactory = new CachingConnectionFactory("localhost");
        connectionFactory.setUsername("guest");
        connectionFactory.setPassword("guest");
        return connectionFactory;
    }

}

@Configuration
public class MessagingConfiguration1 {

    @Bean
    public RabbitTemplate rabbitTemplate(ConnectionFactory connectionFactory) {
        return new RabbitTemplate(connectionFactory);
    }

}

A second PRO is that it makes it easier to see when a bean has too many dependencies, which means it might be doing too much, which means it might be time for a refactor.
I was actually unaware of the second style up until a few weeks ago but it's what I've been using since.
Good luck!

A: In normal use cases there shouldn't be such a big difference between the two approaches. But if your want to split your configuration into multiple classes the first solution cannot simply be used. Assumed you want to put your two @Bean methods into separate classes and import the first one into the second one through @Import, there is no chance for the compiler to know the connectionFactory() method of the first class in the RabbitTemplate(connectionFactory()) constructor of the second class. So you will run into a compiler error. To solve this problem you can use the second approach as recommended by the spring documentation: Injecting dependencies on imported @Bean definitions

Injecting dependencies on imported @Bean definitions
The example above works, but is simplistic. In most practical
  scenarios, beans will have dependencies on one another across
  configuration classes. When using XML, this is not an issue, per se,
  because there is no compiler involved, and one can simply declare
  ref="someBean" and trust that Spring will work it out during container
  initialization. Of course, when using @Configuration classes, the Java
  compiler places constraints on the configuration model, in that
  references to other beans must be valid Java syntax.
Fortunately, solving this problem is simple. As we already discussed,
  @Bean method can have an arbitrary number of parameters describing the
  bean dependencies. Let's consider a more real-world scenario with
  several @Configuration classes, each depending on beans declared in
  the others:

@Configuration
public class ServiceConfig {

    @Bean
    public TransferService transferService(AccountRepository accountRepository) {
        return new TransferServiceImpl(accountRepository);
    }

}

@Configuration
public class RepositoryConfig {

    @Bean
    public AccountRepository accountRepository(DataSource dataSource) {
        return new JdbcAccountRepository(dataSource);
    }

}

@Configuration
@Import({ServiceConfig.class, RepositoryConfig.class})
public class SystemTestConfig {

    @Bean
    public DataSource dataSource() {
        // return new DataSource
    }

}

public static void main(String[] args) {
    ApplicationContext ctx = new     AnnotationConfigApplicationContext(SystemTestConfig.class);
    // everything wires up across configuration classes...
    TransferService transferService = ctx.getBean(TransferService.class);
    transferService.transfer(100.00, "A123", "C456");
}

A: The second (if you consider testing at the point of writing your code, too). Always try to avoid hard-wiring and create instances by means of dependency-injection so that it will be much easier to test your code (e.g. Mocking https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-testing.html) and stay configurable.


text:
Q: Hosting servers: Listing all folders and files in certain directory on the screen When I enter url, for example ignasdamunskis.lt/sites, I want all the items in the sites directory to be listed on the screen.
Is it possible without me listing them by hand? Is it secure for my website?

A: In the folder, add a file named .htaccess containing the following:
Options +Indexes
This assumes your hosting allows such on-the-fly configuration.
Is it secure? Well, that depends on what's in the folder!


text:
Q: RDP File transfer is really slow. Any way to speed it up? The host is running Windows XP Prof SP3 and the client is running Windows 7 Ultimate SP1 x64.
So ... I connect to the remote machine with a 15mbps of ADSL. Which ... I guess, got enough downstream. (~1.3 MB/s). The host machine got a 35mbps of upload. Which is again, fast enough to pump the data with max speed.
All I get is like ~320-400 kbps transfer speed. That is really slow. Is there a way to speed it up?

A: RDP uses a lot of it's bandwidth for screen data and instruction transfer. It's not exactly designed as a file transfer protocol. I'd say 300-400kbps it probably pretty decent for what you're trying to do.
Also, if you're connecting remotely, you probably are running a VPN connection, which takes it's own connection overhead with encryption other protocol requirements.
If you need to transfer a large file between these machines, you'll probably get a much better throughput installing Dropbox on both of them and syncing files that way.
http://www.dropbox.com/

A: Use TeamViewer - it's free and the setup is simple.
Set it up on the remote using your RDP connection.
I needed a 7Gbyte backup of an SQL database - RDP estimated 10 hours, and looked like it was being optimistic. I cancelled it after 30 minutes, then installed Teamviewer on the remote (about 4 minutes)
Teamviewer file transfer (with the RDP connection open the whole time) - 37 minutes.
Remember, if teamViewer ever asks if you need it for 'personal only', 'business' or 'both', always answer "personal only"
good luck!

A: I just had  the same trouble with RDP transfer.
Also, I had trouble setting up a windows share to transfer between windows machines.
So, I used the simple and well understood sftp protocol by using a free ssh/sftp server
http://www.bitvise.com/ssh-server-download
and an sftp/ssh client http://www.bitvise.com/ssh-client-download.
I transfered 300MB(megabytes) in 2 minutes.

A: There is a TechNet thread that describes a similar issue to the one you described. The best answer marked by Nicholas Li from Microsoft suggests you to consider trying RichCopy. As noted, this is not considered to be a fix for the problem but you might be able to achieve better throughput.
Also, more information on Remote Desktop Protocol as well as its design and input capabilities over network connections for Windows-based applications can be found here. It may be helpful to read so as to understand the RDP architecture and features more concisely.


text:
Q: Average electric field calculated from average potential In a Griffiths problem (3.4) I'm asked to find the average electric field over the surface of a sphere due to point charges inside/outside the surface. The calculation is done in his solutions starting with some point charge a distance $z$ away from the origin, and then integrating the electric field over the surface of the sphere and dividing by the total area:
$\mathbf{E}_{ave} = \frac{1}{A} \int_A \mathbf{E} dA$.
This calculation is all well and good to me, but I'm asked by my job to make a solution video to this problem, and the solution they provide me first finds the average potential over the surface, then takes the gradient to find the average electric field:
$V_{ave} = \frac{q}{4\pi\epsilon_0z}, \implies \mathbf{E}_{ave} = -\partial_z V_{ave} \hat{\mathbf{z}} = \frac{q}{4\pi\epsilon_0 z^2} \hat{\mathbf{z}}.$
This doesn't make much sense to me. In the end you get the average potential as a function of $z$, but it's not the potential at $z$, it's just the average over the sphere given some fixed $z$. By taking the gradient you get the right answer, but I feel that this is a coincidence, since I don't think a derivative with respect to $z$ means what it should here. Is this correct?
Edit: Griffiths Introduction to Electrodynamics, 4e.

A:

In electrostatics we have
\begin{equation}
\mathbf{E}\left(\mathbf{r}\right)=\boldsymbol{-\nabla_{\mathbf{r}}} V\left(\mathbf{r}\right)
\tag{01}\label{eq01}
\end{equation}
In a region free of charges the electrostatic potential $\;V\left(\mathbf{r}\right)\;$ at a point $\;\mathrm P\;$ with position vector $\;\mathbf{r}\;$ is equal to the average potential on a spherical surface $\,\mathrm S(\mathbf{r},R)\,$with center at $\;\mathrm P\;$ and radius $\;R$, see Figure-01 above
\begin{equation}
V\left(\mathbf{r}\right)=\dfrac{1}{4\pi R^2}\!\!\oint\limits_{\mathrm S(\mathbf{r},R)}\!V\left(\mathbf{r'}\right)\mathrm{dS}=V_{\bf ave}^{\mathrm S}
\tag{02}\label{eq02}
\end{equation}
Note that this value is independent of the radius $\;R\;$  of the sphere as long as it does not contain charges. Inserting expression \eqref{eq02} in equation \eqref{eq01} we have
\begin{equation}
\mathbf{E}\left(\mathbf{r}\right)=\boldsymbol{-\nabla_{\mathbf{r}}}\left[\dfrac{1}{4\pi R^2}\!\!\oint\limits_{\mathrm S(\mathbf{r},R)}\!\!V\left(\mathbf{r'}\right)\mathrm{dS}\right]
\tag{03}\label{eq03}
\end{equation}
Now we must examine if in the rhs of equation \eqref{eq03} it's permissible to insert into the integral the gradient $\;\boldsymbol{\nabla_{\mathbf{r}}}\;$ with respect to $\;\mathbf{r}\;$  as gradient $\;\boldsymbol{\nabla_{\mathbf{r'}}}\;$ with respect to $\;\mathbf{r'}$. In this case
\begin{equation}
\mathbf{E}\left(\mathbf{r}\right)=\dfrac{1}{4\pi R^2}\!\!\oint\limits_{\mathrm S(\mathbf{r},R)}\!\!\bigl[\boldsymbol{-\nabla_{\mathbf{r'}}}V\left(\mathbf{r'}\right)\bigr]\mathrm{dS}=\dfrac{1}{4\pi R^2}\!\!\oint\limits_{\mathrm S(\mathbf{r},R)}\!\!\mathbf{E}\left(\mathbf{r'}\right)\mathrm{dS}=\mathbf{E}_{\bf ave}^{\mathrm S}
\tag{04}\label{eq04}
\end{equation}
That from \eqref{eq03} we could have \eqref{eq04} is proved below.

Proof  (see Figure-02 in the bottom)
\begin{equation}
V\left(\mathbf{r}+\mathrm d\mathbf{r} \right)=\dfrac{1}{4\pi R^2}\!\!\oint\limits_{\mathrm \Sigma(\mathbf{r}+\mathrm d\mathbf{r},R)}\!\!\!V\left(\mathbf{r'}+\mathrm d\mathbf{r}\right)\mathrm{d\Sigma}\stackrel{\mathrm d\mathbf{r}\equiv\mathrm d\mathbf{r'}}{=\!=\!=\!=}\dfrac{1}{4\pi R^2}\!\!\oint\limits_{\mathrm \Sigma(\mathbf{r}+\mathrm d\mathbf{r},R)}\!\!\!V\left(\mathbf{r'}+\mathrm d\mathbf{r'}\right)\mathrm{d\Sigma}
\tag{05}\label{eq05}
\end{equation}
\begin{align}
V\left(\mathbf{r}+\mathrm d\mathbf{r} \right)-V\left(\mathbf{r}\right)& =\dfrac{1}{4\pi R^2}\!\!\oint\limits_{\mathrm S(\mathbf{r},R)}\!\bigl[V\left(\mathbf{r'}+\mathrm d\mathbf{r'}\right)-V\left(\mathbf{r'}\right)\bigr]\mathrm{dS}
\nonumber\\
&= \dfrac{1}{4\pi R^2}\!\!\oint\limits_{\mathrm S(\mathbf{r},R)}\!\biggl[\dfrac{V\left(\mathbf{r'}+\mathrm d\mathbf{r'} \right)-V\left(\mathbf{r'}\right)}{\mathrm d\mathbf{r'}}\biggr]\boldsymbol{\cdot}\mathrm d\mathbf{r'}\mathrm{dS}
\nonumber\\
&\stackrel{\mathrm d\mathbf{r'}\equiv\mathrm d\mathbf{r}}{=\!=\!=\!=}\left( \dfrac{1}{4\pi R^2}\!\!\oint\limits_{\mathrm S(\mathbf{r},R)}\!\biggl[\dfrac{V\left(\mathbf{r'}+\mathrm d\mathbf{r'} \right)-V\left(\mathbf{r'}\right)}{\mathrm d\mathbf{r'}}\biggr]\mathrm{dS}\right)\boldsymbol{\cdot}\mathrm d\mathbf{r}
\tag{06}\label{eq06}
\end{align}
\begin{equation}
\dfrac{V\left(\mathbf{r}+\mathrm d\mathbf{r} \right)-V\left(\mathbf{r}\right)}{\mathrm d\mathbf{r}} = \dfrac{1}{4\pi R^2}\!\!\oint\limits_{\mathrm S(\mathbf{r},R)}\!\biggl[\dfrac{V\left(\mathbf{r'}+\mathrm d\mathbf{r'} \right)-V\left(\mathbf{r'}\right)}{\mathrm d\mathbf{r'}}\biggr]\mathrm{dS}
\tag{07}\label{eq07}
\end{equation}
\begin{equation}
\lim_{\mathrm d\mathbf{r}\rightarrow\boldsymbol{0} }\dfrac{V\left(\mathbf{r}+\mathrm d\mathbf{r} \right)-V\left(\mathbf{r}\right)}{\mathrm d\mathbf{r}} = \dfrac{1}{4\pi R^2}\!\!\oint\limits_{\mathrm S(\mathbf{r},R)}\!\biggl[\lim_{\mathrm d\mathbf{r'}\rightarrow\boldsymbol{0}}\dfrac{V\left(\mathbf{r'}+\mathrm d\mathbf{r'} \right)-V\left(\mathbf{r'}\right)}{\mathrm d\mathbf{r'}}\biggr]\mathrm{dS}
\tag{08}\label{eq08}
\end{equation}
\begin{equation}
\dfrac{\mathrm d V\left(\mathbf{r}\right)}{\mathrm d\mathbf{r}} = \dfrac{1}{4\pi R^2}\!\!\oint\limits_{\mathrm S(\mathbf{r},R)}\!\!\!\dfrac{\mathrm d V\left(\mathbf{r'}\right)}{\mathrm d\mathbf{r'}}\mathrm{dS}
\tag{09}\label{eq09}
\end{equation}
\begin{equation}
\boldsymbol{\nabla_{\mathbf{r}}} V\left(\mathbf{r}\right) = \dfrac{1}{4\pi R^2}\!\!\oint\limits_{\mathrm S(\mathbf{r},R)}\!\!\boldsymbol{\nabla_{\mathbf{r'}}}V\left(\mathbf{r'}\right)\mathrm{dS}
\tag{10}\label{eq10}
\end{equation}


text:
Q: How to save and fetch image into/from MySQL database using spring rest and reactjs Help me to create an app using react and spring rest to store and fetch images from MySQL database

A: Take a look at Spring Content, a community project, that provides a Spring Data like Java and REST API for content; i.e. files, images, and videos.  It provides several interfaces for managing content either directly, or through association with Spring Data entities.  With several modules for supporting different types of storage including JPA for storing content as BLOBs.  Also with extension APIs for versioning, rendering content into different formats and full-text search.
As you have Spring Boot it is pretty easy to add to your project.

pom.xml

   <!-- other dependencies -->
   ...

   <!-- Java API -->
   <dependency>
      <groupId>com.github.paulcwarren</groupId>
      <artifactId>spring-content-jpa-boot-starter</artifactId>
      <version>1.1.0.M2</version>
   </dependency>

   <!-- REST API -->
   <dependency>
      <groupId>com.github.paulcwarren</groupId>
      <artifactId>spring-content-rest-boot-starter</artifactId>
      <version>1.1.0.M2</version>
   </dependency>

YourEntity.java

public class YourEntity {

   ... existing fields...

   @ContentId
   private UUID contentId;

   @ContentLength
   private Long contentLen;

   @MimeType
   private String mimeType;
}

ImageContentStore.java

@StoreRestResource(path = "images")
public interface ImageContentStore extends ContentStore<YourEntity, UUID> {
}

This is all you need to do to configure your application with REST Endpoints for managing content associated with YourEntity in a database.
How this actually works is very much like Spring Data.  When your application starts Spring Content will see the spring-content-jpa dependency, know that you want to store content on your filesystem and inject a JPA-based implementation for the ImageContentStore interface.  It will also see the spring-content-rest dependency and inject a Controlller (i.e. REST endpoints) that use to the ImageContentStore interface.  Therefore, you don't have to code up any of this yourself.
On the client-side use, in your reactjs code, you can then consume these REST api as you would any other Rest API.  I am not a react person so I'll give curl examples:
So...
curl -X POST /yourEntities/{yourEntityId} -F 'file=@path/to/local/file.jpg'
will store the content path/to/local/file.jpg in the database and associate it with YourEntity whose id is yourEntityId.
curl /yourEntities/{yourEntityId} -H 'Accept: image/jpg'
will fetch it again and so on...
The REST API supports full CRUD (and video streaming too)
There getting started guides and videos here.  The  reference guide for Spring Content JPA is here.
HTH


text:
Q: Calculated field column I am trying to compare two date columns in SharePoint. I need to update the created date field to a different date, but only on documents that have a scan date less than the created date. So I have a formula in a date update column thatstates =IF([Scan Date]<[Created],"Yes"), but when I apply it, it says that all of the documents have a scan date less than the created date. So I thought ok, that is not working, I will change it to say if the dates are equal to say "No" and the formula I have is =IF([Scan Date]=Created,"NO","YES") and the results are all "No".  So the formula only half works. What am I doing wrong? Any help would be greatly appreciated!

A: The following worked for me, where
[Scan Date] is Date and Time Column,
[Created] is a System column shows when items are created and
[ScanStatus] Calculated column outputs Single line of text
Does it match your conditions?
=IF([Scan Date]<Created,"Yes","No")

Updated the formula
to show date comparisons:
If column Date and Time format is Date Only then [Date1]=[Date2]
If the format is Date and Time use as shown below:
=IF(DATE(YEAR([Scan Date]),MONTH([Scan Date]),DAY([Scan Date]))=DATE(YEAR(Created),MONTH(Created),DAY(Created)),"Yes","No")

A: I tested with similar setup with Matiur and it also works in my end. Try with the formula below.
=IF(([Scan Date]<[Created Date]),"Yes","No")


text:
Q: Can you deallocate functions in C++? I was recently told that functions cannot be deallocated, but after-all they are instructions that do take some memory right? Just like how Constructors and Destructors work. So is there a way to deallocate functions?

A: A great deal of program memory is allocated "statically" (executable code, global variables, constants); i.e. mapped once for all and claimed from the system at load time. They stay allocated during the whole program lifetime and there is nothing you can do.
Large heap space and stack space are also preallocated, but can be extended as required. Dynamically allocated variables as well as automatic ones are indeed created and deleted on demand during program allocation, but that does not necessarily mean that the "memory consumption" decreases, as the heap and stack spaces are always there.
Note that constructors and destructors do not allocate any memory, they just perform the initialization and de-initialization tasks. Allocation/deallocation is performed upon function entry/exit, on the stack, or upon invocation of new/delete, on the heap.

In fact, things are more complicated, as the memory space of a process is virtualized, i.e. mapped to physically available RAM and disk blocks, which are shared between all running processes.

A: Yes there is. If you load functions in a Dll (LoadLibrary) or a .so (dlopen). You will deallocate the function when you call FreeLibrary or dlclose respectively.


text:
Q: Spring Boot Kafka consumer with multiple types crashing It is my understanding, if I have topic1=ClassA, topic2=ClassB in the same process, I need 2 container factories?
My configuration class:
@Bean
public ConsumerFactory<String, MessageADto> xxxConsumerFactory() {
    return new DefaultKafkaConsumerFactory<>(consumerConfigs(), new StringDeserializer(), new JsonDeserializer<>(MessageADto.class));
}

@Bean
public ConcurrentKafkaListenerContainerFactory<String, MessageADto> xxxListenerContainerFactory() {
    ConcurrentKafkaListenerContainerFactory<String, MessageADto> factory = new ConcurrentKafkaListenerContainerFactory<>();
    factory.setConsumerFactory(xxxConsumerFactory());
    return factory;
}

@Bean
public ConsumerFactory<String, MessageBDto> xxx2ConsumerFactory() {
    return new DefaultKafkaConsumerFactory<>(consumerConfigs(), new StringDeserializer(), new JsonDeserializer<>(MessageBDto.class));
}

@Bean
public ConcurrentKafkaListenerContainerFactory<String, MessageBDto> xxx2ListenerContainerFactory() {
    ConcurrentKafkaListenerContainerFactory<String, MessageBDto> factory = new ConcurrentKafkaListenerContainerFactory<>();
    factory.setConsumerFactory(xxx2ConsumerFactory());
    return factory;
}

private Map<String, Object> consumerConfigs() {
    Map<String, Object> props = new HashMap<>();
    props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, getKafkaHost());
    props.put(ConsumerConfig.GROUP_ID_CONFIG, "xxx");
    props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);
    props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, JsonDeserializer.class);
    return props;
}

In my rest controller class, I have the following listeners (just for POC):
@KafkaListener(topics=KafkaTopicConfig.xxx_TOPIC, containerFactory="xxxListenerContainerFactory")
public void xxxListener(MessageADto message) {
    System.out.println(message.getMessage());
}

@KafkaListener(topics=KafkaTopicConfig.xxx2_TOPIC, containerFactory="xxx2ListenerContainerFactory")
public void xxx2Listener(MessageBDto message) {
    System.out.println(message.getMessage() + " : " + message.getCount());
}

For the rest controller method, I have to send MessageADto and MessageBDto:
        MessageBDto messageBDto = new MessageBDto() {{ setMessage(message.getMessage()); setCount(17); }};
        this.kafkaService.sendMessageB(messageBDto);
        return convertToDto(this.kafkaService.sendMessageA(message).get().getRecordMetadata());

This produces an exception:
org.apache.kafka.common.errors.SerializationException: Error deserializing key/value for partition dtms2-0 at offset 0. If needed, please seek past the record to continue consumption.
Caused by: java.lang.IllegalArgumentException: The class 'org.xxx.xxx.controllers.KafkaController$1' is not in the trusted packages: [java.util, java.lang, org.xxx.xxx.dtos]. If you believe this class is safe to deserialize, please provide its name. If the serialization is only done by a trusted source, you can also enable trust all (*).
    at org.springframework.kafka.support.converter.DefaultJackson2JavaTypeMapper.getClassIdType(DefaultJackson2JavaTypeMapper.java:125) ~[spring-kafka-2.4.1.RELEASE.jar:2.4.1.RELEASE]
    at org.springframework.kafka.support.converter.DefaultJackson2JavaTypeMapper.toJavaType(DefaultJackson2JavaTypeMapper.java:99) ~[spring-kafka-2.4.1.RELEASE.jar:2.4.1.RELEASE]
    at org.springframework.kafka.support.serializer.JsonDeserializer.deserialize(JsonDeserializer.java:425) ~[spring-kafka-2.4.1.RELEASE.jar:2.4.1.RELEASE]
    at org.apache.kafka.clients.consumer.internals.Fetcher.parseRecord(Fetcher.java:1268) ~[kafka-clients-2.3.1.jar:na]
    at org.apache.kafka.clients.consumer.internals.Fetcher.access$3600(Fetcher.java:124) ~[kafka-clients-2.3.1.jar:na]
    at org.apache.kafka.clients.consumer.internals.Fetcher$PartitionRecords.fetchRecords(Fetcher.java:1492) ~[kafka-clients-2.3.1.jar:na]
    at org.apache.kafka.clients.consumer.internals.Fetcher$PartitionRecords.access$1600(Fetcher.java:1332) ~[kafka-clients-2.3.1.jar:na]
    at org.apache.kafka.clients.consumer.internals.Fetcher.fetchRecords(Fetcher.java:645) ~[kafka-clients-2.3.1.jar:na]
    at org.apache.kafka.clients.consumer.internals.Fetcher.fetchedRecords(Fetcher.java:606) ~[kafka-clients-2.3.1.jar:na]
    at org.apache.kafka.clients.consumer.KafkaConsumer.pollForFetches(KafkaConsumer.java:1263) ~[kafka-clients-2.3.1.jar:na]
    at org.apache.kafka.clients.consumer.KafkaConsumer.poll(KafkaConsumer.java:1225) ~[kafka-clients-2.3.1.jar:na]
    at org.apache.kafka.clients.consumer.KafkaConsumer.poll(KafkaConsumer.java:1201) ~[kafka-clients-2.3.1.jar:na]
    at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.doPoll(KafkaMessageListenerContainer.java:1012) ~[spring-kafka-2.4.1.RELEASE.jar:2.4.1.RELEASE]
    at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.pollAndInvoke(KafkaMessageListenerContainer.java:968) ~[spring-kafka-2.4.1.RELEASE.jar:2.4.1.RELEASE]
    at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.run(KafkaMessageListenerContainer.java:905) ~[spring-kafka-2.4.1.RELEASE.jar:2.4.1.RELEASE]
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[na:na]
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na]
    at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]

I don't understand this exception. What does it have to do with my controller class?

A: You need to add your controller class to the list of trusted packages
Try adding this to your properties file
spring.kafka.consumer.properties.spring.json.trusted.packages=*
If it works then you can figure out what packages you need specifically and replace the * for the package names separated by commas.


text: Q: Use local custom images as thumbnails for Firefox Is there any way to set custom thumbnail from local storage without having to upload the image and paste its url address? Sometimes images are taking (too much) time to be appeared.


text:
Q: Using azure blob storage as repository for gradle I am trying to set up an artifact repository on Azure Blob Storage. I will like to publish my artifact, generated through gradle build, to this repo and later use this artifact as dependency in some other gradle project.
Any thoughts?

A: You could use Azure File Copy task to copy your artifatc to Microsoft Azure storage blobs. Then, you can Download blobs from Azure Blob Storage by using AzCopy as dependency.

A: This response may be delayed, but I encountered a similar issue and was able to resolve it by using SFTP to publish the artifact to a blob container. To do this, you will need to follow these steps:
In your build.gradle file, set up the Maven publish plugin to declare the Maven repository that you want to publish to using SFTP.
Provide your SFTP credentials to authenticate and authorize the publish action.
By following these steps, you should be able to publish your artifact to the blob container successfully.
publishing {
    publications {
        maven(MavenPublication) {
            groupId '<com. ... group here>'
            artifactId '<artifactId here>'
            version '1.0.0.0'
            artifact 'build/outputs/aar/...-release.aar'
        }
    }

    repositories {
        maven {
            url 'sftp://<workspace name here>.blob.core.windows.net:22'
            credentials {
                username "<username here>"
                password "<password here>"
            }
        }
    }
}

To read the published artifact you declare in settings.gradle
pluginManagement {
    repositories {
        gradlePluginPortal()
        google()
        mavenCentral()
    }
}
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        // Using Blob Storage
        maven {
            url "https://<workspace name here>.blob.core.windows.net/<container name here>/"
            credentials {
                username "<username here>"
                password "<password here>"
            }
        }
        jcenter() // Warning: this repository is going to shut down soon
    }
}

and in your dependecies you can now use your artifact
dependencies {
    // Add Dependency
    implementation(group: '<com. ... group here>', name: '<artifactId here>', version: '1.0.0.0')
    // Other dependencies goes here
}

Hope this can help you.


text:
Q: Angular 1.2.5 nested animations Using ng-view, I would like a simple fadeIn / fadeOut for page transitions.  However, in different "views" I have child elements that I would like to animate at the same time as the fadeIn/fadeOut are happening on the parent element.  The problem is, that angular cancel's any nested animations if the parent is animating.  Why is this?  Is there another way to achieve what I want?

A: You should be able to use the $animate service instead of ngAnimate. If you do this, you can chain the animations with a promise.
https://docs.angularjs.org/api/ngAnimate/service/$animate


text:
Q: Why does any non-trivial permutation of ${\rm Aut}(S(5,6,12))$ at least alter $8$ symbols? In my study on Mathieu Groups I came across the following article.
R.G. Stanton states on the second page:

... thus $M_{12}$ is $5$-fold transitive and so has order $m_{12} = 12\cdot 11\cdot 10\cdot 9\cdot 8 \cdot k$, where $k$ is the order of the subgroup leaving five persons invariant. Since every permutation other than the identity of an $l$-fold transitive group must alter at least $2l-2$ symbols, it is necessary that $k$ be unity and so $m_{12} = 95040$.

As discussed in my question here, the $2l-2$ argument doesn't hold for every group (take $S_3$ as a $3$-transitive group).
But this result is only needed for a group on $12$ symbols (which is maybe what R.G. Stanton meant).
So the question arises whether any permutation of a $5$-fold transitive group on $12$ symbols moves at least $8$ symbols. This would make his argument correct.
EDIT: As discussed in the comments, $M_{12}$ is defined in terms of the automorphism group of a Steiner System $S(5,6,12)$. The "$2l-2$"- argument then only needs to apply to this group.