text:
Q: Repeated application of Hom functor For a commutative ring $R$, an $R$-module $M$ and an ideal $I\trianglelefteq R$, I want to show that $\text{Hom}_R(I, \text{Hom}_R(I,M)) = \text{Hom}_R(I^2, M)$.
Is this true in general?
Suppose $I$ is generated by two elements $I = (x,y)$.
Then if $\eta : I^2 \rightarrow M$, then $\eta$ defines a map $\eta': I\rightarrow \text{Hom}(I,M)$ by sending $x\mapsto (x\mapsto \eta(x^2), y\mapsto \eta(xy))$ and similarly for $y$.
However if $\varepsilon : I\rightarrow \text{Hom}(I,M)$, I want to define $\varepsilon'$ by sending $x^2 \mapsto \varepsilon(x)(x)$, $xy\mapsto\varepsilon(x)(y)$ and $y^2 \mapsto \varepsilon(y)(y)$. This is an issue for $xy$, since I could also have defined it to send $xy \mapsto \varepsilon(y)(x)$, so there isn't a single choice for the map $\varepsilon'$.
I don't know how I could prove that $\varepsilon(y)(x) = \varepsilon(x)(y)$ in general. Am I approaching this problem incorrectly?

A: $$\newcommand{\Hom}{\text{Hom}}\Hom_R(I,\Hom_R(I,M))$$
is the set of $R$-bilinear maps from $I\times I$ to $M$. These
are the same as the linear maps from $I\otimes_R I$ to $M$, so
$$\newcommand{\Hom}{\text{Hom}}\Hom_R(I,\Hom_R(I,M))
\cong\Hom_R(I\otimes_R I,M).$$
This is an isomorphism of functors on $M$. From the usual abstract nonsense
we find that
$$\newcommand{\Hom}{\text{Hom}}\Hom_R(I,\Hom_R(I,M))
\cong\Hom_R(I^2,M)$$
if and only if $I^2\cong I\otimes_R I$ as $R$-modules.
In general, $I\otimes_R I$ is not isomorphic to $I^2$ as $R$-modules.
A classic example is $I=(X,Y)$ in a polynomial ring $R=k[X,Y]$
over a field. Then $I^2$ is torsion-free, but $I\otimes_R I$ is not.


text:
Q: Get Date Picked Into User Form Text Box I have two user forms, one is a calendar that I used this guide on how to create https://sites.google.com/site/e90e50/calendar-control-class and one is where a begindate and enddate will be selected.  I am attempting to get the date selected from frmCal into a textbox on userform1.  This is how I am calling from userform1
Private Sub txtBegin_Enter()
  controlwithfocus = ActiveControl.Name
  frmCalendar.Show
  UserForm1.txtBegin.Value = Calendar1.Value
End Sub

Which does not work, it throws an error of

object required

Now this syntax is in the calendar code behind and is able to write to a cell problem free.  My issue is I do not want to write to a cell, I want to write to either txtBegin, or txtEnd depending on which text box "called" the form calendar to open.
Private Sub Calendar1_DblClick()
  ActiveCell.Value = Calendar1.Value
  Unload Me
End Sub

How can I modify this in order to have Calendar1.Value write to the "calling" text-box and not a cell on the worksheet?
EDIT And I am using Excel 2013 64 Bit edition

A: You're unloading frmCalendar and then trying to read a value from it.  You need to create a non-default instance of the calendar form (using New).  Then instead of calling Unload Me in Calendar1_DblClick, use Me.Hide to return execution to the calling code:
In frmCalendar:
Private Sub Calendar1_DblClick()
    ActiveCell.Value = Calendar1.Value
    Me.Hide
End Sub

In UserForm1:
Private Sub txtBegin_Enter()
    controlwithfocus = ActiveControl.Name
    With New frmCalendar                      'Create a new form instance
        .Show
        txtBegin.Value = .Calendar1.Value     'Form is hidden, but not unloaded.
    End With                                  'Form unloads here.
End Sub

redpajama_set_name: RedPajamaStackExchange


text:
Q: Change path of desktop I would like to change the path that my desktop shows so instead of having a bunch of files that are in my desktop folder it shows the files in another folder. My desktop folder has files in it, so deleting that and symlinking the other folder won't work.
How can I change the folder the desktop displays?

A: The folder with the name Desktop in your user folder is a "blessed" folder. The content of this folder is shown on your GUI desktop.
To show the content of a different folder on your GUI desktop you'd have to rename the folder Desktop to an unused name and rename another folder to Desktop:
sudo mv ~/Desktop ~/myOldDesktop && sudo mv ~/myNewDesktop ~/Desktop

You may encounter graphical issues with the file and folder names on your "new" desktop afterwards.
It is not advisable to "enhance" another default user folder like Pictures or Documents like this.

If you have to organize your workflow (or your files and folders) like this, your workflow or your notion of the desktop metaphor is broken. That's like moving around work desks rather than files in an office.


text:
Q: Group By eloquent laravel I have all the matches ordered by start_date, but i want the date not to be shown always instead separate the teams by date like below:
$matches=Match::orderBy('start_date','desc')->get();
foreach($matches as $match)
{
      $match->team1;
      $match->team2;
      $match->start_date;
}

this gives:
Team1
Team2
2016-9-28
Team3
Team4
2016-9-28
Team5
Team6
2016-9-28
...

Instead I want
2016-9-28
Team1
Team2
Team3
Team4
Team5
Team6
....

2016-9-29
Team1
Team2
Team3
....

group_by start_date may be?

A: Use groupBy to group the resulting collection.
$matchGroups = Match::orderBy('start_date','desc')->get()->groupBy('start_date');

If start_date is a Carbon date you may try
$matchGroups = Match::orderBy('start_date','desc')->get()->groupBy(function($item) {
    return $item->start_date->format('Y-n-j');
});

And in your view
@foreach ($matchGroups as $startDate => $matches) {
    {{ $startDate }}

    @foreach ($matches as $match) {
        {{ $match->team1 }}
        {{ $match->team2 }}
    @endforeach
@endforeach

A: hmm.. you can try
$matches =  Match::select(DB::raw('GROUP_CONCAT(team) AS teammate'), 'start_date')
           ->groupBy('start_date');
           ->get()
           ->toArray();

toArray is optional and the result should be:
array:2 [
    0 => array:2 [
      "start_date" => "2016-9-28"
      "teammate" => "Team1,Team2, Team3, Team4, Team5, Team6"
    ]
    1 => array:2 [
      "start_date" => "2016-9-29"
      "teammate" => "Team1,Team2, Team3"
    ]
]

is this the result you seeking for ?


text:
Q: Does $\star(\text{d}\omega)=0$ implies $\text{d}\omega=0$? Yes, $\star(\text{d}\omega)$ is one definition to $\text{rot} \ v$. I need to prove that if $\text{rot} \ v=0$ then $v$ is locally exact (derives locally from a potential, more context can be provided here). And yes, I've checked others answers, like this one (and I know how to solve this problem). But this came to my mind, because in this case, as a consequence, $\text{d}\omega = 0$. Is this true in general?
The definition I have for the Hodge Star Operation on a $k-$form of $\Bbb{R}^{n}$ is that
\begin{align*}
\star(d_{x_{i_{1}}} \wedge \dots \wedge d_{x_{i_{k}}}) = (-1)^{\text{sgn}\ \sigma} (d_{x_{j_{1}}} \wedge \dots \wedge d_{x_{j_{n-k}}}),\ \text{where} \ (i_{1}\dots i_{k}j_{i}\dots j_{n-k}) \in S_{n}.
\end{align*}
If the latter is $0$, then $d_{x_{j_{a}}}=d_{x_{j_{b}}}$ for some $a,b$. But all of $d_{x}$'s form a base for the dual of $k-$form of $\Bbb{R}^{n}$, so this can't happen. This is enough to conclude that? Thanks in advance!


text:
Q: Too much rerendering happeing in React with APIs I'm just a beginner at React and learning how to use an API with react.
My problem is in my code too much rerendering is happening. I came to know about it when I add console.log("test"); line.
What should I do to overcome this issue?
import * as React from "react";
import Table from "@mui/material/Table";
import TableBody from "@mui/material/TableBody";
import TableCell from "@mui/material/TableCell";
import TableContainer from "@mui/material/TableContainer";
import TableHead from "@mui/material/TableHead";
import TableRow from "@mui/material/TableRow";
import Paper from "@mui/material/Paper";

const Home = () => {
    const [data, setData] = React.useState([]);

    useEffect(() => {
        fetch("https://61924463aeab5c0017105ebe.mockapi.io/test")
            .then((res) => res.json())
            .then(
                (result) => {
                    if (result) {
                        console.log("test");
                        setData(result);
                    }
                },
                (error) => {
                    console.log(error);
                }
            );
    });

    return (

            <TableContainer component={Paper}>

                    <TableHead>
                        <TableRow>
                            <TableCell align="center">ID</TableCell>
                            <TableCell align="center">Name</TableCell>
                            <TableCell align="center">Avatar</TableCell>
                        </TableRow>
                    </TableHead>
                    <TableBody>
                        {data.map((row) => (
                            <TableRow
                                key={row.name}
                                sx={{ "&:last-child td, &:last-child th": { border: 0 } }}
                            >
                                <TableCell align="center">{row.id}</TableCell>
                                <TableCell align="center">{row.name}</TableCell>
                                <TableCell align="center">

                                </TableCell>
                            </TableRow>
                        ))}
                    </TableBody>

            </TableContainer>

    );
};

export default Home;

A: Your useEffect is getting executed every time a render happens inside the component.
You need to add empty dependency in the useEffect so that it does not get executed a second time.
useEffect(() => {
    fetch("https://61924463aeab5c0017105ebe.mockapi.io/test")
        .then((res) => res.json())
        .then(
            (result) => {
                if (result) {
                    console.log("test");
                    setData(result);
                }
            },
            (error) => {
                console.log(error);
            }
        );
}, []);


text:
Q: When will the upper regularization of a bounded function not defined? Suppose $E$ is a compact metric space.
A function $f :E \rightarrow \mathbb{R}$ is upper semicontinous if for all $c \in \mathbb{R}$, $f^{-1}(-\infty, c)$ is open in $E.$
For any real-valued bounded function $f$ defined on $E$, we can define the upper regularization of $f$ as
$$\hat{f} = \inf\{ g: g \text{ is upper semicontinuous on }E, g \geq f \}$$
In Kechris and Louveau paper, they define a sequence of functions using upper regularization:
$f_1 = \hat{f}$. For sucessor ordinal $\xi,$ if $f_{\xi}$ is defined, then
$f_{\xi+1}=\widehat{\widehat{f_{\xi}-f}+f}.$ For limit ordinal $\xi,$ if $f_{\lambda}$ is defined for all $\lambda < \xi,$ then $f_{\xi} = \widehat{\sup_{\lambda < \xi} f_{\xi}}.$
In the same paper, the authors stated that the function $\hat{f}$ may not be defined.
Question: What is an example $f:E \rightarrow \mathbb{R}$ such that $f_{\xi}$ is not defined for some ordinal $\xi$?
EDIT: The authors prove the following proposition (page $220$, part of Proposition $2$ in the same paper:
If $f = u - v$ where $u,v$ are upper semicontinuous functions, then for all countable $\xi$, $f_{\xi}$  is defined.
When the authors prove the above proposition, they apply transfinite induction to prove that for all countable $\xi $, $u \geq f_{\xi}$. Hence, $f_{\xi}$ is defined.
From the proof above, I 'guess' that when $f_{\xi}$ is not defined, it should be the case that $f_{\xi}(x) = \infty$ for some $x \in E.$ However, I fail to construct such an example, even at $\xi=1.$
UPDATE: According to the author, there is a gap in the proof in section $3$, Lemma $3$, case $3$ (successor case). If someone can fill in the gap, I would feel appreciated.


text:
Q: GMB mybusinessbusinessinformation.googleapis.com/v1 not returning all locations GMB API v1 does not return all locations.
On Google developer playground if I run something like https://mybusiness.googleapis.com/v4/accounts/my_account_number/locations?
it would return all my locations where I'm a owner
If I use the new API and run https://mybusinessbusinessinformation.googleapis.com/v1/accounts/my_account_number/locations?read_mask=title it would not return all locations.
I verified if anything is different on the location, but could not find anything.
What I'm doing wrong here?

A: add &pageSize=100
https://mybusinessbusinessinformation.googleapis.com/v1/accounts/my_account_number/locations?read_mask=title&pageSize=100
pageToken maybe required if your total locations is more than 100.


text:
Q: Getting' no reply received within timeout' despite the required channel exists I am using spring integration in my project. The following is the web.xml code which loads the required config files:
<listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:TestService/applicationContext.xml</param-value>
    </context-param>
    <servlet>
        <servlet-name>SpringDispatcherServlet</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value/>
        </init-param>
        <load-on-startup>2</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>SpringDispatcherServlet</servlet-name>
        <url-pattern>/rest/*</url-pattern>
    </servlet-mapping>

Here is my applicationContext.xml file:
<int:annotation-config/>
  <context:component-scan base-package="com.test"/>
  <mvc:annotation-driven />

  <import resource="JobDesigner-springintegration.xml"/>
  <import resource="DataSourceConfiguration.xml"/>

   <!-- Inbound/Outbound Channels -->
    <int:channel id="httpJobRequest" />
    <int:channel id="httpJobResponse" />

    <int-http:inbound-gateway id="inboundhttpJobRequestGateway"
        supported-methods="GET, POST"
        request-channel="httpJobRequest"
        reply-channel="httpJobResponse"
        path="/jobdesigner"
        reply-timeout="90000"
        error-channel="cs-exceptionHandlingChannel" >

        <int-http:header name="${headerNames.jobName}" expression="#requestParams.src[0]"/>

    </int-http:inbound-gateway>

    <!-- Http Rest Input Buffered Channel -->
    <int:bridge input-channel="httpJobRequest"      output-channel = "jobDesignerInputChannel"  />

</beans>

here is my JobDesigner-springintegration.xml file which loads all the files having spring integration channels.
   <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:int-xml="http://www.springframework.org/schema/integration/xml"
    xmlns:int="http://www.springframework.org/schema/integration"
    xmlns:int-jdbc="http://www.springframework.org/schema/integration/jdbc"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:util="http://www.springframework.org/schema/util"
    xmlns:int-http="http://www.springframework.org/schema/integration/http"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
            http://www.springframework.org/schema/beans/spring-beans.xsd
            http://www.springframework.org/schema/integration
            http://www.springframework.org/schema/integration/spring-integration.xsd
            http://www.springframework.org/schema/integration/xml
            http://www.springframework.org/schema/integration/xml/spring-integration-xml.xsd
            http://www.springframework.org/schema/util
            http://www.springframework.org/schema/util/spring-util.xsd
            http://www.springframework.org/schema/integration/jdbc
            http://www.springframework.org/schema/integration/jdbc/spring-integration-jdbc.xsd
            http://www.springframework.org/schema/integration/http
            http://www.springframework.org/schema/integration/http/spring-integration-http.xsd ">

    <import resource="spring-integration/Jobs/*.xml"/>

    <!-- map of namespace prefix to URI -->
    <util:map id="xmlMessageNamespace">
        <entry key="SOAP" value="http://schemas.xmlsoap.org/soap/envelope/" />
    </util:map>

    <bean id="customerServProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
        <property name="locations">
            <list>
                 <value>classpath:TestService/property-files/*.properties</value>
            </list>
        </property>
    </bean>

    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="locations">
            <list>
                 <value>classpath:TestService/property-files/*.properties</value>
            </list>
        </property>
    </bean>

    <int:channel id="jobDesignerInputChannel" />
    <int:channel id="cs-exceptionHandlingChannel" />

    <bean id="msgHandler" class="com.org.cs.test.jobs.PQMessageHandler" />

    <bean id="headerMapper" class="org.springframework.integration.http.support.DefaultHttpHeaderMapper">
        <property name="inboundHeaderNames" value="*" />
        <property name="outboundHeaderNames" value="HTTP_REQUEST_HEADERS, Use-200-on-204-response" />
        <property name="userDefinedHeaderPrefix" value="" />
    </bean>

    <int:payload-type-router input-channel="jobDesignerInputChannel"  default-output-channel="xmlMessageChannel">
        <int:mapping type="java.util.HashMap" channel="multipartMessageChannel" />
    </int:payload-type-router>

    <int:chain input-channel="xmlMessageChannel" >
        <int:service-activator  ref="msgHandler" method="test" />

        <int-xml:xpath-header-enricher default-overwrite="true"  should-skip-nulls="true"  >
            <int-xml:header name="${headerNames.legacySystem}"  xpath-expression="//LegacySystem"  evaluation-type="STRING_RESULT"  overwrite="true" />
        </int-xml:xpath-header-enricher>

        <int:header-enricher>
            <int:header name="${headerNames.businessArea}" expression="#xpath(payload, '//businessArea/Code', 'boolean') ? null : #xpath(payload, '//businessArea')"/>
        </int:header-enricher>

        <int:router expression="${routing.jobChannel}"/>
    </int:chain>

    <int:chain input-channel="multipartMessageChannel" >
        <int:router expression="${routing.jobChannel}"/>
    </int:chain>

    <int:chain input-channel="cs-exceptionHandlingChannel">
        <!-- Service Activator to handle the errors -->
        <int:service-activator  ref="msgHandler" method="handleError" />

        <!-- Router to routing the error messages to appropriate job channel for xsl transormation -->
        <int:router expression="${routing.jobErrorChannel}"/>
    </int:chain>
</beans>

The following properties are loaded from the properties file:
routing.jobChannel=headers.jobDesignerJobName+'-InputChannel'
routing.jobErrorChannel=headers.jobDesignerJobName+'-XsltTransformInputChannel'

The idea is to route the message to appropriate channel based on the value of "headers.jobDesignerJobName". All the channels are accessed successfully when they are deployed in Jboss server after accessing the home page of our application. But, weirdly, no channel is accessible if we directly try to invoke the channel with http request. I found by debugging log messages that the message is reached till <int:service-activator  ref="msgHandler" method="test" />, but after that it is not able to trigger the headers.jobDesignerJobName+'InputChannel' though headers.jobDesignerJobName has the valid value. Just getting the error:no reply received within timeout
My test() method is just a dummy method which added for debugging purpose:
public Message<?> test(Message<?> inMessage){
        return inMessage;

    }

What's going wrong here?
Is it something to do with the JBOSS session management? If that's the case, the applicationContext.xml file shouldn't be accessible at all as per my understanding. Can anybody tell the reason?
We are using Maven for dependency management.Spring Messaging jar is pulled transitively by Spring Integration.
+- org.springframework.integration:spring-integration-core:jar:5.0.6.RELEASE:compile
[INFO] |  +- org.springframework:spring-core:jar:5.0.6.RELEASE:compile
[INFO] |  |  \- org.springframework:spring-jcl:jar:5.0.6.RELEASE:compile
[INFO] |  +- org.springframework:spring-aop:jar:5.0.6.RELEASE:compile
[INFO] |  +- org.springframework:spring-context:jar:5.0.6.RELEASE:compile
[INFO] |  +- org.springframework:spring-messaging:jar:5.0.6.RELEASE:compile
[INFO] |  +- org.springframework:spring-tx:jar:5.0.6.RELEASE:compile
[INFO] |  +- org.springframework.retry:spring-retry:jar:1.2.2.RELEASE:compile
[INFO] |  \- io.projectreactor:reactor-core:jar:3.1.6.RELEASE:compile
[INFO] |     \- org.reactivestreams:reactive-streams:jar:1.0.2:compile

Any other thoughts?

A: Are you sure that your msgHandler.test method returns something? If it is void or returns null, the flow stops and there indeed is not going to happen any reply. Therefore an <int-http:inbound-gateway> fails with the mentioned error.
You don't show an important code, e.g. who subscribes to the jobDesignerInputChannel. Who sends messages into the httpJobResponse. That msgHandler.test etc. Everything what is really related to the problem. But you show a standard web.xml. How is it related to the problem, please?
UPDATE
It is hard to understand what is going on in your so custom configuration.
I suggest you to enable <message-history> and log all the traffic via <wire-tap>. So, that way you'll see in logs how your message is passing components and where is really a problem.
See Docs for more info:
https://docs.spring.io/spring-integration/reference/html/#message-history
https://docs.spring.io/spring-integration/reference/html/#channel-wiretap


text:
Q: App Recommendation for automatically stitching screenshots together on iOS As per this marvellous screenshot on another question, is there an App available (preferably an iOS app, but a Mac OS X one might do) that will take a series of screenshots that are produced by taking snaps of various sections of a scrolling App or Webpage display, and automatically create a conjoined single image file.  The example below was done in Photoshop, but the effect is what I would like to achieve.

A: AutoStich Panorama
...has been my choice for the iPhone. You still need to take the pictures manually fist. You can choose all the pictures which you want to stich from your camera roll.

*

*up to 18 megapixels are supported for stitched panoramas

*camera images in any order or arrangement (vertical, horizontal, mixed).

*option to stich using high res images for better result

A: You can try using an app like Photosynth, which creates stitched images from a set of images. Unlike some apps that only stitch panorama left to right, this allows for both up-down and left-right, which makes it a good choice for your purpose.

Using the latest in computer vision techniques, you can not only make a panorama from left to right, but also up and down, enabling you to capture a full "sphere".

A: Autostitch
It's a panorama app, but you can choose images from the camera roll to include in your panorama. The developers webpage says

AutoStitch now brings the latest in image recognition technology to
  your iPhone. Stitch images in any order or arrangement, using photos
  taken from your iPhones camera. Just select a set of images from the
  camera roll or photo albums, and AutoStitch does the rest. For more
  details, see our webpage, or go directly to the app store

A: I currently use StitchIt! which is available in the iOS App Store.
Stitched screen shot here:


text:
Q: Probability of receiving a bit correctly. Bits are sent through an information channel, the probability of incorrectly receiving a $1$ is 0.02, while the probability of incorrectly receiving a 0 is 0.01. What is the probability of receiving a correct bit?
Since both have equal probability of being sent, I thought I need to consider the converse probability of a mistake for each of these, namely $\frac{1}{2}99.9+\frac{1}{2}99,8$. But the solution tells me to use Bayes' theorem. Is my reasoning incorrect?

A: We do not need to use Bayes' theorem. By the law of total probability,
\begin{multline*}
P(\text{correct bit})=P(\text{correct bit}\mid\text{$1$ was sent})P(\text{$1$ was sent})\\+P(\text{correct bit}\mid \text{$0$ was sent})P(\text{$0$ was sent}).
\end{multline*}
Hence,
$$
P(\text{correct bit})=0.98\cdot0.5+0.99\cdot0.5=0.985.
$$


text:
Q: Skip pause in batch file from VBScript In VBScript if myScript.vbs runs otherScript.bat, and in otherScript.bat, there's a pause statement. How can I send a keystroke to skip that pause from myScript.vbs? So my script won't need to take any extract keystroke and won't be blocked by the pause.
There is an answer in another thread with example for acheving this in a batch file, but I need somthing similar in VBScript. Introducing another batch file between myScript.vbs and Otherscript.bat is one dirty solution, but is there a direct way?


text:
Q: Compare data between Elastic Search and RDS We are moving our data from RDS to elastic search and the data volume is around 80GB with around 90 million records.
We have been using bulk api of elastic search for indexing the data but we want to take an entire dump of elastic records and compare the records with our RDS as we want to make sure that the data from RDS is moved correctly to Elastic. In Elastic, we have been combining multiple tables of RDS into a single elastic index, is there any way to take the dump of elastic index into a document or into multiple files?

A: There's no solution out of the box but there's an old post from the elastic website which explain some solutions:
https://www.elastic.co/blog/elasticsearch-verifying-data-integrity-with-external-data-stores
Hope it help.


text:
Q: How to add body element in facebook's reactjs my-app? I want to add a background image on Facebook's react.js my-app. I can do this by setting a background image to a div element. But my div only covers half of the page. Which is why my image is not fulling occupying the page.
Instead, I want to do this on a body element. But how to add a body element and set a background image to it?
I tried this, but its not working in App.js file of my-app

A: [EDITED]
Css-tricks.com provides a quite cool solution of the full page images:
https://css-tricks.com/perfect-full-page-background-image/
I used this example for my React implementation with the useEffect (https://reactjs.org/docs/hooks-effect.html).
Note: background-size replaced by backgroundSize when the style is setted.
import React, { useEffect } from "react";
import img from "./test.jpg";

export default function App() {
  useEffect(() => {
    document.body.style.background = `url('${img}') no-repeat center center fixed`;
    document.body.style.backgroundSize = "cover";
    document.body.style.webkitBackgroundSize = "cover";
  }, []);
  return

;
}

A: Try using style:

And bodyStyle should look like:
var bodyStyle = { backgroundImage: 'url(http://i.imgur.com/DaNQJ6I.jpg)' };

A: For some reason, I cannot add a background image on app.js or  app.css files of react framework. However, I tried to do it on index.html. This worked perfectly to me.
So, please add background images on index.html If you are unable to do it in app.js or app.css.
And also, future readers, If you have found a way to do it, feel free to answer the question, thanks!!

A: This works for me. The actual work is done in componentDidMount(). So technically, you could add this on about any component. Like, you could put it on a navbar or even in the layout.
For my projects, I created a  component. Add it to your layout (or where ever) and it should work.
Good luck!

export default class BodyStyle extends Component {
  componentDidMount() {
    const { style } = this.props;

    var body = document.getElementsByTagName( "body" )[ 0 ];
    for ( var key in style ) {
      body.style[ key ] = style[ key ];
    }
  }

  render() {
    return ;
  }
};


text:
Q: Kerberos ktutil, what kinds of encryption are available? I am attempting to make a keytab using ktutil. I get to choose the encryption type, but the ktutil man page does not offer a list of possible choices. I also don't know which encryption method is the best! How can I find out both of these? I want the strongest encryption available.
$ ktutil
> add_entry -password -p me@DOMAIN.COM -k 1 -e [what goes here?!]

A: Don't use ktutil unless you're trying to make a keytab from an existing keytab. Use kadmin instead.
# kadmin -p user/admin
Password for user/admin@EXAMPLE.COM:
kadmin: add_principal -randkey service/server.example.com
WARNING: no policy specified for service/server.example.com@EXAMPLE.COM; defaulting to no policy
Principal "service/server.example.com@EXAMPLE.COM" created.
kadmin:  ktadd -k /etc/service/service.keytab service/server.example.com
Entry for principal service/server.example.com with kvno 2, encryption type aes256-cts-hmac-sha1-96 added to keytab
Entry for principal service/server.example.com with kvno 2, encryption type camellia256-cts-cmac added to keytab
kadmin: quit

Depending on your kdc's kdc.conf you may end up with different encryption:salt types. The default list is:
aes256-cts-hmac-sha1-96:normal
aes128-cts-hmac-sha1-96:normal
des3-cbc-sha1:normal
arc‐four-hmac-md5:normal

You can also limit (or expand) the enctypes used in the keytab when creating it by using -e and specifying the desired types.

If you are trying to make a keytab from an existing keytab:
# kutil
ktutil: read_kt /etc/krb5.keytab
ktutil:  l -e
slot KVNO Principal
---- ---- ---------------------------------------------------------------------
   1    6   host/server.example.com@EXAMPLE.COM (aes256-cts-hmac-sha1-96)
   2    6   host/server.example.com@EXAMPLE.COM (camellia256-cts-cmac)
   3    3   HTTP/server.example.com@EXAMPLE.COM (aes256-cts-hmac-sha1-96)
   4    3   HTTP/server.example.com@EXAMPLE.COM (camellia256-cts-cmac)
ktutil: delete_entry 1
ktutil:  l -e
slot KVNO Principal
---- ---- ---------------------------------------------------------------------
   1    6   host/server.example.com@EXAMPLE.COM (camellia256-cts-cmac)
   2    3   HTTP/server.example.com@EXAMPLE.COM (aes256-cts-hmac-sha1-96)
   3    3   HTTP/server.example.com@EXAMPLE.COM (camellia256-cts-cmac)
ktutil: delete_entry 1
ktutil:  l -e
slot KVNO Principal
---- ---- ---------------------------------------------------------------------
   1    3   HTTP/server.example.com@EXAMPLE.COM (aes256-cts-hmac-sha1-96)
   2    3   HTTP/server.example.com@EXAMPLE.COM (camellia256-cts-cmac)
ktutil: write_kt /etc/httpd/http.keytab
ktutil: quit
# klist -ke /etc/httpd/http.keytab
Keytab name: FILE:/etc/httpd/http.keytab
KVNO Principal
---- ---------------------------------------------------------------------
    3   HTTP/server.example.com@EXAMPLE.COM (aes256-cts-hmac-sha1-96)
    3   HTTP/server.example.com@EXAMPLE.COM (camellia256-cts-cmac)

A: The ktutil solution provided by 84104 is correct if you are trying to make a keytab for a service. It's a terrible idea for a keytab that you want to use for some automated process as it will randomize the password and make the account unusable without the keytab.
If you are using the keytab as a password store to feed to kinit to automate a process, I would suggest you use whatever enctype that you get when you run kinit using a password.
klist -e

will list out a bunch of stuff the line you want is this one. Use the etype listed with ktutil.
    Etype (skey, tkt): aes256-cts-hmac-sha1-96, aes256-cts-hmac-sha1-96

Be warned, this use of ktutil is exactly the same as storing your password in a clear text file, anybody that can read the keytab can impersonate your identity to the system.
Also these commands are the MIT version, heimdal ktutil and klist are somewhat different.( Heimdal is the kerberos version used on recent versions of OS X )


text: Q: Creating Default Thumbnail in Reactjs and Tailwind CSS The article component am working on has an image but i want to replace the image with the title of the article.How can i achieve this in Reactjs and Tailwind CSS


text:
Q: Undefined method `yield_content' for App I have a Sinatra app. Everything works well, but when I add this code:
   != yield_content :css

to a main view (template) or "shared/_head" directly
!!!5
%html{lang: :en}
  != haml :"shared/_head"
  != yield_content :css
  %body{'data-spy' => "scroll", 'data-target' => ".subnav", 'data-offset '=> "50"}
    != haml :"shared/_header"

    .container-fluid
      != haml :"shared/_flash"
      != yield
      %hr
      != haml :"shared/_footer"

the error throws:
undefined method `yield_content' for #<App:0x00000004267ce0>

Why is that?

A: According to https://github.com/sinatra/sinatra-contrib#modular-style you just need to install the gem and then include content_for extension to your application file. Something like following:
require 'sinatra'
require 'sinatra/content_for'

class App < Sinatra::Base
  helpers Sinatra::ContentFor

  get '/' do
    erb :index
  end
end

Just have checked and it works for me


text:
Q: Java: Converting data types I'm working with a JTable, whose cells data are contained in Object. One column shows a float number. I want to GET the value into afloat, limit decimal places to 3, and then I want to reload the correct data in the cell, so I want to SET the value into the cell again. The problem appears in the last conversion:
 private class CambioTablaMeasurementListener implements TableModelListener{

    public void tableChanged(TableModelEvent e){
        try{
            if(sendDataToDisp){
                TableModel model = (TableModel)e.getSource();
                float value = Float.parseFloat((String)model.getValueAt(e.getLastRow(), 1));
               // Now i want to limit to only 3 decimal places, so:

                double aux = Math.round(value*1000.0)/1000.0;
                value = (float) aux;
                Float F = new Float(value);

                // Now i want to load data back to the cell, so if you enter 0.55555, the cell shows 0.555. This Line gives me an exception (java.lang.Float cannot be cast to java.lang.String):
                model.setValueAt(F, e.getLastRow(), 1);

                // Here I'm getting another column, no problem here:
                String nombreAtributo = (String)model.getValueAt(e.getLastRow(), 0);
                nodoAModificar.setCommonUserParameter(nombreAtributo, value);

            }
           ...}

A: You need to convert Float instance to String.
model.setValueAt(F.toString(), e.getLastRow(), 1);

or
model.setValueAt(String.valueOf(F), e.getLastRow(), 1); // preferred since it performs null check

A: You can use DecimalFormat to display a float as a String in a given format:
...
float value = Float.parseFloat((String)model.getValueAt(e.getLastRow(), 1));
DecimalFormat dec = new DecimalFormat("#.###");
model.setValueAt(dec.format(value), e.getLastRow(), 1);
...


text:
Q: File is both modified and untracked Why I'm asking the question
The following git status output shows a file that is both deleted and untracked:
$ git status
On branch bugfix/1386ReferredBySlow
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified:   Broker/Controllers/InHouseAgentsController.cs
modified:   Broker/Web.config
deleted:    CompanyNameEnterprise.EF/App.Config
modified:   CompanyNameEnterprise.Services/Web.config
Untracked files:
 (use "git add <file>..." to include in what will be committed)
CompanyNameEnterprise.EF/App.config

The file CompanyNameEnterprise.EF/App.config is both "deleted" and "untracked."  Those two states seem contradictory.
The Question
Under what circumstances can git show that a file is both untracked and deleted?
More info

*

*Windows 10

*Bash

*git version 2.13.0

*VisualStudio/C# project

How we worked around it.
My co-worker worked around it by re-cloning the project, which fixed the problem (and destroyed the evidence).  But I want to know why this can happen so we know what to do next time.

A: seems like the problem is related to ignoring the case of the file name: the untracked one has a lowercase 'c' while the deleted one a uppercase 'C'. Maybe the file was renamed?!
I assume the core.ignorecase configuration variable can help: doc (or not if not set correctly).

If true, this option enables various workarounds to enable Git to work better on filesystems that are not case sensitive, like FAT. ...

Use git config --get --show-origin core.ignorecase to check its value and origin.

A: It happens when you remove a file, add the deletion to stage and recreate this file. File will appear in staged and untracked sections.
You can see details with git diff and git diff --staged
Steps to reproduce :

*

*Remove a file with git rm file

*Recreate this file with a non-git tool

*You can see your file in staged and untracked sections. Use git diff --staged to see changes before addition, and git diff to see changes after addition

A similar thing will appear when you edit a file, add changes to stage and modify the file again. Your file will be appear in staged and unstaged sections. (i.e after a partial addition with git add -p)

A: CompanyNameEnterprise.EF/App.config is not modified, it is deleted. In other words, it is present in the last commit but not in the index (aka "staging area").
It is indeed untracked, i.e. present on-disk but not in the index.
To sum up, it is present in the last commit and on disk, but absent from the index. This happens right after your run git rm --cached on the file for example.


text:
Q: How to flush the table in HBase Am using HBase (0.98 in Client with server as HBase 1.1.2) with underlying datastore as HDFS.
I tried to flush the table using the following code and am able to see the data flushed to HFile location in Hadoop.
            htable.put(puts);
            htable.close();
            admin.flush(tableName);

Data location in Hadoop
./hadoop fs -du /hbase/data/default/tableName/

When I do the power shut down and restarted the node, restarted the Hadoop and HBase am able to see the data got corrupted in HDFS.
If the data is properly flushed to HFile, why it is getting corrupted during power shutdown.
Do I need to make any change in the code for flushing the table?
Thanks,
Har

A: I got something like that years ago, and that was due to sync problem. I can see resolution for that. Here is another description, with sequence diagram for put operation.
What happens in your case? Perhaps that put is quite small, and ends in memory storage, not in HFile, where you are looking to check if it is "corrupted", or not.
Try to write 25MB, or more - since that is page size for hadoop, and that would trigger, all writes. That way you can simply eliminate other problems. If that works - then you can play with storing policy or simply wait more. Silly advice, but note that in normal system there will be more writes, so full writes to HFile will be triggered anyway. Other option is to force it, but your production can go bad with too many writes.


text:
Q: Deleted Branch in Gitlab web interface. Trying to create a new branch with the same name gives the error "Branch already exists" We have a test branch which experienced a merge conflict. As this is a non prod branch, we deleted it in the web interface and decided to recreate again from the master branch. Trying to create a new branch (again, in the web interface) with the same name from master gives the error "Branch already exists".
If I clone the repo and run "git branch -a" the branch is not listed. I imagine there may be residual references to the branch remaining in a number of historic merge requests? Is there a way for me to create a branch with the same name here?

A: Managed to sort this one out. It was a strange bug in the Gitlab web interface. Was able to create the branch using git bash using these steps (in case anyone looks for this issue)

*

*git clone https://gitlab.com/yourgitrepo.git

*git checkout -b branchname branchtocreatefrom

*git push origin branchname

Never had this issue before. Maybe just a one off.


text:
Q: Centered buttons on bitmap background I want to create buttons centered horizontally on background created from bitmap. Right now I have vertical field manager with background:
vertical=new VerticalFieldManager()
    {
        protected void paint(Graphics g)
        {
            g.drawBitmap(0, 0, Display.getWidth(), Display.getWidth(), scaleBit, 0, 0);
            super.paint(g);
        }
        protected void sublayout(int maxWidth, int maxHeight)
        {
            super.sublayout(Display.getWidth(), Display.getWidth());
            setExtent(Display.getWidth(), Display.getWidth());
        }
    };

but when I add paramethers like FIELD_HCENTER | Field.USE_ALL_WIDTH to vertical field manager constructor nothing happens when I add buttons, so how should it be done?

A: If this is on a MainScreen you don't need to add the VerticalFieldManager as the screen will have one as its root anyways. I'm going to answer as though the manager needs to be separate as you have it, but this should work either way.
You don't need to override the paint and sublayout methods of your VerticalFieldManager. You should be able to get what you want with standard methods.
public class MyScreen extends MainScreen
{
    public MyScreen()
    {
         super(NO_HORIZONTAL_SCROLL);
         VerticalFieldManager manager = new VerticalFieldManager(USE_ALL_WIDTH | NO_VERTICAL_SCROLL | NO_HORIZONTAL_SCROLL);
         manager.setBackground(BackgroundFactory.createBitmapBackground(null)); // Your bitmap here instead of null

         add(manager);

         ButtonField button = new ButtonField("Button", FIELD_HCENTER);
         manager.add(button);
    }
}

I think the big issue you might be having is a scrollable parent that causes your manager, or button to be placed in the center of and extremely large scroll area.


text:
Q: How to use the output of cv2.HoughLinesP() to rotate the original image? I'm using cv2.HoughLinesP() and it's giving me lines it has detected. These lines are mostly accurate at finding the angle of the object. Then, I want to rotate the original image according to these lines.
My image:

My code:
import cv2 as cv
import numpy as np
img = cv.imread(img)
gray = cv.cvtColor(img,cv.COLOR_BGR2GRAY)
edges = cv.Canny(gray,50,150,apertureSize = 3)
lines = cv.HoughLinesP(edges,1,np.pi/180,100,minLineLength=100,maxLineGap=10)
for line in lines:
    x1,y1,x2,y2 = line[0]
    cv.line(img,(x1,y1),(x2,y2),(0,255,0),5)
cv2.imshow('', img)
cv2.waitKey()

The result:

What I want:

A: It seems you're trying to perform skew correction. Instead of using cv2.HoughLinesP to find the angle and rotate the object, you can use cv2.minAreaRect to find the angle then cv2.getRotationMatrix2D + cv2.warpAffine to deskew the image.
Input -> Output

Skew angle
-29.35775375366211

Code
import cv2
import numpy as np

# Load image, grayscale, Otsu's threshold
image = cv2.imread('1.png')
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
gray = 255 - gray
thresh = cv2.threshold(gray, 0, 255, cv2.THRESH_BINARY + cv2.THRESH_OTSU)[1]

# Compute rotated bounding box
coords = np.column_stack(np.where(thresh > 0))
angle = cv2.minAreaRect(coords)[-1]

if angle < -45:
    angle = -(90 + angle)
else:
    angle = -angle
print(angle)

# Rotate image to deskew
(h, w) = image.shape[:2]
center = (w // 2, h // 2)
M = cv2.getRotationMatrix2D(center, angle, 1.0)
rotated = cv2.warpAffine(image, M, (w, h), flags=cv2.INTER_CUBIC, borderMode=cv2.BORDER_REPLICATE)

cv2.imshow('thresh', thresh)
cv2.imshow('rotated', rotated)
cv2.waitKey()

Note: For other skew correction techniques take a look at

*

*Python OpenCV skew correction

*How to de-skew an image

*Detect image orientation angle based on text direction


text:
Q: Laravel validation rule for either of two fields required but both should not be present Is there a Laravel validation rule for when either of two fields are required but both should not be present at the same time.
Eg. Mobile number and email, either of them should be present but not both.

A: Unfortunately, I couldn't find one.
To meet your needs, below are the steps I took.

*

*Laravel has a validation rule for the case of making one request param required if the others aren't present.

required_without:foo,bar,...

The field under validation must be present and not empty only when any
of the other specified fields are not present.

*For the case of achieving the, not both case, I had to come up with a custom validation rule.

STEPS
2a.  Open your terminal and run the command to generate a custom validation rule.
php artisan make:rule OneOf
Here OneOf is my validation rule name. Name it anything you want. (use PascalCase).
2b. Open the generated file add your logic.
<?php

namespace App\Rules;

use Illuminate\Contracts\Validation\Rule;
use Illuminate\Http\Request;

class OneOf implements Rule
{
    public $oneOf = [];
    public $request = null;
    public $message = "";

    /**
     * Create a new rule instance.
     *
     * @return void
     */
    public function __construct(Request $request, array $oneOf, string $message = "")
    {
    $this->oneOf = $oneOf;
    $this->request = $request;
    $this->message = $message;
    }

    /**
     * Determine if the validation rule passes.
     *
     * @param string $attribute
     * @param mixed $value
     * @return bool
     */
    public function passes($attribute, $value)
    {
    $count = 0;
    foreach ($this->oneOf as $param) {
        if($this->request->has($param)){
        $count++;
        }
    }
    return count($this->oneOf) && ($count === 1) ? true : false;

    }

    /**
     * Get the validation error message.
     *
     * @return string
     */
    public function message()
    {
    $json_encodedList = json_encode($this->oneOf);

    return  strlen(trim($this->message)) ? $this->message : "Please insert one of $json_encodedList.";
    }

}

2c. In your controller, make use of the created custom rule.
<?php

namespace App\Http\Controllers\Employee;

use App\Http\Controllers\Controller;
use App\Rules\OneOf;
use Illuminate\Http\Request;

/**
 * Class Employee
 * @package App\Http\Controllers\Employee
 */
class Employee extends Controller
{

    public function store(Request $request)
    {

    $request->validate([
        "email" => ["required_without:phone_number", new OneOf($request, ["email", "phone_number"])],

        "phone_number" => ["required_without:email", new OneOf($request, ["email", "phone_number"])],

    ]);

    // ...Custom project specific logic here

    return response()->json([]);
    }
}

You can supply a custom message if you wish.
You can also apply it to more than two request params.

A: I've updated this code a little bit to ensure that things are not counted if they are null. A request can have a parameter, but that parameter be null, and the rule will still fire as invalid even though one of the two fields provided has nothing in it.
<?php

namespace App\Rules;

use Illuminate\Contracts\Validation\Rule;
use Illuminate\Http\Request;
use Illuminate\Support\Str;

class OneOf implements Rule
{
    public $oneOf = [];
    public $request = null;
    public $message = "";

    /**
     * Create a new rule instance.
     *
     * @return void
     */
    public function __construct(Request $request, array $oneOf, string $message = "")
    {
        $this->oneOf = $oneOf;
        $this->request = $request;
        $this->message = $message;
    }

    /**
     * Determine if the validation rule passes.
     *
     * @param string $attribute
     * @param mixed $value
     * @return bool
     */
    public function passes($attribute, $value)
    {
        $count = 0;
        foreach ($this->oneOf as $param) {
            if($this->request->has($param) && $this->request->$param != null){
                $count++;
            }
        }
        return count($this->oneOf) && ($count === 1) ? true : false;

    }

    /**
     * Get the validation error message.
     *
     * @return string
     */
    public function message()
    {
        $i = 1;
        $length = count($this->oneOf);
        $fieldNames = null;
        foreach($this->oneOf as $fieldName) {
            if($i < $length) {
                $fieldNames .= Str::replace('_', ' ', Str::title($fieldName)) . ', ';
            } else {
                $fieldNames .= Str::replace('_', ' ', Str::title($fieldName));
            }
            $i++;
        }
        return  strlen(trim($this->message)) ? $this->message : "Only one of these fields should be used: $fieldNames.";
    }
}

A: You can also achieve this by combining required_without and prohibited_unless.
For example:
    [
        'email' => 'required_without:name|prohibited_unless:name,""'
        'name' => 'required_without:email|prohibited_unless:email,""'
    ]

Note: prohibited_unless is fairly new, available since Laravel 8


text:
Q: Layer 2/3 Switch recommendations Looking at setting up VLANs for a quickly-growing office (6 servers, 60 workstations, probably adding another 10 within the next month or so). I need to do inter-VLAN routing and ACLs (layer 3, packet filtering if possible); QoS would be beneficial, but not necessary.
Here's my (likely) impossible wish list:

*

*GbE x 24 -- if I'm buying a new core switch, I want Gigabit.

*Layer 3 routing (RIPv1/2) or "static routing" with a decent sized routing table limit (think the ProCurve 2610 was 8, which is too small)

*Layer 3/4 ACLs (packet filtering): I don't want to do router-on-a-stick to achieve any sort of decent firewalling between the VLANS.

*(the kicker) under $1500

Nice to have:
1. QoS
Any recommendations?  It seems like I need something between a 2600 series and a 2900 series, possibly from another manufacturer, but I'm really drawn to HP ProCurve's good reputation and lifetime warranty.  Will consider other vendors though.

A: No way you can get something that would satisfy all these requirements. Especially #4: a smart GigE switch will run in the neighborhood of $100/port. Of course, you always have the linksyses and netgears of this world, but I wouldn't trust them to run anything more complex than VLANs, some basic trunking and routing with no ACLs.
Among the more reputable vendors, ProCurve is the most budget friendly, and you seem to know enough about them to figure out what would fit (or rather that nothing would fit) on your own.
And one more thing: router on a stick is not such a bad idea, especially if you have robust virtual environment. Just last week I deployed a pair of pfSense virtual appliances, and I couldn't imagine an easier way to get a capable router in my environment at almost zero (CPU and memory consumption of that appliance are negligible) cost. With that requirement gone, you could get much simpler and cheaper switches.


text:
Q: There is a delay between the model load using gltfLoader and the scene rendering, how would I know when to hide the loading screen? I am using threejs 106 build and using webGLRenderer and CSS2DRenderer with my project.
Trying to load a glb model and showing a loading progress based on the onProgress callback of the loader. I hide the loading screen when the loading is 100% complete and call the renderer but rendering of the geometries take a few seconds to appear on the canvas.
How would I know the assets have been shown on the screen, so that I can hide the loading screen and not make the delay to appear before the user?
Any help will be greatly appreciated.

A: When your geometry and textures have finished loading, they only live in RAM but they haven't been passed to the GPU yet. It finally gets loaded to the GPU the first time you call render(scene, cam) if these elements have been added to the scene. This is usually a bottleneck that may lead to a delay. The bigger the assets, the longer the delay. My suggestion is to wait until after the first render finishes to hide the loading screen:
onLoadComplete() {
    update();
}

var firstRender = true;
function update() {
    // This will block for a moment the first time
    renderer.render(scene, camera);

    // Hide loading bar after the first render
    if (firstRender) {
        firstRender = false;
        hideLoadScreen();
    }

    // Subsequent frames should run smoothly afterward
    requestAnimationFrame(update);
}

There are some helper tools that help you pre-upload these assets to the GPU so you don't have to wait until the first frame.

*

*renderer.initTexture(texture) could be used after each texture finishes loading.

*renderer.compile(scene, cam) could be used to pre-compile materials & shaders if you have them before the geometry finishes loading.


text:
Q: Get size of JPanel before realizing I've created JPanel and have already added components into it and I'm going to pass that JPanel to PopUpFactory... So can I get size of JPanel before passing it?
I put Jlabel into it and text after that and I don't know the size of that text...

A: You can set the preferred size using setPreferredSize(Dimension); e.g.
JPanel pnl = new JPanel(new BorderLayout());
pnl.setPreferredSize(new Dimension(640, 480));

This value will subsequently be obtainable by calling getPreferredSize() and will be used when laying out the component, although note that it is not guaranteed that it will actually be rendered at this size.
Why do you actually require the size prior to rendering it?  Typically with Swing programming you don't need to deal with explicit dimensions / sizes as the chosen layout will take care of these specifics for you.
EDIT
To address the OP's query regarding JTextField, one option here it to call the int based constructor that accepts the anticipate number of columns.  This causes the text field to be rendered wide enough to support that number of characters.
My second point addresses the comment that the setXXXSize methods should never be called directly and that the developer should rely solely on the LayoutManager.  This is not always appropriate - Typically it is necessary to set the preferred size of your main application frame.  For example, suppose I were writing a a simple browser application in Swing.  The majority of the main frame is a JEditorPane for rendering HTML.  If I do not set a preferred size for this component (or the containing frame) and I call pack() the frame is likely to be rendered as small as possible, rather than with sensible dimensions.

A: JComponents doesn't returns getSize, getLocation, getBounds or getXxxSize if a JComponents hasn't been previously visible on the screen or after call pack()
but why care about that, because usage of (proper and correct) LayoutManager can do that automatically, that reason why LayoutManager exist there, really why care about that

A: Just call getPreferredSize method for JLabel.No matter if container of it is not realized, preferred size changes if you are setting text of jlabel even before you set it visible.


text:
Q: How to make map tiles load more efficiently using leaflet with an android app? I am currently developing an android application that features a map using phonegap, cloudmade and leaflet. Is there a way I can somehow cache the map tiles on the android phone? Loading the map tiles from the server each time is quite slow.

A: This is only theoretic considerations and I don't known working implementations for leaflet. However I have some issue, but don't have time now to resolve it.
Web and phonegap storages:

*

*loacalstorage - synchronous, easy to implement with base64 url, small size 2.5-5MB (probably phonegap resolve localstorage small size issue).

*indexed db and web sql - asynchronous, size 50 MB (maybe more).

*phonegap file storage - asynchronous.

How implement:
Write own layer which will work with your storage, probably it will be difficult for asynchronous APIs.
You always can store tile as data url with base64 encoding. You can transform image by server url to data url with JS and canvas.
If you can use tile preloading easiest way to use file storage, because you can just use links to tiles on your file system.
For asychronous APIs you always can detect your tile by zoom, latitude and longitude: insert fake tile with zoom_lat_lng id and fake src, check tile in storage by this id, if tile found - load it, else load from server with caching.
UPD: See my caching solution with indexed db and web sql for example:
https://github.com/tbicr/OfflineMap/tree/master/leaflet_idb_sql_site and example http://tbicr.github.com/OfflineMap/leaflet/index.html (now not fast on android).


text:
Q: React-native-sound: setSpeakerphoneOn doesn't work I looked up documentation for setSpeakerphoneOn at https://github.com/zmxv/react-native-sound/wiki/API, where it states that you just need to pass a boolean value into it. What I'm trying to achieve is to have a toggle button for switching on and off setSpeakerphoneOn for voicemail files.
Here's the snippet of my code:
...
  play = async () => {
    if (this.sound) {
      this.sound.play(this.playComplete)
      this.setState({playState: 'playing'})
    } else {
      const { id, userCredential, contentUrl } = this.props
      const voiceMailURL = `${contentUrl}/content/voicemail/get?msgId=${id}&token=${userCredential.access_token}`
      this.sound = new Sound(voiceMailURL, '', (error) => {
        if (error) {
          Alert.alert('Notice', 'audio file error. (Error code : 1)')
          this.setState({playState: 'paused'})
        } else {
          this.setState({playState: 'playing', duration: this.sound.getDuration()})
          this.state.useEarPiece ? this.sound.setSpeakerphoneOn(true) : this.sound.setSpeakerphoneOn(true)
          this.sound.play(this.playComplete)
        }
      })
    }
  }
  playComplete = (success) => {
    if (this.sound) {
      if (success) {
      } else {
        Alert.alert('Notice', 'audio file error. (Error code : 2)')
      }
      this.setState({playState: 'paused', playSeconds: 0})
      this.sound.setCurrentTime(0)
    }
  }
 toggleUseEarPiece = () => {
    this.setState({
      useEarPiece: !this.state.useEarPiece
    })
  }
render () {
...
  <View style={{flexDirection: 'row', justifyContent: 'center'}}>
                        {this.state.playState === 'playing' &&
                        <TouchableOpacity style={{marginHorizontal: 20}} onPress={this.pause}>
                          <Icon color='#000' name='ios-pause' size={20} type='ionicon' />
                        </TouchableOpacity>}
                        {this.state.playState === 'paused' &&
                        <TouchableOpacity style={{marginHorizontal: 20}} onPress={this.play}>
                          <Icon color='#000' name='md-play' size={20} type='ionicon' />
                        </TouchableOpacity>}
                      </View>
...
<TouchableOpacity onPress={this.toggleUseEarPiece}>{speaker}</TouchableOpacity>
}

A: You're going to giggle, but this line in your code may be at fault:
this.state.useEarPiece ? this.sound.setSpeakerphoneOn(true) : this.sound.setSpeakerphoneOn(true);


text:
Q: Why is my function call not working? <script type="text/javascript">
    function CustomAlert() {
        this.render = function() {
            var winW = window.innerWidth;
            var winH = window.innerHeight;
            var dialogOverlay = document.getElementById('dialogOverlay');
            var dialogbox = document.getElementById('dialogbox');

            dialogOverlay.style.display = "block !important ";
            dialogOverlay.style.height = winH+"px !important ";
            dialogbox.style.left = (winW/2) - (550 * .5) + "px !important ";
            dialogbox.style.top = "100px !important ";
            dialogbox.style.display = "block !important";
        }

        this.ok = function () {
        }
    }

    function HighScore( arg )
    {
        CustomAlert().render();
    }
</script>

Why is it telling me that CustomAlert is undefined? I also attempted to assign CustomAlert() to a var but then the console tells me that the var is now undefined.

A: When called as a normal function (CustomAlert()) your function doesn't return anything. However, you can invoke it as constructor function (new CustomAlert()), by using the new operator when calling your function. This will cause the this within the function to refer to the newly created object instance and automatically use that instance as the return value:
function HighScore( arg )
{
    new CustomAlert().render();
}

An alternative (but certainly not equivalent) solution is to return a new object directly from CustomAlert:
function CustomAlert() {
    var obj = {
        render: function () {
            ...
        },
        ok: function () {
            ...
        }
    };

    return obj;
}

And now you can call it as you would a normal function:
function HighScore( arg )
{
    CustomAlert().render();
}

A:
Why is it telling me that CustomAlert is undefined? I also attempted
  to assign CustomAlert() to a var but then the consol tells me that the
  var is now undefined??

Because you should create an object of this
var customerAlert = new CustomAlert();

and then call the render method of it.
Or in one statement:
function HighScore( arg )
{
    new CustomAlert().render();
}

This is called the Constructor Invocation Pattern.
Actually in JavaScript functions can be invoked with one of the following ways:

*

*The method invocation pattern

*The function invocation pattern

*The constructor invocation pattern

*The apply invocation pattern

Method Invocation pattern
This method of invocation is used when the function is stored as a property of an object. Hence we call this function a method, like in other object oriented languages. When we call the function this is bound to the that object. For instance:
var app = {
    render: function() {
                var winW = window.innerWidth;
                var winH = window.innerHeight;
                var dialogOverlay = document.getElementById('dialogOverlay');
                var dialogbox = document.getElementById('dialogbox');

                dialogOverlay.style.display = "block !important ";
                dialogOverlay.style.height = winH+"px !important ";
                dialogbox.style.left = (winW/2) - (550 * .5) + "px !important ";
                dialogbox.style.top = "100px !important ";
                dialogbox.style.display = "block !important";
        }
        ok : function () {

        }
};

In this case we would call the render method as below:
app.render();

Function Invocation Pattern
This is the case where the function is not the property of an object. In this case the function is bound to the global object -which usually is the window object in web applications-.
var render = function(){
    var winW = window.innerWidth;
                var winH = window.innerHeight;
                var dialogOverlay = document.getElementById('dialogOverlay');
                var dialogbox = document.getElementById('dialogbox');

                dialogOverlay.style.display = "block !important ";
                dialogOverlay.style.height = winH+"px !important ";
                dialogbox.style.left = (winW/2) - (550 * .5) + "px !important ";
                dialogbox.style.top = "100px !important ";
                dialogbox.style.display = "block !important";
};

Then we just call it as below:
render();

Constructor Invocation Pattern
This is the case where we invoke a function with the new prefix. In this case a new object will be created. It is a good way to create object with the same properties. These functions are called constructors and by convention their names starts with a capital letter.
Apply Invocation Pattern
The apply method give us the opportunity to construt an array of arguments that will be used for the invocation of the function. Furthermore, it give us the ability to choose the value of this.
For more information on the above, please refer to JavaScript: The Good Parts


text:
Q: Comparing data in a CSV in python I am using python 2.7 to clean some data from a CSV file before chucking it into a MySQL database.
Each row is a user entry with a timestamp.
Before I send the data to the db, I want to check the CSV for duplicate rows (two rows with the same username), and then use the timers (on the same rows) to check which one to keep.
# set up data container
data = []

# read csv file
with open(file, 'rU') as f:
    # create file reader
    reader = csv.reader(f)

    # skip first row (headers)
    next(reader)

    # gather data in a table
    for row in reader:
        data.append(row)

I think I am getting confused with comparing items in a 2d array... I know that the usernames are in data[][1] and the timer (int) is in data[][52].
I tried to create a new list like this:
usernames = []
cleaner_list = data
for row in data:
    if row[1] is in usernames:
         # dupe
    else:
        usernames.append(row[2])

But I keep going out of range when trying to compare the data such as like this:
if row[1] is in usernames:
      if row[52] > usernames[row[2]][52]:
            # delete row[52] from cleaner_data
      else:
            # delete the equivalent row in usernames from cleaner_data

I feel that I am overthinking this but I can't use a set as I need the data to stay in line. I thought about creating some sort of enum list of the unique usernames and filter the CSV column with that, but I wouldn't know how to keep the correct references to the row when I find a duplicate and need to check its timer before deleting it.
Any help would be really appreciated!

A: I'd do the following:
Keep a dictionary of users with associated last timestamps. If you find something newer while scanning the CSV, replace the old value.
cleaner_data = {}
for row in data:
  if row[1] not in cleaner_data:    # user name not yet seen: add
    cleaner_data[row[1]] = row
  else:
    if row[52] > cleaner_data[row[1]][52]:    # already seen, but newer timestamp: replace
      cleaner_data[row[1]] = row


text:
Q: Is this document using laplace transforms incorrectly? (in particular, laplace transform of 1/r) http://folk.uio.no/helgaker/talks/SostrupIntegrals_10.pdf
If you look at page 16/34, you can see this bit:
$
\frac{1}{r_c} = \frac{1}{\sqrt{\pi}} \int_{-\infty}^{\infty} \exp{(-r_c^2 t^2 )dt}
$
The page notes that it is a laplace transform. However, I always thought the laplace transform of 1/r doesn't exist, for reasons that are explaind well here:
Laplace transform of $1/t$
I am wondering how they came up with the above formula. I tried plugging the integral into mathematica to see what popped out, and the result was:
$
\frac{1}{\sqrt{r_c^2}}
$
aka just 1/r. I suppose it formats it in that way to force the sign?
I also found another document (which is also talking about the same thing; molecular integrals) which has a similar expression which it describes at a laplace transform, which evaluates the same in mathematica:
$
\frac{1}{r_c} = \frac{1}{\sqrt{\pi}} \int_{0}^{\infty} \exp{(-sr_c^2 )s^\frac{-1}{2}ds}
$
Note that in the context of these two documents, rc is shorthand for:
$
r_c = \sqrt{(x_c^2 + y_c^2 + z_c^2)}
$
where xc, etc are themselves shorthand for:
$
xc = (x-c_x)
$
Where $ c_x $ is the x coordinate of atom c, etc.
Maybe that's why the transform exists, because it's actually 3 dimensional...? I'm sure the transform (from both documents) are correct, as I have played around with them a bit, but I still don't understand where they came from.
The motivation for these transforms is to be able to evaluate the following types of integrals:
$
\int_{-\infty}^{\infty} dr \frac{\exp{(-\gamma r_c^2)}}{r_c}
$
r again being shorthand as above, and dr meaning dxdydz

A:
I am uncertain as to the specific question in the OP.  It seems that the request is to show the rationale for calling the integral $\frac1{\sqrt \pi}\int_{-\infty}^\infty e^{-r_c^2t^2}\,dt$ a Laplace Transform.  It is to that end that we now proceed.

First, exploiting even symmetry reveals
$$\frac1{\sqrt \pi}\int_{-\infty}^\infty e^{-r_c^2t^2}\,dt=\frac{2}{\sqrt \pi}\int_{0}^\infty e^{-r_c^2t^2}\,dt$$
Then, letting $t=\frac{\sqrt{u}}{r_c}$, we obtain
$$\frac1{\sqrt \pi}\int_{0}^\infty e^{-r_c^2t^2}\,dt=\frac{1}{r_c\sqrt \pi}\int_{0}^\infty u^{-1/2}e^{-u}\,dt \tag 1$$
is in the form of a Laplace Transform of $u^{-1/2}$ evaluated at $s=1$.

Note that nowhere is there the claim that the result is the Laplace Transform of $\frac1{r_c}$ or the inverse Laplace Transform of $\frac{1}{r_c}$. In fact, $(1)$ has the explicit appearance of $1/r_c$.  Hence, given that the expression in $(1)$ is equal to $1/r_c$, we find that
$$\int_0^\infty u^{-1/2}e^{-u}\,du=\sqrt \pi$$

The authors motivation for using the representation $\frac1{r_c}=\frac1{\sqrt{\pi}}\int_{-\infty}^\infty e^{-r_c^2t^2}\,dt$ is to work with a $4$-dimensional integral with $r_c$ appearing as part of the argument in an exponential term rather than work with the $3$-dimensional integral with the appearance of $\frac1{r_c}$.

A: Using symmetry, the right side of the first equation is
$$ \frac{2}{\sqrt{\pi}} \int_0^\infty \exp(-r_c^2 t^2)\; dt$$
The change of variables $t = \sqrt{u}$ makes this into
$$ \frac{1}{\sqrt{\pi}} \int_0^\infty \frac{\exp(-r_c^2 u)}{\sqrt{u}}\; du $$
which is essentially the Laplace transform of $1/\sqrt{u}$ at $r_c^2$.  This one does exist, because $1/\sqrt{u}$ is integrable at $0$.
The value is indeed $1/\sqrt{r^2} = 1/|r|$, assuming $r$ is real.
Actually, this is slightly backwards.  To do this Laplace transform we need to know that $\Gamma(1/2) = \sqrt{\pi}$, and the usual way to show $\Gamma(1/2) = \sqrt{\pi}$ is to reverse the change of variables and apply the well-known fact that $$\int_{-\infty}^\infty \exp(-t^2)\; dt = \sqrt{\pi}$$


text:
Q: Preventing ed CSS file blocking downloads in Internet Explorer 7 Internet Explorer 7 (but not 8/9) blocks anything downloading until the CSS file has finished on our site.
We are not using Internet Explorer tests around it <!--[if IE ]><![endif]-->, nor are we using protocol independent URI's (// instead of http://). It is just a straight forward /css/global/core.css link and yet the browser waits until it has finished downloading before commencing.
Are there any techniques to prevent this behaviour?
PS: All the JavaScript is at the bottom, all the static content is hosted on another domain (except the CSS due to it being able to reuse the existing connection after the HTML document, resulting in a faster experience for the user even with additional cookie headers).
EDIT:
The problem is that profiling IE7 with DynaTrace causes CSS files to block further downloads, however with DynaTrace turned off it works. So this is a DynaTrace bug, not an IE7 one.
WITH DynaTrace:

WITHOUT DynaTrace:

A: Perhaps you hitting the limit for the number of parallel downloads per domain?
I believe IE7's default is 2 files per domain , whereas many newer browsers support 6 by default.
http://www.stevesouders.com/blog/2009/05/12/sharding-dominant-domains/


text:
Q: How to Disable Window "Show" Animation? Whenever a window is shown in Windows, it has a quick display animation that scales/fades it in. Is there anyway method to skip that animation and make it appear immediately? I've managed to do it a couple ways, but they all involve removing the WS_THICCFRAME that I want to maintain.
Is there an event I could cancel or override? Any functions I could use?

A: DwmSetWindowAttribute, with DWMWA_TRANSITIONS_FORCEDISABLED, will disable window's animimation:
BOOL attrib = TRUE;
DwmSetWindowAttribute(m_hWnd, DWMWA_TRANSITIONS_FORCEDISABLED, &attrib, sizeof(attrib));

Side note,
When animation is disabled, and you minimize/restore the window, the transition will look a little odd.
Personally I prefer to show some windows without animation, then restore default behavior after the window is shown (call DwmSetWindowAttribute again with attrib = FALSE;)


text:
Q: How do you pronounce this possessive - Trask's?
Trask's life

How do you pronounce Trask's?

A: You pronounce it in the same way in which you pronounce any noun ending in -sk in the plural: disks, tasks, desks; or any verb ending in -sk in the present simple third person singular: asks. There is no exception of a rule here, it follows the rule and you simply say an additional /s/ sound after the name.


text:
Q: How do I make a future call out with data from the response of a future callout I have a schedulable class that makes a series of callouts to an external email service. I want to take info from the first call out and make another. This code below is part of the SendGridApi Class that is called from the mailScheduler class. I getting an error about future callout from future callout. How should I avoid these issues?
   // check if test is running
   if (!Test.isRunningTest()) {
        res = h.send(req);
        // if status = 201 and the endpoint was used to make a campaign
        if (res.getStatusCode() == 201 && endpoint == '/v3/campaigns') {

            response = res.getBody();

            // deserialize res.body into map
            Map<String, object> results = (Map<String, object>) JSON.deserializeUntyped(res.getBody());

            //get sender id from response
            object idstring = results.get('sender_id');
            integer senderid = integer.valueOf(idstring);

            //get campaign id from response to schedule it later.
            object campaignstring = results.get('id');

            string endpoint2= '/v3/campaigns/' + campaignstring + '/schedules';

            DateTime myDateTime = datetime.now(); // get current time

            myDateTime= myDateTime.addHours(12); // add 12 hours

            long longtime= myDateTime.getTime(); //get epoch time code in miliseconds

            long shorttime= longtime/1000; // convert time to seconds

            Map<String, Object> mapped = new Map<String, Object>{'send_at'=> shorttime};

            mailScheduler.sendit(JSON.serialize(mapped), endpoint2, 'POST');
            }

Here is the mailScheduler class.
global class mailScheduler {

public static void sendIt(string jsonbody, string endpoint, string httpmethod){

        if (!Test.isRunningTest()) {
        SendGridAPI.sendRequest(JSONbody, endpoint, httpMethod);
        }

  }
}

Here is the solution that worked for me.
 // check if test is running
   if (!Test.isRunningTest()) {
        res = h.send(req);
        // if status = 201 and the endpoint was used to make a campaign
        if (res.getStatusCode() == 201 && endpoint == '/v3/campaigns') {

            response = res.getBody();

            // deserialize res.body into map
            Map<String, object> results = (Map<String, object>) JSON.deserializeUntyped(res.getBody());

            //get sender id from response
            object idstring = results.get('sender_id');
            integer senderid = integer.valueOf(idstring);

            //get campaign id from response to schedule it later.
            object campaignstring = results.get('id');

            string endpoint2= '/v3/campaigns/' + campaignstring + '/schedules';

            DateTime myDateTime = datetime.now(); // get current time

            myDateTime= myDateTime.addHours(12); // add 12 hours

            long longtime= myDateTime.getTime(); //get epoch time code in miliseconds

            long shorttime= longtime/1000; // convert time to seconds

            Map<String, Object> mapped = new Map<String, Object>{'send_at'=> shorttime};

            //Instantiate an httpRequest and set the required attributes
            httpRequest req2 = new httpRequest();

            req2.setMethod('POST');
            req2.setEndpoint(endpointBase + endpoint2);
            system.debug('^e^n^d^POINT2^ '+endpointBase + endpoint2);

            // format headers
            req2.setHeader('Authorization', keyBearer);
            req2.setHeader('content-type', 'application/json');

            // set json body from
            req2.setBody(json.serialize(mapped));

            // prepart to send request
            httpresponse res2 = new httpresponse();
            Http h2 = new Http();
            res2 = h.send(req2);

              }

A: As you found, you can't chain future method calls together. I.e. a future method can't invoke another future method.
Assuming all the code is under your control you can just wrap in a System.isFuture() check. If it is already in a future context call a variation of the method in question that doesn't have the @future annotation.
That should serve for the majority of scenarios. If you still need to split out to another asynchronous methods have a look at Queueable Apex.

As an aside, see if you can get this out of your code.
if (!Test.isRunningTest()) {
    // lots of code here.
}

That's likely to come back to bite you sooner or later. A mock response should make this code testable.


text:
Q: Why is the first group of text not aligned with the others? I'm trying align each group of text in the middle, while keeping the text left-aligned.
The first group of text is not aligned with the others for some reason. I'm wondering what's the best approach to fix this problem. I know I can make a hacky fix by doing something like margin-left: -2rem on the first group of text.
What would be the best approach to center each group of text in the middle while having a left text alignment?

* {
  margin: 0;
  padding: 0;
}

section {
  display: flex;
  flex-direction: column;
}

h1 {
  text-align: center;
  margin-bottom: 2rem;
}

div {
  margin-right: auto;
  margin-left: auto;
  margin-bottom: 2rem;
}

Locations

Corporate

17170 Loriot Rd
      Gainesville State, PA 99999

    (999) 999-9999

Alabama

9999 Street Name
      City, State 99999

    (999) 999-9999

Nashville

9999 Street Name
      City, State 99999

    (999) 999-9999

Birmingham

9999 Street Name
      City, State 99999

    (999) 999-9999

Texas

9999 Street Name
      City, State 99999

    (999) 999-9999

A: Its actually doing its job correctly. Its finding the center perfectly. it just so happens that the first one has a longer paragraph than the rest, so it adjusts accordingly.
If you gave the others the same baton rouge address, they will all fall in line.
add a big div around them and text-align: left;

Locations

Corporate

17170 Loriot Rd
      Gainesville State, PA 99999

    (999) 999-9999

Alabama

9999 Street Name
      City, State 99999

    (999) 999-9999

Nashville

9999 Street Name
      City, State 99999

    (999) 999-9999

Birmingham

9999 Street Name
      City, State 99999

    (999) 999-9999

Texas

9999 Street Name
      City, State 99999

    (999) 999-9999

* {
  margin: 0;
  padding: 0;
}

section {
  display: flex;
  flex-direction: column;
}

h1 {
  text-align: center;
  margin-bottom: 2rem;
}

div {
  text-align: left;
  margin-right: auto;
  margin-left: auto;
  margin-bottom: 2rem;
}

*edit - added code

A: For blocks, you must specify the same width, then they are automatically aligned

* {
  margin: 0;
  padding: 0;
}

section {
  display: flex;
  flex-direction: column;
}

section > div {
  width: 300px;
}

h1 {
  text-align: center;
  margin-bottom: 2rem;
}

div {
  margin-right: auto;
  margin-left: auto;
  margin-bottom: 2rem;
}

Locations

Corporate

17170 Loriot Rd
      Gainesville State, PA 99999

    (999) 999-9999

Alabama

9999 Street Name
      City, State 99999

    (999) 999-9999

Nashville

9999 Street Name
      City, State 99999

    (999) 999-9999

Birmingham

9999 Street Name
      City, State 99999

    (999) 999-9999

Texas

9999 Street Name
      City, State 99999

    (999) 999-9999

A: You just need a fixed width on the div

* {
  margin: 0;
  padding: 0;
}

section {
  display: flex;
  flex-direction: column;
}

section div {
 width: 300px;
}

h1 {
  text-align: center;
  margin-bottom: 2rem;
}

div {
  margin-right: auto;
  margin-left: auto;
  margin-bottom: 2rem;
}

Locations

Corporate

17170 Perkins Rd
      Baton Rouge, LA 70810

    (225) 281-4202

Alabama

9999 Street Name
      City, State 99999

    (999) 999-9999

Nashville

9999 Street Name
      City, State 99999

    (999) 999-9999

Birmingham

9999 Street Name
      City, State 99999

    (999) 999-9999

Texas

9999 Street Name
      City, State 99999

    (999) 999-9999

A: Assign the width to the div tag since you need it for center use % than px:
Play around with fiddle

* {
  margin: 0;
  padding: 0;
}

section {
  display: flex;
  flex-direction: column;
}

section>div{
width:50%;
}
h1 {
  text-align: center;
  margin-bottom: 2rem;
}

div {
  margin-right: auto;
  margin-left: auto;
  margin-bottom: 2rem;
  border:1px solid black;
}

Locations

Corporate

17170 Perkins Rd
      Baton Rouge, LA 70810 , LA 70810

    (225) 281-4202

Alabama

9999 Street Name
      City, State 99999

    (999) 999-9999

Nashville

9999 Street Name
      City, State 99999

    (999) 999-9999

Birmingham

9999 Street Name
      City, State 99999

    (999) 999-9999

Texas

9999 Street Name
      City, State 99999

    (999) 999-9999

A: You can change it up a bit to have it fully on flexbox and also the divs need to have the same width if you don't want any being wider.
* {
  margin: 0;
  padding: 0;
}

section {
  display: flex;
  align-items: center;
  flex-direction: column;
}

h1 {
  text-align: center;
  margin-bottom: 2rem;
}

div {
  margin-bottom: 2rem;
}


text:
Q: I don't understand a step in the proof of Euler's Theorem, please explain I am trying to learn the proof for Euler's theorem which states:

If $\gcd(a,m)=1$ then $a^{\phi(m)} \equiv 1 \mod m$.

The proof goes like this. Take the reduced residue system modulo $m$. $ar_1,...,ar_k$ is also a reduced residue system modulo $m$ (the text proves this lemma) then they state that,
$$r_1 r_2...r_k \equiv a r_1 a r_2... a r_k \mod m$$
Where $k=\phi(m)$. I don't understand this step, please explain.

A: The function multiply-by-$a$-mod $m$ is a bijection, ie. a permutation on the set $\{r_1,r_2,\ldots, r_k\}$. SO the product on either sides in your question are equal mod m.  To check it is a bijection suffices to check it is one-one.
Suppose $ar_i\equiv ar_j \pmod m$. This shows $m$ divides $a(r_i-r_j)$. But as $\gcd(a,m)=1$ it follows that $r_i-r_j$ must be a multiple of $m$. As all the $r_i$'s are less than $m$ this is possible only when the difference is zero, hence $r_i=r_j$. QED

A: A reduced residue system mod $m$ consists of those congruence classes that are relatively prime to $m$. Stated differently, we say that $r_1, \ldots, r_k$ is a reduced residue system mod $m$ if it is a reordering of every number (mod $m$) from $1$ to $m-1$ that is relatively prime to $m$.
So the two lists of numbers $r_1, r_2, \ldots, r_k$ and $ar_1, ar_2, \ldots, ar_k$ are the same lists of numbers (mod $m$, that is). Therefore multiplying them together mod $m$ must give the same product, which is the step you are asking about.
Let's do an example. Suppose we're interested in showing $2^6 \equiv 1 \pmod 9$. Then a reduced residue system mod $9$ is $$1,2,4,5,7,8.$$
What happens when we multiply each of these by $2$? At first, we get
$$ 2,4,8,10,14,16,$$
and after reducing mod $9$ we get
$$ 2,4,8,1,5,7.$$
Notice that this is exactly the same as the first list, but in a different order.
Since these are the same lists, their products must be equal. Here, that means that
$$ 1\cdot 2 \cdot 4 \cdot 5 \cdot 7 \cdot 8 \equiv 2 \cdot 4 \cdot 8 \cdot 10 \cdot 14 \cdot 16 \equiv 2^6 \cdot 1 \cdot 2 \cdot 4 \cdot 5 \cdot 7 \cdot 8 \pmod 9.$$
After multiplying by the modular inverse of $1 \cdot 2 \cdot 4 \cdot 5 \cdot 7 \cdot 8$, we see that
$$ 2^6 \equiv 1 \pmod 9.$$
Do you see how it works now?


text:
Q: How to Split one column in Excel into multiple columns of 55 rows I have a movie list with over 1500 entries (A1-A1500), all alphabetized (Thanks to Excel) and I would like to split that into multiple columns of 55 rows each on a separate sheet if possible.  So A1-A55 from Sheet1 would go to A1-A55 on Sheet2, and A56-A110 would go to B1-B55 on Sheet2, so on and so on.
Each cell is an individual movie name and I would just like them to go from one long column to multiple columns with 55 rows in each.

A: If your data are on Sheet1, then fill in Sheet2!A1 with
=INDIRECT("Sheet1!R" & (COLUMN()-1)*55+MOD(ROW()-1,55)+1 & "C1", FALSE)

Drag/fill this down to row 55 and out to column AB.  The first parameter of INDIRECT is a constructed string of the form Sheet1!RnnnC1, with A1 evaluating to Sheet1!R1C1, A55 –> Sheet1!R55C1, B1  –> Sheet1!R56C1, etc…
AB15 evaluates to Sheet1!R1500C1.
INDIRECT(reference, FALSE) retrieves the value from the cell referenced by reference using "R1C1" style, in which a row number and a column number are specified –– and of course these correspond to A1:A1500 on Sheet1.
This will cause your data to appear in columns of 55 rows on Sheet2; it will still be linked to Sheet1.  To make a static copy, "Copy" the data (A1:AB55 on Sheet2) and do "Paste Values".  (To be safe, you might want to do this on Sheet3, then delete Sheet2.)

A: If your data is comma (,) delimited then select the rows first then goto Data -> Text to column -> Click on Delimited radio button and click next -> Now choose Delimiters (if it is comma delimited the click on comma check box) and click next and finally Finish button and see the result.


text:
Q: How to get all browser's installed on a machine with its install location and browser version (including Chrome dev, canary..etc) using cmd Hello i am developing a application using selenium and python 3.7 to automatically update the browser driver by getting old version and new version from browser's website and i want this for other chrome builds also like canary etc... i am new to command-line and registry so i am unable to figure it out.
i have also tried this code :-
@echo off
setlocal enableExtensions

echo.
echo.
echo INSTALLED BROWSERS
echo.
echo.

rem :::::::::::::::::::::::::::::::::::::::::::::::::::::
rem :: exporting registry values for installed browsers
rem :::::::::::::::::::::::::::::::::::::::::::::::::::::

rem for 64 bit systems
START /W REGEDIT /E "%Temp%\BROW3.reg" HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Clients\StartMenuInternet
rem for 32 bit systems
if not exist "%Temp%\BROW3.reg" START /W REGEDIT /E "%Temp%\BROW3.reg" HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet

setLocal enableDelayedExpansion
for /f "tokens=*" %%B in ('type "%Temp%\BROW3.reg" ^| findstr /E "DefaultIcon]"') do (
  rem extracting browser name from icon path
  set "browser=%%B"
  rem removing \DefaultIcon] string
  set "browser=!browser:\DefaultIcon]=!"
  rem get the browser name
  for %%P in ("!browser!") do echo %%~nP
)
endLocal

echo.
echo.
echo EXECUTABLES PATHS
echo.
echo.

setLocal enableDelayedExpansion
for /f "tokens=* delims=@=" %%B in ('type "%Temp%\BROW3.reg" ^| findstr /B "@" ^| findstr /E ".exe\\\",0\"^"') do (
  set "browser=%%~B"
  set "browser=!browser:\\=\!"
  echo !browser!

)
setLocal enableDelayedExpansion
for /f "tokens=* delims=@=" %%B in ('type "%Temp%\BROW3.reg" ^| findstr /B "@" ^| findstr /E ".exe,0\"^"') do (
  set "browser=%%~B"
  set "browser=!browser:\\=\!"
  set "browser=!browser:,0=!"
  echo !browser!

)
endLocal

rem delete temp file
del /Q /F "%Temp%\BROW3.reg"

echo.
echo.
echo DEFAULT BROWSER
echo.
echo.

START /W REGEDIT /E "%Temp%\BROW5.reg" HKEY_CLASSES_ROOT\http\shell\open\command
setLocal enableDelayedExpansion
for /f tokens^=3^ delims^=^" %%B in ('type "%Temp%\BROW5.reg" ^| find "@"') do (
    set "default=%%B"
    rem removing double slashes
    set "default=!default:\\=\!"
    rem removing end slash
    set "default=!default:~0,-1!"
    rem get the name
    for %%D in ("!default!") do echo %%~nD
)
endLocal
del /Q /F "%Temp%\BROW5.reg"

echo.
echo.
echo DEFAULT .HTML VIEWER
echo.
echo.

START /W REGEDIT /E "%Temp%\BROW6.reg" HKEY_CLASSES_ROOT\htmlfile\shell\open\command
setLocal enableDelayedExpansion
for /f tokens^=3^ delims^=^" %%B in ('type "%Temp%\BROW6.reg" ^| find "@"') do (
    set "default=%%B"
    set "default=!default:\\=\!"
    set "default=!default:~0,-1!"
    for %%D in ("!default!") do echo %%~nD
)
endLocal
del /Q /F "%Temp%\BROW6.reg"
echo.
echo.
pause

Output:-
But does not show location for chrome dev
INSTALLED BROWSERS

Firefox-308046B0AF4A39CB
Google Chrome
Google Chrome Dev
IEXPLORE
Microsoft Edge

EXECUTABLES PATHS

C:\Program Files\Internet Explorer\iexplore.exe
C:\Program Files\Mozilla Firefox\firefox.exe
C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe

DEFAULT BROWSER
iexplore

DEFAULT .HTML VIEWER
iexplore

Press any key to continue . . .

A: @echo off
setlocal enableExtensions

echo.
echo.
echo INSTALLED BROWSERS
echo.
echo.

rem :::::::::::::::::::::::::::::::::::::::::::::::::::::
rem :: exporting registry values for installed browsers
rem :::::::::::::::::::::::::::::::::::::::::::::::::::::

rem for 64 bit systems
START /W REGEDIT /E "%Temp%\BROW3.reg" HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Clients\StartMenuInternet
rem for 32 bit systems
if not exist "%Temp%\BROW3.reg" START /W REGEDIT /E "%Temp%\BROW3.reg" HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet

setLocal enableDelayedExpansion
for /f "tokens=*" %%B in ('type "%Temp%\BROW3.reg" ^| findstr /E "DefaultIcon]"') do (
  rem extracting browser name from icon path
  set "browser=%%B"
  rem removing \DefaultIcon] string
  set "browser=!browser:\DefaultIcon]=!"
  rem get the browser name
  for %%P in ("!browser!") do echo %%~nP
)
endLocal

echo.
echo.
echo EXECUTABLES PATHS
echo.
echo.

setLocal enableDelayedExpansion
for /f "tokens=* delims=@=" %%B in ('type "%Temp%\BROW3.reg" ^| findstr /B "@" ^| findstr /E ".exe\\\",0\"^"') do (
  set "browser=%%~fB"
  set "browser=!browser:\\=\!"
  echo !browser!

)
setLocal enableDelayedExpansion
for /f "tokens=* delims=@=" %%B in ('type "%Temp%\BROW3.reg" ^| findstr /B "@" ^| findstr /E ".exe,0\"^"') do (
  set "browser=%%~fB"
  set "browser=!browser:\\=\!"
  set "browser=!browser:,0=!"
  echo !browser!

)
endLocal

rem delete temp file
del /Q /F "%Temp%\BROW3.reg"

echo.
echo.
echo DEFAULT BROWSER
echo.
echo.

START /W REGEDIT /E "%Temp%\BROW5.reg" HKEY_CLASSES_ROOT\http\shell\open\command
setLocal enableDelayedExpansion
for /f tokens^=3^ delims^=^" %%B in ('type "%Temp%\BROW5.reg" ^| find "@"') do (
    set "default=%%B"
    rem removing double slashes
    set "default=!default:\\=\!"
    rem removing end slash
    set "default=!default:~0,-1!"
    rem get the name
    for %%D in ("!default!") do echo %%~nD
)
endLocal
del /Q /F "%Temp%\BROW5.reg"

echo.
echo.
echo DEFAULT .HTML VIEWER
echo.
echo.

START /W REGEDIT /E "%Temp%\BROW6.reg" HKEY_CLASSES_ROOT\htmlfile\shell\open\command
setLocal enableDelayedExpansion
for /f tokens^=3^ delims^=^" %%B in ('type "%Temp%\BROW6.reg" ^| find "@"') do (
    set "default=%%B"
    set "default=!default:\\=\!"
    set "default=!default:~0,-1!"
    for %%D in ("!default!") do echo %%~nD
)
endLocal
del /Q /F "%Temp%\BROW6.reg"
echo.
echo.
pause

This should solve your issue with Chrome Dev, however, there are some errors with the DEFAULT BROWSER and DEFAULT HTML VIEWER sections of the file which I do not understand why it doesn't work. One thing that I noticed with my default html handler and browser, Brave, they create their own html tag Brave HTML Document which is separate to htmlfile in the registry and ftype command. ftype output for me shows Brave HTML file alone and iexplorer as my default html and https handler which both are incorrect. I don't know why this is and I want to know as well but since that is a different problem, you should ask a different question for it.

A: @echo off

echo:
echo INSTALLED BROWSERS
echo:

for /f "delims=" %%A in (
    'reg query HKLM\SOFTWARE\Clients\StartMenuInternet /k /f *'
) do (
    for /f "tokens=1,2,*" %%B in (
        '2^>nul reg query "%%~A\defaulticon" /ve ^| findstr /v "^HKEY"'
    ) do (
        echo "%%~nD"
    )
)

echo:
echo EXECUTABLES PATHS
echo:

for /f "delims=" %%A in (
    'reg query HKLM\SOFTWARE\Clients\StartMenuInternet /k /f *'
) do (
    for /f "tokens=1,2,*" %%B in (
        '2^>nul reg query "%%~A\shell\open\command" /ve ^| findstr /v "^HKEY"'
    ) do (
        echo "%%~D"
    )
)

echo:
echo DEFAULT BROWSER
echo:

for /f "tokens=1,2,*" %%A in (
    'reg query HKCR\http\shell\open\command /ve ^| findstr /v "^HKEY"'
) do (
    echo "%%~nC"
)

echo:
echo DEFAULT .HTML VIEWER
echo:

for /f "tokens=1,2,*" %%A in (
    'reg query HKCR\htmlfile\shell\open\command /ve ^| findstr /v "^HKEY"'
) do (
    echo "%%~nC"
)

echo:
pause

Can eliminate use of temporary files with reg query and avoid regedit which may require administrator privileges.
The output is double quoted though you can remove the quotes if desired.
No named variables are used so setlocal is not used.
I do not have Chrome Dev installed so testing if detected is unknown from my current environment so I will show the output I do get on Windows 7:

INSTALLED BROWSERS

"firefox"
"chrome"
"iexplore"

EXECUTABLES PATHS

"C:\Program Files\Mozilla Firefox\firefox.exe"
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
"C:\Program Files\Internet Explorer\iexplore.exe"

DEFAULT BROWSER

"iexplore"

DEFAULT .HTML VIEWER

"iexplore"

Press any key to continue . . .

If you want browser versions, this example for Firefox version may help guide the way:
for /f "tokens=1,2,*" %%A in (
    '2^>nul reg query "HKLM\SOFTWARE\Mozilla\Mozilla Firefox" /ve ^| findstr /v "^HKEY"'
) do (
    echo "%%~C"
)


text:
Q: is it possible to reverse engineer AOT angular build to source code in angular 6? I lost my source code due to HD crash :(
I do have my uploaded Build of angular 6 project.
Is there any way to reverse those bundles to my source code ?
Please suggest related algos or any tools for the same.
it would be really helpful for all devs like me who have lost their codes


text:
Q: ggplot2 - how to add a specific axis tick? Is there a way to add axis ticks discretely (i.e. just 1 at a time, not redefining the whole axis)? This would be very useful to dynamically show data without having to reconfigure the whole axis breaks every time.
I'm really hoping this can be done without grabbing the data from the grob! If not possible, I'd still appreciate a best practice on how to add specific ticks/numbers to an axis.

A: You can use the pretty function:
library(ggplot2)

extra_breaks <- c(6, 21)

breaks <- sort(c(extra_breaks, with(mtcars, pretty(range(mpg)))))

ggplot(mtcars, aes(x = cyl, y = mpg)) +
  geom_point() +
  scale_y_continuous(
    breaks = breaks,
    limits = range(breaks)
  )

Created on 2020-05-10 by the reprex package (v0.3.0)


text:
Q: Urbit error: Assertion '!"plan: no pier"' failed in vere/pier.c:2091 I downloaded urbit and am attempting to boot my ship for the first time. In following the instructions online, I ran the following command:
./urbit -w sampel-palnet -k path/to/my-planet.key
The script progressed until this line:
boot: downloading pill https://bootstrap.urbit.org/urbit-v0.10.4.pill
After some time, I received the error in the title of this question.
Does anyone know what the error means and what I can do to resolve it?

A: Have you tried checking this issue on Github. It's not exactly the same error as yours, but it's similar, so maybe it could be related.
Did you also check the Urbit Docs.
If none of this works I would recommend you create an issue in Urbit's Github page.


text:
Q: Rails production assets pre compile not working properly When I run assets:precompile on my server i can clearly see that my assets are getting precompiled, also files are being written to filesystem properly, but when I visit my application from browser I am getting not found error because asset file names that are being referenced in HTML are older ones.
I am absolutely clueless about how to debug this issue. Any kind of refrence/help will be highly appreciated

A: Based on OP's comments, the app is in production environment and as such, it needed to be restarted to force the app to reevaluate the asset hashes.


text:
Q: Question About two sided directional derivatives Question: Let $f:\mathbb{R}^{2}\rightarrow\mathbb{R}$ be defined by $f(0,0)=0$ and for $(x,y)\neq(0,0)$:
$f(x,y)=\frac{xy}{\sqrt{x^2+y^2}}$.
Show that the two-sided directional derivative of $f$ evaluated at $(x,y)=(0,0)$ exists in all directions $h\in\mathbb{R}^{2}$, but that $f$ is not differentiable at $(0,0)$.
I am unsure how to solve this problem. I believe I need to set up a limit as $h\to0$, but behind that I am stumped.

A: Use polar coordinates to write the function as
$$
f(r,\phi)=r\cos\phi\sin\phi=\frac12r\sin2\phi\;.
$$
Since $\sin(2(\phi+\pi))=\sin2\phi$, the angular factor is the same for opposite directions, so along any line through the origin the function behaves like an absolute value; e.g., on $(x,y)=(\lambda,\lambda)$ it takes the form $\frac1{\sqrt2}|\lambda|$. The absolute value function is not differentiable at $0$, so the two-sided directional derivatives don't exist.


text:
Q: What does the exclamation mark after a SASS import mean? For example, this is in the codebase I'm working in:
@import core/mixins/retina-sprites!
What does this mean?

A: That is not part of the core Sass syntax.  The only add-on I am aware of that uses that syntax is the import-once plugin:

@import "something";
@import "something!"; // this will be imported again.

The plugin prevents files from being imported more than once, but exclamation mark overrides this allowing you to import the file again.  This plugin used to be a stand alone extension, but is now bundled with Compass by default.


text:
Q: Using '@' in parameters names I know the usage of verbatim prefix to avoid having to escape special characters all the time. For example:
string s = @"c:\myPath";

However I just realized it is possible having something similar for parameters names. Example:
public void aMethod(int i, DateTime @date){

}

I wonder why is that syntax correct and in which case can this be useful..