text:
Q: Android rotate a shape use java code I have a XML format like this:
XML:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
  <item>
    <rotate
      android:fromDegrees="45"
      android:toDegrees="45"
      android:pivotX="13%"
      android:pivotY="-40%">
      <shape
        android:shape="rectangle" >
        <solid android:color="#FFFFFFFF" />
      </shape>
    </rotate>
  </item>
</layer-list>

I want to implement it use java code without xml, how?

A: OK,now I have know how to do this
java code :
View view = new View(getContext());
GradientDrawable iconPlayShape = new GradientDrawable();
iconPlayShape.setShape(GradientDrawable.RECTANGLE);
iconPlayShape.setColor(Color.WHITE);
RotateDrawable iconPlayRotate = new RotateDrawable();
iconPlayRotate.setFromDegrees(45.0f);
iconPlayRotate.setToDegrees(45.0f);
iconPlayRotate.setPivotXRelative(true);
iconPlayRotate.setPivotYRelative(true);
iconPlayRotate.setPivotX(0.13f);
iconPlayRotate.setPivotY(-0.4f);
iconPlayRotate.setDrawable(iconPlayShape);
iconPlayRotate.setLevel(1);
view.setBackground(iconPlayRotate);

A: You need to create an instance of LayerDrawable, you can read more about the class here. Provide the class constructor with an array of Drawable objects. In your case the Drawable objects should be of the type RotateDrawable (more information here)


text:
Q: Using mouse-over on raster surface to stream values to text file using ArcGIS Desktop? This is a weird one. I have a user who wants to add a statistical surface to ArcMap and then mouse-over the raster surface and stream those values (z) to a text file. MouseTips can show underlying values, but I can't see a way to use it.
I'm not inclined to create features and geoprocess them for the results as the user wanted a real time experience. Several searches in stack and google have not yielded any results.
I am using ArcGIS Desktop 10.3.1.
Is it even possible?

A: Assuming that the user is not processing the output file as the Z values come into it, I think the answer will be to use stream mode when adding a line to get the "real-time" capturing effect that your user is after.
Once you have the line, use its vertices (you may need to convert them to points first), to get cell values for them that you write to the text file.
Alternatively, I suspect that you would need to use ArcObjects to do more precisely what you describe.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Embed Microsoft Word, Excel documents inside python desktop application using PyQt I am trying to use python-oletools to embed MS word, Excel inside my PyQt Desktop Application.
I am expecting something like how eclipse opens Word & Excel?
Is there any other way I can achieve this?

A: I don't know how Eclipse does it, but QAxContainer is how I would do it (assuming you're on Windows).


text:
Q: swift EXC_BAD_INSTRUCTION error in playground I have the following test code...
import Foundation

var n = 5

let binSlots = 64
var numOfOnes = 0
var inSequence = false

func toThePower(number: Int, power: Int) -> Int {
    var ans = number
    for _ in 1..<power  {
        ans = ans * number
    }
    return ans
}

// the following line is fine
if n <= toThePower(number: 2, power: 4) {
    print("ok")
}

for i in stride(from: binSlots, through: 0, by: -1) {
    // the following line produces this error:
    // // error: Execution was interrupted, reason:
    // EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0).
    let pCalc = toThePower(number: 2, power: i)

    if n >= pCalc {
        n = n - pCalc
        numOfOnes += 1
        inSequence = true
    }
    else {
        if inSequence {
            break
        }
    }
}

Any clues as to what's causing the error? I know that if I comment out the following...
//    for _ in 1..<power  {
//        ans = ans * number
//    }

the error goes away however I don't know why or why the first call to the function runs with no errors.
I have looked at other similar posts but none was similar to my case.
your help is appreciated.
thank you.

A: Your error is from this line in your toThePower function:
for _ in 1..<power  {

The problem is that the right side of the range can't be smaller than the left side of the range.
The line:
for i in stride(from: binSlots, through: 0, by: -1) {

results in you calling your toThePower function with a power down to and including 0.
0 is less than 1, hence the crash.
Change:
for i in stride(from: binSlots, through: 0, by: -1) {

to:
for i in stride(from: binSlots, through: 1, by: -1) {

to avoid the crash.


text:
Q: stackView not expanding according to to the dynamic label content

I am using stackView to show the hierarchy shown in image1. The two labels are in vertical stack view and then this stack view with the image is combined in an horizontal stackview.
I set the description label no of lines to 0 and make it workWrap
but as this the cell is not expanding according to data.

A: I made it solved by adding the both labels in view. Everything else is same.
Select both label -> Editor -> Embed In -> View


text:
Q: Movieclips inside movieclips I have created a movieclip with some buttons inside it divided in 5 categories (frutoN). Each categorie will have a different ammount of buttons (frutoLC).
The Variable frutoLN is the instance name for that specifc buttom (ie: bt0101 or bt0532);
So, here is the question:
the variable frutoLN must have what kind of argument? I've tried :String and :MovieClip and none of them work at all.
for (frutoLC=1; frutoLC<=frutoL;frutoLC++){
        var frutoLN;
        frutoLN = "this.cena.cenaDentro.bt"+frutoN+""+frutoLC;
        trace ("frutoLN = "+frutoLN);
        frutoLN.visible = true;
    }

Sorry for my english and I hope I've made myself clear.

A: In your code above, the frutoLN variable will be a String object. To access the MovieClip you are looking for, you need to do something along these lines:
for (var frutoLC:uint = 1; frutoLC <= frutoL; frutoLC++) {
    var frutoLN:MovieClip = this.cena.cenaDentro["bt" + frutoN.toString() + frutoLC.toString()];
    frutoLN.visible = true;
}


text:
Q: Running docker on Ubuntu: mounted host volume is not writable from container Docker works great on a Mac for me, but I have to run docker host inside of a VirtualBox (or Parallels, or VMWare Fusion), since Mac's kernel doesn't support docker.
So I tried to setup my application and a docker-compose on an Ubuntu Desktop - natively, where both docker client and docker host run physically on the same system. This worked, but my running docker containers can't write into a mounted host volume.
I use docker-compose with the following settings:
volumes:
   - ./api:/usr/src/app

So I'm mounting the "api" directory of the host Ubuntu OS into docker container under /usr/src/app.
docker inspect <container ID> shows that the volume is writable
"Destination": "/usr/src/app",
"Mode": "rw",
"RW": true

However it is not: I get permission denied when I try to create a directory or edit a file from within the docker container.
I googled for this issue, of course, and I came across a few SELinux issues of CentOS/RHEL, but I'm running Ubuntu 15.10, 64 bit edition, not CentOS.

A: If your uid on the host (id -u) isn't the same as the uid of the user in the docker container (often "docker") then you can have this problem.  You can try:

*

*Making the UIDs the same between your user and the user in the docker container.

*Setting the group permissions on the directory to be writable for a group that both you and docker belong to.

*You could also use the nuclear option:

chmod a+rwx -R project-dir/

The nuclear option will make your git workspace filthy, which will annoy you greatly, so isn't the best long-term solution.  It stops the bleeding tho.
For further understanding the problem, you might find these useful:

*

*https://github.com/docker/docker/issues/7906

*https://github.com/docker/docker/issues/7198

A: New answer:
This questions seems to have a lot of traffic and there is better solution available now -  fixuid, as the name suggests it's a magic executable to change the container user's uid & gid on container startup (using -u somebody:somebody).
For a more in dept explanation see:
https://boxboat.com/2017/07/25/fixuid-change-docker-container-uid-gid/

Old answer:
As of docker version 1.7 you have the option to mount a host directory with permissions to a container using the :Z or :z flags like so:
docker run -v ./api:/usr/src/app:Z

*

*:z - will add permissions to all containers using label 'svirt_sandbox_file_t'

*:Z - will add permissions only to the current container label

As of docker-compose v1.4.0, you can use it in docker compose like this:
volumes:
   - ./api:/usr/src/app:Z

Although I should add I still have some problems with this
(see Adding permissions to host directory with docker-compose).
References:
Using Volumes with Docker can Cause Problems with SELinux - http://www.projectatomic.io/blog/2015/06/using-volumes-with-docker-can-cause-problems-with-selinux/
Docker user guide -
   https://docs.docker.com/engine/userguide/dockervolumes/#volume-labels
Docker-compose release notes for v1.4.0 - https://github.com/docker/compose/releases/tag/1.4.0


text:
Q: JOIN Problems with SQL Server I have table (user_page_cells) displayed with the following query:
SELECT tag_id, nid
FROM user_page_cells WHERE nid = 1;

It gives me the results:

I also have a table (graph_tags):
SELECT *
FROM graph_tags where page_node = 1

which gives me the results:
.
user_page_cells.nid and graph_tags.page_node both reference page nodes.
I need a query that will display my first query results
(SELECT tag_id, nid FROM user_page_cells WHERE nid = 1;)

with one extra column. This column needs to have the default_graph_tag_id from the second table (graph_tags) if nid = page_node or a NULL at all if it doesn't.
I have tried using LEFT, RIGHT, FULL OUTER JOIN but I cannot get the results I am looking for.
Here is an example of the query I thought would work.
SELECT user_page_cells.tag_id, graph_tags.default_graph_tag_id
FROM user_page_cells
LEFT OUTER JOIN graph_tags ON user_page_cells.nid = graph_tags.page_node
WHERE user_page_cells.nid = 1.

I always get this no matter if LEFT, RIGHT, or FULL is used;

Can anyone point me in the right direction?
Thank you

A: You just need to include tag_id in your join, if I understand what you want.
SELECT user_page_cells.tag_id, graph_tags.default_graph_tag_id
FROM user_page_cells
Left OUTER JOIN graph_tags
ON user_page_cells.nid = graph_tags.page_node
and user_page_cells.tag_id=graph_tags.tag_id
where user_page_cells.nid = 1


text:
Q: assistance on good handling of text on TikZ paths I am putting together an ornate logo using TikZ. The logo as it is currently is as follows:

I request assistance on handling the lowermost outer text (which reads "UNIVERSITY OF GLASGOW"). For the purposes of easy legibility, I would like the text to be inverted with respect to what it is now. I'm relatively new to TikZ and I'm not sure how to approach the problem.
Comments on improving the code generally also are welcome. The code is as follows:
\documentclass[11pt]{scrartcl}
% TikZ
    \usepackage{tikz, pgfornament, tikzrput}
    \usetikzlibrary{decorations, decorations.text}
% font size
    \usepackage{fix-cm}
% cryillic font
    \usepackage[OT2, OT1]{fontenc}
    \newcommand\cyr{%
        \renewcommand\rmdefault{wncyr}%
        \renewcommand\sfdefault{wncyss}%
        \renewcommand\encodingdefault{OT2}%
        \normalfont
        \selectfont
    }
    \DeclareTextFontCommand{\textcyr}{\cyr}
    \def\Eoborotnoye{\char3}
    \def\eoborotnoye{\char11}
    \def\cprime{\char126}
    \def\cdprime{\char127}
\begin{document}
    \begin{tikzpicture}
        % outer circle
            \draw[line width=2 mm] circle[radius=7.4 cm];
        % inner circles
            \draw[ultra thick] circle[radius=6 cm] circle[radius=7 cm]  ;
        % outer text
            \path[
                rotate=-15.2,
                postaction={
                    decoration={
                        text along path,
                        text format delimiters={|}{|},
                        text={
                            |\Huge|
                            {\pgfornament[scale=.4, ydelta=-9 pt]{15}}
                            UNIVERSITY OF GLASGOW
                            {\pgfornament[scale=.4, ydelta=-9 pt]{15}}
                            OFFICIAL DRINK PARTICLE PHYSICS EXPERIMENT
                        },
                        text align=fit to path,
                        reverse path
                    },
                    decorate
                }
            ]
            circle[radius=6.2 cm];
        % top ornamentation
            \rput{-30}(2.5, 4.2){\pgfornament[scale=.4]{87}}
            \rput{30}(-2.5, 4.2){\pgfornament[scale=.4]{87}}
        % bottom ornamentation
            \rput(0, -2.5){\pgfornament[scale=.7]{75}}
        % right ornamentation
            \rput{-90}(5, 0){\pgfornament[scale=.6]{72}}
        % left ornamentation
            \rput{90}(-5, 0){\pgfornament[scale=.6, symmetry=v]{72}}
        % central text
            \node[font=\fontsize{35}{60}\selectfont] at (0, 2.5){P.P.E.};
            \node[font=\fontsize{60}{60}\selectfont] at (0, 0.5){{\cyr k v a s}};
            \node[font=\huge] at (0, -5){MMXII};
    \end{tikzpicture}
\end{document}

many thanks for your assistance

A: As percusse commented, the easiest way is to use two arcs, one of which is without reversing the text.
\documentclass[11pt]{scrartcl}
% TikZ
    \usepackage{tikz, pgfornament, tikzrput}
    \usetikzlibrary{decorations, decorations.text}
% font size
    \usepackage{fix-cm}
% cryillic font
    \usepackage[OT2, OT1]{fontenc}
    \newcommand\cyr{%
        \renewcommand\rmdefault{wncyr}%
        \renewcommand\sfdefault{wncyss}%
        \renewcommand\encodingdefault{OT2}%
        \normalfont
        \selectfont
    }
    \DeclareTextFontCommand{\textcyr}{\cyr}
    \def\Eoborotnoye{\char3}
    \def\eoborotnoye{\char11}
    \def\cprime{\char126}
    \def\cdprime{\char127}
\begin{document}
    \begin{tikzpicture}
        % outer circle
            \draw[line width=2 mm] circle[radius=7.4 cm];
        % inner circles
            \draw[ultra thick] circle[radius=6 cm] circle[radius=7 cm]  ;
        % outer text
            \path[
                %rotate=-15.2,
                postaction={
                    decoration={
                        text along path,
                        text format delimiters={|}{|},
                        text={%
                            |\Huge|
                            {\pgfornament[scale=.4, ydelta=-9 pt]{15}}
                            OFFICIAL DRINK PARTICLE PHYSICS EXPERIMENT
                            {\pgfornament[scale=.4, ydelta=-9 pt]{15}}
                        },
                        text align=center,
                        reverse path
                    },
                    decorate
                }
            ]
             (-27:6.2cm) arc (-27:210:6.2cm);
\path [postaction={decorate,decoration={text along path, text align=fit to path,text={|\Huge|UNIVERSITY OF GLASGOW}}}] (209:6.8cm) arc (209:330:6.8cm);
        % top ornamentation
            \rput{-30}(2.5, 4.2){\pgfornament[scale=.4]{87}}
            \rput{30}(-2.5, 4.2){\pgfornament[scale=.4]{87}}
        % bottom ornamentation
            \rput(0, -2.5){\pgfornament[scale=.7]{75}}
        % right ornamentation
            \rput{-90}(5, 0){\pgfornament[scale=.6]{72}}
        % left ornamentation
            \rput{90}(-5, 0){\pgfornament[scale=.6, symmetry=v]{72}}
        % central text
            \node[font=\fontsize{35}{60}\selectfont] at (0, 2.5){P.P.E.};
            \node[font=\fontsize{60}{60}\selectfont] at (0, 0.5){{\cyr k v a s}};
            \node[font=\huge] at (0, -5){MMXII};
    \end{tikzpicture}
\end{document}

To get a customized look, one may adjust the angles in the definitions of arcs. Some more details can be found in these answers.


text:
Q: How do I resize a UITableViewCell according to the size of a UITextView inside it? I need to be able to resize a UITableViewCell from within the cell according to the height of a UITextView object in the table view cell. As the user types more characters in the text view, the text view needs to increase in height and the table view cell needs to increase in height also to accomodate the height of the text view. I need to do this without UITableView.reloadData(), as I need the text view to remain first responder as the user types more characters into it.
I have tried using NSLayoutConstraint.deactivate(:), NSLayoutConstraint.activate(:), contentView.updateConstraints(), contentView.updateConstraintsAsNeeded(), contentView.setNeedsUpdateConstraints(), contentView.layoutIfNeeded() and UITextView.sizeToFit() with constraints on the height of the text view and on the contentView in different combinations.
I have not gotten it to work.
I include the code for my table view cell subclass. I put a comment where I tried all the code I mentioned.
    import UIKit

    class TableViewCell: UITableViewCell {

        @IBOutlet weak var textView: UITextView!

        override func awakeFromNib() {
            super.awakeFromNib()

            textView.delegate = self
            textView.textContainer.lineBreakMode = .byWordWrapping
            textView.isScrollEnabled = false

        }

    }

    extension TableViewCell: UITextViewDelegate {

        func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {

            // !!! I tried the code here !!!

            return true

        }

    }

In the table view controller I have this code:
        override func viewDidLoad() {
            super.viewDidLoad()

            tableView.rowHeight = 44
            tableView.rowHeight = UITableViewAutomaticDimension
            tableView.estimatedRowHeight = 44

        }

I can get the table view cell to resize when I use UITableView.reloadData(), but I can't get it to work otherwise.
I have looked at the other questions on StackOverflow and have not found a solution.
This helped
(How do I resize a UITableViewCell according to the size of a UITextView subView?)
but it solves the problem in a way that is not the intended way. I suspect the way Apple intends for this problem to be solved has to do with the other ways I've tried, namely using constraints.
I hope someone knows how to do what I want to do. Any help is appreciated.

A: Since you have turned off the scrolling behaviour of textview in your TableViewCell, you can call the delegate to your view controller when and call it when text changes.
 protocol TextFieldUpdateDelegate {
     func textFieldDidChangeText(_ textview: UITextView)
 }

Now in your view controller's delegate conformance.
func textFieldDidChangeText(_ textView: UITextView) {
     tableView.beginUpdate()
     tableView.endUpdate()
}

According to docs:

You can also use this method followed by the endUpdates() method to animate the change in the row heights without reloading the cell.

And this should update the height of the tableview cell according to the contained text in the textView.


text:
Q: Trouble with Microsoft Word 2008 and AFP Sharing Currently, I have a central server that is accessed by many users through AFP sharing. Sometimes, multiple users may have the same Word document open, while other times it may just be one user and one document at a time. No matter what the case may be, an underlying problem persists when Microsoft Word attempts to interact with the network share, both with loading and saving documents. A common workaround will be to copy the required document to the local computer, edit it as necessary, and copy it back and replace the file. However, I'd like to be able to do all the file editing on the server, as it ends up becoming a question of sheer convenience. Also, sometimes Finder will crash as well as Microsoft Word crashing when trying to access or edit certain files. Is there anything I can do to remedy this issue?
Another piece of information to note is that although the word issues are pervasive, they do seem to occur more often when accessing the server via vpn. Thus the issue may simply be a slow network connection.
Are there underlying issues with office 2008? Is updating to 2011 the best course of action?
Also, I've noticed that the way this AFP share is set up, it seems that the connection only persists as long as the finder window opens. In other words, as soon as I close the finder window, when navigating back to the share on the server I will have to re-authenticate, seeming to suggest the connection does not persist and that the client computer repeatedly tries to reconnect to the server. Perhaps this may be the underlying cause? Any advice would be greatly appreciated.

A: are the affected users with network homes? MS Office apps try to create a temporary directory in the root of volumes which is very often prohibited by network policies. As far as I know similar issues are same for Office 2011 as Microsoft (similar to Adobe) doesn't support direct editing of files on shared volumes.


text:
Q: How to display a SearchBox in CommandBar I would like to add a AutoSuggestBox in the CommandBar. However the following code does not make the AutoSuggestBox stretch. I tried setting the HorizontalContentAlignment="Stretch" and HorizontalAlignment="Stretch", but it has no impact. What am I missing?
    <CommandBar Grid.Row="0" HorizontalContentAlignment="Stretch">
        <CommandBar.Content>
            <AutoSuggestBox HorizontalAlignment="Stretch" Margin="8 8 8 4" PlaceholderText="Search podcasts" QueryIcon="Find">
                <Interactivity:Interaction.Behaviors>
                    <Core:EventTriggerBehavior EventName="QuerySubmitted">
                        <Core:InvokeCommandAction
                    Command="{Binding SearchCommand}"
                    InputConverter="{StaticResource QueryArgsConverter}" />
                    </Core:EventTriggerBehavior>
                </Interactivity:Interaction.Behaviors>
            </AutoSuggestBox>
        </CommandBar.Content>
    </CommandBar>

A:
I tried setting the HorizontalContentAlignment="Stretch" and HorizontalAlignment="Stretch", but it has no impact.

Setting HorizontalAlignment to stretch means an element stretched to fill the entire layout slot of the parent element. In your code snippet, the AutoSuggestBox is inside the content of the CommandBar, if we checked the default template of CommandBar, the content of the CommandBar using a ContentControl. So actually the parent element is a ContentControl not the CommandBar directly. It seems like the size of ContentControl here is depend on its child size, so that AutoSuggestBox has no space to fill.
Actually the content area is designed aligned to the left side of the bar. Details see Anatomy of app bars. So I don't recommend  you to stretch it. You may consider using other controls as the container of the AutoSuggestBox. If you do want to have stretch effect you may calculate the width of AutoSuggestBox manually. For example:
<CommandBar x:Name="cmdbar">
    <CommandBar.Content>
        <AutoSuggestBox
            x:Name="autobox"
            Width="{Binding ElementName=cmdbar, Path=ActualWidth}"
            HorizontalAlignment="Stretch"
            PlaceholderText="Search podcasts"
            QueryIcon="Find" />
    </CommandBar.Content>
</CommandBar>


text:
Q: How does these services get passed into the controller? version 1.0.8 I got a new job, and took over some systems from some people that isn't here anymore. The version is all the way down to 1.0.8 in angular.js though, and the implementations they have been using seems to be what the community has been saying not to do since forever.
My question is, how do the vvscontroller get the services in as arguments?
I have been trying to grep through the project for any reference for the args: ElReport, ElRow, User, PriorReports, Documentation but it seems like they just magically get parsed in, then i searched for dependency injection, looking if i could find any implementations of the different providers the angular.js mentions, but i can only find the routeProvider and maybe something else that didn't look like it was configured.
So there is a lot of code where i don't think its related - but it might be but obviously i cannot post the entire code here. I was thinking it might be configured into the HTML or something but when i grep for ng-controller i don't find anything related to the PlumbingCtrl, but i just can't quite point it out. Can anyone tell me in what direction i should be looking?? what classes are likely to be used in order to achive this?

app.js

angular.module('housingevaluation', ['ngRoute', 'housingServices', 'ngUpload', 'angucomplete', 'ui.bootstrap.datetimepicker', 'ngResource', 'fcsa-number']).
    config(['$routeProvider', function($routeProvider) {
        $routeProvider.
            when('/', {templateUrl: 'partials/home.html', controller: HomeCtrl}).when('/vvs/:reportId', {templateUrl: 'partials/plumbing.html', controller: PlumbingCtrl}).
...more controllers + some config that does something with http/https(don't think thats related)

services.js

angular.module('housingServices', ['ngResource']).
        factory('ElReport', function($resource) {
        return $resource('reports/el/:id', {id: '@Id'}, {
            query: {method: 'GET', isArray: false},
            get: {method: 'GET'},
            save: {method: 'POST'},
            completeReport: {method: 'POST', url: 'reports/el/:id/complete'},
            reopenReport: {method: 'POST', url: 'reports/el/:id/reopen'},
            queryPlumbing: {method: 'GET', isArray: false},
            createCopy: {method: 'POST', url: 'reports/el/:id/reevaluation'},
            createRealCopy: {method: 'POST', url: 'reports/el/:id/copy'},
            markBilled: {method: 'POST', url: 'reports/el/:id/markBilled'}
        });
    }).
...some more factories (Documentation, User, etc.)
...some more directives

vvscontroller.js

function PlumbingCtrl($scope, $routeParams, $location, ElReport, ElRow, User, PriorReports, Documentation) {
...
}

index.html

<html ng-app>

Thanks !

A: you need to inject your controller in angularjs app module
  angular.module('housingServices').controller('PlumbingCtrl', PlumbingCtrl);
PlumbingCtrl.$inject = ['$scope', '$routeParams', '$location', 'ElReport', 'ElRow', 'User', 'PriorReports', 'Documentation'];
function PlumbingCtrl($scope, $routeParams, $location, ElReport, ElRow, User,
PriorReports, Documentation) {
   ...
          }

A: Looks like module housingevaluation is your root module of Angularjs application. All your services like ElReport , Documentation etc are part of module housingServices and module housingServices is injected to your root module module housingevaluation. It means all your services from module housingServices are accessible in module housingevaluation. And your all controllers are part of your root module that is module housingevaluation. Thats why all services from module housingServices are accessible in your controller.
One more thing is services.js and vvscontroller.js must be added in index.html before app.js.

EDIT :
Somewhere in your code PlumbingCtrl must have added to your root module housingevaluation. While adding the controller to module you can give order of depedancy injection for PlumbingCtrl. like this...
angular.module('housingevaluation')
  .controller('PlumbingCtrl', [ '$scope', '$routeParams', '$location', 'ElReport', 'ElRow', 'User', 'PriorReports', 'Documentation', function PlumbingCtrl($scope, $routeParams, $location, ElReport, ElRow, User, PriorReports, Documentation) {
    ...
}]);

Now while defining your controller you have to follow the same order for injecting the factories/services. like this...
function PlumbingCtrl($scope, $routeParams, $location, ElReport, ElRow, User, PriorReports, Documentation) { ... }

It may help you.


text:
Q: how to draw polygon in google map in iOS, zip code wise in iOS i am working on map view where i have list of zip code and i want to highlight area of every zip code on map.
i am using google map.
i have list of zip code.
what i actually need is boundary coordinates of every zip code.
actual requirements are in picture.

CLGeocoder *geoCoder = [[CLGeocoder alloc] init];
[geoCoder geocodeAddressString:@"94111" completionHandler:^(NSArray *placemarks, NSError *error) {

    GMSMutablePath *rect = [GMSMutablePath path];

    for (CLPlacemark* aPlacemark in placemarks)
    {
        // Process the placemark.
        CLLocation *location = aPlacemark.location;

        CLLocationCoordinate2D coordinate = location.coordinate;

        NSLog(@"Latitude %f", coordinate.latitude);

        NSLog(@"Longitude %f", coordinate.longitude);

        [rect addCoordinate:CLLocationCoordinate2DMake(coordinate.latitude, coordinate.longitude)];
    }

    // Create the polygon, and assign it to the map.
    GMSPolygon *polygon = [GMSPolygon polygonWithPath:rect];
    polygon.fillColor = [UIColor colorWithRed:0.25 green:0 blue:0 alpha:0.75];
    polygon.strokeColor = [UIColor blackColor];
    polygon.strokeWidth = 2;
    polygon.map = self.mapVew;

}];


text:
Q: How do I draw text into a subview? I want to draw text into UIView's subview using drawInRect:withFont:lineBreakMode call but that operates on the current context only.
Is it possible to draw text into a subview from current view?
The subview is a generic UIView instance and I don't really want to create a new UIView-derived class just for this purpose if I can avoid it.

A: No, if you're going to do something with a context, you have to be in that view's -drawRect:. You can always make your subview a UIView subclass that overrides -drawRect: to display the text you want... but at that point, you're kind of reinventing UILabel.

A: One option would be to add a CALayer to the view's layer instead of adding a UIView to the view.  The CALayer has a delegate property which you can assign any object to.  The CALayer calls:
- (void)drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx

on the delegate, which you can take to do something like:
- (void)drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx {
    if (layer == myLayer) {
        UIGraphicsPushContext(ctx);
        [string drawInRect:rect withFont:font lineBreakMode:mode];
        UIGraphicsPopContext();
    }
}

A: No, you can't do what you describe. Subclassing UIView is exactly the method you're supposed to use for this— there's nothing wrong with creating a UIView subclass which only has a simple -drawRect: method.


text:
Q: How can I return a single Promise[A] given A or Promise[A]? I have two functions that are working as expected

*

*def getSomething: Promise[JsValue]

*def getSomethingElse: Promise[JsValue]
Now I want to define a third function (def getAll: Promise[JsValue]) that calls getSomething and then based on the response either return the response or getSomethingElse and append its response to the original.
I currently have getAll defined as follows:
def getAll: Promise[JsValue] = {
  getSomething flatMap { response:JsValue =>
    (response \ "someAttribute").asOpt[String] match {
      case None =>
        val resultPromise = Promise[JsValue]
        resultPromise.redeem(response)
        resultPromise
      case Some(someAttribute) => getSomethingElse map { moreResponse:JsValue =>
        response ++ moreResponse
      }
    }
  }
}

This works but was wondering if there was a shorter way to accomplish the same thing that was more canonical scala?

A: Got a response from Derek Williams on the cross post on Play Frameworks Google Group.

The only thing I see there that isn't ideal is pattern matching on Option, instead using map/getOrElse gives you a bit more freedom to compose better. Also, if you aren't going to use some value, it's best to not give it a name and instead use _

def getAll: Promise[JsValue] = {
  getSomething flatMap { response =>
    (response \ "someAttribute").asOpt[String] map { _ =>
      getSomethingElse map (response ++ _)
    } getOrElse {
      Promise pure response
    }
  }
}


text:
Q: Change Public or Private Chatter Group to Unlisted Is there any way to do this with the IDE, or any sort of workaround? It looks unlikely, but I just want to make sure before I create a new unlisted group and migrate the group contents to it.
I ran the following Apex in an Execute Anonymous command and it threw a DMLException that pretty much resoundingly says "we don't want this behavior to be possible."
Exception:

System.DmlException: Update failed. First exception
  on row 0 with id 0F9G00000004lE9KAI; first error: INVALID_STATUS, You
  can't make an existing group unlisted.: [CollaborationType]

Apex:
CollaborationGroup c = [SELECT CollaborationType,Id FROM CollaborationGroup WHERE Id = '0F9G00000004lE9KAI'];
c.CollaborationType = 'Unlisted';
update c;

UI on "Group Settings" of the group:

A: Unfortunately this is not currently supported.

You can convert unlisted groups to public or private groups, but not the other way around.

https://help.salesforce.com/apex/HTViewHelpDoc?id=collab_unlisted_groups_overview.htm&language=en_US
If this is something that has to be done, you could create a new Unlisted version of the group and migrate all the Chatter discussions & memberships to the new group (and then delete the old one). Depending on the use of the group, you may have to audit references elsewhere (@ mentions of the group, any ID references for URLs, etc).


text:
Q: ProGuard for Android and Retrofit2 Converter Gson? i am using ProGuard  in my project but its giving wrong data in new Gson().toJson(Request);
i am getting out put
{"a":"manage","b":"689184d4418b6d975d9a8e53105d3382","c":"10","d":"76"}

instead of
{"username":"manage","password":"689184d4418b6d975d9a8e53105d3382","value":"10","store":"76"}

My ProGuard  rule
-dontwarn okio.**
-dontwarn retrofit2.Platform$Java8
-dontwarn sun.misc.Unsafe
-dontwarn org.w3c.dom.bootstrap.DOMImplementationRegistry
-dontwarn retrofit2.**
-keep class retrofit2.** { *; }
-keepattributes Signature
-keepattributes Exceptions
-keepclassmembers class rx.internal.util.unsafe.** {
    long producerIndex;
    long consumerIndex;
}

-keepclasseswithmembers class * {
    @retrofit2.http.* <methods>;
}
-keep class com.google.gson.** { *; }
-keep class com.google.inject.** { *; }

and i am using
 compile 'com.squareup.retrofit2:converter-gson:2.0.0'

is there a new recommended ProGuard configuration for retrofit2:converter-gson in Android?

A: Annotate your JSON model classes with @Keep.

A: Use android @Keep annotation on you desired class like authToken
@Keep
data class AuthToken(
    var access_token: String,
    var token_type: String,
    var expires_in: String,
    var userName: String,
    var issued: String,
    var expires: String) {}

And then in ProGuard  add below line:
If using androidx
-keep @androidx.annotation.Keep public class *

Else
 -keep @android.support.annotation.Keep public class *

A: you either want to keep the class you are using with gson or use @SerializedName annotation.
option 1 (keep class)

// all classes in a package
-keep class com.example.app.json.** { *; }
// or a specific class
-keep class com.example.app.json.SpecificClass { *; }

option 2 (use @SerializedName):

public class YourJsonClass{
   @SerializedName("name") String username;

   public MyClass(String username) {
     this.username = username;
   }
 }

with the second option proguard still obfuscates the class and field names but gosn can use the annotation to get the correct name for each field

A: In my case, I was using Moshi for JSON with Retrofit, but the problem was the same. It worked in debug, but after building with ProGuard, the RecyclerView that used the model crashed with a NullPointerException, because the list was full of empty model objects, since Moshi didn't recognize any of the fields. I think the exact same thing happens with Gson.
One solution is to annotate every field with its corresponding serialized name:
@Json(name="username") String username;

That way ProGuard can obfuscate the variable names without breaking the conversion.
The other solution is adding a "keep" option like Dodge suggested, in the proguard-rules.pro file
-keep public class com.example.model.User

A: If your using jsonschema2pojo every field is annotated with

@SerializedName(field)

Just add this to your proguard-rules.pro to keep every fieldname by it's @SerializedName.
-keepclassmembers,allowobfuscation class * {
  @com.google.gson.annotations.SerializedName <fields>;
}


text:
Q: How to get output of a php file in separate html form at the middle of screen of lesser size How to get output of a php file in separate html form at the middle of screen of lesser size. See tyhe below part. It is not working. Help pl.

  <form>

   </form>

    <form id = "qform" name="qform" action="getques.php" style="visibility:hidden"
      method="post" target="_blank">
   <input type="text" name="subnm1" >

   <input type="text" name="chpno1" >

   <input type="text" name="qnumber1" >

   <input type="submit">
   </form>

The above code is opening a new window but i want the size of that window not full screen but less. How to do that?

A: If I understand your question then, The easiest way would be to open create a page which takes all these parameter as query string. You can then open the new page in the window by making it a hyperlink. The new page can also process your input by taking all these parameter from query string.

Submit


text:
Q: Conditionally change color of angularjs element? Im still pretty new to AngularJS. Im trying to change the color of the table element so that its yellow if the user voted on this choice.

            {{choice.text}}

                        {{choice.votes.length}}

                    {{choice.votes.length}}

A: This is done by using ng-class.
Use ng-class on your td like this:
...

that will put the css class yellowstyle on the item when your condition is true.
And in your example:

    {{choice.text}}

          {{choice.votes.length}}

with a style.css file that has:
.yellowstyle {background-color: yellow;}
.lightbluestyle {background-color: lightblue;}


text:
Q: Is there any way to log deleted messages with images? I'm trying to make a message and image logger, but I have no thoughts about how I can log a message's image when the message is delete.
I've tried to use embed.set_image(url=message.attachments[0].url), but it didn't work and didn't cause any errors. The message text was logged but the image was not.
Also, I tried to use embed.set_image(url=message.attachments), and obviously, it didn't work:discord.errors.HTTPException: 400 BAD REQUEST (error code: 50035): Invalid Form Body
In embed.image.url: Not a well formed URL.
@client.event
async def on_message_delete(message):
    embed = discord.Embed(
        timestamp=message.created_at,
        title = "[Message Deleted]",
        colour = discord.Colour(0xff0000)
        )
    embed.set_author(name=f'{message.author.name}#{message.author.discriminator}', icon_url=message.author.avatar_url)
    embed.set_footer(text=f"Author ID:{message.author.id} • Message ID: {message.id}")
    embed.add_field(name="Message Content:", value=message.content)
    embed.set_image(url=message.attachments[0].url)
    channel = client.get_channel(665307525897519105)
    await channel.send(embed=embed)
    ```

A: Lu M is correct. There is not a good way to do this consistently after the message has already been deleted.
You've properly set the attachment URL as the embed's image URL, but if no one (besides Discord itself) viewed/requested the image, e.g. via a web browser, then when the message that the image is attached to is deleted, Discord's CDN will restrict access to the image.
Even if someone has viewed/requested the image already, the CDN will regularly delete/make inaccessible images that were attached to now deleted messages.


text:
Q: Mac book pro manufacturing year How to identify mac book pro product manufacturing year? And not the product release date.
example is mac book pro series launched in 2012 but what is its product manufactured date?

A: If you're running Yosemite or later, click Apple symbol (top left) -> About This Mac & it's there.

A: There's a freeware app from Micromat, the makers of TechTool Pro, called MachineProfile which will give detailed information…

It can even give away anomalies - for instance, my machine shows as a 2010 (which should make it a 4,1) & yet it registers as a 5,1. That's because it's had a hardware upgrade to 2012 spec.


text:
Q: Access-Control-Expose-Headers does not work to allow JS client side to read cookies I make AJAX calls to CORS server, I make many attempts to be able to read cookies returned on response using javascript client side, however, in vain .
1. First Attempt :
- Server Side (node.js powered by express) :
  response.header('Access-Control-Allow-Origin', '*');
  response.header('Access-Control-Allow-Headers', 'X-Requested-With, X-HTTP-Method-Override, Content-Type, Accept, Set-Cookie');
  response.header('Access-Control-Expose-Headers', "Set-Cookie");

 //------SET COOKIES
  response.cookie('SessionId', GeneratorId(64), {
            maxAge:3600000,
            httpOnly:flase // i disable httpOnly ==> does not work
          });

- client Side :
var xhttp=new XMLHttpRequest();
xhttp.open("POST", "http://localhost:9090/api/map", true);
xhttp,send(`{layer:1}`);

2. Second Attempt: (withCredentials)
-Server Side :
 //Append another response' header
  response.header('Access-Control-Allow-Credentials','true');

-Client Side :
// Before xhttp.send , I add another instruction :
 xhttp.withCredentials=true;

3. Third Attempt :
- Server Side :
//Avoid the wildcard on Access-Control-Allow-Origin =>Replace the first header by :
response.header('Access-Control-Allow-Origin', request.get('Origin'));

- Client Side :
 // Nothing is appended

Conclusion :
With all those attempts , xhttp.getResponseHeader('Set-Cookie') still returns null even :

*

*Set-Cookie is assigned  to the response header : Access-Control-Expose-Headers .

*I saw cookies on the browser console (Inspector) :

A: TL;DR: the Set-Cookie header is entirely off-limits: you can't access it, even when you include it in Access-Control-Expose-Headers. However, once it's set, and the cookie isn't marked httpOnly, you should be able to access it through document.cookie.
TMI follows:
As documented here,

A response will typically get its CORS-exposed header-name list set by parsing the Access-Control-Expose-Headers header. This list is used by a CORS filtered response to determine which headers to expose.

What a CORS filtered response is, is documented here:

A CORS filtered response is a filtered response whose type is "cors", header list excludes any headers in internal response's header list whose name is not a CORS-safelisted response-header name, given internal response's CORS-exposed header-name list, and trailer is empty.

And safelisted headers are subsequently documented here:

*

*Cache-Control

*Content-Language

*Content-Type

*Expires

*Last-Modified

*Pragma
Any value in list that is not a forbidden response-header name.

Finally, the list of forbidden response-header names is listed here:

*

*Set-Cookie

*Set-Cookie2


text:
Q: Nvidia HDMI sound and Logitech Headphones not working in 14.04 There is no sound going from the HDMI port on my Nvidia card to my tv that I am using as a monitor. When I use my Logitech Headphones, I hear no sound either. Does anyone know how to rectify the situation? Here's some screenshots and system information (sorry if this is too much info):

*

*Ubuntu Server 14.04

*Fluxbox WM

*SABERTOOTH 990FX/GEN3 R2.0

*AMD FX(tm)-8350 Eight-Core Processor

*GeForce GTX 660 Ti (Nvidia 331.20 Drivers)

*Logitech G35 Headphone/Microphone

aplay -L output:
default
Playback/recording through the PulseAudio sound server
null
Discard all samples (playback) or generate zero samples (capture)
pulse
PulseAudio Sound Server
sysdefault:CARD=SB
HDA ATI SB, ALC892 Analog
Default Audio Device
front:CARD=SB,DEV=0
HDA ATI SB, ALC892 Analog
Front speakers
surround40:CARD=SB,DEV=0
HDA ATI SB, ALC892 Analog
4.0 Surround output to Front and Rear speakers
surround41:CARD=SB,DEV=0
HDA ATI SB, ALC892 Analog
4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=SB,DEV=0
HDA ATI SB, ALC892 Analog
5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=SB,DEV=0
HDA ATI SB, ALC892 Analog
5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=SB,DEV=0
HDA ATI SB, ALC892 Analog
7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=SB,DEV=0
HDA ATI SB, ALC892 Digital
IEC958 (S/PDIF) Digital Audio Output
dmix:CARD=SB,DEV=0
HDA ATI SB, ALC892 Analog
Direct sample mixing device
dmix:CARD=SB,DEV=1
HDA ATI SB, ALC892 Digital
Direct sample mixing device
dsnoop:CARD=SB,DEV=0
HDA ATI SB, ALC892 Analog
Direct sample snooping device
dsnoop:CARD=SB,DEV=1
HDA ATI SB, ALC892 Digital
Direct sample snooping device
hw:CARD=SB,DEV=0
HDA ATI SB, ALC892 Analog
Direct hardware device without any conversions
hw:CARD=SB,DEV=1
HDA ATI SB, ALC892 Digital
Direct hardware device without any conversions
plughw:CARD=SB,DEV=0
HDA ATI SB, ALC892 Analog
Hardware device with all software conversions
plughw:CARD=SB,DEV=1
HDA ATI SB, ALC892 Digital
Hardware device with all software conversions
hdmi:CARD=NVidia,DEV=0
HDA NVidia, HDMI 0
HDMI Audio Output
hdmi:CARD=NVidia,DEV=1
HDA NVidia, HDMI 1
HDMI Audio Output
hdmi:CARD=NVidia,DEV=2
HDA NVidia, HDMI 2
HDMI Audio Output
hdmi:CARD=NVidia,DEV=3
HDA NVidia, HDMI 3
HDMI Audio Output
dmix:CARD=NVidia,DEV=3
HDA NVidia, HDMI 0
Direct sample mixing device
dmix:CARD=NVidia,DEV=7
HDA NVidia, HDMI 1
Direct sample mixing device
dmix:CARD=NVidia,DEV=8
HDA NVidia, HDMI 2
Direct sample mixing device
dmix:CARD=NVidia,DEV=9
HDA NVidia, HDMI 3
Direct sample mixing device
dsnoop:CARD=NVidia,DEV=3
HDA NVidia, HDMI 0
Direct sample snooping device
dsnoop:CARD=NVidia,DEV=7
HDA NVidia, HDMI 1
Direct sample snooping device
dsnoop:CARD=NVidia,DEV=8
HDA NVidia, HDMI 2
Direct sample snooping device
dsnoop:CARD=NVidia,DEV=9
HDA NVidia, HDMI 3
Direct sample snooping device
hw:CARD=NVidia,DEV=3
HDA NVidia, HDMI 0
Direct hardware device without any conversions
hw:CARD=NVidia,DEV=7
HDA NVidia, HDMI 1
Direct hardware device without any conversions
hw:CARD=NVidia,DEV=8
HDA NVidia, HDMI 2
Direct hardware device without any conversions
hw:CARD=NVidia,DEV=9
HDA NVidia, HDMI 3
Direct hardware device without any conversions
plughw:CARD=NVidia,DEV=3
HDA NVidia, HDMI 0
Hardware device with all software conversions
plughw:CARD=NVidia,DEV=7
HDA NVidia, HDMI 1
Hardware device with all software conversions
plughw:CARD=NVidia,DEV=8
HDA NVidia, HDMI 2
Hardware device with all software conversions
plughw:CARD=NVidia,DEV=9
HDA NVidia, HDMI 3
Hardware device with all software conversions
sysdefault:CARD=Headset
Logitech G35 Headset, USB Audio
Default Audio Device
front:CARD=Headset,DEV=0
Logitech G35 Headset, USB Audio
Front speakers
surround40:CARD=Headset,DEV=0
Logitech G35 Headset, USB Audio
4.0 Surround output to Front and Rear speakers
surround41:CARD=Headset,DEV=0
Logitech G35 Headset, USB Audio
4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=Headset,DEV=0
Logitech G35 Headset, USB Audio
5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=Headset,DEV=0
Logitech G35 Headset, USB Audio
5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=Headset,DEV=0
Logitech G35 Headset, USB Audio
7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=Headset,DEV=0
Logitech G35 Headset, USB Audio
IEC958 (S/PDIF) Digital Audio Output
dmix:CARD=Headset,DEV=0
Logitech G35 Headset, USB Audio
Direct sample mixing device
dsnoop:CARD=Headset,DEV=0
Logitech G35 Headset, USB Audio
Direct sample snooping device
hw:CARD=Headset,DEV=0
Logitech G35 Headset, USB Audio
Direct hardware device without any conversions
plughw:CARD=Headset,DEV=0
Logitech G35 Headset, USB Audio
Hardware device with all software conversions

aplay -l output:
**** List of PLAYBACK Hardware Devices ****
card 0: SB [HDA ATI SB], device 0: ALC892 Analog [ALC892 Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: SB [HDA ATI SB], device 1: ALC892 Digital [ALC892 Digital]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 7: HDMI 1 [HDMI 1]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 8: HDMI 2 [HDMI 2]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 9: HDMI 3 [HDMI 3]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: Headset [Logitech G35 Headset], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0

The volumes for the headset look normal, but the volumes for my HDMI output look like this:

In addition, nothing shows up in the HDMI tab in gnome-alsamixer


text:
Q: How should I annotate a controller to work when minified, when it's dependencies are a mixture of objects provided by Angular and by a resolve method? Ok so I have the following angular view:

    {{helloWorld}}

    <button type='button' ng-click='showModal();'>Click me</button>

And the following JS code:
var testApp = angular.module('testApp', ['ui.bootstrap']);

var myController = function($scope, $modal){
    $scope.helloWorld = 'Hello World';

    $scope.showModal = function(){
        var modalInstance = $modal.open({
            template: '{{something}}
 <button type="button" ng-click="updateSomething()">Click me now</button>',
            controller: modalController,
            resolve: {
                helloWorld: function () {
                    return $scope.helloWorld;
            },
        }
    });
    }

}

myController.$inject = ['$scope', '$modal'];
testApp.controller('myController', myController);

var modalController = function($scope, $modalInstance, helloWorld){

    $scope.something = 'Yada yada yada';

    $scope.updateSomething = function () {
        $scope.something = helloWorld;
    };
}

The JSFiddle is here.
When everything is bundled and minified, myController works great, because I have created an annotation telling testApp about myController, and called testApp's controller method.
However, I am stuck on modalController, how do I wire this up properly to Angular's DI container?
I know that it has a property called $inject. I tried creating an annotation for modalController, in the same way I have done for myController and then pushing helloWorld onto that array as shown in this updated fiddle, but I get an Unknown Provider error.
So my question is, when some of a controllers dependencies are provided by angular, and others are provided through a resolve method, how do you tell Angular's DI container about all of them, so everything will work as expected when minified?
Thanks

A: The problem is here:
modalController.$inject.push($scope.helloWorld);

This adds the value of helloWorld to the dependencies, but you want helloWorld itself. So delete that line just add helloWorld to the other dependencies:
modalController.$inject = ['$scope','$modalInstance', 'helloWorld'];


text:
Q: R use the name of function as a parameter in formals I am working with several classification algorithms from different libraries (for example):
library(ranger) #RandomForest
library(gbm) #Gradient Boosting

I need to use formals function to get all the arguments from all of them.
The following attempts works perfectly:
formals(gbm)
formals(gbm::gbm)
formals("gbm")

functionName="gbm"
formals(functionName)

What I need is to parametrize the name of the package as well as the name of the function, but it fails. Something like this:
> packageName="gbm"
> functionName="gbm"
> formals(packageName::functionName)
Error in loadNamespace(x) : there is no package called 'packageName'

Is there anyway to do it?
Thanks

A: The good thing is that :: accepts strings:
`::`("gbm", "gbm")

The above code is working.
However, when we use an object name in which the string is stored, :: takes this as literal expression and looks for a package called packageName.
packageName <- functionName <- "gbm"
`::`(packageName, functionName)
#> Error in loadNamespace(x): there is no package called 'packageName'

With base R we can use eval(bquote()) and evaluate the strings early with .().
By evaluating the strings early with .() we make it clear that we are really looking for the string value (that is the value of packageName)  and not the object name itself.
formals(eval(bquote(`::`(.(packageName), .(functionName)))))

#> $formula
#> formula(data)
#>
#> $distribution
#> [1] "bernoulli"
#>
#> $data
#> list()
#>
#> $weights
#>
#>
#> $var.monotone
#> NULL
#>
#> $n.trees
#> [1] 100
#>
#> $interaction.depth
#> [1] 1
#>
#> $n.minobsinnode
#> [1] 10
#>
#> $shrinkage
#> [1] 0.1
#>
#> $bag.fraction
#> [1] 0.5
#>
#> $train.fraction
#> [1] 1
#>
#> $cv.folds
#> [1] 0
#>
#> $keep.data
#> [1] TRUE
#>
#> $verbose
#> [1] FALSE
#>
#> $class.stratify.cv
#> NULL
#>
#> $n.cores
#> NULL

With {rlang} we can use inject() and !! sym():
library(rlang)
formals(inject(`::`(!! sym(packageName), !! sym(functionName))))

Of course in base R we always have the option to eval(parse()):
packageName="gbm"
functionName="gbm"

formals(eval(str2lang(paste0(packageName, "::", functionName))))

Created on 2023-02-19 with reprex v2.0.2


text:
Q: Is there magical science? I know someone had a question about whether or not the magic from Harry Potter had science behind it[1]. What I want to know, however, is what is the magical view on Muggle science.
What do wizards think about physics, and chemistry, and all of that?
Of course when they cast some spells they are able to "break science" (or go against it). However they are undeniably still bound by its rules at most times (wizards are still under gravity whenever magic is not involved).
So, granted some rules are proven to be very wrong from a magical point of view, many still apply, so do wizards and witches study those kinds of science? Do they follow Muggle advances and try to help?
Just wondering.

1: Is There Any Science Behind the Magic in Harry Potter?

A: There are a number of subjects taught as part of the Hogwarts curriculum that involve one or another branch of science, and lead a practitioner to a wizard-world equivalent of a Muggle scientist career. Some examples of these fields, along with the Muggle equivalent and some practitioners mentioned by Rowling, include:

*

*Astronomy - astronomy (Aurora Sinistra)

*Herbology - botany (Pomona Sprout, Neville Longbottom, Tilden Toots)

*Care of Magical Creatures - veterinary science, zoology (in wizardspeak, naturalists are called "Magizoologists": Rubeus Hagrid, Newt Scamander, Luna Lovegood)

*Potions - chemistry (Severus "I don't expect many of you to appreciate the subtle science and exact art that is potion-making" Snape)

*Alchemy - physics (n/a)

*Arithmancy - computational mathematics (Hermione Granger, Percy Weasley, Barty Crouch Jr)
These examples indicate that, while some fields like engineering or quantum physics appear to be absent from wizard society, there are varieties of science, primarily related to the natural world, which are studied and practised. So while we have no wizards or witches quoting their opinions on science, we can infer with some certainty that they were not opposed to scientific endeavor. The reason it's much more limited in the wizard world compared to the Muggle world is probably because there is far less necessity to know how to build bridges or computers etc, when you can harness magic to get many of these jobs done much quicker and easier (c.f. the essay "Why Muggles Need Electricity").


text:
Q: How to use setState without using onPressed I am new to flutter and i want to setState  a variable that will use to display an on and off icon. onPressed cannot be used because the input switch is a string.
void _toggleIcon() {
  setState(() {
      if (switch.contains('on')) {
        _iconState = true;
      } else if (switch.contains('off')) {
        _iconState = false;
      }
  });
}

I know that i can use the void function above on IconButton on onPressed using this code:
Container(
          padding: const EdgeInsets.all(0),
          child: IconButton(
            padding: const EdgeInsets.all(0),
            alignment: Alignment.centerRight,
            icon: (_iconState
                ? const Icon(Icons.star)
                : const Icon(Icons.star_border)),
            color: Colors.red[500],
            onPressed: _toggleIcon,
          ),
        ),

But i don't know how to implement it because the input is a string.
I don't also know how to implement a Icon Class or is it even possible.
Please help me.

A: You can use ValueNotifier with ValueListenableBuilder.
ValueNotifier<String> switchString = ValueNotifier("");

@override
Widget build(BuildContext context) {
  return Scaffold(
    body: Column(
      children: [
        ValueListenableBuilder<String>(
          valueListenable: switchString,
          builder: (context, _iconState, child) {
            return Container(
              padding: const EdgeInsets.all(0),
              child: IconButton(
                padding: const EdgeInsets.all(0),
                alignment: Alignment.centerRight,
                icon: (switchString.value.contains('on')
                    ? const Icon(Icons.star)
                    : const Icon(Icons.star_border)),
                color: Colors.red[500],
                onPressed: () {},
              ),
            );
          },
        ),
        TextField(
          onChanged: (v) {
            switchString.value = v;
          },
        )
      ],
    ),
  );
}


text:
Q: Querying MYSQL longtext holding JSON I have a table with the following structure:
CREATE TABLE `Event` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `created` datetime(6) NOT NULL,
  `last_updated` datetime(6) NOT NULL,
  `info` longtext NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=720 DEFAULT CHARSET=latin1

I need to query it using the info column (which holds JSON string).
If I query it doing:
SELECT e.id, e.created, JSON_TYPE(e.info) AS info
  FROM Event e

It returns OBJECT on the INFO column, but if I try to grab an specific column of the JSON, I receive:

SQL Error [3144] [22001]: Data truncation: Cannot create a JSON value from a string with CHARACTER SET 'binary'.

The SQL I am running:
SELECT INFO - > '$User'
  FROM (SELECT e.id, e.created, JSON_TYPE(e.info) AS info
          FROM Event e) as X

Its not an option to change the type of the column to json

A: You can try to CAST to JSON then
SELECT info -> '$.User', info_type
  FROM (SELECT e.id, e.created,
               JSON_TYPE( CAST( info AS JSON ) ) AS info_type,
               CAST( info AS JSON ) AS info
          FROM Event e) as X

since a string value within a JSON value accepting function( JSON_TYPE() ) wouldn't work.
Btw, you don't need to bring the JSON type, but the JSON only, for your case.
Update : You can alternatively use without subquery by using JSON_EXTRACT() as
SELECT JSON_EXTRACT( CAST( info AS JSON ) , '$.A' ) AS info,
       JSON_TYPE( CAST( info AS JSON ) ) AS info_type
  FROM Event


text:
Q: find out the intersection between a straight line and a curve parametrized by phi on a complex plane The equation for a straight line is simply:
$$
y = mx + c
$$
Let's say for now that the other curve is a unit circle $z = e^{i\phi}$, we know that:
$$
y^2 + x^2 = 1
$$
which can simply be solved by substitution. Now consider the following:
$$
f(z, \phi) = a(\phi)z^2 + bz + c = 0
$$
where the coefficient $a(\phi) = e^{i\phi}$, b and c are complex constants. There are 2 solutions for the polynomial root $z$:
$$
z = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}
$$
which is implicitly a function of $\phi$ and should form a closed loop like how a circle would. My question is that, for a curve like this, I do not have a definition like the equation of a circle, so how should I go about solving the intersection between such a curve and a straight line?


text:
Q: JavaScript Integer math incorrect results I am just trying to implement a simple RNG in JS.
What's happening is javascript evaluates 119106029 * 1103515245 to be 131435318772912110 rather than 131435318772912105. We know it's wrong since two odd numbers multiplied does not give an even number.
Anyone know what's up? I just want a reliable repeatable RNG, and because of these incorrect values I can't get results to match up with my C implementation of the same thing.

A: When an integer in javascript is too big to fit in a 32 bit value, some browsers will convert it to a floating point. Since the value of floating points is only save to a limited precision, some rounding can occur on big values.

A: If done in C/C++ (double), the last numbers will be ...112
instead of 105 (which is correct). If performed with 'long double',
the result will be as expected (...105). So it looks like the
Javascript interpreter converts the numbers to 8-byte-double
internally, does the calculation and does some unknown rounding
which leads to a marginally better result than the C/C++ standard
double calculation.
GCC 4.5:
 int main(int argc, char** argv)
{
 long double a = 119106029;
 long double b = 1103515245;
 long double c = a * b;
 printf("%.Lf\n", c);

 return 0;
}

Result:
131435318772912105

Expected:
131435318772912105

So I don't see a chance in Javascript without the
aid of a BIGNUM library (if any).
Regards
rbo

A: Per the ECMAScript standard, all numbers in JavaScript are (64-bit IEEE 754) floating-point numbers by default.
However all 32-bit integers can be exactly represented as floating-point numbers. You can force a result to 32 bits by using the appropriate bitwise operator, like this:
x = (a * b) >>> 0;  // force to unsigned int32
x = (a * b) | 0;    // force to signed int32

Weird, but that's the standard.
(Incidentally this rounding behavior is one of the most frequently reported "bugs" against Firefox's JavaScript engine. Looks like it's been reported 3 times so far this year...)
If you want real integer math, you can use BigInt values, a different type of number, written with an n at the end:
> 119106029n * 1103515245n
131435318772912105n

This is a relatively recent JS feature, and may not be implemented in old browsers.

As for reproducible random numbers in JavaScript, the V8 benchmark uses this:
// To make the benchmark results predictable, we replace Math.random
// with a 100% deterministic alternative.
Math.random = (function() {
  var seed = 49734321;
  return function() {
    // Robert Jenkins' 32 bit integer hash function.
    seed = ((seed + 0x7ed55d16) + (seed << 12))  & 0xffffffff;
    seed = ((seed ^ 0xc761c23c) ^ (seed >>> 19)) & 0xffffffff;
    seed = ((seed + 0x165667b1) + (seed << 5))   & 0xffffffff;
    seed = ((seed + 0xd3a2646c) ^ (seed << 9))   & 0xffffffff;
    seed = ((seed + 0xfd7046c5) + (seed << 3))   & 0xffffffff;
    seed = ((seed ^ 0xb55a4f09) ^ (seed >>> 16)) & 0xffffffff;
    return (seed & 0xfffffff) / 0x10000000;
  };
})();

A: With the arrival of BigInt, you can now perform these calculations with accuracy:

console.log((119106029n * 1103515245n).toString());


text:
Q: Android support design library vs. raygun I have an app that uses Raygun. This is giving me problems when I try to update the com.android.support:design library. They works fine when I use com.android.support:design:22.2.0, but when I go up to com.android.support:design:23.+ I get a series of errors akin to this:
{Path}\raygun4android-1.3.0-sources.jar(main/java/com/mindscapehq/android/raygun4android/RaygunClient.java):15: error: package org.apache.http does not exist
I get that same error for api's 15-19.

A: You need to add the org.apache.http legacy jar to the applicaiton
android {
    useLibrary 'org.apache.http.legacy'
    ...
}


text:
Q: WCF testing service where transaction doesn't work I made windows forms application which uses database and now I am trying to make WCF application, where this Win FORM will be client, then I will host it using ISS, but I have problem with transactions. To wit
I added to my existing solution (where I have this winform as well) new project-> WCF Service Application
in service.svc I have :
[OperationBehavior(TransactionScopeRequired = true)]
        public void AddEmail(string str, Queue<string> checkBoxes)
        {

     Task.Run(() =>
            {
                SqlCeConnection conn = new SqlCeConnection("Data Source=G:\\VisualStudio2012Projects\\WCF_Muszynski_Grossman\\WcfService1\\App_Data\\Database1.sdf");
                conn.Open();

                try { MailAddress a = new MailAddress(str); }
                catch (Exception ex)
                {
                    conn.Close();
                    return;
                }

                if (checkBoxes.Count() == 0)
                {
                    conn.Close();
                    return;   //no groups were selected
                }
                SqlCeTransaction tx = null;
                try
                {
                    SqlCeCommand cmd = conn.CreateCommand();
                   // MessageBox.Show(conn.State.ToString());
                    tx = conn.BeginTransaction();
                    cmd.Connection = conn;
                    cmd.Transaction = tx;

                    cmd.CommandText = string.Format("INSERT INTO Emails(Email) VALUES('{0}')",str);
                    cmd.ExecuteNonQuery();
                    int UniqueID;
                    cmd.CommandText = string.Format("Select UniqueID from Emails WHERE Email='{0}' ",str);
                    SqlCeDataReader dr = cmd.ExecuteReader();

                    dr.Read();
                    UniqueID = (int)dr["UniqueID"];
                    dr.Close();

                    while (checkBoxes.Count() != 0)
                    {
                        cmd.CommandText = string.Format("Insert into Groups(ID,Grupa) VALUES({0},'{1}') ", UniqueID, checkBoxes.Dequeue());
                        cmd.ExecuteNonQuery();
                    }
                    tx.Commit();
                }
                catch (SqlCeException ex)
                {

                    tx.Rollback();
                    conn.Close();
                    return;
                }
                catch (InvalidOperationException ex)
                {
                    tx.Rollback();
                    conn.Close();
                    return;
                }

                catch (Exception ex)
                {
                    // MessageBox.Show(string.Format("typ bledu {0}", ex.GetType().ToString()));

                    tx.Rollback();
                    conn.Close();
                    return;

                }
                conn.Close();
              return;
            });
    return;
    }

in IService.cs :
[OperationContract]
        [TransactionFlow(TransactionFlowOption.Allowed)]
        void AddEmail(string str, Queue<string> checkBoxes);

Of course when I try to do those things without transaction it works properly.
Of course my database is moved to WCFService now.
So I am very puzzled why thing which worked in WinForm doesn't work now in Service.
Could you tell me why is that and what should I do?


text:
Q: Hook with jQuery in joomla squeeze box Situation is quite difficult and i don't have enough time to solve it properly, so is there any way to use jQuery with Joomla's squeeze box modal windows instead of MooTools. Not delete MooTools, but just use jQuery parallel. At the moment jQuery does not react on any id, class, and etc. Only helps onclick="someFunctionName();" in which is jQuery.

A: You need to provide a lot more information or maybe a link in order to properly diagnose the issue.
However, chances are that you just need to call the noconflict function to eliminate the conflict.
http://api.jquery.com/jQuery.noConflict/
If that doesn't work, post some code so we can see what we are working with.


text:
Q: Activate PHP commands on login Everytime I login into my centOS box.  I need to run source /opt/rh/php54/enable to be able to run php commands.  What do I need to do to my installation for this to work without running this command?

A: That will depend on what the command is doing. However, you could automate it by adding this line to your ~/.profile:
source /opt/rh/php54/enable

That will run the source command each time you log in. There is probably a better way of doing this, presumably the enable script is just setting some variables that you could set directly but this should work as a workaround.


text:
Q: spark-jobserver - managing multiple EMR clusters I have a production environment that consists of several (persistent and ad-hoc) EMR Spark clusters.
I would like to use one instance of spark-jobserver to manage the job JARs for this environment in general, and be able to specify the intended master right when I POST /jobs, and not permanently in the config file (using master = "local[4]" configuration key).
Obviously I would prefer to have spark-jobserver running on a standalone machine, and not on any of the masters.
Is this somehow possible?

A: You can write a SparkMasterProvider
https://github.com/spark-jobserver/spark-jobserver/blob/master/job-server/src/spark.jobserver/util/SparkMasterProvider.scala
A complex example is here https://github.com/spark-jobserver/jobserver-cassandra/blob/master/src/main/scala/spark.jobserver/masterLocators/dse/DseSparkMasterProvider.scala
I think all you have to do is write one that will return the config input as spark master, that way you can pass it as part of job config.


text:
Q: Total number of documents in pysolr How can I get the total number of documents matching the given query. I have use the query below:
result = solr.search('ad_id : 20')
print(len(result))

Since the default returning value is '10', the output is only 10, but the count is 4000. How can I get the total number of counts?

A: The results object from pysolr has a hits property that contains the total number of hits, regardless of how many documents being returned. This is named numFound in the raw response from Solr.
Your solution isn't really suitable for anything with a larger dataset, since it requires you to retrieve all the documents, even if you don't need them or want to show their content.

A: The count is stored in numFound variable. Use the code below:
result = solr.search('ad_id : 20')
print(result.raw_response['response']['numFound'])

A: As @MatsLindh mentioned -
result = solr.search('ad_id : 20')
print(result.hits)

A: If you just want the total number of items that satisfy your query, here is my Python3 code (using the pysolr module):
    collection='bookindex'  # or whatever your collection is called
    solr_url = f"http://{SOLR_HOST}/solr/{collection}"
    solr = pysolr.Solr(url=solr_url, timeout=120, always_commit=True)
    result = solr.search("*:*", rows=0);
    return result.hits

This queries for all documents (":") -- 315913 in my case -- but you can narrow that to suit your requirements.  For example, if I want to know how many of my book entries have title:pandas I can search("title:pandas", rows=0) and get 41 as the number that have pandas in the title.  By setting rows=0 you're letting Solr know that it need not format any results for you but you just return the meta information, and thus much more efficient than setting a high limit on rows.

A: Finally got the answer:
Added rows=1000000 at the end of the query.
result = solr.search('ad_id : 20', rows=1000000)
But if the rows are greater than this the number should be changed in the query. This might be a bad solution but works.
If anyone has a better solution please do reply.


text:
Q: C# check merge field check box in a word document Just wondering how to check a check box on a word document, i have my C# Window Forms application filling in Merge Fields with data obtained from the forms such as textBoxes and comboBoxes. Though i was wondering how to check a text box from with in C#?
I have been trying to find this for awhile now, and have resulted in actually asking the question here.
The code below is how i connect to my word document and fill out the Merge Field on that document.
        Object oMissing = System.Reflection.Missing.Value;
        Object oTrue = true;
        Object oFalse = false;
        Word.Application oWord = new Word.Application();
        Word.Document oWordDoc = new Word.Document();

        oWord.Visible = true;

        if (File.Exists("pathName.txt"))
        {
            FileStream file = new FileStream("pathName.txt", FileMode.Open, FileAccess.Read);
            StreamReader Reader = new StreamReader(file);
            PathName = Reader.ReadLine();
        }

        Object oTemplatePath = PathName;

        oWordDoc = oWord.Documents.Add(ref oTemplatePath, ref oMissing, ref oMissing, ref oMissing);

        foreach (Word.Field myMergeField in oWordDoc.Fields)
        {
            iTotalFields++;
            Word.Range rngFieldCode = myMergeField.Code;
            String fieldText = rngFieldCode.Text;

            if (fieldText.StartsWith(" MERGEFIELD"))
            {

                Int32 endMerge = fieldText.IndexOf("\\");
                Int32 fieldNameLength = fieldText.Length - endMerge;
                String fieldName = fieldText.Substring(11, endMerge - 11);

                fieldName = fieldName.Trim();

                if (fieldName == "Name")
                {
                    myMergeField.Select();
                    oWord.Selection.TypeText(firstName.Text);
                }

                if (fieldName == "Name2")
                {
                    myMergeField.Select();
                    oWord.Selection.TypeText(textBox6.Text);
                }

                if (fieldName == "LastName1")
                {
                    myMergeField.Select();
                    oWord.Selection.TypeText(textBox3.Text);
                }
       }

Any help would be appreciated.
Thank you.


text:
Q: how to clear multple select box data I want to clear the selected data on multiple select boxes but it won't work for me.
<select  name="age" id="age" class="span2 typeahead" multiple data-rel="chosen">
    <?php
        $age_arr = explode(",", $result['age']);
        foreach ($age as $a)
        {
            $select = "";
            for ($is = 0; $is < count($age_arr); $is++)
            {
                if ($age_arr[$is] == $a['age_id'])
                {
                    $select = "selected";
                }
            } ?>
            <option id="age2" value="<?php echo $a['age_id']; ?>" <?php echo $select; ?>><?php echo $a['age']; ?></option>
            <?php
        }
    ?>
</select>
<input type="hidden" id="age_val" name="age_val" value="<?php echo $result['age']; ?>" />

<input type="button" value="Clear" id="clear" class="btn" onClick="clearFields()">

This is what I tried:
<Script>
    function clearFields(){
        document.getElementById("age_val").value = "";
        document.getElementById("age").value = '';
    }
</Script>

Please advice me how to clear data when clear button clicked,
selectbox

A: As you have a multiple select, not a standard select, you need to set the selected property of each option element to false. Try this:
function clearFields() {
    $('#age option:selected').prop("selected", false);
    $('#age_val').val('');
}

Working example

A: Javascript:
function clearFields(){
    document.getElementById("age_val").value = "";

    var collection = document.getElementById('age').getElementsByTagName('option');

    for(var i = 0; i<collection.length; i++){
        collection[i].selected = false;
    }

    // for chosen
    $('#age').trigger('chosen:updated');
}

But as long as you using jquery, then you can use code in answer provided by @Rory McCrossan and add to the function: $('#age').trigger('chosen:updated');


text:
Q: Map Shift+Esc to 'Esc Esc Esc' on osx? I would like to map
Shift+Esc to
Esc Esc Esc
on my MacBook Pro.
I have tried Better Touch Tool. It can remap one key combination to another, but not to a sequence of keystrokes.

A: For a general solution you'll want to use Karabiner. It'll let you remap things for all your applications and it comes with tons of options as well as the ability to customize and create your own mappings if you want. Check out this answer for an example of how to go about creating new mappings or check out their (fairly friendly) documentation here.

A: Within what application do you want this binding?  I'm guessing Terminal or iTerm.
For iTerm, you can select Preferences > Keys then add a global shortcut to the action you want.
For Terminal it's similar. Preferences > Keyboard but you'll have to know the keystroke sequence in hex (I believe ESC is 0x35)
The other way to set shortcuts is in System Preferences > Keyboard > App Shortcuts.  This is the easy way to map a menu option but may not be appropriate for your use case.


text:
Q: Hamburger button log in goes to the bottom I am trying to create the login from the right side go to the top of the hamburger button menu when it becomes responsive (obviously inside of it with the other tabs). I am assuming that I would have to write a media query or if there is a way to apply a different class in that media query...but I have no idea how to do it. Also, I am using bootstrap for it.
This is what I have so far:

        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">

        </button>
        HEALTHY LIFE FITNESS

Clubs

Classes

Training

Pilates

Join

    <button type="button" id="login" class="btn btn-default navbar-btn pull-right" style="margin:10px 10px 0px 0px;">Log In</button>

CSS:
 #navbar{background-color: rgb(18,18,28);}

.navbar-toggle .icon-bar:nth-of-type(2) {
      top: 1px;
}

.navbar-toggle .icon-bar:nth-of-type(3) {
    top: 2px;
}

.navbar-toggle .icon-bar {
      position: relative;
      transition: all 500ms ease-in-out;
}

.navbar-toggle.active .icon-bar:nth-of-type(1) {
      top: 6px;
      transform: rotate(45deg);
}

.navbar-toggle.active .icon-bar:nth-of-type(2) {
      background-color: transparent;
}

.navbar-toggle.active .icon-bar:nth-of-type(3) {
      top: -6px;
      transform: rotate(-45deg);
}

JS:
$(document).ready(function () {
              $(".navbar-toggle").on("click", function () {
                    $(this).toggleClass("active")
              });
        });


text:
Q: Einstein Field equations for the whole universe Can someone please show the EFE solved for the entire universe. I've heard people say that 'Einstein solved the Einstein equations for the universe and found this'. If I am missing something, what does this statement really imply?

A: "Equations for the whole universe" were not solved by Einstein. The Universe with her every captivating quirk and je ne sais quoi is impossible to fathom. The only persons who claimed ultimate solution are the fortune tellers and the Wall Street pundits who purportedly can predict tomorrow's SNP 500.
However, when it comes to the coarse-grained approximate solution (assuming that She is homogeneous and isotropic), there are at least four guys (Friedmann–Lemaître–Robertson–Walker) who beat Einstein to the punch. See wiki quotes below:

The Soviet mathematician Alexander Friedmann first derived the main results of the FLRW model in 1922 and 1924. Although the prestigious physics journal Zeitschrift für Physik published his work, it remained relatively unnoticed by his contemporaries. Friedmann was in direct communication with Albert Einstein, who, on behalf of Zeitschrift für Physik, acted as the scientific referee of Friedmann's work. Eventually Einstein acknowledged the correctness of Friedmann's calculations, but failed to appreciate the physical significance of Friedmann's predictions.
Friedmann died in 1925. In 1927, Georges Lemaître, a Belgian priest, astronomer and periodic professor of physics at the Catholic University of Leuven, arrived independently at results similar to those of Friedmann and published them in the Annales de la Société Scientifique de Bruxelles (Annals of the Scientific Society of Brussels).[10] In the face of the observational evidence for the expansion of the universe obtained by Edwin Hubble in the late 1920s, Lemaître's results were noticed in particular by Arthur Eddington, and in 1930–31 Lemaître's paper was translated into English and published in the Monthly Notices of the Royal Astronomical Society.
Howard P. Robertson from the US and Arthur Geoffrey Walker from the UK explored the problem further during the 1930s. In 1935 Robertson and Walker rigorously proved that the FLRW metric is the only one on a spacetime that is spatially homogeneous and isotropic (as noted above, this is a geometric result and is not tied specifically to the equations of general relativity, which were always assumed by Friedmann and Lemaître).

What Einstein did is tweaking (adding and subsequently dropping a constant term) the equation to make the solution palatable.
To make it worse, Einstein was not even the first to write down the correct version of Einstein equation. It's the great mathematician Hilbert who proposed the action of gravity in 1915, prior to the celebrated 1916 paper of Einstein.


text:
Q: Ansible playbook: MariaDB user creation fails I'm trying to create a database user, but it throws an error. Any help is much appreciated!
Ansible version: 2.0.0.2
MariaDB version: mysql  Ver 15.1 Distrib 10.0.38-MariaDB,
                 for debian-linux-gnu (x86_64) using readline 5.2

The part of my playbook which causes the following error
- name: "Create user for callcenter db"
  mysql_user:
    name: callcenter_rw
    password: "{{mysql_myapp_rw_password}}"
    priv: callcenter.*:SELECT,INSERT,UPDATE,DELETE
    login_user: root
    login_password: "{{mysql_root_password.stdout}}"
    state: present
  when: is_root_password_set.rc == 0

TASK [Create user for callcenter db] *******************************************
fatal: [10.0.1.237]: FAILED! => {"changed": false,
"failed": true,
"msg": "(1********64,
         'You have an error in your SQL syntax;
         check the manual that corresponds to your MariaDB server
         version for the right syntax to use near
         \\'{\\'changed\\': \\'1\\',
         \\'end\\': \"\\'2********19-12-13 17:56:19.799********58\\'\",
         \\'stdout\\': \"\\'********\\'\"\\' at line 1')"
}


text:
Q: How to set number instead of icon to status bar on android I want to make a timer/reminder that will show number of minutes until ring starts at status bar.
It needs to be updated every minute automatically, and I know how to set icon but I don't know how to set number to be there instead of icon, so I don't want to have 30 icons of numbers... instead is there any option to somehow convert numbers to icons and show it on status bar every minute.

A: If your status bar means notification bar, according to this document, there is no way to put a text or number into the icon place. You may show the remaining time in the title or text in the notification as a normal App doing.
Edit: This thread is what you want. There is a method which converts numbers to icon format. You may pass the converted numbers to the icon parameter.


text:
Q: How to store arbitrary metadata in a photo saved using the Photos library? The app takes pictures. Then is meant to save those pictures using the below code in the delegate method:
public func photoOutput(_ output: AVCapturePhotoOutput, didFinishProcessingPhoto photo: AVCapturePhoto, error: Error?) {

    // Abort if an error was faced.
    guard error.isNone else {
        print("Error capturing photo: \(error!).")
        return
    }

    // Get the image data from the photo.
    guard let imageData=photo.fileDataRepresentation() else {
        print("Error converting photo to data.")
        return
    }

    // Create a `UIImage` from the image data.
    guard let image: UIImage = .init(data: imageData) else {
        print("Error converting data to a `UIImage`.")
        return
    }

    // Edit image.
    let result: UIImage=UIGraphicsImageRenderer(size: image.size).image(actions: { _ in
        ...
    })

    // Save edited image to photo library.
    PHPhotoLibrary.shared().performChanges {
        let creationRequest: PHAssetChangeRequest = .creationRequestForAsset(from: result)

        // Add metadata to the photo.
        creationRequest.creationDate = Date()
        if let location=self.location {
            creationRequest.location = .init(latitude: location.latitude, longitude: location.longitude)
        }
    }
}

However, I need to save some metadata with the photo. The metadata is two strings. One is a description and the other is a category. How can I include these strings in the saved photo's metadata?


text:
Q: how to display the listviews as cover flow in Android I am new to Android programming.I tried the cover flow example for rotating image views by using below link.
http://www.codeproject.com/Articles/146145/Android-3D-Carousel
But my requirement is to rotate the multiple list views data.Is it possible to do using this Carousel.Please tell me how to proceed.
Thanks in advance.


text:
Q: Odd/even styling divs I have a page with multiple divs, i want to change the background-color property based on the odd and even rule, the first two divs are not included in the count so i want it to start from section four which should be odd because it's the first one but it's not working it always stays even, here is my code:

.box:nth-child(odd) {
  background-color: yellow;
}

.box:nth-child(even) {
  background-color: red;
}

Hello World

Hello World

Hello World

Hello World

Hello World

Hello World

Hello World

A: The fourth is even. If you want it counted differently, make it the first (or odd) child in a different container.

A: If you are using jquery, you can do this:
$(document).ready(function() {
  $(".box:odd").css('background-color','yellow');
  $(".box:even").css('background-color','red');
});

Source (example with paragraphs): https://codepen.io/cibily/pen/hCDjF

A: It does not work because they are siblings or childs of the same parent, so it does not matter that you're trying to select only those with class, it counts sibling tags.
So it's not the first (odd), it's the fourth (even).
Simply change it to:
.box:nth-child(odd) {
  background-color: red;
}

.box:nth-child(even) {
  background-color: yellow;
}

And you'll get the colors in your desired order.


text:
Q: ¿Porqué mi aplicación de Windows 64 mapea bibliotecas kernel32, gdi32, win32u, etc.? Estuve explorando e intentando aprender un poco sobre la arquitectura y los detalles de bajo nivel de Windows x64. Para ver un poco cómo se organiza el espacio de memoria de los procesos compilé una aplicación básica y la cargué en el debugger. Curiosamente, en el espacio de memoria están mapeadas las bibliotecas kernel32.dll, gdi32.dll, user32.dll, gdi32full.dll y win32u.dll. No tengo motivo para asumir que porque tienen 32 en el nombre están de alguna forma atadas a 32 bits, aunque me resultó llamativo. ¿Alguien sabe si es solo una cuestión de nomenclatura o si realmente hay algo más profundo?
Gracias.

A: Siempre se llamaran kernel32.dll, etc., incluso en Windows de 64 bits. Esto es por las mismas razones de compatibilidad que system32 contiene binarios de 64 bits, mientras que syswow64 contiene binarios de 32 bits.
Windows de 64 bits proporciona dicho entorno "listo para usar" y es compatible con aplicaciones de 32 bits que utilizan el subsistema "Windows en Windows 64", abreviado a WOW64, que se ejecuta en modo de usuario y asigna las llamadas de 32 bits al sistema operativo kernel en una llamada equivalente de 64 bits. Normalmente, esto es casi invisible para el programa que hace la llamada. Windows proporciona un conjunto de DLL de 64 bits en% windir% \ system32 y un conjunto equivalente de DLL de 32 bits en% windir% \ syswow64. De hecho, la mayor parte de las imágenes binarias en este directorio son idénticas a los mismos archivos en el directorio system32 en una instalación de Windows de 32 bits. (Me parece un desafortunado problema de nomenclatura que las DLL de 64 bits esten en system32 y las de 32 bits en syswow64, pero ahí están)
Por ejemplo:
En las versiones de Windows de 64 bits, uno de los "kernel32.dll" s contiene un código de 64 bits, pero aún se llama kernel32.dll. Esto es algo engañoso.
Espero que los siguientes enlaces te ayuden:

*

*http://www.howzatt.demon.co.uk/articles/DebuggingInWin64.html

*http://www.viva64.com/en/l/0002/

*https://docs.microsoft.com/en-us/archive/blogs/aaron_margosis/using-ntfs-junctions-to-fix-application-compatibility-issues-on-64-bit-editions-of-windows
Fuente: Tomado el ingles:
https://stackoverflow.com/questions/1364741/does-64-bit-windows-use-kernel64


text:
Q: Same form for login and registration in FOSUserBundle I am using the newest versions of FOSUserBundle and Symfony2. I have to provide a form that can be used for login and for registration. It has two fields:

*

*mail adress (required)

*password (only required for login)

and two buttons:

*

*login

*register

If the user enters his mail adress and clicks login, he will get an error that the password is missing. If he enters his mail adress and clicks register he gets an account and a password is generated. I already implemented the whole functionality, but I use two separated forms for login and register.
Now I want to merge these forms. This is what I tried so far:
    public function welcomeAction()
    {
        $data = array();
        $form = $this->createFormBuilder($data)
            ->add("email", "email")
            ->add("password", "password", array("required" => false))
            ->add("register", "submit")
            ->add("login", "submit")
            ->getForm();

        $form->handleRequest($this->getRequest());

        if ($form->isValid()) {
            if ($form->get("login")->isClicked()) {
                return $this->forward('FOSUserBundle:Security:check',
                       array('_username'  => $form->getData()["email"],
                             '_password' => $form->getData()["password"]
                       )
                );
            } else if ($form->get("register")->isClicked()) {
            echo "REG"; #testing
            } else die("ERROR_WELCOME_FORM");
        }

        return $this->render('MyBundle:Index:welcome.html.twig', array("form" => $form->createView()));
    }

I am using forward instead of redirect because it is not possible to pass POST parameters when redirecting.
When I submit the form by clicking the login button I get:

You must configure the check path to be handled by the firewall using form_login in your
  security firewall configuration.

So I changed the check_path parameter in security.yml from

check_path: fos_user_security_check

to

check_path: welcome (that is my route for Index:welcome() Action

and test it again. The error disappears as expected but I get two new problems.
First, I am not able to use the single login form with the new check_path anymore. This is because the original fos_user_security_check was removed, obviously. But I need to be able to use both the merged form and the single form.
Second, I get the error

Invalid CSRF-Token.

Does anyone have a solution for this? Is this easily possible without hacking into FOSUserBundle or implementing the login action by hand? I need the same for the register part of the form but I think that this is analog.
Is this maybe the wrong approach? Can I somehow use the same field (email) for two separated forms?


text:
Q: Set div by default active I have 3 div's and 3 buttons each button on click reveals one div but what im trying to achieve is to set div-nr1 to be by default displayed
this is the angular code that im using...
 var app = angular.module('app',[]);
    app.controller('Test',function($scope){
            $scope.show = 1;
    });

this are buttons

and this is one of the div's

A: Couldn't you just init the show variable in the markup like below?


text:
Q: How to authenticate windows user in a intranet Nodejs app I developed a web app using React and NodeJS for the company I am working at. I set up authentication using JWT (Using a login HTML form) but now I am required to authenticate users in the web app using the windows credential. I am hosting the React app in IIS on a server inside the company's local network.
What are the options to get this task done? Thanks for your comments.
I have tried Passport-windowsauth.


text:
Q: SharePoint User Code Host Eating all my memory and CPU I'm running sharepoint 2013 on a windows server R2 2012, my machine has 12gb RAM. The problem is that above process is creating multiple instances which are in turn eating all my ram and CPU.
See below

I'm running one web application on a single server.
See my system properties

Any idea on how to solve that guys?

A: If you are using Sandbox Solutions you need the User Code Service to make them work. If you don't then turn it off. That service, along with the associated host controller, creates a new process for each instance of your sandbox solution. The more solutions you deploy, the more RAM you will need.
Generally, on a development box, with Visual Studio, you would want 16-24 GB RAM.
If you spin up the Search Service it will spin up 6 processes that will eat your RAM. Again, if you don't need search in development, don't create the service application. If you do, dial down the performance level so you are not impacted.


text:
Q: D365FO x++ syscomputedcolumn table name How can you use the syscomputedcolumn class to retrieve a table or field name for an entity? this is fairly easy using virtual field entity postload method something like
public class SysDatabaseLogHeaderEntity extends common
{
    public void postLoad()
    {
        super();

        this.TableName = tableId2Name(this.table);
    }
}

but there's a rumour that virtual fields won't be supported in upcoming synapse link for D 365 FnO so want to know how to do this with computed columns...
https://learn.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/data-entities/data-entity-computed-columns-virtual-fields

A: SysComputedColumn is used to help create computed columns in views.
Supposing for some reason you want a column in which every row contains the string value "CustTable", you'd create create a method (AX 2012 syntax):
public static server string TableNameColumn()
{
    return SysComputedColumn::returnLiteral(tableStr(CustTable));
}

and then you'd add a computed column to the view as outlined here: https://learn.microsoft.com/en-us/dynamicsax-2012/developer/walkthrough-add-a-computed-column-to-a-view
Note: hopefully this is a toy example, there is no reason to ever actually do this particular column.  Or really any fully static columns.
View computed columns are essentially based on static server methods which return the SQL definition for the computed column, and then the SysComputedColumn class has a bunch of helper methods to let you build those SQL string statements without using specific implementation knowledge of the backend database such as column names.
A complete description is beyond the scope of this comment, but the big one you'll use is SysComputedColumn::returnField(view,datasource,field) which gets the specified field from the specified datasource in the specified view.  You want to use intrinsic functions for these parameters to keep your cross references valid (https://learn.microsoft.com/en-us/dynamicsax-2012/developer/intrinsic-functions).
There will be a lot you can't do though.  These are sql only so they cannot send individual rows into X++ business logic.  You need to reconstruct said business logic in SQL which can't always be done easily.
I like to keep those methods public so I can info them out and test them in SQL directly.  I'm guessing you can't access the sql in d365, but looking at the string returned from your method can still help in troubleshooting.


text:
Q: Bash Curl request PHP array I need to send a request with POST containing something like this:
values = [
    test1 => foo,
    test2 => bar,
]
This is how my post request looks like:
curl_opts=(
    --silent
    --header "Content-type: application/json"
    --header "Authorization: Bearer foobar"
)

data=$(printf '{"values[test1]":"%s", "values[test2]":"%s"}' "foo" "bar")
auth_response=$(curl "${curl_opts[@]}" -v -s -H -X POST -d "$data" "http://$SITE" --trace-ascii /dev/stdout)

But this does not work. A POST request with Postman with the same variables does work.


text:
Q: Django doesn't see fk in other table I have some models and fk on them to others.
models.py
class ElementMessages(models.Model)
    element = models.ForeignKey(Element, on_delete=models.CASCADE)
    sender = models.ForeignKey(UserAccount, on_delete=models.SET_NULL, null=True)
    text = models.TextField(max_length=512, null=True)
    send_time = models.DateTimeField(auto_now_add=True)
    type = models.CharField(max_length=16, choices=MESSAGE_TYPES, default=SIMPLE)
    type_dialog = models.CharField(max_length=10, choices=DIALOG_TYPE, default=DIALOG_TALK)
    request = models.ForeignKey(ChatRequest, null=True, default=None, on_delete=models.CASCADE)
    post_work = models.ForeignKey(PostWork, null=True, default=None, on_delete=models.CASCADE)
    files = models.BooleanField(default=False)

class Element(models.Model):
    id = models.UUIDField(default=uuid.uuid4, editable=False, unique=True, primary_key=True)
    artist = models.ForeignKey(Artist, on_delete=models.CASCADE, related_name='chat_element', null=True, blank=True)
    customer = models.ForeignKey(Customer, on_delete=models.CASCADE, related_name='chat_element', null=True, blank=True)
    element = models.ForeignKey('projects.Element', null=False, on_delete=models.CASCADE, related_name='chat_element')

When I try to delete Element object, it raises this:
django.db.utils.IntegrityError: insert or update on table "chat_elementmessages" violates foreign key constraint "chat_elementmessages_element_id_672e2ba2_fk_chat_element_id"
DETAIL:  Key (element_id)=(87cdd8d7-47f0-4264-8aa7-ae21a8246fd8) is not present in table "chat_element".

But when I look at table in db, this key exists.
How to fix that?

A: As it turned out, problems were at Django pre_delete andpost_delete signals. They tried to refer to a non-existing object, that I'm try to delete. Fixed with simple check on the existence of the object.