text:
Q: Why is the comma splice an error? It's always drilled into us that we shouldn't use comma splices. They're bad, to be avoided and poor form.
But why? What makes the comma a faulty choice in something like this:

I never liked school, it was boring and repetitive most of the time.

It could be replaced with a semicolon, dash, period or colon and be "correct." Yet to a fair amount of people, the comma seems fine. If it weren't, it wouldn't be found so often in online forums, text messages, emails and so on.
What makes the comma between two sentences an error?

A: Is it more accurate to call punctuation rules 'traditions' or 'conventions'?
To my mind, the word "convention" refers to a shared practice that was adopted to serve some perceived practical purpose and that continues (at least arguably) to serve such a purpose today, whereas a "tradition" refers to a shared practice that need not have any other justification for its continuing existence that that we or our predecessors did it in the past.
I would use the term "convention" rather than "tradition" to describe usage rules such as the one against using a comma to separate independent clauses that are not connected by conjunctions. Likewise, putting a period rather than a comma at the end of a declarative sentence is a convention, and so is using single or double quotation marks rather than commas to indicate a "words used as word." It is certainly possible to replace all of the conventional punctuation marks in the paragraph I am now writing with commas—treating them as, in effect, a unitary way to convey the idea, "a punctuation mark of some kind goes here"—and still have a consistent graphical representation of a grammatical utterance. Looking at it, however, you can see why writers and readers might find conventions that entail the use of punctuation marks besides commas (in addition to the convention of using capitalization to indicate the beginning of a new sentence) for particular purposes to be quite valuable:

I would use the term, convention, rather than, tradition, to describe usage rules such as the one against using a comma to separate independent clauses that are not connected by conjunctions, likewise, putting a period rather than a comma at the end of a declarative sentence is a convention, and so is using single or double quotation marks rather than commas to indicate a, word used as word, it is certainly possible to replace all of the conventional punctuation marks in the paragraph I am now writing with commas, treating them as, in effect, a unitary way to convey the idea, a punctuation mark of some kind goes here, and still have a consistent graphical representation of a grammatical utterance, looking at it, however, you can see why writers and readers might find conventions that entail the use of punctuation marks besides commas, in addition to the convention of using capitalization to indicate the beginning of a new sentence, for particular purposes to be quite valuable,

The language is the same. All I've done is replace more-or-less standard conventions for using quotation marks, periods, dashes, parentheses, and sentence-case initial capping with comma-only punctuation and capping only of the pronoun I. Has the grammar changed? No—not if you accept the view that grammar is fundamentally an attribute of spoken language. Punctuation isn't spoken; it's added to the plain words of speech in writing to clarify the internal connections of certain words, phrases, and clauses. Consistent, conventional punctuation helps readers follow the flow of writing with a minimum of misreadings, false starts, and sheer bewilderment.
Because it is based on convention rather than on linguistic necessity, punctuation is sometimes treated as an arbitrary and artificial construct of ignorant or officious rule enforcers—"fake grammar," as it were. But in orthography, as in other spheres of human activity, convention is a powerful force for coherence and shared meaning.

What justification is there for the rule against comma splices?
Viewed in isolation, the convention against comma splices may seem unnecessary and ultimately unjustified. After all,

I never liked school, it was boring and repetitive most of the time.

isn't materially more difficult to parse than

I never liked school. It was boring and repetitive most of the time.

or

I never liked school; it was boring and repetitive most of the time.

But when the wording appears in a larger context, issues of interrupted narrative flow and misdirection become apparent. For example:

I know that some people have fond memories of spending most of their waking life in childhood attending school, they recall the joy of learning, the camaraderie with fellow students, and the opportunity to explore creative tasks, I never liked school, it was boring and repetitive most of the time.

The only unconventional aspect of this block of text is its rejection of the convention against comma splices. Three sentences become one; and because the text is punctuated as a single continuous sentence with two internal comma splices, the word they—which would start a new sentence if the text were punctuated conventionally—is not initial-capped. The comma splices damage the flow of the text and force readers to feel their way carefully through the text to make sure that they haven't run through an ambiguous stop sign and misread the sense of the clause that follows each comma.
The conventional rule against comma splices thus promotes a valuable purpose in limiting the province of things that a comma (which in any event may perform a multitude of functions in writing) can properly signal. By insisting that colons, semicolons,  and periods—but not commas—should play the role of indicating abrupt breaks in written text at the end of complete clauses, the convention frees readers from having to include "hard break signal" among the possible meanings of any particular comma they encounter.


text:
Q: Is there any significance to the file Code.gs? Best practices? Is the Code.gs file and/or filename special in any way? Is it expected to be used for any particular purposes, like initialization or UI setup or general utilities?

A: It's just the default name for the file whenever you create a new Script, you can rename it as you wish and create others with whichever name you choose. As Cooper said, however, keep in mind not having duplicate functions, since these are declared across files.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Allow user to click on a Button of the form when Application is in Pause/Sleep Mode in C# winform Application I am working on a C# winform application which continuously navigates some links in a webbrowser control and process the data of that webpage. I need to provide two buttons on the form for Pause and Resume.
On click of button the whole application should get pause processing and after that on click of Resume button it should start again.
So to pause the application, on click of Pause button I made thread to sleep for infinite time by following code.
private void Pause_Click(object sender, EventArgs e)
{
  System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);
}

But this piece of code unable the user to click on Resume Button on form to resume the application. Also I am not getting a perfect piece of code to resume the application on click of Resume Button.
Can Anyone get me the correct solution for this issue ?

A: Thread.Sleep method yields execution of code to process scheduler and doesn't get it back until specified time passes. Therefore you can't make sleeping thread wake itself up. You can't even make a working thread wake another sleeping thread (to my knowledge).
You need to accomplish your goal differently.

*

*Separate data processing code to separate, worker, method

*Run worker method in separate thread

*Share a state variable between UI and worker thread. This variable should pass signals on whether execution should be paused.

*From UI thread, set pause signals in shared variable as needed

*In processing loop, write handler code for stopping processing

I'll post some pseudo code below on how you should do this:
private bool _Paused = false;
private void OnPauseClick()
{
    _Paused = true;
}
private void OnResumeClick()
{
    _Paused = false;
}
private void OnRunClick()
{
    ThreadPool.QueueUserWorkItem(new WaitCallback(WorkerMethod));
}

private void WorkerMethod(object state)
{
    ...
    while (needToDoMoreWork)
    {
        // do some work here
        ...
        // if pause requested, wait to unpause
        while (_Paused)
        {
            // Sleep for a short time and check again if paused
            Thread.Sleep(100);
        }
    }
}

You'll need to fill in the blanks according to your business needs.

A: If you put your UI thread to indefinite sleep, you're going to kill your UI indefinitely. Don't do that.
Your application has some mechanism to know it's time to do its navigation and processing, probably a timer of some sort. If it's a timer, just stop it when you pause the application, and start it again when you resume. If it's some other mechanism, you need to stop it,too, but it's hard to tell you how without knowing what that mechanism is.


text:
Q: Ubuntu (LiveUSB, not hard install) "suddenly" won't boot from USB stick after Windows XP format I formatted because the Windows XP I was using wouldn't let me view the drive in the window without formatting first, so I just said what the heck.
Turns out, after using the Linux USB creator, placing the ISO on disc properly and booting, BIOS hangs; no bootloader, no startup, nothing.
Windows XP's formatting screwed something up with my USB's filesystem, and I'm uncertain of what to do.
Help?! My business depends on me using an OS, so prompt ideas are a must and very appreciated(no money).

A: Try formatting the USB stick with ubuntu's "disk utility". Then create a bootable again using start-up-disk-creator or universal USB installer.


text:
Q: How to use Aspectc++ with C++v11? I want to use the aspectc++ compiler for a C++11-project. I have read in the manual, that c++11 support will come with version 2. I thought that aspect weaving happens only on the code level, so why does it depend on the used C++ version? Why does aspectc++ care the source code when it just has to weave the aspects to generate a composed piece of code? Is there a way to use aspectc++ for C++11 source code? Or is there an alternative which can handle it?

A: This post is already a bit older, i know.
Nevertheless I'd like to answer the question why aspectC++ depends on the C++-version:
aspectC++ internally parses the code (amongst other things to identify the locations where to weave the code). Not all of this can be done by external parsers therefore it needs to understand the syntax basically itself.
Some new c++-constructions from C++11 like attributes ([[...]]) could not be handeled by the AspectC++-compiler version < 2.0.
To use c++11 for compiling just use -std=c++11


text:
Q: Iterating through an array in order to mark checkboxes I have an array that was passed to Jquery from PHP.  The array contains input values from checkboxes.  I want to now use the values from the array to mark the checkboxes as checked again.  Here is my code that is not working:
//pass PHP array to JQuery
var array = <?php echo json_encode($array); ?>;

//use each array value to select and check the checkboxes
$.each( array, function( index, value ){
  $("input[value='value']").prop('checked',true);
});

Any help is appreciated!


text:
Q: Complex Numbers: $1-z+z^2-z^3=0$ How to solve this equation? ($z$ is a complex number)
$1-z+z^2-z^3=0$
I tried using $z=a+ib$ and reached an answer but I'm not sure if it's a correct one.
Thanks!

A: $$1-z+z^2-z^3=(1-z)(1+z^2)=0$$
$$z=1,\pm i$$

A: $1-z+z^2-z^3=0 $ is equivalent to $(1-z)(1+z^2)=0$,
then $(1-z)(i-z)(i+z)=0$. So, the solutions are:
$z=1$, $z=i$ or $z=-i$


text:
Q: Java trying to find 3rd party class in my package even though that class is in an included JAR I'm new to Java and NetBeans and I'm having a very hard time getting a simple project started.
I'm trying to include .jar files I need to work on a NetBeans plugin.  I can successfully add the .jar files to my project using a variety of attempted methods.

*

*I added .jar files by the project properties and added the 'wrapped jar' files to the project

*I added the .jar files to the 'Libraries'  item in the Projects explorer tree

Both methods appear to work in the IDE.  They allow the desired classes to be accessed in the IDE and no syntax or access errors (etc) are detected.  However, when I build and run I get ten pages of errors such as NullPointerException and this doozy:
java.lang.ClassNotFoundException: Will not load class org.netbeans.modules.openide.nodes.NodesRegistrationSupport arbitrarily from one of ModuleCL@2afef4c1[org.openide.nodes] and ModuleCL@2debe24[com.myproject.simplelauncherbutton] starting from SystemClassLoader[316 modules]

com.myproject.simplelauncherbutton is my own package.  Why would NetBeans even be looking in my package for this class?  And even if it is looking there, how can it be finding the class there, to be confused?  I just want to make a NetBeans plugin using a .jar file for support.  How can I get this working?!

A: Solved with help from a coworker.  The problem was the way in which I was including packages in my project.  I was trying to include packages in my project that did not seem to be available.  For example, I needed to use org.openide.nodes, so at the top of my class file I wrote:
import org.openide.nodes;

NetBeans would respond saying it couldn't find this package.  When I found a wrapped JAR package containing org.openide.nodes and included that in my project, it generated a slew of errors too long to list here.
However, when I add the module by its English name "Nodes API" in the project properties, everything works fine.  I wish there were some documentation or instructions I had been able to find to save me hours of stressing about why I couldn't get NetBeans to recognize the various versions of org.openide.* I was trying to use.


text:
Q: Read/Write Hbase without reducer, exceptions I want to read and write hbase without using any reducer.
I followed the example in "The Apache HBase™ Reference Guide", but there are exceptions.
Here is my code:
public class CreateHbaseIndex {
static final String SRCTABLENAME="sourceTable";
static final String SRCCOLFAMILY="info";
static final String SRCCOL1="name";
static final String SRCCOL2="email";
static final String SRCCOL3="power";

static final String DSTTABLENAME="dstTable";
static final String DSTCOLNAME="index";
static final String DSTCOL1="key";
public static void main(String[] args) {
    System.out.println("CreateHbaseIndex Program starts!...");
    try {
        Configuration config = HBaseConfiguration.create();
        Scan scan = new Scan();
        scan.setCaching(500);
        scan.setCacheBlocks(false);
        scan.addColumn(Bytes.toBytes(SRCCOLFAMILY), Bytes.toBytes(SRCCOL1));//info:name
        HBaseAdmin admin = new HBaseAdmin(config);
        if (admin.tableExists(DSTTABLENAME)) {
            System.out.println("table Exists.");
        }
        else{
            HTableDescriptor tableDesc = new HTableDescriptor(DSTTABLENAME);
            tableDesc.addFamily(new HColumnDescriptor(DSTCOLNAME));
            admin.createTable(tableDesc);
            System.out.println("create table ok.");
        }
        Job job = new Job(config, "CreateHbaseIndex");
        job.setJarByClass(CreateHbaseIndex.class);
        TableMapReduceUtil.initTableMapperJob(
                SRCTABLENAME, // input HBase table name
                scan, // Scan instance to control CF and attribute selection
                HbaseMapper.class, // mapper
                ImmutableBytesWritable.class, // mapper output key
                Put.class, // mapper output value
                job);
        job.waitForCompletion(true);
    } catch (IOException e) {
        e.printStackTrace();
    } catch (InterruptedException e) {
        e.printStackTrace();
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    }
    System.out.println("Program ends!...");
}

public static class HbaseMapper extends TableMapper<ImmutableBytesWritable, Put> {
    private HTable dstHt;
    private Configuration dstConfig;
    @Override
    public void setup(Context context) throws IOException{
        dstConfig=HBaseConfiguration.create();
        dstHt = new HTable(dstConfig,SRCTABLENAME);
    }

    @Override
    public void map(ImmutableBytesWritable row, Result value, Context context) throws IOException, InterruptedException {
        // this is just copying the data from the source table...
        context.write(row, resultToPut(row,value));
    }

    private static Put resultToPut(ImmutableBytesWritable key, Result result) throws IOException {
        Put put = new Put(key.get());
        for (KeyValue kv : result.raw()) {
            put.add(kv);
        }
        return put;
    }

    @Override
    protected void cleanup(Context context) throws IOException, InterruptedException {
        dstHt.close();
        super.cleanup(context);
    }
}
}

By the way, "souceTable" is like this:
key  name    email
1    peter   a@a.com
2    sam     b@b.com

"dstTable" will be like this:
key    value
peter  1
sam    2

I am a newbie in this field and need you help. Thx~

A: You are correct that you don't need a reducer to write to HBase, but there are some instances where a reducer might help.  If you are creating an index, you might run into situations where two mappers are trying to write the same row.  Unless you are careful to ensure that they are writing into different column qualifiers, you could overwrite one update with another due to race conditions.  While HBase does do row level locking, it won't help if your application logic is faulty.
Without seeing your exceptions, I would guess that you are failing because you are trying to write key-value pairs from your source table into your index table, where the column family doesn't exist.

A: In this code you are not specifying the output format. You need to add the following code
    job.setOutputFormatClass(TableOutputFormat.class);

    job.getConfiguration().set(TableOutputFormat.OUTPUT_TABLE,
            DSTTABLENAME);

Also, we are not supposed to create new configuration in the set up, we need to use the same configuration from context.


text:
Q: Remove indentation of enumerate environment in enumerate environment I have the following code:
\documentclass{amsart}
\usepackage{enumitem}

\begin{document}
\begin{enumerate}[label = \textbf{Exercise \arabic*.}]
\item ajksdjkldjslasdjklasd
    \begin{enumerate}[label = \textbf{\alph*.}]
        \item ajhsdjajksdasdajksd
    \end{enumerate}

\item ajksdkasjdadsasd
\end{enumerate}
\end{document}

Which produces:

How do I remove the indentation of the item a.? I would like to have it aligned with the item Exercise 1/2.

A: Maybe you want one of these?
\documentclass{amsart}
\usepackage[showframe]{geometry}%
 \usepackage{enumitem}

\begin{document}

\begin{enumerate}[label=\textbf{Exercise \arabic*.}, wide = 0pt, itemsep=1.5ex]
\item ajksdjkldjslasdjklasd
    \begin{enumerate}[label = \textbf{\alph*.},wide =0pt]
        \item ajhsdjajksdasdajksd ajhsdjajks dasdajksd ajhsdjajksd asdajksd ajhsdjajks dasdajksd dasdajksd ajhsdjajksd asdajksd ajhsdjajks dasdajksd
    \end{enumerate}

\item ajksdkasjdadsasd
\end{enumerate}
\bigskip

\begin{enumerate}[label = \textbf{Exercise \arabic*.}, wide=0pt, itemsep=1.5ex]
\item ajksdjkldjslasdjklasd
    \begin{enumerate}[label = \textbf{\alph*.},wide=0pt, labelsep=0.15em, leftmargin=*]
        \item ajhsdjajksdasdajksd ajhsdjajks dasdajksd ajhsdjajksd asdajksd ajhsdjajks dasdajksd dasdajksd ajhsdjajksd asdajksd ajhsdjajks dasdajksd
    \end{enumerate}

\item ajksdkasjdadsasd
\end{enumerate}

\end{document}

A: You may add option leftmargin=0pt for enumii,
\begin{enumerate}[label = \textbf{\alph*.},leftmargin=0pt]


text:
Q: DRY out my CSS, but want to keep the basic CSS syntax Starting a new rails project and we have a well-thought-out color palette, and want to capture that in one place. I have usually kept colors in the CSS, but I find I end up with all the same color in lots of different selectors, as it shows up as a background color, color, border color, etc. I also will occassionally need access to colors in the Javascript. It would be great to just define each color ONCE.
So I'd just like to define my color palette in a way that's re-usable in the CSS and Javascript, but I don't want to go all the way to SASS, abandoning CSS syntax completely.
Is there a rails plugin already made that allows this? I could patch together an ERB type solution, but I don't want to do it if someone else has something readily available.

A: There is a new project out called {less} that sounds like what you are looking for: http://lesscss.org/

A: LESS seems to have a rails plugin, and a more css like syntax.

A: There are several server side parsers like LESS and SASS, but if you want to use the palett mentality in straight CSS you have to revers your thinking. Define basic styles like colors, fonts etc. and apply multiple classes at the tag level.
[style]
.color1{color:red}
.color2{color:blue}
.color3{color:green}
.bcolor1{color:red}
.bcolor2{color:blue}
.bcolor3{color:green}
[/style]
[tag class="color1 bcolor2"]
This has worked very well for us.

A: Another (pure CSS) way may be to define each color once, and have the several selectors associated with that oe color definition, for example:
body,
p,
#foo,
.bar {color: #802369 }


text:
Q: ASP.NET Dropdrownlist croaks with SelectValue Assignment This is my aspx
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    <asp:ObjectDataSource ID="DSCategories" runat="server"
        SelectMethod="GetCategories" TypeName="BAL.CategoryBAL">
    </asp:ObjectDataSource>

Category:

        <asp:DropDownList ID="ddlCategories" runat="server"
            DataSourceID="DSCategories" DataTextField="Description"
            DataValueField="Code">
        </asp:DropDownList>
        <asp:Button ID="btnSetCriteria" runat="server" Text="Set Criteria" />

</asp:Content>

And this is briefly my Page_Load code:
SearchCriteriaBAL scb = SearchCriteriaBAL.GetSearchCriteria(id);

string cat = String.Empty;
if (!string.IsNullOrEmpty(scb.Criteria))
{
    cat = ParseCriteria(scb.Criteria);

    ddlCategories.SelectedValue = cat;
}

I break on the SelectedValue assignment line and see the items in the dropdownlist and I see a valid value for cat and it is in the list but I get:

'ddlCategories' has a SelectedValue
  which is invalid because it does not
  exist in the list of items. Parameter
  name: value

It seems to be doing the GetCategories AFTER I set the selectedValue and then it dies.
I placed it on its own test page for fear of interaction but it still fails.  Has anyone seen this before?

A: You could try selecting the item this way:
ddlCategories.Items.FindByValue(cat).Selected = true;

Which of course wont' work if cat really isn't in the Items collection

A: Write the function on DropDownList's DataBound event instead of Page_Load

Occurs after the server control binds
  to a data source.

<asp:DropDownList ID="ddlCategories" runat="server"
    DataSourceID="DSCategories"
    DataTextField="Description"
    DataValueField="Code"
    OnDataBound="ddlCategories_DataBound">
</asp:DropDownList>

Rather than using SelectedValue, I would have opted
ddlCategories.Items.FindByValue(cat.Trim()).Selected = true;


text:
Q: Protection against XSS using a tiny virtual-machine in browser I'm working on a web framework that makes surveys. It has an expression manager which lets admin users run code on the client as Javascript. There could be a potential XSS problem when there's more than one admin, as is the case for universities. So, instead of compiling expressions to Javascript, what about compiling them to a bitcode and have a tiny VM in the browser to check for XSS? Do you think it could give better protection than just analyzing Javascript?

A: Building your own "VM" could be a pretty heavy lift.
Just treat any code you didn't write as part of an external application. Execute the script off-page, ideally in a sandbox on the server. (Use a spidermonkey plugin or a node sandbox.) At the very least, execute untrusted scripts in a frame on a totally separate domain.


text:
Q: How to send messages with Firebase admin SDK Nuget used:
FireBaseAdmin v1.9.2
I'm trying to use firebase admin to send push notification to fcm.
I read the documentation but can't find any other good source to figure out how to use it properly.
I can't figure out where to add the serverkey and senderid.
I made a methode for sending push notifications.
Has anyone an example i could follow or any other documentation?
public override async Task<string> Send(List<String> tokens, string title, string body)
{
   var message = Message()
   {
      Tokens = tokens,
      Notification = new Notification()
      {
         Title = title,
         Body = body
      }
   };

   return await FirebaseMessaging.DefaultInstance.SendAsync(message).ConfigureAwait(false);
}

When i debug this code the response is null from SendAsync.
It might be because i didn't give it the serverkey and senderId but then i would expect an error like serverKeyNotFound.

A: Server key and sender ID parameters are not used in the Admin SDK. You just need to instantiate a FirebaseApp with some GoogleCredential as shown in https://firebase.google.com/docs/admin/setup.
On top of that your code seems to be syntactically incorrect. There's no Tokens property available in the Message class. You need MulticastMessage class for that. So I'd expect the above code to fail compilation.


text:
Q: Is it possible to find all finite groups which has subgroup of order $n$? Is it possible to find all finite group which has a subgroup of certain order $n$ (here say for example $2$) ? I am thinking about this problem for few days, but not getting how to approach.
I am thinking that the theorem -

Every finite group is isomorphic to a subgroup of $S_n$.

can give something about it. Can anyone answer please? I have searched for it, but it is not posted here and not available in internet.

A: First, the result regarding $S_n$ that you are referring to is known as "Cayley's theorem".
In fact, a necessary condition is $n$ divides $|G|$, the order of the group $G$.
Indeed, if there exists a subgroup of $G$ that has order $n$, then $n$ will divide $|G|$ by Lagrange's theorem.
Under a certain condition, a converse holds.
Suppose that $n$ divides $|G|$, and pick Sylow groups $P_1, \ldots, P_r$, where we assume that $n = p_1^{k_1} \cdots p_r^{k_r}$ and $P_j$ is a $p_j$-Sylow group.
Now if $P$ is any $p$-group, then it has a normal subgroup of order $p^m$, whenever $p^m$ divides $|P|$. For $m=1$ this is Cauchy's theorem, and for general $m$ use Cauchy's theorem and divide out the corresponding cyclic group and then use induction.
Thus, pick for each $j$ a subgroup $Q_j \le P_j$ of order $p_j^{k_j}$. Then the $Q_j$ are pairwise disjoint for order reasons, so that they define a subgroup
$$
H := \langle Q_1, \ldots, Q_r \rangle
$$
that is a direct product of $Q_1, \ldots, Q_r$ (if each $Q_j$ is a normal subgroup of $H$) and hence has order $n$.

A: As noted in the comments by Display name and Orat, it is (as of today) improbable for general or even for a given $n$ to find all groups containing a subgroup of order $n$ in the sense of classification - to formulate a list of groups such as that any group is isomorphic to one in the list.
On the other hand, sometimes necessary and/or sufficient conditions can be given. One simple necessary condition is that $n$ divides the order of $G$, and one simple sufficient condition is that $G$ has order $n$.
For specific $n$, better conditions can be given. If $n = p$ is a prime, then Cauchy's theorem states that a necessary and sufficient condition is that $p$ divides the order of $G$. This is strengthened by Sylow's theorems: a necessary and sufficient condition for a finite group $G$ to have a subgroup of order $p^a$ is that $p^a$ divides the order of $G$. In terms of classification, even $p$-groups are hard to tell, let alone all groups who contain them.
When $n$ is no longer a prime, things get complicated. If we factor $n = p_1^{a_1}\cdots p_k^{a_k}$, then for a group $G$ whose order is a multiple of $n$ we can easily find subgroups $H_i$ with order $p_i^{a_i}$ for every $1 \leq i \leq k$. But we cannot guarantee in general that their product is again a subgroup (altough it will have the correct order as a set and every subgroup of order $n$ can be written in such way). I don't have a construction out of my pocket, but I believe that arbitrarily bad behaved examples can be found.
If your group $G$ is nilpotent, than each of the $H_i$ in the above construction are normal in $G$ and you can guarantee that the product $H = H_1\cdots H_k$ is again a subgroup of $G$ of order $n$. Classify all nilpotent finite groups - that's also a hard problem.
According to GroupWiki, your property lies somewhere between supersolvable (which is weaker than nilpotency) and solvable, as the alternating group on four letters $A_4$ is a solvable group that does not satisty this property. It also states that any group satisfying it must be solvable. Note that I'm talking about an even stronger property: a group $G$ having subgroups of every order possible (at least one subgroup for each divisor of it's order). If we talk about a fixed $n$, then we go back to the original problem: if $H$ has order $n$ and $G$ is any finite group, $G\times H$ is a group containing a subgroup of order $n$, and their classification involves classifying all finite groups.


text:
Q: oracle - sql query select max from each base I'm trying to solve this query where i need to find the the top balance at each base. Balance is in one table and bases are in another table.
This is the existing query i have that returns all the results but i need to find a way to limit it to 1 top result per baseID.
SELECT o.names.name t.accounts.bidd.baseID, MAX(t.accounts.balance)
FROM order o, table(c.accounts) t
WHERE t.accounts.acctype = 'verified'
GROUP BY o.names.name, t.accounts.bidd.baseID;

*

*accounts is a nested table.

this is the output
      Name        accounts.BIDD.baseID        MAX(T.accounts.BALANCE)
 ---------------  ------------------------- ---------------------------
 Jerard            010                       1251.21
 john              012                       3122.2
 susan             012                       3022.2
 fin               012                       3022.2
 dan               010                       1751.21

What i want the result to display is calculate the highest balance for each baseID and only display one record for that baseID.
So the output would look only display john for baseID 012 because he has the highest.
Any pointers in the right direction would be fantastic.

A: I think the problem is cause of the "Name" column. since you have three names mapped to one base id(12), it is considering all three records as unique ones and grouping them individually and not together.
Try to ignore the "Name" column in select query and in the "Group-by" clause.
SELECT t.accounts.bidd.baseID, MAX(t.accounts.balance)
FROM order o, table(c.accounts) t
WHERE t.accounts.acctype = 'verified'
GROUP BY t.accounts.bidd.baseID;


text:
Q: How to enter two digits from same textfield in AWT/SWING I have created a Simple calculator in which I take inputs of two operands in two different textfields, and it is working good. But I need to take two inputs from same textfield. What changes should I make?
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

class Calculation_ActionEvent extends JFrame implements ActionListener
{
    JFrame f;
    JLabel l;
    JTextField tf1, tf2, tf3;
    JButton b1, b2, b3, b4 ,b5, b6;
    Calculation_ActionEvent(String s)
    {
        f = new JFrame("Calculation");
        f.setLayout(null);
        l = new JLabel("Enter two numbers : ");
        tf1 = new JTextField();
        tf2 = new JTextField();
        tf3 = new JTextField();
        b1 = new JButton("+");
        b2 = new JButton("-");
        b3 = new JButton("*");
        b4 = new JButton("/");
        b5 = new JButton("equals");
        b6 = new JButton("C");
        f.add(l);
        f.add(tf1);
        f.add(tf2);
        f.add(tf3);
        f.add(b1);
        f.add(b2);
        f.add(b3);
        f.add(b4);
        f.add(b5);
        f.add(b6);
        tf1.setBounds(180,100,50,30);
        tf2.setBounds(320,100,50,30);
        tf3.setBounds(250,420,50,30);
        b1.setBounds(250,180,50,30);
        b2.setBounds(350,260,50,30);
        b3.setBounds(150,260,50,30);
        b4.setBounds(250,340,50,30);
        b5.setBounds(230,260,90,30);
        b6.setBounds(250,100,50,30);
        b1.addActionListener(this);
        b2.addActionListener(this);
        b3.addActionListener(this);
        b4.addActionListener(this);
      //b5.addActionListener(this);
        b6.addActionListener(this);
        f.setSize(550,550);
        f.setVisible(true);
    }

    public void actionPerformed(ActionEvent e)
    {
        int num1= Integer.parseInt(tf1.getText());
        int num2= Integer.parseInt(tf2.getText());
        String s1 = e.getActionCommand();
        if(s1.equals("C"))
        {
            tf1.setText("0");
            tf2.setText("0");
            tf3.setText("0");
        }
        else
        {
         if(s1=="+")
        {
            tf3.setText(String.valueOf(num1+num2));
        }
        if(s1=="-")
        {
            tf3.setText(String.valueOf(num1-num2));
        }
        if(s1=="*")
        {
            tf3.setText(String.valueOf(num1*num2));
        }
        if(s1=="/")
        {
            tf3.setText(String.valueOf(num1/num2));
        }
        }
 }

    public static void main(String... s)
    {
        new Calculation_ActionEvent("Calculation");
    }
 }

A: Just get the value from the two textbox and perform all the calculation addition,multiplication,subtraction,divide and store in different variable and the set that variable in textbox you cant directly perform the action in textbox.ex below
String val1=textbox1.gettext();
String val2=textbox2.gettext();
int addition=Integer.ParseInt(val1)+Integer.ParseInt(val2);
textbox3.settext(addition.toString());

A: Would this be something like what you're looking for? I did a quick version for you.
Simply put, I store the last operator (+, -, *, /) in a String variable (lastAction), the total as an int. When "equals" is pressed, I work out the total and reset the total variable and lastAction. When an operator is pressed, I change the total but keep the last value in a variable.
package cf.pgmann.calc;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;

class Calculation_ActionEvent extends JFrame implements ActionListener {
    JFrame f;
    JLabel l;
    JTextField tf1, tf3;
    JButton b1, b2, b3, b4, b5, b6;

    Calculation_ActionEvent(String s) {
        f = new JFrame(s);
        f.setLayout(null);
        l = new JLabel("Enter two numbers : ");
        tf1 = new JTextField();
        // tf2 = new JTextField();
        tf3 = new JTextField();
        b1 = new JButton("+");
        b2 = new JButton("-");
        b3 = new JButton("*");
        b4 = new JButton("/");
        b5 = new JButton("equals");
        b6 = new JButton("C");
        f.add(l);
        f.add(tf1);
        f.add(tf3);
        f.add(b1);
        f.add(b2);
        f.add(b3);
        f.add(b4);
        f.add(b5);
        f.add(b6);
        tf1.setBounds(160, 100, 250, 30);
        // tf2.setBounds(320,100,50,30);
        tf3.setBounds(250, 420, 50, 30);
        b1.setBounds(250, 180, 50, 30);
        b2.setBounds(350, 260, 50, 30);
        b3.setBounds(150, 260, 50, 30);
        b4.setBounds(250, 340, 50, 30);
        b5.setBounds(230, 260, 90, 30);
        b6.setBounds(420, 100, 50, 30);
        b1.addActionListener(this);
        b2.addActionListener(this);
        b3.addActionListener(this);
        b4.addActionListener(this);
        b5.addActionListener(this);
        b6.addActionListener(this);
        f.setSize(550, 550);
        f.setVisible(true);
    }

    int total = 0;
    String lastAction = "";

    public void actionPerformed(ActionEvent e) {
        int num = 0;
        try {
            num = Integer.parseInt(tf1.getText());
        } catch(NumberFormatException ex) {}
        String s1 = e.getActionCommand();
        if (s1.equals("C")) {
            tf1.setText("");
            tf3.setText("0");
            tf1.requestFocus();
            total = 0;
        } else if (s1.equals("equals")) {
            tf3.setText(String.valueOf(calc(total, lastAction, num)));
            tf1.setText("");
            tf1.requestFocus();
            total = 0;
        } else {
            total = total==0 ? num : calc(total, lastAction, num);
            tf3.setText(String.valueOf(total));
            tf1.setText("");
            tf1.requestFocus();
            lastAction = s1;
        }
    }

    private int calc(int num1, String action, int num2) {
        switch (action) {
        case "+":
            return num1 + num2;
        case "-":
            return num1 - num2;
        case "*":
            return num1 * num2;
        case "/":
            return num1 / num2;
        default:
            return num1;
        }
    }

    public static void main(String... s) {
        new Calculation_ActionEvent("Calculator");
    }
}


text:
Q: Getting KeyError for Column Name in Pandas Python 3 I am reading a csv with pandas and then applying some basic functions to the columns. However I am getting a KeyError for the columnname (only 2 columns in my data frame). I have read other articles that suggest the column name has a whitespace in it but it does not. I have opened the file in notepad to verify and I am seeing nothing.
My thoughts are that my lineterminator argument in my read_csv call is causing something to be muddying my 2nd column name up.
C_Notes = pd.read_csv(r"Claims_Notes.csv", sep = ',', lineterminator =
'\n', encoding="utf-8-sig")

C_Notes['ClaimsNotes'] = C_Notes['ClaimsNotes'].apply(str.rstrip) ##KeyError

However, the below code works but it creates a new column titled the same as my 2nd column 'ClaimsNotes':
C_Notes['ClaimsNotes'] = C_Notes[C_Notes.columns[1]].apply(str.rstrip)

I must be missing something with the column names..
My error is simply KeyError: 'ClaimsNotes'
It must be something to do with the column headers but I cannot figure out why.
Thanks,


text:
Q: Facing issue in getting the largest integer from Array Receiving 5,9,7 as output.. Where as the expected should be only 9..Below is the code:
public class GreatestNoInArray {
    public static void main(String[] args) {
        int a[]= new int[] {1,2,5,9,7};
        int big=a[0];
        for (int i=1; i<a.length; i++){
            if (big<a[i])
                big=a[i];
            System.out.println(a[i]);
        }
    }
}

Please help

A: for expected answer you need to print big (not a[i])  out side of loop

A: public class GreatestNoInArray {
  public static void main(String[] args) {
      int a[]= new int[] {1,2,5,9,7};
      int big=a[0];

      for (int i=1; i<a.length; i++){
          if (big<a[i])
              big=a[i];
          }
      System.out.println(big);
  }
}

A: code should be like this:
public class GreatestNoInArray {
    public static void main(String[] args) {
        int a[] = new int[] {1,2,5,9,7};
        int big = a[0];
        for (int i=1; i<a.length; i++){
            if (big < a[i])
                big = a[i];
            //System.out.println(a[i]);
        }
    System.out.println("Big: " + big);
    }
}

This works!


text:
Q: Listview Adapter problemas com espaços em brancos Estou criando um listView com adpater e estou com um problema, eu precisei adicionar uma imagem no meio da lista para ficar no canto direto, essa imagem é somente uma seta. como posso resolver ai ela ocupa tudo espaço da tela mesmo eu definindo o tamanho da imagem e que é para ela ficar no canto direto.
segue XML  lista:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingTop="15dp"
    android:background="@drawable/color_list">

    <LinearLayout
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:ignore="UselessParent">

        <TextView
            android:text="@string/textview"
            android:layout_width="match_parent"
            android:textSize="18sp"
            android:textStyle="bold"
            android:layout_height="wrap_content"
            android:id="@+id/txtVencimento"
            android:layout_marginLeft="10dp"
            tools:ignore="RtlHardcoded" />

        <TextView
            android:text="TextView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/txtPagamento"
            tools:ignore="HardcodedText,RtlHardcoded"
            android:layout_marginLeft="10dp"
            android:elevation="50dp"
            tools:targetApi="lollipop" />

        <TextView
            android:text="TextView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/txtNumeDoc"
            tools:ignore="HardcodedText,RtlHardcoded"
            android:layout_marginLeft="10dp"
            android:elevation="50dp"
            tools:targetApi="lollipop" />

        <TextView
            android:text="TextView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/txtHistorico"
            tools:ignore="HardcodedText,RtlHardcoded"
            android:layout_marginLeft="10dp"
            android:elevation="50dp"
            tools:targetApi="lollipop" />

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="end"
            app:srcCompat="@drawable/caratrblack"
            android:id="@+id/imageView3"
            tools:ignore="ContentDescription,RtlHardcoded"
            android:layout_marginRight="15dp" />

        <TextView
            android:text="TextView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/txtOrigem"
            tools:ignore="HardcodedText,RtlHardcoded"
            android:layout_marginLeft="10dp"
            android:elevation="50dp"
            tools:targetApi="lollipop" />

        <TextView
            android:text="TextView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/txtValoresDesconto"
            tools:ignore="HardcodedText,RtlHardcoded"
            android:layout_marginLeft="10dp"
            android:elevation="50dp"
            tools:targetApi="lollipop" />

        <TextView
            android:text="TextView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/txtMultaJuros"
            tools:ignore="HardcodedText,RtlHardcoded"
            android:layout_marginLeft="10dp"
            android:elevation="50dp"
            tools:targetApi="lollipop" />

        <TextView
            android:text="TextView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/txtTotal"
            tools:ignore="HardcodedText,RtlHardcoded"
            android:layout_marginLeft="10dp"
            android:elevation="50dp"
            tools:targetApi="lollipop" />

    </LinearLayout>

</RelativeLayout>

A:  <?xml version="1.0" encoding="utf-8"?>
  <LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:ignore="UselessParent">

<LinearLayout
    android:layout_width="match_parent"
    android:orientation="horizontal"
    android:layout_height="wrap_content">

    <TextView
        android:text="teste"
        android:layout_weight="1"
        android:layout_width="wrap_content"
        android:textSize="18sp"
        android:textStyle="bold"
        android:layout_height="wrap_content"
        android:id="@+id/txtVencimento"
        android:layout_marginLeft="10dp"
        tools:ignore="RtlHardcoded" />

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="end"
        app:srcCompat="@drawable/user"
        android:id="@+id/imageView3"
        tools:ignore="ContentDescription,RtlHardcoded"
        android:layout_marginRight="15dp" />

    </LinearLayout>

    <TextView
        android:text="TextView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/txtPagamento"
        tools:ignore="HardcodedText,RtlHardcoded"
        android:layout_marginLeft="10dp"
        android:elevation="50dp"
        tools:targetApi="lollipop" />

    <TextView
        android:text="TextView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/txtNumeDoc"
        tools:ignore="HardcodedText,RtlHardcoded"
        android:layout_marginLeft="10dp"
        android:elevation="50dp"
        tools:targetApi="lollipop" />

    <TextView
        android:text="TextView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/txtHistorico"
        tools:ignore="HardcodedText,RtlHardcoded"
        android:layout_marginLeft="10dp"
        android:elevation="50dp"
        tools:targetApi="lollipop" />

    <TextView
        android:text="TextView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/txtOrigem"
        tools:ignore="HardcodedText,RtlHardcoded"
        android:layout_marginLeft="10dp"
        android:elevation="50dp"
        tools:targetApi="lollipop" />

    <TextView
        android:text="TextView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/txtValoresDesconto"
        tools:ignore="HardcodedText,RtlHardcoded"
        android:layout_marginLeft="10dp"
        android:elevation="50dp"
        tools:targetApi="lollipop" />

    <TextView
        android:text="TextView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/txtMultaJuros"
        tools:ignore="HardcodedText,RtlHardcoded"
        android:layout_marginLeft="10dp"
        android:elevation="50dp"
        tools:targetApi="lollipop" />

    <TextView
        android:text="TextView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/txtTotal"
        tools:ignore="HardcodedText,RtlHardcoded"
        android:layout_marginLeft="10dp"
        android:elevation="50dp"
        tools:targetApi="lollipop" />

</LinearLayout>

Isso deve resolver seu problema. Retirei o Relative e estou usando o LinearLayout.
Você precisava colocar a imagem dentro de outro Linear na horizontal.
Deve ter outros meio, assim achei mais fácil.


text:
Q: FTP retrieve user home directory from an admin connection I'm implementing a cleanup of old files on SFTP server. I have a user named admin who has full access rights on the FTP.
I would like to know if it's possible to retrieve the home directory for another "classic" user when being connected as an admin.
To illustrate imagine 2 users

*

*admin with full access on the FTP

*bob is a simple user that has his own directory on the FTP

I want to know as an admin  what is the home directory of bob
If you need more context let me know.
Any helps would be greatly appreciated


text:
Q: Dot in Apache location name requires trailing slash? I noticed that using a dot (.) in Apache Location requires adding trailing slash in URL to work properly.
Anyone knows why this happens, and how to enable it to work without the trailing slash?


text:
Q: Is there are place to report missing/incorrect album art to the iTunes team? I know there are various ways to get/replace album art in iTunes and other questions about that. Some of them don't provide as good quality art as from iTunes (Store). Some of them also inflate file sizes by putting the image in each album. However, one thing I've noticed is that sometimes art gets updated in the store to better reflect the CD I ripped, or missing art becomes available. For example, Bob Dylan albums used to always get the ugly "Bob Dylan Collection" cover (same for each) whereas now they get the real original covers.
Is there somewhere to report mistakes and omissions to the team responsible? It seems that overall quality could easily be improved if Apple accepted "bugs" on this. The mistakes often seems quite strange - for example, the album is in the store with the correct artwork and yet you get the wrong art downloaded or none at all. I recently got correct art for an unusual independent artist who I thought had self-published his album, followed by nothing for Phil Selway's much more famous new album. This album is available (correct art) in the store!

A: you can always use Apple Feedback page to submit any kind of request.
if you have this problem in our own iTunes Library, it is easy to assign a new cover to the song or album by just dragging the cover to it or using the GetInfo option, you know how to do this right?
if you install Last.fm app you can simple play a song and then drag the last.fm cover into the artwork of the iTunes song.


text:
Q: my jquery is working until refresh only in sharepoint I have a jquery script in sharepoint to insert a date with attachment. It's in the edit page. It works only after refreshing the edit page. How can I solve this problem?
 <script type="text/javascript">
    $(document).ready(function () {
        SP.SOD.executeFunc("sp.js", 'SP.ClientContext', RenameAttachments);
    });
    var attfiles;
    function RenameAttachments() {
        var ctx = new SP.ClientContext.get_current();
        attfiles = ctx.get_web().getFolderByServerRelativeUrl('Lists/Test/Attachments/' + getUrlParameter('ID')).get_files();
        ctx.load(attfiles);
        ctx.executeQueryAsync(Function.createDelegate(this, this.onSuccess), Function.createDelegate(this, this.onFailed));
    }

......... etc

A: Please find the modification of the code.
This will run on the load of the page and it will work when we edit the share-point page.

<script type="text/javascript">
    jQuery(window).load(() => {
        SP.SOD.loadMultiple(["sp.js", "clienttemplates.js"], RenameAttachments);
      });
    var attfiles;
    function RenameAttachments() {
        var ctx = new SP.ClientContext.get_current();
        attfiles = ctx.get_web().getFolderByServerRelativeUrl('Lists/Test/Attachments/' + getUrlParameter('ID')).get_files();
        ctx.load(attfiles);
        ctx.executeQueryAsync(Function.createDelegate(this, this.onSuccess), Function.createDelegate(this, this.onFailed));
    }


text:
Q: How to load jquery last I have searched the web, found some answers but none of them work.  All i want for my site to load faster.  I have minified my images.  Now am using jquery and used version hosted by google.  Though it's not hosted on my site, it's the heaviest file (32kb) in the site and it loads 2nd on the line before any other images.  I have tried the adding a javascript before the body closing tag like this:
<script language="javascript">

      var e=document.createElement('script');
      e.setAttribute('type','text/javascript');
      e.setAttribute('src','http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js');

      document.body.appendChild(e)

      var f=document.createElement('script');
      f.setAttribute('type','text/javascript');
      f.setAttribute('src','myjs.js');
      document.body.appendChild(f)
  </script>

On firebug console, it shows that jquery is loaded last.  However it also shows uncaught reference error $ not defined, which am guessing an error you get when jquery isn't loaded properly.
If i put these two js files inside the head tag, everything works fine.
How can I accomplish this task?
thanks.

A: Loading javascript files dynamically causes them to be loaded asynchronously, so you can't guarantee which library will load first. If you need to enforce order (as you always will with a library like jQuery), you'll need to add script tags with src attributes to page like so:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="myjs.js"></script>

If you add your script tags as the last elements in the body element rather than the head, it will give the appearance of loading faster (progressive enhancement).
EDIT As one of the commenters noted, you can read the answer to this question to get more detail.

A: I was unable to force the script order in a particular system and I was able to get around the issue by wrapping my jQuery code with addEventListener
<script><!--
(function() {
    'use strict';
    window.addEventListener('load', function() {
        // All resources loaded
        $('#my-selector').on('click', function(event){
            //Do something
        });
    }, false);
})();
//--></script>

Which allows me to load jQuery at the bottom of the document and still use '$' in my code further up in the DOM where needed. Not a perfect solution for all situations, but served my purposes ;)


text:
Q: How do I capture the PO references assigned into SOLineSplit3 during POCreate for an SO? I have a modification that facilitates an internal business process utilizing PO and SO.  The screen provides the ability to purchase an MRO spare part outside of the normal replenishment process.  The item may or may not be maintained in inventory, so it may be ordered for replenishment or as an SO to be processed as Mark for PO.
In creating the SO, I am able to store the SO reference information to the DAC for my customization.  When creating the PO directly, I also am able to capture the PO reference information.  However, when creating the PO from the SO using the standard Acumatica menu action for Create Purchase Order, I have been unable to capture the right event to enable storing the PO reference being assigned in SOLineSplit3 to my custom DAC.  (Worth noting that I also need to be able to override the default curyunitcost value on the PO line using the value stored on my custom DAC as these purchases do not carry a fixed price per buy.  This is done by tracing the SOLineSplit back to my custom DAC and overriding POLine_CuryUnitCost_FieldDefaulting.)
The action invoked on the Sales Order Entry screen (Action - Create Purchase Order) calls the method CreatePOOrders in POCreate.cs which in turn creates an instance of the POOrderEntry graph to create the actual purchase order.
Eventually, the following code is reached, which appears to attach the PO reference information to SOLineSplit3 as soline:
soline.POType = line.OrderType;
soline.PONbr = line.OrderNbr;
soline.POLineNbr = line.LineNbr;
soline.RefNoteID = docgraph.Document.Current.NoteID;

docgraph.UpdateSOLine(soline, docgraph.Document.Current.VendorID, true);

docgraph.FixedDemand.Cache.SetStatus(soline, PXEntryStatus.Updated);

I am not yet familiar with Cache.SetStatus, but the pop-up description seems to indicate that this is using the FixedDemand select in POOrderEntry to find and set (or insert) the SOLineSplit3 record.  The call to UpdateSOLine above it is a new internal method that was not in my previous version of POCrete.cs, as this entire method seems to have had some significant rework recently.  In trying to capture events on SOLineSplit3 in both POCreate and POOrderEntry, it appears that Cache.SetStatus does not raise any events that I can capture... or I am just completely lost on what event to capture/override.
Immediately following this section, the following appears to update a Replenishment record and save the entire POOrderEntry graph.
if (docgraph.Transactions.Cache.IsInsertedUpdatedDeleted)
{
    using (PXTransactionScope scope = new PXTransactionScope())
    {
        docgraph.Save.Press();

        if (demand.PlanType == INPlanConstants.Plan90)
        {
            docgraph.Replenihment.Current = docgraph.Replenihment.Search<INReplenishmentOrder.noteID>(demand.RefNoteID);
            if (docgraph.Replenihment.Current != null)
            {
                INReplenishmentLine rLine =
                    PXCache<INReplenishmentLine>.CreateCopy(docgraph.ReplenishmentLines.Insert(new INReplenishmentLine()));

                rLine.InventoryID = line.InventoryID;
                ...
                rLine.PlanID = demand.PlanID;
                docgraph.ReplenishmentLines.Update(rLine);
                docgraph.Caches[typeof(INItemPlan)].Delete(demand);
                docgraph.Save.Press();
            }
        }
        scope.Complete();
    }
...
}

Basically, I need to insert my code right between the assignment of the PO information to "soline" and the docgraph.Save.Press(); without copying dozens of lines of code to modify this method.  I have managed cloning the base method and inserting my code successfully, but I'd prefer to use an event handler and eliminate modifying the standard code.  But the question...  What event in which graph will let me grab the PO information and follow the breadcumbs back through SOLineSplit to my custom DAC?
Acumatica Build 18.212.0033

A: Extend POCreate graph because it is the one instanciating the POOrderEntry you are interested in.
Setup a hook on any POOrderEntry graph created by POCreate and subscribe your events on the intercepted graph. I tested this solution, with a Sales Order that has allocations lines in allocation window it will catch the SOLineSplit3 events:
public class POCreate_Extension : PXGraphExtension<POCreate>
{
    public override void Initialize()
    {
        PXGraph.InstanceCreated.AddHandler<POOrderEntry>((graph) =>
        {
            graph.RowInserting.AddHandler<POOrder>((sender, e) =>
            {
                PXTrace.WriteInformation("POOrderEntry_POOrder_RowInserting");
            });

            graph.RowInserting.AddHandler<POOrderEntry.SOLineSplit3>((sender, e) =>
            {
                PXTrace.WriteInformation("POOrderEntry_SOLineSplit3_RowInserting");
            });

            graph.RowUpdating.AddHandler<POOrderEntry.SOLineSplit3>((sender, e) =>
            {
                PXTrace.WriteInformation("POOrderEntry_SOLineSplit3_RowUpdating");
            });

            graph.RowPersisting.AddHandler<POOrderEntry.SOLineSplit3>((sender, e) =>
            {
                PXTrace.WriteInformation("POOrderEntry_SOLineSplit3_RowPersisting");
            });
        });
    }
}


text:
Q: How to do named slots in Vue3 project? In my vue 3 script setup component, I have this
<template>

            <template v-for="(row, i) in componentProps.rows">

                        {{ header.title }}

                        <template #test>

                        </template>

            </template>

</template>

But I get this error

And vite complains this too
Codegen node is missing for element/if/for node. Apply appropriate transforms first.
4:00:10 PM [vite] Internal server error: Codegen node is missing for element/if/for node. Apply appropriate transforms first.
  Plugin: vite:vue

How can I resolve this?

A: Slots are a way for parent components to inject content inside child components, rendered at predetermined locations inside the child component's template.

In more detail: you declare a <slot name="test" /> 1 inside a (child) component's <template>. You can put fallback content inside the slot. This fallback content will be rendered if the parent component doesn't specify anything for the slot.
Example ComponentA.vue:
<template>
  <slot name="test">
    Fallback content
  </slot>
  More child component content
</template>

Then you import this component in another component and you use it as 2:
<template>
  Some parent content...
  <component-a>
    <template #test>
      I am injected content
    </template>
  </component-a>
  More parent content...
</template>

which will render:
Some parent content...
I am injected content
More child component content
More parent content...

Without <template #test> specified (e.g: <component-a />) it would render:
Some parent content...
Fallback content
More child component content
More parent content...

So, before you can use <template #test> anywhere, you need to declare <slot name="test" /> inside a component and then import that component into any other component, and use <template #test> to inject parent defined content into the imported component's template, to replace the fallback content of the slot (if it has any).
And what makes slots really interesting and particularly useful is their ability to expose a scope to the parent component's template, which the parent component can use to output dynamic content, by combining the slot scope's logic with their own logic.
Read more on that here.

1 - slots can also be unnamed. Default (or unnamed) slots (<slot />) are actually a special case of named slots: under the hood, they are named default, and also, implicitly, they get all the content you put inside the child component's tag, in the parent component. For example, if the above ComponentA.vue's template looked like this:
<template>
  <slot />
  Bla bla...
</template>

when used as
<component-a>
  Whatever
</component-a>

...would render:
Whatever
Bla bla...

which would also be the result of the full blown syntax:
<component-a>
  <template #default>
    Whatever
  </template>
</component-a>

2 - Slots work with both DOM text nodes and HTML elements, like normal components. I opted not to use HTML elements here to keep things simple. If you used the exact examples as above you'd get all the content rendered in one single text line, since all text is inline content in HTML.


text:
Q: how to assign an actor to a lane in bonita 7.5? I want to assign an actor to a lane. I set a single user for lane from: Details tab, General window, actor. But the task was not addressed to the lane. What can I do to to assign an actor to a lane?

A: If you have defined the single user at lane, the default actor settings to the human task should automatically assign the task to that single user defined in the lane. The below steps should get your requirement done:

*

*Click on the lane, General -> Actors -> Actor Filter -> Click on "Set" button - > Organization (from Categories) -> Single user (from Actor filter definitions)

*Write your groovy script to return the user id. For example, if you want to return the user id by username:
return apiAccessor.identityAPI.getUserByUserName(username).getId();
   // where username is the username of the user you want to assign the task to

*Click on the User/Human Task, General -> Actors -> Use the actor defined in lane (default selection)


text:
Q: FreeRTOS and 3 UARTS I have application which has 3 UARTS (GSM / Debug / GPS) and will be developed under FreeRTOS (not the matter here but STM32F1 will be used).
What would be the pattern to use with this setup regarding:
GSM: Will be used to receive message commands and send feedback from sensors.
GPS: Will be processed to get new location ASAP.
Debug: Will output information on the status of the system.
My thoughts:
4 Tasks should be implemented;

*

*GPS Receive

*GSM communication

*Debug output

*Application task

GPS will get location and put it into global buffer then signal via semaphore that location is available. If semaphore has not been taken (either put that new location into circular buffer or discard it).
GSM will receive data into queueRX and queueTX and send when possible to the server.
Debug output will also receive in queueRX and queueTX and send to dedicated UART.
Application task will coordinate all of the main algorithm (take location, acquire sensor info and send output to GSM and debug).
Now comes the question, because there is 3 UARTS in the same time (two at 115200 and GPS at 9600) what would be the best / pattern approach of handling that Tx/Rx.
I have made some tests for GPS and tried to put every RX char into queue but that generates too much Interrupts, also using DMA has issue because you can easily miss ending \r\n and then you are in wait.
Tnx in advance.

A: Use DMA with IDLE detection, don't process data in interrupts. Your interrupt handler just signals your tasks, that IDLE has been detected and returns number of characters and pointer to the buffer to task responsible for processing it. Tasks just process the data or sleep, if all is done.
Note, that you'll have to implement IDLE detection yourself, for STM HAL does not do that yet. But I've seen in forums patches for this.

A: To add to the answer from stiebrs, here's a start for the relevant DMA interrupt handlers to add Idle detection. You need to implement RegisterRemainingBuffer_ISR() yourself, reacting to \r\n etc. Also, you need to distinguish the different UARTs.
//Called from interrupt when the buffer is completely filled (DMA will
//wrap around).  An IDLE interrupt will still follow if this happened
//to be the last data.
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) {
  //The buffer is filled, hence number of remaining bytes is 0.
  RegisterRemainingBuffer_ISR(0);
}

//"There is no received byte for more than 1 byte time length"
//Called from interrupt
void HAL_UART_RxIdleCallback(UART_HandleTypeDef *huart) {
  // This is the number of bytes in the buffer *not* written:
  uint16_t remainingBuffer = huart->hdmarx->Instance->CNDTR;
  //RegisterRemainingBuffer_ISR() must handle the case where no new
  //data has been written.
  RegisterRemainingBuffer_ISR(remainingBuffer);
}

//Called from interrupt.
//Not enabled right now! The interrupt is disabled in STM32 HAL!
void HAL_UART_RxHalfCpltCallback(UART_HandleTypeDef *huart) {
  uint16_t remainingBuffer = huart->hdmarx->Instance->CNDTR;
  RegisterRemainingBuffer_ISR(remainingBuffer);
}

Before going the DMA route, check whether the MCU has separate DMA channels for the UARTs you wish to use in parallel. The 9600 baud UART is less important to use DMA with.
By the way, there's no functional advantage to relegate UART Tx to the task also dealing with UART Rx on a particular UART bus, since UART is full duplex. The important thing is to avoid race condition if multiple tasks use the same UART bus. Simply blocking until the bus is available, then doing a blocking write might be good enough.


text:
Q: Spring Autowire returning only one object from JSON Array of objects , when reading file from class path I am using Springboot application
<modelVersion>4.0.0</modelVersion>
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.6.7</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

My JSON Structure is below and I am reading it from a file in Classpath named: "source.json"
[
    {
        "id": "12345",
        "name": "Name 1",
        "key": "Key 1",
        "pdetails": "desc1"
    },
    {
        "id": "12346",
        "name": "Name 2",
        "key": "Key 2",
        "pdetails": "desc2"
    },
    {
        "id": "12347",
        "name": "Name 3",
        "key": "Key 3",
        "pdetails": "desc3"
    }
]

And I am using POJO Structure: TestPOJO.java
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

@Component
@PropertySource(value = "classpath:source.json")
@ConfigurationProperties

public class TestPOJO {
    String id;
    String name;
    String pdetails;
    String key;

    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getPdetails() {
        return pdetails;
    }
    public void setPdetails(String pdetails) {
        this.pdetails = pdetails;
    }
    public String getKey() {
        return key;
    }
    public void setKey(String key) {
        this.key = key;
    }

}

In my Controller I am using below code for autowire
@Autowired
private TestPOJO testData;

This code always returning only Last object of the JSON Array
its not returning all objects.
The output is below:
 [{
        "id": "12347",
        "name": "Name 3",
        "key": "Key 3",
        "pdetails": "desc3"
    }]

Can somebody help me what is wrong with my Code.


text:
Q: Cambiar el color de la barra de estado en versiones menores a Android 5.0 Tengo una duda respecto a la forma de poder cambiar el color de la barra de estado (StatusBar) de mi aplicación cuando la versión del SDK en el dispositivo sea mayor o igual a 4.0 (API 14).
Actualmente tengo lo siguiente para cuando el SDK es mayor o igual a la versión 5.0 (API 21) y la cual me funciona correctamente:
public class LoginActivity extends AppCompatActivity {

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);
    isColorNotifications();
  }

  ....
  ....

  private void isColorNotifications(){
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        Window window = getWindow();
        window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        window.setStatusBarColor(ContextCompat.getColor(getApplicationContext(), R.color.colorPrimaryDark));
    }
  }
}

Tal vez alguien me pueda dar alguna pista.
De antemano Gracias.

A: Buena pregunta, esto fue requerimiento del diseño en una de nuestras aplicaciones Android, por lo cual tuvimos la tarea de buscar como poder cambiar el color de la barra de estado.
Desafortunadamente nos encontramos que para dispositivos pre-Lollipop (-5.0) no hay forma en que programáticamente se pueda cambiar el color de la barra de estado, incluso difícilmente podría realizarse mediante una futura versión de la librería de soporte.

Importante comentar que esta información fue dicha por ingenieros de
  Google.


text:
Q: how to get the hibernate mysql database connection to android emulator I am new to Android development. How can I connect to a MySQL web server database in the Android emulator?
My web application database is connected via hibernate in a struts2 application. Please help me and send some code for struts and Android.

A: You don't provide much detail so it's not really possible to help you but here are a few thoughts. If your application is a web application you don't connect directly to MYSql through Android, you need to talk to the web server. You can do this in several ways either having the user use the normal site through the browser on Android, create a special version of the site optimized for mobile devices that the user would access through Android's browser, or using web services. If you want to create an Android application instead of having the user use the actual site on their device you'll need to research web services, any functionality requiring database access such as adding a record or listing records will then need to be exposed through web services and called from your Android app.


text:
Q: Negative Ratio - Is it possible I came across this problem recently where
$$A:B = C:A$$
and $B= -9$ and $C = -4$
What is $A$ then?
I got $A^2 = 36$  $\Rightarrow$ $A= \pm 6$
However, as far as my knowledge goes a ratio is always positive
Therefore, we could easily eliminate $A=+6$
and the answer remains $A=-6$
Is my explanation correct, if not then why so?
Can -ve Ratios exist?

A: Both $+6$ and $-6$ are correct answers. There is no rule that the ratio has to be positive.

A: Your work is correct, but it's possible to have a negative ratio. Therefore, both $A=6$ and $A=-6$ will satisfy the ratio.
It is true that a ratio between natural numbers will always be positive. That's because the natural numbers are the numbers $\{1,2,3,\ldots\}$. Since every natural number is positive, every ratio of natural numbers will be as well.
Since you're working with numbers like $-9$ and $-4$, however, it's clear that you're working with the set of integers, which are the numbers $\{ \ldots, -3, -2, -1, 0 , 1, 2, 3, \ldots\}$. Since some of the integers are negative and some are positive, we can definitely have a negative ratio between them.


text:
Q: bootstrap version 3 - how to use a custom image for specific media query I just downloaded bootstrap 3. ( not a custom version... just the standard one)  And I'm using the bootstrap carousel template for a prototype.
I've added some pictures in the carousel but now I'm wondering where / how I specify different versions of the same image for each device size?
For example, for large screens like desktops,I wnat to use a file called "logo_desktop.jpg" but for iphones, I want something like "logo_smallphone.jpg"
I can see in the bootstrap.css file that they have media queries there but it's not clear to me how to switch out the image depending on what device is connected.
Thanks.

A: There are a lot of ways to do this. I'll walk you through three of them. Also note, I usually use Bootstrap-Sass, so I'll show you how to do it with that version of the framework (LESS would be very similar).
1- Media queries aren't designed to switch between different assets like you are trying to do. You really want to use srcset, a new feature of CSS that automatically switches images based on the type of device connecting to your server (A List Apart has a great article on the concept).
srcset adds a new parameter to img tags in your HTML, and you provide the source set of imagery to the tag. The browser determines when / how to provide the assets. This gives you a big performance bump on image heavy sites because the browser only has to download one of the assets.
Your code would look something like this:

*

*srcset is where you provide the image declarations and their pixel widths. In this example, I'm saying your desktop image is 768px wide and the mobile image is 310px wide.

*sizes is how much space the image takes up on the page. In this example, I'm saying the desktop image takes up half the screen while the mobile image takes the full width of the screen.

*src acts like a fallback for browsers that don't understand any of the new parameters.

2- If you want to control image substitution with media queries, it's trickier but doable. Bootstrap does give you four breakpoints to use (see the documentation for more guidance):
@screen-xs-min / @screen-xs-max
@screen-sm-min / @screen-sm-max
@screen-md-min / @screen-md-max
@screen-lg-min / @screen-lg-max

You'd have to add the images as background images and use combination media queries to get the job done. A mobile-first approach would look something like this:
.my-logo-style {
  background-image: url('images/logo_smallphone.jpg');

  @media (min-width: @screen-sm-min) and (orientation: landscape) {
    background-image: url('images/logo_desktop.jpg');
  }
}

3- Lastly, you could also just show/hide images with media queries which incurs loading both images for your user but would probably get the job done.
HTML:

Sass:
.desktop {
  @media (max-width: @screen-sm-max) {
    display: none;
  }
}

.mobile {
    @media (min-width: @screen-sm-min) {
    display: none;
  }
}


text:
Q: How to update value after Ajax call synchroniously I'm fetching data from my node(express) backend server to react front end. But when I try to access the array index values I get the output as undefined. I sure am doing something wrong here. Appreciate if someone could help me.
Here's my server side code:
const companyDetails = [];

companies.forEach((company) => {
    companyDetails.push(company);
});

app.get("/api/companies", (req, res) => {
    res.json(companyDetails)
});

Here's my client side code:
let arr = [];

    function fetchComNames() {
        axios.get('/api/companies').then(res => {
          for(let i=0; i<=4; i++) {
              arr.push(res.data[i].name)
          }
        })
    }

    fetchComNames();

    console.log(arr[0]);   //undefined

But when I console.log(arr); it prints out the array. I just cant access each index value separately.

A: The problem here is that the axios call is an async call and the follow of your code is sync so when you execute this code javascript execute the sync code first then the async one so in this case the line of code onsole.log(arr[0]);
is executed before the response comes from the server

A: Adding to below answer, fetchComNames is asynchronously updated the arr as you're using API call. You're accessing the data before it has been updated, that's why getting undefined.
You can try this.

const fetchComNames = async () => {
    try {
      const response = await axios.get('/api/companies')
      const array = response.data.map(c => c.name)
      OR
      const array = []
      for (let i = 0; i<= 4; i++) {
        array.push(response.data[i].name)
      }
      console.log(array[0])
    } catch(err) {
      console.error(err)
    }
}

fetchComNames()

A: API calls are asynchronous so you are accessing the array before it has its values in it. Try marking your enclosing function as async and awaiting the axios get so that the call is forced to synchronous.
let arr = [];

    async function fetchComNames() {
      const fetched = await axios.get('/api/companies');
          for(let i=0; i<=4; i++) {
              arr.push(fetched.data[i].name)
          }

    }

    fetchComNames();

    console.log(arr[0])

A: (async () => {
    const arr = [];

    // Marking this function as async function so that
    // we can use await to wait until result returning
    // before further executing code below
    async function fetchComNames() {
        // I don't have access to you API
        // I resolve data after 1 second to simulate Ajax call here
        return new Promise(function(resolve, reject) {
            setTimeout(function() {
                resolve({
                    data: [{
                        name: "1"
                    }, {
                        name: "2"
                    }, {
                        name: "3"
                    }, {
                        name: "4"
                    }]
                });
            }, 1000);
        }).then(res => {
            return res.data.map(each => each.name)
        });
    }

    // You are calling Ajax call via Axios, which is a Promise.
    // It is executed asyncrhoniously.
    // If you need to use result from this call,
    // you need to wait until result returning from async call.
    // You can achieve it with await.

    // Update existing array
    arr.push(...(await fetchComNames()));

    // After await, arr should contain result you expected.
    console.log(arr[0]);

    // There reason why your version is not working
    // is because you are accessing the first cell of arr
    // wihich is still empty as the Axios is still running
    // and you are not waiting until it returns result.
})();


text:
Q: PHP: Using preg_split to split on empty lines I would like to split a multi-line string using using an empty line as a delimiter.
For example:
apple
aardvark
accordion

banana
bilby
banjo

cherry
cockatoo
cello

should give me results like:
Array
(
    [0] => apple
aardvark
accordion
[2] => banana
bilby
banjo
[3] => cherry
cockatoo
cello

I have tried the following:
$data=preg_split('/^$/m',$data);

but I get the following result:
Array
(
    [0] => apple
aardvark
accordion

    [1] =>
banana
bilby
banjo

    [2] =>
cherry
cockatoo
cello
)

That is, the results appear to include the leading and trailing empty line.
I have tried PREG_SPLIT_NO_EMPTY, but that only makes it worse: the result is a single string.
What should I do to split a string by empty lines?

A: Why not use the simple explode() function?

$str = "apple
aardvark
accordion

banana
bilby
banjo

cherry
cockatoo
cello" ;

 $arr = explode(PHP_EOL.PHP_EOL, $str);

Var_dump ($arr);

Output:
 array(3) {
 [0]=>
 string(24) "apple
 aardvark
 accordion"
 [1]=>
 string(18) "banana
 bilby
 banjo"
 [2]=>
 string(21) "cherry
cockatoo
cello"
}

https://3v4l.org/98CV8


text:
Q: Python Help - Learn Python The Hard Way exercise 41 "phrase = PHRASES[snippet]" I am learning python - this is my first programming language that I am learning. I am a little confused about one line of the code. The full code can also be found at http://learnpythonthehardway.org/book/ex41.html
import random
from urllib import urlopen
import sys

WORD_URL = "http://learncodethehardway.org/words.txt"
WORDS = []

PHRASES = {
"class %%%(%%%):":
    "Make a class named %%% that is-a %%%.",
"class %%%(object):\n\tdef __init__(self, ***)" :
    "class %%% has-a __init__ that takes self and *** parameters.",
"class %%%(object):\n\tdef ***(self, @@@)":
    "class %%% has-a function named *** that takes self and @@@ parameters.",
"*** = %%%()":
    "Set *** to an instance of class %%%.",
"***.***(@@@)":
    "From *** get the *** function, and call it with parameters self, @@@.",
"***.*** = '***'":
    "From *** get the *** attribute and set it to '***'."
}

# do they want to drill phrases first
PHRASE_FIRST = False
if len(sys.argv) == 2 and sys.argv[1] == "english":
PHRASE_FIRST = True

# load up the words from the website
for word in urlopen(WORD_URL).readlines():
WORDS.append(word.strip())

def convert(snippet, phrase):
class_names = [w.capitalize() for w in
                random.sample(WORDS, snippet.count("%%%"))]
other_names = random.sample(WORDS, snippet.count("***"))
results = []
param_names = []

for i in range (0, snippet.count("@@@")):
    param_count = random.randint(1,3)
    param_names.append(', '.join(random.sample(WORDS, param_count)))

for sentence in snippet, phrase:
    result = sentence[:]

    # fake class name
    for word in class_names:
        result = result.replace("***", word, 1)

    # fake other names
    for word in other_names:
        result = result.replace("***", word, 1)

    # fake parameter lists
    for word in param_names:
        result = result.replace("@@@", word, 1)

    results.append(result)

return results

# keep going until they hit CTRL-D
try:
while True:
    snippets = PHRASES.keys()
    # returns a randomly shuffled dictionary keys list
    random.shuffle(snippets)

    for snippet in snippets:
        phrase = PHRASES[snippet]
        question, answer = convert(snippet, phrase)
        if PHRASE_FIRST:
            question, answer = answer, question

        print question

        raw_input("> ")
        print "ANSWER:  %s\n\n" % answer
except EOFError:
print "\nBye"

It is the 11th line of code from the bottom that I don't quite understand: phrase = PHRASES[snippet]. Since snippet in for snippet in snippets: is looping through the keys of the randomized-shuffled PHRASES list, why can't the code simply be phrase = snippet. Thanks in advance for any help.
Cheers - Darren

A: get the value of key"snippet" in  the dictionary


text:
Q: expo-location not working in ios and not showing location permission in app settings I am trying to get current location in IOS 14, but i am getting no response and when i check in expo
settings it's not showing location permission there. I have checked in both simulator and physical device.
Hook Code
import { useEffect, useState } from "react";
import * as Location from "expo-location";

export default useLocation = () => {
  const [location, setLocation] = useState();

  const getLocation = async () => {
    try {
      const { granted } = await Location.requestPermissionsAsync();
      if (!granted) return;
      const {
        coords: { latitude, longitude },
      } = await Location.getLastKnownPositionAsync();
      setLocation({ latitude, longitude });
    } catch (error) {
      console.log(error);
    }
  };

  useEffect(() => {
    getLocation();
  }, []);

  return location;
};

Response
undefined

A: The docs says Location.getLastKnownPositionAsync() might return null:

Returns a promise resolving to an object of type LocationObject or
null if it's not available or doesn't match given requirements such as
maximum age or required accuracy.

so you should do something like:
import { useEffect, useState } from "react";
import * as Location from "expo-location";

export default useLocation = () => {
  const [location, setLocation] = useState();

  const getLocation = async () => {
    try {
      const { granted } = await Location.requestPermissionsAsync();
      if (!granted) return;
      const last = await Location.getLastKnownPositionAsync();
      if (last) setLocation(last);
      else {
        const current = await Location.getCurrentPositionAsync();
        setLocation(current);
      }
    } catch (error) {
      console.log(error);
    }
  };

  useEffect(() => {
    getLocation();
  }, []);

  return location;
};

A: use requestForegroundPermissionAsync() instead of requestPermissionAsync. and the problem is solved.


text:
Q: How to add timestamp in filename while exporting MatTable components? I am using mat-table-exporter npm module to export mat table components.
I am able to export it correctly with test as the name of the exported file.
<button mat-raised-button (click)="exporter.exportTable('csv', {fileName:'test',
   Props: {Author: 'myName'}})">
   Export
</button>

I also want to add timestamp in the name of the exported file for which I am modifying fileName
to test-{new Date()} as below:
<button mat-raised-button (click)="exporter.exportTable('csv', {fileName:'test-{new Date()}',
   Props: {Author: 'myName'}})">
   Export
</button>

The above code is throwing compile time errors.

A: Is there some specific reason why this export function can't be inside the .ts file of the component? It's way easier to debug then and it offer better configuration options.
exportTable(): void {
  this.exporter.exportTable('csv', {
    filename: `test-${new Date().toISOString()}`,
    Props: {
      Author: 'myName'
    }
  })
}

And then in template just call it.
<button mat-raised-button (click)="exportTable()">Export</button>

A: I solved in this form; in the file .ts put this
import { formatDate} from '@angular/common';
@Component({
    // ...
})
export class AppComponent  {
datenow = new Date();
formatted: string;
constructor() {
      this.nowFormatted = formatDate(this.datenow, 'dd-MM-yyyy', 'en-US');
   }
}

and in the HTML
put this
                    <button style="float: right;"  (click)="exporter.exportTable('xlsx', {fileName:'Applications_'+formatted})">
                    <img src="../../../assets/iconos/excel.png" alt="" />
                    </button>

the formatted variable in ts is now formated with the currentDate.
I hope I've helped


text:
Q: How can i change the value of an element in an object from extrareducer redux This is the initial state:
const initialState ={
  ordersWholesale:[
    {
      "id": 14,
      "name": "XTPara 650mg Tablet",
      "code": "XTP5656",
      "date": "17/10/2022",
      "accepted": null,
      "wholesale": "shakthi",
      "quantity": "5"
    },
    {
      "id": 15,
      "name": "Dolo 650 Tablet",
      "code": "DOL1213",
      "date": "17/10/2022",
      "accepted": false,
      "wholesale": "shakthi",
      "quantity": "5"
    },
  ],
}

This is the slice reducer
extraReducer: {
  [asyncOrderAccept.fulfilled]: (state, { payload }) => {

  }
}

How can I change only the value orderWholesale[0]['accepted']: true using the payload value which is 14?

A: If I'm understanding your question correctly that the action payload is the id of the ordersWholesale state element you want to toggle true, then you'll need to search the array to find the correct element by id and then update that element. Keep in mind that state is the ordersWholesale array and that Array.prototype.find potentially returns undefined if no match is found.
extraReducer: {
  [asyncOrderAccept.fulfilled]: (state, { payload }) => {
    const el = state.find(order => order.id === payload);
    if (el) {
      el.accepted: true,
    }
  },
}

This may also work for you if you can use Optional Chaining.
extraReducer: {
  [asyncOrderAccept.fulfilled]: (state, { payload }) => {
    state.find(order => order.id === payload)?.accepted = true;
  },
}


text:
Q: edit/delete table with pop-up I wanted to add edit & delete button inside table.on click of edit and delete buttons opens a popup where we can change the values and give update in pop-up, which will update in table in angular.

A: This is possible, you could for example place buttons in a table cell and implement necessary logic in the click event.
Full example with working delete button based on Angular Material documenation in this stackblitz:
https://stackblitz.com/edit/angular-slhbob?file=src/app/table-basic-example.ts
Here the crucial code snippets:
Adding Buttons in table row:
  <ng-container matColumnDef="actions">
    <th mat-header-cell *matHeaderCellDef>Actions</th>
    <td mat-cell *matCellDef="let element">
      <button mat-raised-button (click)="onEdit(element)">Edit</button>
      <button mat-raised-button (click)="onDelete(element)">Delete</button>
    </td>
  </ng-container>

Deleting elements from the data source:
onDelete(element: PeriodicElement): void {
    const indexToDelete = this.dataSource.findIndex(
      (periodicElement) => periodicElement.position === element.position
    );
    ELEMENT_DATA.splice(indexToDelete, 1);
    this.dataSource = ELEMENT_DATA;
    this.table.renderRows();
  }


text:
Q: Angular NX workspace: getting error "Required property 'main' is missing I have a project that's being split apart using nx workspaces. Some of the workspaces give the error:
Required property 'main' is missing

when running the nx test command, and some don't. There seems to be nothing that would cause this in nx.json. Here is the relevant content of my angular.json:
{
  "version": 1,
  "cli": {
    "defaultCollection": "@nrwl/angular",
    "analytics": false
  },
  "schematics": {
    "@nrwl/angular": {
      "application": {
        "linter": "eslint"
      },
      "library": {
        "linter": "eslint"
      },
      "storybook-configuration": {
        "linter": "eslint"
      }
    },
    "@nrwl/angular:application": {
      "style": "scss",
      "linter": "eslint",
      "unitTestRunner": "jest",
      "e2eTestRunner": "cypress"
    },
    "@nrwl/angular:library": {
      "style": "scss",
      "linter": "eslint",
      "unitTestRunner": "jest"
    },
    "@nrwl/angular:component": {
      "style": "scss"
    }
  },
  "newProjectRoot": "apps",
  "projects": {
    "pricing": {
      "projectType": "application",
      "root": "apps/pricing",
      "sourceRoot": "apps/pricing/src",
      "prefix": "trade-ops",
      "architect": {
        "build": {
          "builder": "ngx-build-plus:browser",
          "options": {
            "outputPath": "dist/apps/pricing",
            "index": "apps/pricing/src/index.html",
            "main": "apps/pricing/src/main.ts",
            "polyfills": "apps/pricing/src/polyfills.ts",
            "tsConfig": "apps/pricing/tsconfig.app.json",
            "aot": true,
            "assets": [
              {
                "glob": "*",
                "input": "libs/gav-shared/Assets/Icons/",
                "output": "assets/"
              },
              "apps/pricing/src/assets"
            ],
            "styles": ["apps/pricing/src/styles.scss"],
            "scripts": []
          },
          "configurations": {
            "production": {
              "optimization": true,
              "outputHashing": "none",
              "sourceMap": false,
              "namedChunks": false,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "budgets": [
                {
                  "type": "initial",
                  "maximumWarning": "10mb",
                  "maximumError": "25mb"
                },
                {
                  "type": "anyComponentStyle",
                  "maximumWarning": "6kb",
                  "maximumError": "10kb"
                }
              ]
            }
          }
        },
        "serve": {
          "builder": "ngx-build-plus:dev-server",
          "options": {
            "browserTarget": "pricing:build"
          },
          "configurations": {
            "production": {
              "browserTarget": "pricing:build:production"
            }
          }
        },
        "extract-i18n": {
          "builder": "@angular-devkit/build-angular:extract-i18n",
          "options": {
            "browserTarget": "pricing:build"
          }
        },
        "lint": {
          "builder": "@nrwl/linter:eslint",
          "options": {
            "lintFilePatterns": [
              "apps/pricing/src/**/*.ts",
              "apps/pricing/src/**/*.html"
            ]
          }
        },
        "test": {
          "builder": "ngx-build-plus:karma",
          "outputs": ["coverage/apps/pricing"],
          "options": {
            "jestConfig": "apps/pricing/jest.config.js",
            "passWithNoTests": true
          }
        }
      }
    },
    "pricing-e2e": {
      "root": "apps/pricing-e2e",
      "sourceRoot": "apps/pricing-e2e/src",
      "projectType": "application",
      "architect": {
        "e2e": {
          "builder": "@nrwl/cypress:cypress",
          "options": {
            "cypressConfig": "apps/pricing-e2e/cypress.json",
            "tsConfig": "apps/pricing-e2e/tsconfig.e2e.json",
            "devServerTarget": "pricing:serve"
          },
          "configurations": {
            "production": {
              "devServerTarget": "pricing:serve:production"
            }
          }
        },
        "lint": {
          "builder": "@nrwl/linter:eslint",
          "options": {
            "lintFilePatterns": ["apps/pricing-e2e/**/*.{js,ts}"]
          }
        }
      }
    },
// Other projects...
  },
  "defaultProject": "trade-operations"
}

It also gives this error when running "nx test" (on the default project).

A: Oh, ha! In posting my question, I noticed that I had the line:
"builder": "ngx-build-plus:karma"

That was setting up my tests for karma, even though I'm using Jest.


text:
Q: how to hide data/message of push notification in android I have successfully implement the fcm notification using java server but I want to show only one string in notification instead of all message so how to hide data and send only some  data of message.
for e.g "refresh data common" I want to show only refresh data in notification message and hide common but common word requires on app side.
private void showSmallNotification(NotificationCompat.Builder mBuilder, int icon, String title, String message, PendingIntent resultPendingIntent, Uri alarmSound)
{
    NotificationCompat.InboxStyle inboxStyle = new NotificationCompat.InboxStyle();

    inboxStyle.addLine(message);

    Notification notification;
    notification = mBuilder.setSmallIcon(icon).setTicker(title).setWhen(0)
            .setAutoCancel(true)
            .setContentTitle(title)
            .setContentIntent(resultPendingIntent)
            .setSound(alarmSound)
            .setStyle(inboxStyle)
           /* .setSmallIcon(R.drawable.space)*/
            .setLargeIcon(BitmapFactory.decodeResource(mContext.getResources(), icon))
            .setContentText(message)
            .build();

    NotificationManager notificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
    notificationManager.notify(Config.NOTIFICATION_ID, notification);
}

In this code I have pass only "refresh data" but it show all"{message=refresh data common}".


text:
Q: Is SQL 2008 Express R2 really free like 2005 Express is? About to download it, keeps talking about "evaluation" and "evaluating SQL 2008 R2" and want to be sure it doesn't expire after 60 days or something.

A: Yes it's free and not limited to 60 days trial. Make sure you're downloading it from here, just in case you've clicked on the wrong link.
I've just gone to download it and it's definately confusing wording, but it's probably refering to a newsletter or some other spam.


text:
Q: Create enum Z3 constant issue in C# API I have an enum in C#:
public enum CustomerType
{
    Premium,
    Gold,
    Regular
}

I have created an enum sort like this:
var enumSort = context.MkEnumSort("CustomerType", "Premium", "Gold", "Regular");

How can I create the Z3 constant corresponding to CustomerType.Premium for instance?
Trying context.MkConst("Premium", enumSort); produces an enum sort that can take any CustomerType value.

A: I'm not an expert on Z3 C# bindings, but here's an example that can possibly help: https://github.com/Z3Prover/z3/blob/master/examples/dotnet/Program.cs#L1466-L1501

A: I have achieved this using:
sort.As<EnumSort>().Consts.First(x => x.FuncDecl.Name.ToString() == "Premium").