text:
Q: What's the best way to turn CPAN modules into Debian packages? Whenever I work on a system of any flavor that has a particular way of handling package management, I try to stick with that standard for managing my Perl modules.  "When in Rome, etc."
For example, on a Win32 system using ActivePerl, I use PPM for everything and use the great PPM::Make.  On a RedHat system I prefer to use RPMs.
Now I am working on a Debian system, and find myself in need of a way to turn an arbitrary CPAN or CPAN style distribution into a deb.
Google shows options like dh-make-perl, CPANPLUS::Dist::Deb and CPAN::Packager::Builder::Deb.
Does anyone with experience with these different tools have any recommendations as to what to use or avoid?
What's the best way to handle building deb files from standard CPAN modules?
Update:
I found an article by Hans Dieter Piercy on this subject - he suggests, for his own needs, CPANPLUS tools.  Under some circumstances he recommends dh-make-perl.  Jeremiah Foster (who wrote the article brian d foy points to) responds to HDP and makes a case for dh-make-perl.
There's also a post on idimmu.net that describes using dh-make-perl.
ATM, I'm leaning toward dh-make-perl, since that has been thrice recommended (brian d foy as proxy for Jeremy Foster, the idimmu.net author and hillu) vs once for CPANPLUS

A: I suggest you ask the Debian Perl Maintainers group, rather than here on SO.  Just mail the address shown as maintainer on any odd package:
Debian Perl Group <pkg-perl-maintainers@lists.alioth.debian.org>
Back in the day, I added a few modules to Debian, and just 'did it by hand'. I still maintain some. That isn't hard either.  but the group now maintains way more package, and has tools.

A: Jeremiah Foster published an article about turning Perl distros into Debian packages in the Spring 2009 issue of The Perl Review.

A: There is a very good step by step here as well. (also with links to other good resources and some decent comments. [it is dated 2005, but still mostly relavent and many comments much more recent])
http://www.debian-administration.org/articles/78
here is the debian perl policy (also linked to in article)
http://www.debian.org/doc/packaging-manuals/perl-policy/

A: dh-make-perl does a good job in taking care of the repetitive and heavy lifting and guessing information from the sources. It has worked correctly for almost all of the CPAN modules that I have packaged up as Debian packages (official or for in-house use only).
That said, the resulting package should only be considered as a starting point for a proper Debian packages. dh-make-perl puts warning notes into the automatically generated such as debian/control (i.e. description of the package and dependencies) and debian/copyright (licensing information).
In response to Manni, I believe that it is a great idea to work with the tools that the OS or distribution provides for package management, not against them. In the case of Debian, this means putting stuff into .deb packages and installing those. Perl's build tools and CPAN do a great job of providing a cross-platform build environment and for distribution of the source code, but compared to package management tools in modern Linux distributions, they perform suboptimally, simply because extra manual intervention is often required that is less easily automated across multiple machines than rolling up a package.
(For one-off and test installations, installing into /usr/local/ and using stow(8) as a poor man's package manager may be okay.)
Even if you are just building the packages for your own use, consider contacting the Debian Perl Group and have someone sponsor an upload to Debian if you feel that the module in question is of use for other people.

A: You won't like this, but I really think that you should not do this at all. The various Perl Debian packages aren't for developers that need certain Perl modules on their machines. They were built because other applications need them and users want or might want those applications.
Please take a look at the answers to this question before doing something that you probably should not be doing.


text:
Q: call to search() in vimrc iab statement not working I'm trying to make a vim iab statement in my vimrc file that will take "__div" and insert  with the cursor in between the open and close div tag.
From reading online, I should be able to do the following to make it work:
iab __div <div>!cursor!</div>:call search('!cursor!', 'b')cf!

I've tried it in gvim 7.3 on Windows and vim 7.2 in Linux, and it hasn't worked (all I get is the full string, with the search call in text, inserted into my file).
From reading online, it sounds like there may have been some changes to the search() function as of vim 7. But I can't find any specifics that would explain why this doesn't work.
Why does this not work?

A: You are in insert mode, so, of course, it does not work. You should add <C-o> before :call and <CR> after (or you won't get it executed). But I suggest you write the following instead:
inoreabbrev __div <LT>div><LT>/div><C-o>F<

redpajama_set_name: RedPajamaStackExchange


text:
Q: Mysql: ON DUPLICATE KEY UPDATE ALL VALUES? Is there any easy way to update all values after a duplicate key? For example:
INSERT INTO published_books
           SELECT * FROM books
           WHERE book_id = book_id
           ON DUPLICATE KEY UPDATE ?everything?

The table has around 50 columns and updating each would be painful. Any ideas?

A: You can use REPLACE INTO for this purpose:
REPLACE INTO published_books SELECT * from books;

A: If you can generate the query, you could use something like this (PHP):

$fields = array(
    'field_1',
    'field_2',
    'field_3'
);
$query = '
    INSERT INTO table (
    ' . implode(', ', $fields) . '
    ) SELECT
        -- ...
    ON DUPLICATE KEY UPDATE ';
foreach ($fields as $i => $field) {
    $query .= ($i > 0 ? ', ' : '') . $field . '=VALUES(' . $field . ')';
}

A: INSERT INTO published_books(col1, col2)
VALUES ('xxx', 'yyy') ON DUPLICATE KEY UPDATE col1 = VALUES(col1)


text:
Q: Visual Studio--Alter Variable While Debugging Is it possible to alter a variable while debugging?
Say for example I have this code:
    string x = "foo"; //would actually be a passed-in variable in the real world.

    var y = "X equals " + x;

    ==>[BREAKPOINT] return x;

Is there a way to manually enter or otherwise change the value of "x" when I hit the break point?  Also , is it possible to "step back" in the code in the same way that you can press F11 and step through it?

A: Yes, there are 2 ways to change a variable:

*

*Use the Immediate window. Simply typing x = "a new value" will change it. Also, if you want to check the value of x use ?x

*You can hover over the variable, and when the value displays in the quickwatch pop-up thing, just click on it an manually change it. (You can also add the variable to watch, or select quickwatch to change it).

If you would like to step to a different instruction, there are 2 ways to do that too:

*

*You can right-click on the line you want to go to and select 'Set next statement'. This even works if you have hit an exception while debugging

*You can drag the yellow arrow that indicates the current instruction to wherever you need it


text:
Q: Modal ajax.form validation ASP.NET MVC, error message not showing, modal not closing after succesful submit i'm new to the ASP.net and i get easilly confused when jquery and Ajax get in the middle of a code.
I have a popup bootstrap Modal that show when i click on a button, the Modal contains an Ajax.form that allows me to create projects, i'm using HTML.validation to check if my form is filled correctly. I have two main problems :

*

*When I enter valid informations in my form and i submit the form, the project is created succesfully but the Modal doesn't close automaticlly.

*When i enter non-valid informations when i submit no message error apear, nonetheless when I close the modal and open it again, the errors apear.

I need your help to :

*

*Close the modal once the submit form is valid.

*Have the error message show in my modal form.

*This is a part of my main view :
enter code here

                        Créer projet

                                Créer un Projet

                                <button type="button" class="btn-close"
    data-bs-dismiss="modal" aria-label="Close"></button>

                            @using (Ajax.BeginForm("createProjectPost",
    "ProjectSelection", new AjaxOptions { HttpMethod = "POST",
     UpdateTargetId = "Body_NewProject" }, new { id = "projectForm" }))
                            {

                                        Loading...

                            }

*And this is my partial view that containts the elements of the form

        @Html.DropDownListFor(m => m.Project.Domain,
         new SelectList(Model.Domains, "IdDomain", "Name"),"Selectionner un domaine",
         new { @class = "w-100", @id = "DomainSelection" })

        @Html.ValidationMessageFor(m => m.Project.Domain, null,
          new { style = "color: red;" })

        @Html.DropDownListFor(m => m.Project.Teams,
         new SelectList(Model.Teams.Select(teamElement => teamElement.Name).ToList()),
         "Selectionner une équipe", new { @class = "w-100" })

        @Html.ValidationMessageFor(m => m.Project.Teams, null,
         new { style = "color: red;" })

        <input class="form-control " data-val-required="Le champ Projet est requis."
         id="Project.Name" name="Project.Name" type="text" value="">
        Nom du projet
        @Html.ValidationMessageFor(m => m.Project.Name, null,
          new { style = "color: red;" })

             <button class="btn btn-secondary" data-bs-dismiss="modal"
              type="button">Annuler</button>
             <button type="submit" form="projectForm"
                 class="btn btn-red">Valider</button>

*This is my Controller code
    public ActionResult createProject()
    {
        //initialization code
        return PartialView();
    }
    [HttpPost]
    [ValidateAntiForgeryToken]
    [HandleError]
    public ActionResult createProjectPost(Project project)
    {

        #region Variable verification

        if (!ModelState.IsValid)
        {
            Session["Error"] = true;

            if (project.Domain == null)
            {
                Session["DomainError"] = true;
            }
            if (project.Teams == null)
            {
                Session["TeamError"] = true;
            }
            if (project.Name == null)
            {
                Session["NameError"] = true;
            }
            ViewData["project"] = "create";

            //return View("ProjectSelectionPage");
            return PartialView(project);
        }

        #endregion

        #region Initialisation
         //initilization code
        #endregion

        #region Check possible copy of the project

        if (projectDB.Exist(project.Name))
        {
            //Check that this project doesn't exist in the database
            //Create a session variable that will trigger an error message
            Session["Error"] = true;
            Session["NameCopy"] = true;
            ViewData["project"] = "create";
            return PartialView(project);
        }

        #endregion

        #region Project to database and generate name

        //Add the project to the database

        #endregion

        return PartialView();
    }

It's been several days since i'm searching for an answer, i either missed one or didn't use it correctly.
enter image description here
Thank you


text:
Q: Upload files - Cant find BROWSE button control windows phone 7 I want to upload my files from windows phone 7 to my server using web service via HTTPRequest or WebClient.
But i could not find the "Browse" button from where user can select the file to upload.
Can anyone point me they ways from which user can select the file to upload?

A: There is no browse functionality in Windows Phone 7. Windows Phone does not have the concept of a 'hard drive' containing user documents like a Windows PC does.
There are various ways to get at specific types of files, such as Pictures via the various "Choosers" that Microsoft provides. http://msdn.microsoft.com/en-us/library/ff769543(v=vs.92).aspx
If the documents are documents you have created then you will likely have stored them in Isolated Storage (the only disk space your app has access to) so you will have to provide the browser functionality yourself as only you will know what files are there and which the user should be able to upload.


text:
Q: Changing a file name using VBScript Hi I succeed changing a file name using VBS by using this code:
Set fso = CreateObject("Scripting.FileSystemObject")

set oFldr = fso.getfolder("C:\v\t_TEST\")

for each ofile in oFldr.Files
 if lcase(fso.GetExtensionName(ofile.Name)) = "txt" then
  ofile.name = "index.txt"
  Exit for
 end if
Next

Now I would like to make every .txt file placed on folder "v" (subfolders) to change it name also.
Or to define a changing path ("C:\v\t_XXX), so each folder starts with t_ in this path will change inside it all files end with .txt.
How do I do that?
Thanks!

A: I believe this is what you are looking for....
Set fso = CreateObject("Scripting.FileSystemObject")

Set oFldr = fso.getfolder("C:\v\")
For Each fld In ofldr.SubFolders
    If Left(fld.name, 2) = "t_" Then
        Set ofls = fso.GetFolder("C:\v\" & fld.name & "\")
        For Each ofile In ofls.Files
            If LCase(fso.GetExtensionName(ofile.Name)) = "txt" Then
                ofile.name = "index.txt"
                Exit For
            End If
        Next
    End If
Next


text:
Q: cassandra 3.0.0.8 memtable flush is not happening i am using cassandra 3.0.0.8 on centos i got the below error in the logs after that metable flushes are not happening
ERROR [MemtableFlushWriter:7735] 2017-01-18 23:00:02,101 CassandraDaemon.java:201 - Exception in thread Thread[MemtableFlushWriter:7735,5,RMI Runtime]
java.lang.StackOverflowError: null
        at org.apache.cassandra.db.DecoratedKey.compareTo(DecoratedKey.java:85) ~[apache-cassandra-3.0.8.jar:3.0.8]
        at org.apache.cassandra.db.DecoratedKey.compareTo(DecoratedKey.java:39) ~[apache-cassandra-3.0.8.jar:3.0.8]

A: This can be due to data corruption.
Try to run repair on the node.
If it doesn't help, try to run rebuild on the node.
Does it happens on 1 node or all nodes in the cluster?


text:
Q: Why/when is __declspec( dllimport ) not needed? In a project using a server.dll and a client.exe, I have dllexported a server symbol from the server dll, and not dllimported it into the client exe.
Still, the application links, and starts, without any problem.  Is dllimport not needed, then???
Details:
I have this 'server' dll:
// server.h
#ifdef SERVER_EXPORTS
  #define SERVER_API __declspec(dllexport)
#else
  #define SERVER_API // =====> not using dllimport!
#endif
class  SERVER_API CServer {
   static long s;
   public:
   CServer();
};

// server.cpp
CServer::CServer(){}

long CServer::s;

and this client executable:
#include <server.h>
int main() {
   CServer s;
}

The server command line:
cl.exe /Od  /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL"
 /D "SERVER_EXPORTS" /D "_UNICODE" /D "UNICODE" /D "_WINDLL"
 /Gm /EHsc /RTC1 /MDd /Yu"stdafx.h"
 /Fp"Debug\server.pch" /Fo"Debug\\" /Fd"Debug\vc80.pdb"
 /W3 /nologo /c /Wp64 /ZI /TP /errorReport:prompt

cl.exe /OUT:"U:\libs\Debug\server.dll" /INCREMENTAL:NO /NOLOGO /DLL
/MANIFEST /MANIFESTFILE:"Debug\server.dll.intermediate.manifest"
/DEBUG /PDB:"u:\libs\Debug\server.pdb"
/SUBSYSTEM:WINDOWS /MACHINE:X86 /ERRORREPORT:PROMPT
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib
shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib

Client command line:
cl.exe /Od /I "..\server"
 /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE"
 /Gm /EHsc /RTC1 /MDd /Fo"Debug\\" /Fd"Debug\vc80.pdb" /W3 /c /Wp64 /ZI /TP
 .\client.cpp

cl.exe /OUT:"U:\libs\Debug\Debug\client.exe" /INCREMENTAL
/LIBPATH:"U:\libs\Debug"
/MANIFEST /MANIFESTFILE:"Debug\client.exe.intermediate.manifest"
/DEBUG /PDB:"u:\libs\debug\debug\client.pdb"
/SUBSYSTEM:CONSOLE /MACHINE:X86
server.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib

A: __declspec(dllimport) is a client-side MSVC attribute that can be specified for imported code and data.
It isn't required for code.  It is an optimization; a client-side compiler hint that a function call isn't direct but imported.  The imported function pointer for a function named foo() will be __imp_foo.  Without the hint, a thunk is created to load the address in __imp_foo and jump to it.  With the hint the thunk is skipped and an indirect call through the IAT1 entry is generated i.e. the thunk is inlined.  It is a time optimization, not space.
It's required for data that's imported from a DLL.
This blog post has the details.
1: Import Address Table of a program

A: I was wondering about this too. I also removed the __declspec(dllimport) instruction and was very surprised to see that a dll (gmodule) relying on functions in another dll (glib) compiled and ran (in wireshark in particular) without problems. Here's a quote by MS:
__declspec(dllimport) is ALWAYS required to access exported DLL data.

No idea why MS says this, because on other pages they state the instruction is not necessary. Regardless, not only does my library run without dllimport, but I haven't seen an "__imp" symbol in ages, while formerly I was constantly stumbling upon it (or it on me). What happened to it? The answer is here:
That's why using __declspec(dllimport) is better: because the linker doesn't generate a thunk if it's not required. There's no thunk and no jmp instruction, so the code is smaller and faster. You can also get the same effect WITHOUT __declspec(dllimport) by using whole program optimization. For more information, see /GL (Whole Program Optimization).

Now it makes sense. I am using /GL (+ /LTCG) on all projects. So that's the answer to the topic question
when is __declspec( dllimport ) not needed?

When whole program optimization is utilised.


text:
Q: Code to draw geometry doesn't run I'm new to Mathematica and have no background whatsoever in programming, although I will teach myself soon.  I was wondering if one of you programming pros could help me out.  I received a code from an online source.  The code is supposed to draw some form of geometry (ie: remove faces from say a cube and make a shell/pipe structure out of its edges)  I was under the impression that I had to copy/paste the code in the browser and enter it for it to run.  However it doesn't seem to do anything.  I'm wondering if the code was meant for an old version of Mathematica, has errors in or perhaps I just don't know how to get it running. Would really appreciate if someone could help me until I get my head around Mathematica/coding.
edgeIndicesOfFace[face_] :=
 Select[Transpose[{face, RotateLeft[face]}], (#[[1]] < #[[2]]) &];
edgeIndices[gc_] := Apply[Join, Map[edgeIndicesOfFace, gc[[1, 2, 1]]]];
edges[gc_] := Map[vertices[gc][[#]] &, edgeIndices[gc], {2}];

translateVertices[name_, scale_, xyz_] :=
  Map[(xyz + #) &, scale vertices[PolyhedronData[name]]];

strut[name_, scale_, edge_] :=
 cHull[Join[translateVertices[name, scale, edge[[1]]],
   translateVertices[name, scale, edge[[2]]]]];

edgeModel[name_, nameVertex_, scale_] :=
 Apply[Join, Map[strut[nameVertex, scale, #] &, edges[PolyhedronData[name]]]];

view[edgeModel["Cube", "Cube", .2]]

Manipulate[
 view[edgeModel[big, small, scale]], {big, PolyhedronData[All]}, {small,
  PolyhedronData[All]}, {scale, 0.001, 1}]

A: I think that your 'online source' has given you only part of a longer Mathematica notebook. This extract is from a notebook by the great George Hart, who's an artist and Mathematica-gician.  You'll find it in:

Procedural Generation of Sculptural Forms George W. Hart, Stony Brook
  University, http://www.georgehart.com, Jan 2008  This notebook
  contains all the examples from my Bridges 2008 paper.

Some of the functions required by your extract have been defined in earlier sections of the notebook.
The image produced by the view[] expression near the end is:

Although the notebook was written for Mathematica 6, it works OK in Mathematica 8. It's better to evaluate the notebook sequentially, as sections use functions defined in earlier sections.


text:
Q: Telegraf x509 input to monitor Kafka SSL endpoint I wondered how I can monitor Kafka SSL endpoint with x509 telegraf input as it doesn't seem to work as expected.
Here is my input configuration:
#
# INPUTS:
#
[[inputs.x509_cert]]
sources = ["https://mykafka.example.com:9093"]

And here is what I get in telegraf logs:
mykafka.example.com 06:46:41 ~ # systemctl status telegraf -l
● telegraf.service - The plugin-driven server agent for reporting metrics into InfluxDB
   Loaded: loaded (/usr/lib/systemd/system/telegraf.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2020-06-12 15:24:13 UTC; 6 days ago
     Docs: https://github.com/influxdata/telegraf
 Main PID: 29548 (telegraf)
    Tasks: 10
   Memory: 78.4M
   CGroup: /system.slice/telegraf.service
           └─29548 /usr/bin/telegraf -config /etc/telegraf/telegraf.conf -config-directory /etc/telegraf/telegraf.d

Jun 19 06:37:45 mykafka.example.com telegraf[29548]: 2020-06-19T06:37:45Z E! [inputs.x509_cert] Error in plugin: cannot get SSL cert 'https://mykafka.example.com:9093': local error: tls: unexpected message
Jun 19 06:38:45 mykafka.example.com telegraf[29548]: 2020-06-19T06:38:45Z E! [inputs.x509_cert] Error in plugin: cannot get SSL cert 'https://mykafka.example.com:9093': local error: tls: unexpected message
Jun 19 06:39:45 mykafka.example.com telegraf[29548]: 2020-06-19T06:39:45Z E! [inputs.x509_cert] Error in plugin: cannot get SSL cert 'https://mykafka.example.com:9093': local error: tls: unexpected message

I also tried with tcp://mykafka.example.com:9093 (instead of https) with the exact same result.
And openssl is returning me the served certficate without any issue, if I do: openssl s_client -connect mykafka.example.com:9093 I have the information I'm looking for.
Thank you in advance for your help, should it be with telegraf x509 input or with any other solution that can come around.

A: I gave the plugin a try to check the x509_cert plugin to connect to the Kafka Broker's SSL port directly and it works fine for me. Here is my config:
[[inputs.x509_cert]]
  sources = [ "tcp://kafkabr3test.example.com:9093" ]
  tls_ca = "/etc/telegraf/telegraf.d/MMW-CA-SHA256.cer.crt"

I've tested it with version 1.25 of telegraf.


text:
Q: Axiomatic definition of integers The real numbers can be axiomatically defined (up to isomorphism) as a Dedekind-complete ordered field.
What is a similar standard axiomatic definition of the integer numbers?
A commutative ordered ring with positive induction?

A: The ring $\mathbb{Z}$ is the unique ordered ring which satisfies full second-order induction:
$$\forall X(0 \in X \land (\forall n \geq 0)(n \in X \to n+1 \in X) \to (\forall n \geq 0)(n \in X)),$$
where $X$ varies over all subsets of $\mathbb{Z}$ (or even all sets). In the comments, Martin Brandenburg has given yet another characterization of $\mathbb{Z}$ which does not assume the ordering.
A dual characterization is that every nonempty subset of $\mathbb{Z}$ which is bounded below has a minimal element. This is closer to the characterization of $\mathbb{R}$. Note that all of these characterizations only make sense in standard second-order logic, but the proposed characterization of $\mathbb{R}$ has the same problem.
The ring of integers also has categorical characterizations. For example, as proposed in the comments, $\mathbb{Z}$ is initial object in the category of (ordered) rings. See this question for related information.

A: Part 1: Abelian group introduction
(See Part 2 for the final answer).
I feel that for a fully elegant definition of integers one needs to readdress the definition of an Abelian group. For the sake of communication I will even introduce a synonym minusop for abelian groups to stress the independence of their definition from the general groups. The general groups have an elegant definition (perhaps more than one). Then adding the commutativity axiom one gets Abelian groups. This seems to me unnecessarily complex. Let me define Abelian groups directly.
Symmetric operations
Symmetric operations should not be confused with much more special commutative operations.
By definition, an operation   $\#:X^2\rightarrow X$   is called symmetric   $\Leftarrow:\Rightarrow$
$$ \forall_{x\ y\ z\in X}\qquad x\ \#\ (y\ \#\ z)\ \ =\ \ z\ \#\ (y\ \#\ x) $$
This property will appear in the definition of minusop as an axiom. Both addition and subtraction are symmetric operations in any Abelian group. Every commutative operation is symmetric.
Minusop
By definition, a minusop is an ordered pair   $(X\ -)$,   where   $X$   is an arbitrary set, and   $-$   is a binary operation in   $X$,   such that the following three axioms hold:

*

*$x-(y-z)\ =\ z-(y-x)$

*$x-x\ =\ y-y$

*$x-(x-x)\ =\ x$

for arbitrary   $x\ y\ z\in X$.
Every Abelian group admits a standard interpretation as a minusop; and every non-empty minusop admits its standard interpretation as an Abelian group, so that Abelian groups and non-empty minusops are essentially the same objects.
(I am not writing the last obvious statement in any detail to keep this post sensibly short).
REMARK
A class of operations even more general than symmetric is still useful--I call operation   $\#:X^2\rightarrow X$   insider trading (in mathematics it's legal)   $\Leftarrow:\Rightarrow$
$$\forall_{u\ w\ x\ y\ \in\ X}\qquad (u\ \#\ w)\ \#\ (x\ \#\ y)\ \ =\ \ (u\ \#\ x)\ \#\ (w\ \#\ y)$$
Every symmetric operation is an insider trading.
A simplification by Emil Jeřábek
The last two of the three minusop axioms above (in the previous section before REMARK) can be replaced by one, as pointed out Emil Jeřábek, as now presented below. A minusop can be axiomatized by the following two conditions:

*

*Symmetry:     $x-(y-z)\ =\ z-(y-x)$

*Zero:     $x-(y-y)\ =\ x$

for arbitrary   $x\ y\ z\ \in\ X$.
It can be seen instantly that the earlier three axioms imply the two above (the new first axiom is a repetition of the old first axiom).
In the other direction, a substitution of $y$ by $x$ in axiom zero gives the old axiom 3. Furthermore, assuming the above two axioms we obtain:
$$ x-x\ =\ (x-x)-((y-y)-(y-y))\ =\ (y-y)-((y-y)-(x-x)) $$
$$ (y-y) - (y-y)\ =\ y-y $$
which proves the old axiom 2. The new 2-axiom system is equivalent to the old 3-axiom system.

A: Part 2: Cyclands and integers
(This text is a continuation of Part 1 from the same thread).
First I'll axiomatize here the cyclic groups--I'll call them cyclands (to avoid any confusion during the definition stage; later one can go back to the standard naming; the same goes for Abelian groups and minusops). Then there will come time for integers.
Cyclands
By definition, a cycland is an ordered triple   $(X\ -\ 1)$   such that   $X$   is an arbitrary set,   symbol   $-$   stands for a binary operation in   $X$,   $1\in X$, and   the following (algebraic induction-like) axiom holds:
$$ \left(\left(1\in A\subseteq X\right)\ \ \&\ \ \left(\forall_{x\ y\in A}\ x-y\in A\right)\right)\quad\Rightarrow\quad \left(A=X\right)$$
Integers
DEFINITION   Integers (i.e. the system of integers) is a cycland   $(\mathbb Z\ -\ 1)$   such that the following (additional) two axioms hold:

*

*$1-x\ne x$

*$1-x=x-1\quad\Rightarrow\quad x=1$

for arbitrary   $x\in\mathbb Z$.
Integers from scratch
To have an easy overview of the definition of integers let me list all the relevant axioms directly (without mentioning minusops and cyclands).
The system of integers is an ordered triple   $(\mathbb Z\ -\ 1)$   such that the following six axioms hold:

*

*$ x-(y-z)\ =\ z-(y-x)$

*$ x-x\ =\ y-y$

*$ x-(x-x) = x$

*$ 1-x\ne x$

*$ \left(1-x=x-1\right)\ \Rightarrow\ \left(x=1\right)$

*$ \left(\left(1\in A\subseteq X\right)\ \ \&\ \ \left(\forall_{x\ y\in A}\ x-y\in A\right)\right)\quad\Rightarrow\quad \left(A=X\right)$

for arbitrary   $x\ y\ z\ \in\ \mathbb Z$.
Other standard constructions or notions
We define in   $\mathbb Z$   the usual, like:

*

*$0\ :=\ 1-1$

*$\mathit{Neg}(x)\ :=\ 0-x$

*$x+y\ :=\ x -\mathit{Neg}(y)$

Furthermore, in every cycland, in particular in   $\mathbb Z$,   there is exactly one binary operation   $\cdot$   which has the following two properties:

*

*$x\cdot 1\ =\ x$

*$x\cdot(y-z)\ =\ x\cdot y - x\cdot z$

for arbitrary   $x\ y\ z\ \in\ \mathbb Z$.

A: It's the unique commutative ordered ring whose positive elements are well-ordered.

A: The integers can also be characterized as a well-ordered abelian group (Theorem 20.14 in "Modern Algebra" by Seth Warner).

A: This has been beaten to death, but here goes...
The positive numbers in a ring are the sums of ones, i.e. the set of positive numbers is the smallest inductive subset of the ring. The negative numbers are the negatives of the positive numbers. A ring is minimal if every number is positive, negative, or zero.
$\bf Z$ is the unique minimal ring in which zero is neither positive nor negative.
${\bf Z}/n\bf Z$ is the unique minimal ring in which zero is either positive or negative.
Similarly, the positive numbers in a field are the sums of ones or their ratios. A field is minimal if every number is positive, negative, or zero.
$\bf Q$ is the unique minimal field in which zero is neither positive nor negative.
${\bf Z}/p\bf Z$ is the unique minimal field in which zero is either positive or negative.


text:
Q: How did Omni-Man keep his secret identity hidden? Omni-Man is a Viltrumite living on Earth. He is also known by his regular name: Nolan Grayson. As a way to make money, and to preserve his identity as Omni-Man, Nolan takes a job as an author for travel books.

 When Nolan disappears from Earth after fighting Mark,

Cecil mentions that

"all his travel books always sold well, but sales will see a significant spike after his death."

This indicates that Nolan's death would drive up sales of his books even more, so he must be well known and pretty popular.
How is it that no one would recognise Nolan Grayson as the revered Omni-Man? Omni-Man didn't wear a mask, so it's incredibly easy to see his face. Was Nolan Grayson - The Author somehow different in appearance from Nolan Grayson - Omni-Man? Did no one ever make the connection?

A: In the TV show it's simply hand-waved. Norms (and in this case, other supers) don't recognise supers in their day clothes, even when they've seen them in real life.

Mark: I never recognized you before.
Eve: No one does. It's a psychology thing. If you don't expect to see a superhero in your school, you don't see a superhero in your school.

In the comics, Atom Eve is extremely surprised that she's recognised, even by someone who knows her personally. Again, zero explanation is offered.

Invincible #004


text:
Q: Background image not stretching to full height of container in Firefox/IE/Edge I'm having trouble with the fact that Firefox/IE/Edge browsers don't read percentage height the same way Chrome does.
I want my figure element to stretch to the full height of its container, whenever more content is added to the Div element which is alongside the figure element.
Here is the HTML:

SomeHeading

Lorem ipsum dolor sit amet, consectetur adipiscing elit. pharetra

         Click Me

The CSS:
article.TextAndImage {
    display: table;
    height: 100%;
}

figure {
    background-size: cover;
    background-position: center center;
    display: table-cell;
    height: 100%;
    min-height: 300px;
}

div.textDiv [
    display: table-cell;
    height: 100%;
}

In Chrome, the image always stretches to full height when there is more text in the textDiv element. In the other browsers they ignore the percentage height property and the image doesn't stretch. Searching for other solutions in Stack Overflow, there was an option to set the body and html height to 100% but that doesn't work either.

A: I try to make a test with your code with Edge and Chrome.
I got the similar results in both browser.
Below is my testing result using Chrome.

Below is my testing result using Edge.

Can you show us your output in different browsers. So that we can see the issue there on your side.
Then we can again try to provide you a suggestion to solve the issue.
Regards
Deepak


text:
Q: Parallelize a function call with mpi4py I want to use mpi4py to parallize an optimization problem. To minimize my function I use the minimize routine from scipy
from scipy.optimize import minimize

def f(x, data) :
    #returns f(x)
x = minimize(f, x0, args=(data))

Now if I want to parallelize my function using mpi4py. The implementatino of the minimization algorithm is sequential and can only run on one process so only my function is parallelized which is not a problem since the function call is to most time consuming step. But I can't figure out how to implement this problem, with parallel and sequential parts.
Here is my attempt:
from scipy.optimize import minimize
from mpi4py import MPI

comm = MPI.COMM_WORLD
size = comm.Get_size()
rank = comm.Get_rank()

N = 100 # for testing
step = N//size # say that N is divisible by size
def mpi_f(x, data) :
    x0 = x[rank*step:(rank+1)*step]
    res = f(x0, data)
    res = comm.gather(res, root=0)
    if rank == 0 :
        return res

if rank == 0 :
   x = np.zeros(N)
   xs = minimize(mpi_f, x, args=(data))

This is obviously not working since mpi_f only runs on the process 0. So I am asking how should I proceed ?
Thanks.

A: In your code, the root process is the only one which calls comm.gather() since the root process is the only one which calls the parallelized cost function. Hence, the program faces a deadlock. You are well aware of this issue.
To overcome this deadlock, the other processes must call the cost function as many times as minimize needs it. Since this number of calls is not known in advance, a while loop seems suitable for these processes.
The stopping condition of the while loop is to be defined. This flag is to be brodcast from the root process to all processes since the root process is the only one aware of the fact that the minimize() function ended. The broadcast must be performed in the cost function, since all processes must test the end of the minimize function at each iteration. Since minimize makes use of the return value of the function, the flag is passed by reference via a mutable type
Finally, here is a potential solution to your problem. It is ran by mpirun -np 4 python main.py. I used fmin() instead of minimize() because my version of scipy is outdated.
#from scipy.optimize import minimize
from scipy.optimize import fmin
from mpi4py import MPI
import numpy as np

comm = MPI.COMM_WORLD
size = comm.Get_size()
rank = comm.Get_rank()

N = 100 # for testing
step = N//size # say that N is divisible by size

def parallel_function_caller(x,stopp):
    stopp[0]=comm.bcast(stopp[0], root=0)
    summ=0
    if stopp[0]==0:
        #your function here in parallel
        x=comm.bcast(x, root=0)
        array= np.arange(x[0]-N/2.+rank*step-42,x[0]-N/2.+(rank+1)*step-42,1.)
        summl=np.sum(np.square(array))
        summ=comm.reduce(summl,op=MPI.SUM, root=0)
        if rank==0:
            print "value is "+str(summ)
    return summ

if rank == 0 :
   stop=[0]
   x = np.zeros(1)
   x[0]=20
   #xs = minimize(parallel_function_caller, x, args=(stop))
   xs = fmin(parallel_function_caller,x0= x, args=(stop,))
   print "the argmin is "+str(xs)
   stop=[1]
   parallel_function_caller(x,stop)

else :
   stop=[0]
   x=np.zeros(1)
   while stop[0]==0:
      parallel_function_caller(x,stop)


text:
Q: How can I make the background on top like the SVG at the bottom? I have been working on this website. I am trying to make the banner background like the svg image at the bottom. I don't want to use a picture as the background, so I have been using CSS background-image. I am using clip-path because it makes it easier to hide portion of the picture.
Is there any way I can make the point where the bottom left corner radius meet with the straight line rounded, so it can look like the SVG image at the bottom, please?

header {
    position: relative;
    overflow: hidden;
    height: 800px;

    background-image: linear-gradient(315deg, #6c2aad 0%, rgb(44, 80, 199) 74%);

    clip-path: polygon(
        0 0,
        100% 0,
        100% calc(100% - 200px),
        0 100%
    );
    border-bottom-left-radius: 50% 50%;
}

.header-bg{
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#banner-content {
    height: inherit;
    position: relative;
    display: flex;
    flex-direction: row;
    justify-content: center;
}

#banner-image-container img {
  position: absolute;
  left: 0;
  bottom: 50px;
}

#banner-image-container {
    align-self: flex-end;
    margin: 0 7%;
    height: 410px;
}

#right-side {
    align-self: center;
    margin: 0 7%;
    max-width: 420px;
    text-align: center;
    color: #FFF;
}

#right-side p:first-child {
    font-size: 30px;
    font-weight: bold;
}

@media screen and (min-width: 551px) {

    #right-side {
        align-self: center;
        margin: 0 7%;
    }
}

#banner-content img {
    max-width: 600px;
    width: 70%;
    display: block;
    margin: 0 auto;
}

@media screen and (max-width: 724px) {
    #banner-content {
        flex-direction: column-reverse;
        justify-content: flex-start;
    }

    #banner-image-container {
        align-self: center;
    }
}
<!DOCTYPE html>

    <meta charset="utf-8">
    <title></title>
    <link rel="stylesheet" href="style.css">

LOREM IPSUM

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

  <svg width="1600px" height="612px" viewBox="0 0 1600 612" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
      <defs>
          <path d="M0,0.111104331 L1600,5.68434189e-14 L1600,344.091288 C1112.04518,489.644113 740.739648,576.663624 486.083401,605.14982 C376.998796,617.352174 281.625713,612.768489 207.849921,583.94285 C136.196666,555.946528 66.9133592,475.996007 0,344.091288 L0,0.111104331 Z" id="path-1"></path>
      </defs>
      <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
          <g id="Artboard">
              <mask id="mask-2" fill="white">
                  <use xlink:href="#path-1"></use>
              </mask>
              <use id="Mask" fill="#071246" fill-rule="nonzero" xlink:href="#path-1"></use>
          </g>
      </g>
  </svg>

A: You can approximate it using pseudo element and some rotation combined with radius:

header {
  position: relative;
  overflow: hidden;
  height: 800px;
  z-index: 0;
}

header:before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 0;
  bottom: 0;
  left: 0;
  right: -200px;
  background-image: linear-gradient(315deg, #6c2aad 0%, rgb(44, 80, 199) 74%);
  border-bottom-left-radius: 35% 35%;
  transform: rotate(-18deg);
  transform-origin: left;
}

.header-bg {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

#banner-content {
  height: inherit;
  position: relative;
  display: flex;
  flex-direction: row;
  justify-content: center;
}

#banner-image-container img {
  position: absolute;
  left: 0;
  bottom: 50px;
}

#banner-image-container {
  align-self: flex-end;
  margin: 0 7%;
  height: 410px;
}

#right-side {
  align-self: center;
  margin: 0 7%;
  max-width: 420px;
  text-align: center;
  color: #FFF;
}

#right-side p:first-child {
  font-size: 30px;
  font-weight: bold;
}

@media screen and (min-width: 551px) {
  #right-side {
    align-self: center;
    margin: 0 7%;
  }
}

#banner-content img {
  max-width: 600px;
  width: 70%;
  display: block;
  margin: 0 auto;
}

@media screen and (max-width: 724px) {
  #banner-content {
    flex-direction: column-reverse;
    justify-content: flex-start;
  }
  #banner-image-container {
    align-self: center;
  }
}

LOREM IPSUM

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

  <svg width="1600px" height="612px" viewBox="0 0 1600 612" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
      <defs>
          <path d="M0,0.111104331 L1600,5.68434189e-14 L1600,344.091288 C1112.04518,489.644113 740.739648,576.663624 486.083401,605.14982 C376.998796,617.352174 281.625713,612.768489 207.849921,583.94285 C136.196666,555.946528 66.9133592,475.996007 0,344.091288 L0,0.111104331 Z" id="path-1"></path>
      </defs>
      <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
          <g id="Artboard">
              <mask id="mask-2" fill="white">
                  <use xlink:href="#path-1"></use>
              </mask>
              <use id="Mask" fill="#071246" fill-rule="nonzero" xlink:href="#path-1"></use>
          </g>
      </g>
  </svg>


text:
Q: How to make dynamic picklist? I have one custom object Backlog and I have one picklist field Full_Name_of_the_Specialist__c which is having manually inserted all the Names of the Specialist profile. Now when new employee come, I want to dinamically assign them all from this profile to the picklist field.
How can I achieve this?

A: I am assuming here that you have the field "Full_name..." on the Backlog object. Is that a correct assumption?
You could achieve what you want to programmatically as indeed has been suggested. However, what is your use case? Because to me it sounds like you may benefit equally or better from creating a lookup field for the specialists.
I don't know how you are currently saving specialists in your system? But you could either create them as contacts (with a separate record type) or even as a custom object (e.g. if you don't want to link to accounts every time). Then in "Backlog", you can create a lookup that looks for these. With some additional config, you can also make sure that only the specialists can be found (i.e. not other contacts).
Was this helpful?


text:
Q: Custom JavaScript and Server-Side Code Interaction in Microsoft Dynamics 365 (On-Premises) I am new to Microsoft Dynamics.  I need to build a feature into a Microsoft Dynamics 365 On-Premises form that allows users to:

*

*Select files to upload via an "upload files" button

*Send those selected files to a remote MS SQL Server database (i.e. not the Dynamics database)

The first part seems like straightforward HTML and JavaScript:

Select files to upload:

<input type="file" itemId="myFiles" multiple />

Choose files to upload and then click "Send" to send the files to the remote DB.

<button onclick="uploadButtonClick()">Upload</button>

The second part is where I am stuck because I don't know how to pass the upload file names to server-side code and then send those files to the remote SQL Server database.  I can write the C# myself outside of Dynamics in a separate .NET C# project, but am unaware of how it is done via best practice in Dynamics 365. A custom Plug-in?  WebAPI? Something else?
Is there a tried-and-true approach for doing the above in Dynamics 365?

A: Net to net, this is a simple HTML, Javascript, AJAX file upload requirement. Dynamics 365 web resource is no different, except cross origin request. No need to use CRM plugin or web api.
You will find thousands of examples online, maybe in SO itself. Start with this thread and build the code. You need a web api endpoint to POST url which handle your file insert into on-prem remote SQL DB. Read more


text:
Q: UID of a deleted account How can an administrator find the UID of a user that's been deleted with the userdel command?

A: By looking at /etc/passwd in the backups taken of your system from the day/week/period before the user deletion.
If userdel was used with -r, then both the home directory and user's mail spool have gone.  If it wasn't used with -r, check for the user's mail spool, or perhaps a crontab if you're very lucky.
If there are no backups, and no obvious files owned by that user you can check, then you'll need to scout around places like /tmp and look for files with UID's as owners and try and work it out - but really, your backup is your best bet.
Edit: as jw013 points out you could also use find / -nouser to find files which have no matching user for the file's UID.

A: If there are 10 users and 1 deleted user, you could check /etc/passwd for which UID from 1000 and up is missing.


text: Q: Is possible to codify all images in base64 using nginx reverse proxy? i started using nginx some times ago and i want to speed up my webpages during loading. One of the problem that i can't fix is this, images loading time. I know what is base64 but i don't know how to codify all images in it on nginx. Can you help me? Thanks to all.


text:
Q: Programmatically add user permission to a list in Sharepoint How do I programmatically add user permissions to a list in Sharepoint? I want to add the permission "Contribute" to a user or group for a certain list. I'm using C#.

A: You can do this using the SPRoleAssignment object, e.g.
// Assuming you already have SPWeb and SPList objects
...
SPRoleAssignment roleAssignment = new SPRoleAssignment("dom\\user", "user@dom", "user", "some notes");
SPRoleDefinition roleDefinition = web.RoleDefinitions.GetByType(SPRoleType.Contributor);
roleAssignment.RoleDefinitionBindings.Add(roleDefinition);
if (!myList.HasUniqueRoleAssignments)
{
    myList.BreakRoleInheritance(true); // Ensure we don't inherit permissions from parent
}
myList.RoleAssignments.Add(roleAssignment);
myList.Update();


text:
Q: Haskell "Source reduction" I'm revising for an upcoming Haskell exam and I don't understand one of the questions on a past paper. Google turns up nothing useful
fst(x, y) = x
square i = i * i

i) Source reduce, using Haskells lazy evaluation, the expression:
fst(square(3+4), square 8)

ii) Source reduce, using strict evaluation, the same expression
iii) State one advantage of lazy evaluation and one advantage of strict evaluation
What I don't understand is what is source reduction?

A: From the structure of the question, it probably just mean "evaluate the expression by hand", e.g.
head (map primeTest (enumFromTo 1000 2000))

in lazy (evaluate only when needed) evaluation,
  head (map primeTest (enumFromTo 1000 2000))
= head (map primeTest (1000 : enumFromTo 1001 2000))
= head (primeTest 1000 : map primeTest (enumFromTo 1001 2000))
= primeTest 1000
= False

in strict (evaluate everything first) evaluation
  head (map primeTest (enumFromTo 1000 2000))
= head (map primeTest (1000 : enumFromTo 1001 2000))
= ...
= head (map primeTest [1000, 1001, ..., 2000])
= head (primeTest 1000 : map primeTest [1001, 1002, ..., 2000])
= head (False : map primeTest [1001, 1002, ..., 2000])
= ...
= head [False, False, ..., False]
= False

The only relevant place I could find is http://www.cs.bham.ac.uk/internal/modules/2009/11582.html where "source reducation" is listed as a "Programming technique". (O_O)

A: Reduction is a term from the lambda calculus which involves a semantics-preserving transformation that replaces one term with an equivalent term.  For the examples you've given, the most important kind of reductions are

*

*Replacement of a name by its definition (an instance of substituting equals for equals).

*Beta-reduction of a function application.

Beta-reduction is the fundamental rule in the lambda calculus, and in a pure, lazy language like Haskell, it always preserves semantics.  The beta rule is the one that says:
(\x. e) m

can be replaced by e with m substituted for x.  (The substitution must avoid "capturing" free instances of x in m.)
It's quite possible that your instructor wants you to combine reductions as follows:

*

*Find a function application where the function being applied is a name.

*Replace the name with its definition, which will be a lambda abstraction.

*Beta-reduce the application.

*Do this all in one step.

Notice you often have a choice about which application to reduce; for example, in the term you give, there are two applications of square and one of fst that could be reduced in this fashion.  (The application of + can also be reduced, but reduction involving constants requires different rules.)
From the questions I see that your instructor wants you to reduce each term repeatedly until it reaches a normal form and that your instructor wants you to demonstrate your understanding of different reduction strategies.  The word "source" in "source reduce" is superfluous; reduction means manipulation of source terms in some language.  I would have phrased the questions as follows:

*

*Using the reduction strategy that corresponds to Haskell's lazy evaluation, reduce the following expression to weak head normal form.  Show each step in the sequence of reductions.

*Using the reduction strategy that corresponds to evaluation in a strict functional language, reduce the following expression to head normal form.
I probably would have chosen to be less coy and just name the reduction strategies: a call-by-need reduction strategy and a call-by-value reduction strategy.


text:
Q: Azure Get Video Index or Get Project Index API response body is blank This is about Azure Video Indexer API. I am using a trial account. (Using Corporate account to log in to the Video Indexer portal but using a trial, not a paid account yet). I uploaded a few videos using Indexer Portal. Then I am trying to use the Video Indexer API to get video index. The Get Video Index (or Get Project Index) APIs give proper response when called through the "Try it" panel of the Developer Portal. But when exactly same Get API is called through Java code, the response is blank. The response status is 200 OK. Response header also shows valid header as follows:
[Content-Length:"13052", Content-Type:"application/json; charset=utf-8", x-ms-request-id:"a747d33c-a1e8-444d-89ce-d49a531507c2", X-Content-Type-Options:"nosniff", Strict-Transport-Security:"max-age=31536000; includeSubDomains", api-supported-versions:"2.0", Access-Control-Allow-Credentials:"true", Date:"Thu, 27 Oct 2022 15:19:53 GMT"]
But response body just doesnt print anything.
(Just to repeat, the same Get API call works fine from the "Try it" panel using same/similar access token etc. But when called through Java code, it doesnt give back any response, not any error).
Any help would be highly appreciated.
I have already tried using the readily available Java code snippet provided in the "Try it" panel. But same behaviour.
Thanks.
mrisbud


text:
Q: Android AlertDialog with DialogFragment: don't close the dialog even if OK is clicked I have an AlertDialog with a custom layout (just an EditText) and I want to validate the data when the OK button is clicked. If the validation fails I don't want to close the dialog.
I'm using dialog's default buttons (positive and negative). If I use "setPositiveButton("", new DialogInterface.OnClickListener() ..." the dialog is always closed. I've seen several posts and they said that the onClick Listener should be override, but I can't get it working. This is the code I found:
Button theButton = dialog.getButton(DialogInterface.BUTTON_POSITIVE);
theButton.setOnClickListener(new CustomListener(dialog));

Since it says it should be done AFTER showing the dialog I placed this code inside my activity, not inside my DialogFragment, but if I use mDialogFragment.getDialog() it always returns null.
This is a part of my Dialog Fragment:
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    // Use the Builder class for convenient dialog construction
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());

    builder.setTitle(R.string.new);

    LayoutInflater inflater = getActivity().getLayoutInflater();
    dialogView = inflater.inflate(R.layout.edit_license, null);

    builder.setView(dialogView)

    // Add action buttons
    .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int id) {

        }
    })
    .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {
            MyDialogFragment.this.getDialog().cancel();
        }
    });

    return builder.create();

}

And in my Activity I do the following:
DialogFragment dialog = new MyDialogFragment(true, null);
dialog.show(getSupportFragmentManager(), "EditLicenseDialogFragment");

AlertDialog alertDialog = (AlertDialog)dialog.getDialog();
alertDialog.getButton(DialogInterface.BUTTON_POSITIVE);
btnPositive.setOnClickListener(new CustomListener(alertDialog));

...

class CustomListener implements View.OnClickListener {
    private final Dialog dialog;
    public CustomListener(Dialog dialog) {
        this.dialog = dialog;
    }
    @Override
    public void onClick(View v) {
        ...
    }
}

Like I said, (AlertDialog)dialog.getDialog(); always returns null. Why is that? How can I avoid closing the dialog if the validation is not ok?
Thanks!

A: This solution works for me. Dialog is already visible in onResume so this is a good place to get access to buttons and replace listeners.
public class XYZFragment extends DialogFragment {
   ...

    @Override
    public void onResume() {
        super.onResume();

        AlertDialog dialog = (AlertDialog)getDialog();

        Button positiveButton = dialog.getButton(DialogInterface.BUTTON_POSITIVE);
        positiveButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View onClick) {
            ...
            }
        });
    }
}

A: here is some text from reference of DialogFragment:

A fragment that displays a dialog window, floating on top of its
  activity's window. This fragment contains a Dialog object, which it
  displays as appropriate based on the fragment's state. Control of the
  dialog (deciding when to show, hide, dismiss it) should be done
  through the API here, not with direct calls on the dialog.

Instead of calling getDialog().dismiss() you should do dismiss()


text:
Q: Carousel need to start from middle slide on page load I have using Multi Carousel to display complete months dates in a slider. Each date some data be hide on click. When I browse to Multi Carousel clicked date is today,s date, Means active class for slides is current date.
But as slider have 30 days. so slider always start from day 1. I always need to slide it to current date by clicking next arrow.
Like today is sep-26. If you check following page you find a date slider there which is on sep-1 now. so to get sep-26 you need to slide next. http://prosport.guru/ps/game.php
I want that when page load slider should moves to current date auto. I have add auto class to current date slide but it did not work.
Following is my code for Multi Carousel.
    <?php
    $page2 = $_SERVER["PHP_SELF"];
    $page2 = explode("/", $page2);
    $page2 = $page2[count($page2) - 1];

    $id_sport2 = $_GET["id_sport"];

    $m = date("m");
    $day = date("d");
    $year = date("Y");
    $dates = array();
    $dates2 = array();
    $tmp = array();
    for ($i = 1; $i < 32; $i++) {
        if ($i < 10) {
            $ii = "0$i";
        } else {
            $ii = $i;
        }
        $date = "$year-$m-$ii";
        //$date = date("Y-m-d", strtotime($date));
        if ($i % 3 != 0) {
            array_push($tmp, $date);

            if ($i == 60) {
                if (count($tmp != 0)) {
                    array_push($dates2, $tmp);
                }
            }
        } else {
            array_push($tmp, $date);
            array_push($dates2, $tmp);
            $tmp = array();
        }

        array_push($dates, $date);
    }

    ///print_r($dates2);
    ?>

        <?php
                $cpt = 0;

                for ($i = 0; $i < count($dates2); $i++) {

                    $line = $dates2[$i];

                    $today = date("Y-m-d");
                    if (empty($_GET["date"])) {
                        $goto = $today;
                        if (in_array($today, $line)) {
                            $active = "active";
                        } else {
                            $active = "";
                        }
                    } else {
                        $dt = $_GET["date"];
                        $goto = $dt;
                        if (in_array($dt, $line)) {
                            $active = "active";
                        } else {
                            $active = "";
                        }
                    }

                    for ($x = 0; $x < count($line); $x++) {

                        $el = $line[$x];
                        if (!empty($_GET["date"])) {
                            $dt = $_GET["date"];
                            if ($el == $dt) {
                                $color = "red";
                            } else {
                                $color = "white";
                            }
                        } else {
                            if ($el == $today) {
                                $color = "red";
                            } else {
                                $color = "white";
                            }
                        }
                        $href = "$page2?id_sport=$id_sport2&date=$el";
                        if ($x == 0) {
                            //echo "

";
                            //echo "
";
                        }

                        /* echo '

                          '.$el.'
';
                         */
                        if ($x == 2) {
                            //echo "
";
                        }
                        ?>

                            <a href="<?php echo $href; ?>" >
                                <p class=" sportName mydate p-date" real="<?php echo $el; ?>" style="color:white; font-size: 12px; text-align: center;" >
                                    <?php
                                    $date = $el;
                                    $month_name = ucfirst(strftime("%b", strtotime($date)));
                                    $day_number = ucfirst(strftime("%d", strtotime($date)));

                                    echo $month_name . ' ' . $day_number;
                                    ?>

                        <?php
                    }
                }
                echo "<input type='hidden' value='$goto' id='cd'>";
                ?>

            <button class="btn btn-primary btn-sm leftLst" style="border-radius: 0px; top: calc(64% - 20px);"><</button>
            <button class="btn btn-primary btn-sm rightLst fw" style="border-radius: 0px; top: calc(64% - 20px);">></button>

A: This jquery script will move it to the current date on page load.
$(function() {
    // Get month and day, ex. "Sep 21"
    var monthAndDay = new Date().toLocaleString("en-us", { month: "short" }) + ' ' + new Date().getDate();
    // Locate the carousel item using month and day string
    var $list = $('#MultiCarousel2 > div .item');
    var $carouselToday = $('#MultiCarousel2 > div .item a p:contains('+monthAndDay+')');
    var $parent = $carouselToday.closest('.item');
    var index = $list.index( $parent );
    var itemWidth = $list.eq(0).width();
    var position = (index * itemWidth) * -1;
    $('#MultiCarousel2 > div').css({"transition": "0s", "transform": "translate("+ position +"px)"});
    $('#MultiCarousel2 > div').one("webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend", function() {
        $(this).css({"transition": "1s ease all"})
    });
});


text:
Q: 'BackgroundModes' - system capability is not listing inside the 'project.pbxproj' file of an iOS project I am trying to integrate the Background fetch feature inside a Flutter project using Workmanager plugin. So I enabled the background fetch feature under 'Background Modes' of my iOS project Capability.
But the following block is not added to project.pbxproj file. As I understood, it should be automatically added by XCode.
SystemCapabilities = {
                            com.apple.BackgroundModes = {
                                enabled = 1;
                            };
                        };

Currently, I am working with Xcode 11.3.1 and Swift 5.0.  So how do I bring the above snippet in project.pbxproj file?. Or please help me if my understanding is wrong.


text:
Q: Spring boot, hibernate, hikariCP and mysql no communication after inactivity We are facing a weird error. When we first srtart the server we can login etc. After a few hours of inactivity we cannot login anymore. We can solve the problem by restarting the application, but it will occur at least one time each day. To restart the application is only a shortterm solution and we need to find a more stable solution to this a critical problem.
I am using the following configuration:
Environment
Hibernate       : 5.2.13
JPA             : spring-boot-starter-data-jpa (1.5.10)
JDK version     : 1.8.0_191
Database        : Mysql (version 5.7.25)
JDBC Driver     : 5.1.45
Spring Boot     : 1.5.10
OS              : Ubuntu 16.04.6

Hikari
HikariCP version: 2.7.7

datasource:
        type: com.zaxxer.hikari.HikariDataSource
        driver-class-name: com.mysql.jdbc.Driver
        url: jdbc:mysql://localhost:3306/<database>?useUnicode=true&characterEncoding=utf8&useSSL=false
        username: <username>
        password: <secret password>
        hikari:
            data-source-properties:
                cachePrepStmts: true
                prepStmtCacheSize: 250
                prepStmtCacheSqlLimit: 2048
                useServerPrepStmts: true

From the application log:
AuthenticationServiceException[http-nio-18080-exec-9] UserJWTController: Authentication exception trace: {}
org.springframework.security.authentication.InternalAuthenticationServiceException: Could not open JPA EntityManager for transaction; nested exception is org.hibernate.TransactionException: JDBC begin transaction failed: uthentication.dao.DaoAuthenticationProvider.retrieveUser(DaoAuthenticationProvider.java:126)
        at org.springframework.security.authentication.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:144)
        at org.springframework.security.authentication.ProviderManager.authenticate(ProviderManager.java:174)
        at com.example.web.rest.UserJWTController.authorize(UserJWTController.java:48)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
        at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)
        at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97)
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
        ...
        ...
        ...
        ...
        ...
        ...
        Caused by: org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for transaction; nested exception is org.hibernate.TransactionException: JDBC begin transaction failed:
        at org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:431)
        at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:373)
        at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:461)
        at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:277)
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
        at com.sun.proxy.$Proxy159.loadUserByUsername(Unknown Source)
        at org.springframework.security.authentication.dao.DaoAuthenticationProvider.retrieveUser(DaoAuthenticationProvider.java:114)
        ... 107 common frames omitted
Caused by: org.hibernate.TransactionException: JDBC begin transaction failed:
        at org.hibernate.resource.jdbc.internal.AbstractLogicalConnectionImplementor.begin(AbstractLogicalConnectionImplementor.java:73)
        at org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl.begin(LogicalConnectionManagedImpl.java:263)
        at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl$TransactionDriverControlImpl.begin(JdbcResourceLocalTransactionCoordinatorImpl.java:214)
        at org.hibernate.engine.transaction.internal.TransactionImpl.begin(TransactionImpl.java:56)
        at org.springframework.orm.jpa.vendor.HibernateJpaDialect.beginTransaction(HibernateJpaDialect.java:189)
        at org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:380)
        ... 115 common frames omitted
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operations allowed after connection closed.
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
        at com.mysql.jdbc.Util.getInstance(Util.java:408)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:919)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:898)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:887)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:861)
        at com.mysql.jdbc.ConnectionImpl.throwConnectionClosedException(ConnectionImpl.java:1184)
        at com.mysql.jdbc.ConnectionImpl.checkClosed(ConnectionImpl.java:1179)
        at com.mysql.jdbc.ConnectionImpl.setAutoCommit(ConnectionImpl.java:4770)
        at sun.reflect.GeneratedMethodAccessor325.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.tomcat.jdbc.pool.ProxyConnection.invoke(ProxyConnection.java:126)
        at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:108)
        at org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptor.invoke(AbstractCreateStatementInterceptor.java:79)
        at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:108)
        at org.apache.tomcat.jdbc.pool.DisposableConnectionFacade.invoke(DisposableConnectionFacade.java:81)
        at com.sun.proxy.$Proxy98.setAutoCommit(Unknown Source)
        at org.hibernate.resource.jdbc.internal.AbstractLogicalConnectionImplementor.begin(AbstractLogicalConnectionImplementor.java:67)
        ... 120 common frames omitted
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet successfully received from the server was 33,215,831 milliseconds ago.  The last packet sent successfully to the server was 7 milliseconds ago.

I really don't know how to trigger this issue manually after a restart so we have to wait a few hours before this state kicks in.
It seems that we are not the only one having this issue, but after days without solving it, it's a bit frustrating.
We need to solve this soon, any ideas?

A: I found a solution to our problem. It seemed like the configuration we did in the yaml file didn't work properly so I had to configure the HikariCP programmatically.
I removed the configuration for hikari in the yaml file and afterwards the datasource looked like:
datasource:
    type: com.zaxxer.hikari.HikariDataSource

And the datasource config looks the following:
@Configuration
public class DatasourceConfiguration {

    private static final Logger log = LoggerFactory.getLogger(DatasourceConfiguration.class);

    private final Environment env;

    public DatasourceConfiguration(Environment env) {
        this.env = env;
    }

    @Bean(name="primaryDatasource")
    @Primary
    @ConfigurationProperties(prefix="spring.datasource")
    public DataSource dataSource() {

        HikariConfig config = new HikariConfig();
        config.setDriverClassName("com.mysql.jdbc.Driver");
        config.setPoolName("JPAHikariCP");
        config.setAutoCommit(false);
        config.setConnectionTestQuery("SELECT 1");

        String profile = env.getProperty("spring.profiles.active");

        Optional<String> db = Optional.of("database");
        Optional<String> username = Optional.of("user");
        Optional<String> password = Optional.of("pass");

        if("test".equals(profile) || "dev".equals(profile)) {
            config.addDataSourceProperty("cachePrepStmts", true);
            config.addDataSourceProperty("prepStmtCacheSize", 250);
            config.addDataSourceProperty("prepStmtCacheSqlLimit", 2048);
            config.addDataSourceProperty("useServerPrepStmts", true);
        }

        config.setJdbcUrl(String.format("jdbc:mysql://localhost:3306/%s?useUnicode=true&characterEncoding=utf8&useSSL=false", db.get()));
        config.setUsername(username.get());
        config.setPassword(password.get());

        return new HikariDataSource(config);
    }

}

And now it works.


text:
Q: Pubsub API Explorer : Incorrect message data returned I'm learning PubSub APIs. I published few messages to the Topic and when I used API Explorer to do subscriber pull
Method: projects.subscriptions.pull the data does not seem to match what I actually published:

*

*what I published: "Message number 13

*what API Explorer returns is: NTlkMjdhYzQtZTUyZi00M2Q3LTk0ZTItNTZhNTM1ZGRlODNk
(attach screenshot)
Oddly, when using actual API (Python Client Library) to do subs pull, things are fine:
subscriber = pubsub_v1.SubscriberClient()
subscription_path = subscriber.subscription_path(PROJECT_ID, SUBSCRIPTION)
messages = subscriber.pull(subscription_path, max_messages=10, timeout=10, return_immediately=True)
print(messages.received_messages[0])

ack_id: "QV5AEkw2AERJUytDCypYEU4EISE-MD5FU0RQBhYsXUZIUTcZCGhRDk9eIz81IChFEAtTE1FcdhNaEGszXHUHUQ0YdHhncGgOQFMAEFl-VVsJPGh-Y3QAVwUfen5pdWJTGgQARHv7z4Dzvb9LZhg9XBJLLD5-PTVF"
message
{    data: "Message number 13"
message_id: "176868380899521"
publish_time {
seconds: 1535000824
nanos: 625000000
}
}

A: Pubsub returns your data base64 encoded. It's necessary to decode this in order to retrieve the published message in its original form.


text:
Q: JS Keep Character's Regular Value When I run my snippet (shown below), it replace the dashes (-), the single quote, and the double quote with �.

var button = document.querySelector('#fileInput + button');
var input = document.getElementById('fileInput');
var text = null;
input.addEventListener("change", addDoc);
button.addEventListener("click", handleText);

function addDoc(event) {
  var file = this.files[0];
  var reader = new FileReader();
  reader.onload = function(e) {
    text = reader.result;
    button.removeAttribute("disabled");
  };

  reader.onerror = function(err) {
    console.log(err, err.loaded, err.loaded === 0, file);
    button.removeAttribute("diabled");
  };
  a = reader.readAsText(event.target.files[0]);
  console.log(a);
}

function handleText() {
  addtoPreviousOutput();
  changeOutputParagraph(text);
  button.setAttribute("disabled", "disabled");
}

function changeOutputParagraph(newText) {
  var element = document.getElementById("output");
  element.innerHTML = newText;
}

function addtoPreviousOutput() {
  var previousOutput = document.getElementById("output").innerHTML;
  var previousOutput_sOutput = document.getElementById("previousOutput").innerHTML + "
";
  console.log(previousOutput);
  console.log(previousOutput_sOutput);
  document.getElementById("previousOutput").innerHTML = previousOutput_sOutput + previousOutput;
}

<input type="text" id="textInput" onkeypress="getText(event)" />
<input type="file" id="fileInput" accept="text/*" />
<button type="button" id="addDoc">Add Document</button>

Why is that and how do I fix it?
Edit
I get this when I run my file which is 176 lines and 22 KB. Note: This isn't all of the text.

A: A FileReader can only read one file at the time, however you're trying to read the file twice:
reader.readAsText(event.target.files[0]);
console.log(reader.readAsText(event.target.files[0]));

There's no actual reason for you to do that. Just store the first read result - and print the data that you've already read.

A: readAsText reads the text as utf-8 by default. The reason you see � instead of your expected characters is because your text file is not utf-8 encoded.
You can pass the encoding of your file to readAsText to properly read the text.
e.g. for latin 1
a = reader.readAsText(event.target.files[0], 'ISO-8859-1');


text:
Q: Laravel Model Binding missing relationships I'm trying to convert to Model binding on a Model built on customer orders. My route:
Route::model('order', 'App\Models\Order');
Route::resource('orders', 'OrderController');

This allows me to pull up an Order to edit through my controller (also grabbing statuses to populate a table and passing the logged in user):
public function index(Order $order)
 {
  $orders = $order->get();
  return view('orders.index', compact('orders'));
}

My orders.index will display $order->id properly but when I try to loop through the Actions, which is connected by a hasMany relationship, nothing shows. Or I try to show $order->user->firstname which belongs to User by user_id.
@foreach( $order->actions as $action )
  {{ $action->type->type }}
@endforeach

From my Action model:
public function order()
{
    return $this->belongsTo('\App\Models\Order', 'order_id');
}

From my Order model:
public function actions()
{
    return $this->hasMany('\App\Models\Action', 'order_id');
}

Here's an excerpt from a dump of the Order:
`Illuminate\Database\Eloquent\Collection Object
(
    [items:protected] => Array
        (
            [0] => App\Models\Order Object
                (
                    [table:protected] => orders
                    [timestamps] => 1
                    [dates:protected] => Array
                        (
                            [0] => deleted_at
                        )

                    [connection:protected] =>
                    [primaryKey:protected] => id
                    [perPage:protected] => 15
                    [incrementing] => 1
                    [attributes:protected] => Array
                        (
                            [id] => 1
                            [created_at] => 2015-03-16 23:42:45
                            [updated_at] => 2015-03-19 04:37:53
                            [deleted_at] =>
                            [user_id] => 16
                            [status_id] => 5
                            [address_id] => 5
                            [datetime_pickup_actual] =>
                            [datetime_delivery_actual] =>
                            [datetime_pickup_requested] => 2015-03-20 17:00:00
                            [datetime_delivery_requested] => 2015-03-21 17:00:00
                            [hold] => 0
                            [weight] => 20
                        )

                    [original:protected] => Array
                        (
                            [id] => 1
                            [created_at] => 2015-03-16 23:42:45
                            [updated_at] => 2015-03-19 04:37:53
                            [deleted_at] =>
                            [user_id] => 16
                            [status_id] => 5
                            [address_id] => 5
                            [datetime_pickup_actual] =>
                            [datetime_delivery_actual] =>
                            [datetime_pickup_requested] => 2015-03-20 17:00:00
                            [datetime_delivery_requested] => 2015-03-21 17:00:00
                            [hold] => 0
                            [weight] => 20
                        )

                    [relations:protected] => Array
                        (
                        )

                    [hidden:protected] => Array
                        (
                        )

                    [visible:protected] => Array
                        (
                        )

                    [appends:protected] => Array
                        (
                        )

                    [fillable:protected] => Array
                        (
                        )

                    [guarded:protected] => Array
                        (
                            [0] => *
                        )

                    [casts:protected] => Array
                        (
                        )

                    [touches:protected] => Array
                        (
                        )

                    [observables:protected] => Array
                        (
                        )

                    [with:protected] => Array
                        (
                        )

                    [morphClass:protected] =>
                    [exists] => 1
                    [forceDeleting:protected] =>
                )`

A: As you compact orders in your controller you should use orders in your Blade template:
@foreach( $orders->actions as $action )
  {{ $action->type->type }}
@endforeach

You should be also aware that Order in your index method in controller have nothing in common with Route Model Binding. For index it won't be used at all.
For other methods (show/edit/delete) it won't work because you make a binding with wrong name. It should be:
Route::model('orders', 'App\Models\Order');

and not
Route::model('order', 'App\Models\Order');

A: Model name (MoneyEntry)
Changed from
Route::resource('moneyentries', 'MoneyEntryController');

to
Route::resource('moneyEntries', 'MoneyEntryController');

Did a trick.


text:
Q: Can't bind to 'ngIf' since it isn't a known property of 'ion-col' I want to render the column, only if the rule is met, but it doesn't recognize me.
ANGULAR
HTML

    <ion-row>
      <ion-col class="col-12 text-center titles mt-5"> Ingresa tu PIN </ion-col>
      <ion-col class="col-12 mt-2">

 0 ? 'active' : ''">

 1 ? 'active' : ''">

 2 ? 'active' : ''">

 3 ? 'active' : ''">

      </ion-col>
      <ion-col class="mt- 2" size="12" *ngIf="messageError.length > 0">

{{ messageError }}

      </ion-col>
      <ion-col size="12" class="my-loading" *ngIf="loading === true">
        <ion-spinner name="dots"></ion-spinner>
      </ion-col>
    </ion-row>

COMPONENT.TS

@Component({
  selector: "app-pin",
  templateUrl: "./pin.component.html",
  styleUrls: ["./pin.component.scss"],
})
export class PinComponent implements OnInit {
  public messageError: string = "";
  public loading: boolean = true;
  public circlePin: any = 0;
  public mePin: any = "";

I want to render the column, only if the rule is met, but it doesn't recognize me.

A: Instead of adding *ngIf to <ion-col>.
Try using:
<ng-container *ngIf="condition">
  …
</ng-container>

https://angular.io/api/core/ng-container#usage-notes
Also, check if your Module have CommonModule import.


text:
Q: Magento2 Checkout Customization I need help with checkout customization.
Can someone give me some links to resourses with information about Magento 2 checkout customization?  I am all ready readed developer guide and docs, but i still dont understand how to show additional parameters depending on the chosen shipment method.

A: Overview the frontend technology stacks
Require JS
http://requirejs.org/
We also need to know how to override the Js and template html via Require Js. For example, we will override the shipping js and shipping html template:
vendor/magento/module-checkout/view/frontend/web/js/view/shipping.js
vendor/magento/module-checkout/view/frontend/web/template/shipping.html
In your custom module, create requirejs-config.js:
var config = {
    map: {
        '*': {
            'Magento_Checkout/js/view/shipping':
                'Vendor_YourModule/js/view/shipping', // <= Override the Js

            'Magento_Checkout/template/shipping.html':
                'Vendor_YourModule/template/shipping.html' // <= Override the html template
        }
    }
};

KnockoutJs Template
http://knockoutjs.com/
For example, go to vendor/magento/module-checkout/view/frontend/web/js/view/shipping.js:
    ......
    return Component.extend({
        defaults: {
            template: 'Magento_Checkout/shipping'
        },
    ......

On the checkout page, Magento will be rendered by using Knockout templates.
We can find the Knockout template under pub/static orvendor/magento/module-checkout/view/frontend/web/template. We can use Require Js to override these templates.
Layout render and how to debug
One of the most important skills of a good developer is the debugging skill:
Debug Magento 2 checkout jsLayout
Magento will load and merge the layout from checkout_index_index.xml.
Take a look these files to see more details:
vendor/magento/module-checkout/view/frontend/layout/checkout_index_index.xml
vendor/magento/module-checkout/view/frontend/templates/onepage.phtml
Practical examples
Please, practice some good samples:
http://devdocs.magento.com/guides/v2.0/howdoi/checkout/checkout_overview.html
http://devdocs.magento.com/guides/v2.0/howdoi/checkout/checkout_customize.html
We can follow the logic of checkout agreements - vendor/magento/module-checkout-agreements to add more content: add a static block, static content, etc.


text:
Q: passing actions and data from one controller to another controller in ember.JS I am new to ember. i have got a situation where i have inventory module(which has its own controller, route, template, model). I have to display the whole inventory module as a popup in reservation desk module. I created a component which had the template code from inventory module and displayed that in reservation. I have got the UI.
I injected the inventory controller in reservation controller.
The main problem is that the action in component is handled by reservation module controller. But as the action is defined in inventory controller. So i am passing the action from reservation controller to inventory controller by this.get('inventoryController').send('goToPreviousMonth') where inventoryController is the injected inventory controller in reservation desk and goToPreviousMonth is the action that i am trying to send.
Its is giving me an error because goToPreviousMonth function in inventory controller is accessing its model and other variables. these varaibles are set by other functions which are not getting called, because i am specifically calling only this function and not going with the code flow.
please suggest how to sort out the situation.
Thanks in advance

A: You could either move the action down to the component level (instead of passing it from controllers) or you could create a function on a service, which you could call from almost anywhere in your app.
I would recommend moving the action into the component.


text:
Q: How to authorize users (oAuth 2.0) on Facebook from a Java Desktop App? I am writing a Facebook desktop app in Java that will authorize several users in succession (each in person typing in their credentials on my machine then logging out) and then use their profile ID and access_token to do some stuff with their statuses/picture etc.
From what I understand, the user must use a browser to authorize my app to use their info and then it will send the browser to a redirect URI: https://www.facebook.com/connect/login_success.html? code=their_access_token
How can I use the desktop app to launch a browser?  (If that is what I need to do, Mac specific is ok)
Then, how can I get that code back into my desktop app?
Some solutions I have tried are:

*

*Use javascript to find the access_token and write it to a file, that the java app can read

*Write a simple java web browser that pops up using swing elements

A: https://www.facebook.com/connect/login_success.html? code=their_access_token
from above -- code=their_access_token  --  this is not the access token. You should pass this code with your app secret with another url to get the access token.
I tried like you a lot. I was using javafx and there I had a webview and I did it. May be you should find some things in java which can help you in embedding a browser with your application.


text:
Q: Connect Marketing Cloud Journey Builder to Salesforce Sandbox Environment I'm wondering if it's possible to connect Marketing Cloud to a Salesforce sandbox environment with the Journey Builder API
Thanks in advance!
-N

A: It is absolutely possible to connect Marketing Cloud's Journey Builder API to a Sandbox. Essentially, you're just treating the Sandbox as a 3rd party system.
I'm assuming you have MC Connector configured and integrated this with the Production environment. This will allow you to create SF Entry Events, SF Object Activity etc.
For the Sandbox, none of these activities will be available... You can create an API Entry Event in Journey Builder. In order to do that, you need to go via the API as you suggest, which means creating API Access Credentials (via Installed Packages in Marketing Cloud).
So while you can connect it, please do not use this as a way to "test" SF Entry Events. SF Entry Events are executed via "Process Builder" whereas your Sandbox API test would execute via APEX Code, which, in the order of execution might yield very different outcomes.