text:
Q: How can I make a pull request for a wiki page on GitHub? I saw a wiki page on GitHub that isn't open for editing. Then I forked the project, edited it on "my end" and tried to do a pull request. It turns out, the wiki isn't in the project, and there isn't a way to commit changes to it.
Other than e-mailing, is there a way to proceed if I want to suggest a change on the wiki in this case?
At this point I found out what seems like an alternative under "Questions with similar titles", but I couldn't do the pull request with it yet, and so I'm not sure submodules is a good way for this purpose. I now see I could probably branch it somehow... So is this the way to go?

A: I've taken a different approach to this, which is to push exactly the same content into both the main repo and the wiki.  This won't be to everyone's taste, but Risk-First is mainly a wiki with a few Jekyll pages in the main repository.
This means the pull request/fork process works fine.  However, after merging a pull-request, I have to do the extra step of pulling to my local repository and then pushing to both the main repository and the wiki, which Git supports fine with multiple origin URLS:
localhost:website robmoffat$ git remote show origin
* remote origin
  Fetch URL: git@github.com:risk-first/website.git
  Push  URL: git@github.com:risk-first/website.wiki.git
  Push  URL: git@github.com:risk-first/website.git
  HEAD branch: master

In order to achieve this, I merged the commits from both repositories following this:
How do you merge two Git repositories?
And then push to both repositories like this:
Git - Pushing code to two remotes

A: You can't do a pull request, but you can open an issue, paste a link to your wiki page, and let them merge in your wiki page to their wiki page.
Wikis on GitHub are full git repositories, so you can treat them as such. Therefore, the following works.
In short:
They just need to clone your wiki page repository, (git clone YOUR_FORKED_REPO.wiki.git), squash all of your wiki commits into one big commit, then cherry-pick this big squashed commit onto their repository. That will bring in all of your wiki changes into their wiki.
Full instructions:
(Copied from Larry Botha's GitHub gist here: Merge wiki changes from a forked GitHub repository):

Merge Wiki Changes From A Forked GitHub Repo
This is inspired (or basically copied) from How To Merge GitHub Wiki Changes From One Repository To Another, by Roman Ivanov, and serves to ensure that should something happen to the original article, the information remains nice and safe here.
Terminology
OREPO: original repo - the repo created or maintained by the owner
FREPO: the forked repo that presumably has updates to its wiki, not yet on the OREPO
Contributing
Should you want to contribute to the wiki of a repo you have forked, do the following:

*

*fork the repo

*clone only the wiki to your machine:
$ g clone [FREPO].wiki.git

*make changes to your local forked wiki repo

*push your changes to GitHub

Once you are ready to let the author know you have changes, do the following:

*

*open an issue on OREPO

*provide a direct link to your wiki's git repo for ease of merging:
i.e. [FREPO].wiki.git

Merging Changes
As the owner of OREPO, you have now received a message that there are updates to your wiki on someone else's FREPO.
If wiki changes are forked from latest OREPO wiki, you may do the following:
$ git clone [OREPO].wiki.git
$ cd [OREPO].wiki.git

# squashing all FREPO changes
$ git pull [FREPO].wiki.git master

$ git push origin master

If OREPO wiki is ahead of where FREPO forked from, do the following:
$ git clone [OREPO].wiki.git
$ cd [OREPO].wiki.git
$ git fetch [FREPO] master:[FREPO-branch]
$ git checkout [FREPO-branch]

# Check out to last OREPO commit
$ git reset --hard [last-OREPO-commit-hash]

# Do massive squash of all FREPO changes
$ git merge --squash HEAD@{1}
$ git commit -m "Wiki update from FREPO - [description]"
$ git checkout master

# Cherry-pick newly squashed commit
$ git cherry-pick [OREPO-newly-squashed-commit]
$ git push

A: We have found the best solution for the problem so far in https://devonfw.com:

*

*Put your documentation into the Git repository together with the code inside a documentation folder.

*Extend your Travis CI build with some magic that stages all changes from that documentation folder with transformations applied to the wiki Git. See last example link below.

*Consider the wiki as read-only view on the documentation. Please note that with github.com you can still view and directly edit the files in the documentation folder. So you still can fix typos within the browser within seconds (even as PR without permissions on the repo) - just not via the wiki.

*When a contributor forks, he/she also has the documentation with the code. He/she can change both in one PR and all gets reviewed in the same process, so after merge, code and documentation remains in sync. Still you have the nicer UX for reading documentation in the wiki with sidebar, etc.

As we are 100% OSS, we love to share our hard efforts to come to this great solution. Here are the links as example:

*

*https://devonfw.com/website/pages/docs/master-devon4j.asciidoc_introduction.html

*Architecture

*devon4j, Architecture

*devonfw for Java 3.2.0 (2019)

*devon4j/.travis.yml

A: GitHub doesn't support pull requests for the wiki repository, only the main repository (this is a bit of a shame, IMO, but I can understand it).
Here's an interesting way one project manages community updates to their wiki, while still keeping tight control, as for source code:

My proposed workflow is this:

*

*Manually create a fork of the Taffy wiki on your Github account:

*

*Create a new repository on your github account. Let's call it "Taffy-Wiki".

*Clone the Taffy wiki repo to your local machine somewhere: git clone git@github.com:atuttle/Taffy.wiki.git

*Remove the original "origin" remote and add your github repo as new "origin" git remote rm origin and git remote add origin git@github.com:<YOUR_USERNAME>/Taffy-Wiki.git

*Make your proposed changes locally, then push them to your github account: git push -u origin master ('-u origin master' only required the first time; afterwards just do git push)

*Submit a ticket to the official Taffy issue tracker requesting me to review your changes and merge them in. Please be sure to include a link to your repo and describe what you've changed.

*Goto #2

(From  How you can contribute to Taffy documentation.)
If it were me, I'd create an issue in the main repository (that is, the one you forked) suggesting an update to the wiki. If issues aren't enabled, then email's about the only other option I can think of.

A: If you are ok to have a single page long document (I actually like it more), you can hijack the README.MD and put the content of the wiki there.
Not only it will be tracked as part of the normal repository, it will also be displayed on the home page.
It can be made to start with a quick reference and then get into more detailed description/instructions, so that the regular users will hit first the more generic information.

A: GitHub now supports this and you can find details at Adding or editing wiki pages.
It's treated as a "normal" repository now, with branches, pull requests, commits, etc.

A: In addition to the @Gabriel Staples answer, you could also create a git patch file and attach it when you create an issue on the upstream repo. That way they can easily apply it...


text:
Q: XAMARIN iOS iPad Pro Fullscreen Issue have somebody also the problem with the new iOS 13.4.1 and the fullscreen mode?
My App should look like this:

But it looks like this if I am using new iOS:

I am using Xamarin with C#.

redpajama_set_name: RedPajamaStackExchange


text:
Q: how can i add animate function here i am trying to show some div contents when user click a show more button and then hide the div contents when user click a hide button, i want to make this function with some animation. here is my script :
$(document).ready(function(){  //Toggling between more results
    $('.loadMoreDiv').click(function(){
        $('#loadMoreDiv').hide();
        $('#hideMoreDiv').show();
        $('.old_message_block').removeClass('inactive').addClass('active');
        $('#messagesLabel').text('showing all messages');
    });
    $('.lessMoreDiv').click(function(){
        $('#hideMoreDiv').hide();
        $('#loadMoreDiv').show();
        $('.old_message_block').removeClass('active').addClass('inactive');
        $('#messagesLabel').text('Most Recent message');
    });
});

and my jsfiddle is here

A: A quick fix: http://jsfiddle.net/sureshpattu/JkuW3/1/
But I'd write that thing completely different anyway:
http://jsfiddle.net/UPWpB/1/

A: Use jQUery fadeOut() and fadeIn() like so:
$(document).ready(function(){  //Toggling between more results
    $('.loadMoreDiv').click(function(){
        $('#loadMoreDiv').hide();
        $('#hideMoreDiv').show();
        $('.old_message_block').fadeIn();
        $('#messagesLabel').text('showing all messages');
    });
    $('.lessMoreDiv').click(function(){
        $('#hideMoreDiv').hide();
        $('#loadMoreDiv').show();
        $('.old_message_block').fadeOut();
        $('#messagesLabel').text('Most Recent message');
    });
});

Edit: Applied the functions to the correct elements.

A: Try this,
 $(document).ready(function(){
   //Toggling between more results

   $('.loadMoreDiv').click(function(){
     $('#loadMoreDiv').hide();
     $('#hideMoreDiv').show();
     $('.old_message_block').slideDown(500).removeClass('inactive').addClass('active');
     $('#messagesLabel').text('showing all messages');
   });

   $('.lessMoreDiv').click(function(){
     $('#hideMoreDiv').hide();
     $('#loadMoreDiv').show();
     $('.old_message_block').slideUp(500).removeClass('active').addClass('inactive');
     $('#messagesLabel').text('Most Recent message');
   });

 });

A: try
$('#clickme').click(function() {
  $('#book').toggle('slow', function() {
    // Animation complete.
  });
});

show this link http://api.jquery.com/toggle/


text:
Q: Real time update content from database I have beggining php this week so i don´t have experience. I want to know how i can make real time update (without refreshing page) data from a database.
If i have this database:
section  | himidity

1        | 5

2        | 40

3        | 30

4        | 25

5        | 26

How can i update the value in real time since the humidity is always changing?
Many thanks

A: I've found a code that update each second but only refresh the date:

update

What i have to change to give the update from the database?
Thanks


text:
Q: reading file and storing data in python I have a text file which has data in following format:
*NODE
   5100387,  54.799831647418,  -4.147024550067,  22.466648807633
*ELEMENT,TYPE=C3D10M,ELSET=HEAD-R
   5446424,   6192081,   5849509,   5849511,   6182919,   6820540,   5210471,  6611315,
   6611314,   6459296,   6611316

I want to read this file and store node information in a node tuple and element information in a element tuple.
node = (5100387,  54.799831647418,  -4.147024550067,  22.466648807633)
element = (5446424,   6192081,   5849509,   5849511,   6182919,   6820540,   5210471,  6611315, 6611314,   6459296,   6611316)

and store element type and elset in variables.
Thanks.
*Please see there is a break in element information.

A: You can do this with a regular expression.
r"\*NODE\n(.+\n)\*ELEMENT.+\n(.+\n.+)"

To utilize this regex you will need to pass the MULTILINE flag.
regex = re.compile(r"\*NODE\n(.+\n)\*ELEMENT.+\n(.+\n.+)", re.MULTILINE)

This regex will capture two groups, which we utilize to build your node and element tuples.
import re

regex = re.compile(r"\*NODE\n(.+\n)\*ELEMENT.+\n(.+\n.+)", re.MULTILINE)
record = """*NODE
   5100387,  54.799831647418,  -4.147024550067,  22.466648807633
*ELEMENT,TYPE=C3D10M,ELSET=HEAD-R
   5446424,   6192081,   5849509,   5849511,   6182919,   6820540,   5210471,  6611315,
   6611314,   6459296,   6611316"""

matches = re.match(regex, record)

nodes = tuple([x.strip() for x in matches.group(1).split(",")])
elements = tuple([x.strip() for x in matches.group(2).split(",")])

We utilize each capture group to build a list of nodes and elements. This is accomplished with these two lines:
[x.strip() for x in matches.group(1).split(",")]
[x.strip() for x in matches.group(2).split(",")]

We split the captured string on commas (,) and then strip white space from each element. At the end of the above lines, we what two sets of lists. The first (group(1)) contains the nodes. The second (group(2)) contains the elements.
Finally, since it was requested that these are tuples, we convert the list to tuples by wrapping the list comprehension. Side note: You may not actually need these to be tuples, a list could work just as well depending on what the rest of your application does and expects.

The nodes and elements contain these values after running the above code.
('5100387', '54.799831647418', '-4.147024550067', '22.466648807633')
('5446424', '6192081', '5849509', '5849511', '6182919', '6820540', '5210471', '6611315', '6611314', '6459296', '6611316')

A: You probably want to use open() to read the file as a string into python. Then you can parse the string for the information you want and store it in the appropriate variables.
Read more about open.


text:
Q: Search A Variable in Specific Column in BASH with awk I have LOG_FILE like below:
LOG|Server301|2015|05|12|00|58|35|572617|0|COMP|002.01.003.00|DSOHMSN2ViewCallback.cpp|142|CALLBACK:DSOHMSN2ViewCallback::FLIPBypassOn Changed SN=2 old value =2 new value =1
LOG|Client2|2015|05|12|00|58|35|593088|0|COMP|002.01.003.00|AMSN.cpp|12577|CALLBACK:OHMOAM::ohmSN2ViewChange, Old FLIPBypassOnMT
LOG|Server302|2015|05|12|00|58|35|593116|0|COMP|002.01.003.00|AMSN.cpp|12590|CALLBACK:OHMOAM::ohmSN4ViewChange, New FLIPBypassOnMT
LOG|Server301|2015|05|12|00|58|35|593302|0|COMP|002.01.003.00|AMSN.cpp|12577|CALLBACK:OHMOAM::ohmSN3ViewChange, Old disableFLIPBypassOnMT
LOG|Client1|2015|05|12|00|58|35|593324|0|COMP|002.01.003.00|AMSN.cpp|12590|CALLBACK:OHMOAM::ohmSN2ViewChange, New disableFLIPBypassOnMT

I just want to print line no which have

*

*word Server at 2nd column

*word CALLBACK at 15th column

*variable $parameter_name at 15th column
I executed the below command:
parameter_name="FLIPBypassOnMT"
$(awk -v var="$parameter_name" -F'|' '$2 ~ /Server/ && $15 ~ /CALLBACK/  && index($15,var) { print NR}' $LOG_FILE 2>/dev/null | tail -1)

But Not getting the line no.
I am using sun4-solaris.
please help me out.
N.B:
$(awk -v var="$parameter_name" -F'|' '$2 ~ /Server/ && $15 ~ /CALLBACK/ { print NR}' $LOG_FILE 2>/dev/null | tail -1)

is running fine.
but need all the three criteria.

A: Have you tried
$(awk -v var="$parameter_name" -F'|' '$2 ~ /Server/ && $15 ~ /CALLBACK/  && $15 ~ var { print NR}' $LOG_FILE 2>/dev/null | tail -1)

I'm not sure why you used the index function when you can use the ~ regex operator again.

A: I would suspect that the problem lies elsewhere.
If
awk blah blah

prints 23 then
$(awk blah blah)

will attempt to execute 23 as a shell command (and usually fail).  Remove the  process substitution at least while  debugging this problem.
Tangentially,  some Sun systems have a very  limited Awk, but I guess that's not the problem here. Still, you might want to google for "Solaris XPG4 Awk".

A: thanks both of you @tripleee and @bkmoney
I have used the below command and works fine:
$(nawk -v var="$parameter_name" -F'|' '$2 ~ /Server/ && $15 ~ /CALLBACK/  && $15 ~ var { print NR}' $LOG_FILE 2>/dev/null | tail -1)


text:
Q: How does the output jump up to 7.5 volts when the switch is closed and opened again? Sorry if the question might sound dumb. In this circuit, when the switch is closed the output voltage drops to zero and then rapidly charges back up to 5 volts. My question being, when the switch is opened up back again, the voltage spikes up to 7.5 bolts as shown in the oscilloscope figure attached. I am confused as the direction of the current would be the opposite of what it used to be when the switch is closed. Can anyone help me with understanding the behavior of this circuit? thanks!

A: The successive steps shown in the schematic below will aid in understanding the following discussion points:

simulate this circuit – Schematic created using CircuitLab

*

*Here, capacitor \$C_1\$ has long been discharged so the voltage difference across its leads is \$0\:\text{V}\$. So there is no current in \$R_1\$ or \$R_2\$ and therefore no voltage drop across either resistor. The output voltage will be \$5\:\text{V}\$.

*Now the switch is closed. \$R_2\$ has its own current but doesn't participate in charging \$C_1\$ so I removed it as "distracting" so that you can focus on the capacitor charging activity. \$V_\text{OUT}\$ will rise, exponentially, until it reaches \$V_\text{OUT}=+5\:\text{V}\$ and then the charging process stops.

*The switch is re-opened and the circuit returns to the configuration shown in step 1 above. However, there is a difference. Now, node \$N_2\$ is \$+5\:\text{V}\$ relative to node \$N_1\$. Because of this, current immediately starts flowing through \$R_1\$ and then through \$R_2\$ in order to start discharging \$C_1\$ via this path. The two resistors have the same value, so their mid-point (which is attached to a \$+5\:\text{V}\$ voltage source) will be half-way between or \$2.5\:\text{V}\$ lower than node \$N_2\$ and \$2.5\:\text{V}\$ higher than node \$N_1\$. So it must be the case, right after opening the switch, that \$V_{\text{N}_1}=+2.5\:\text{V}\$ and \$V_{\text{N}_2}=+7.5\:\text{V}\$. Note that there is still just the original \$5\:\text{V}\$ voltage difference across \$C_1\$. That didn't change (yet.) But now \$V_\text{OUT}\$ must initially start higher than \$+5\:\text{V}\$ (by the voltage drop across \$R_1\$.) Now, \$C_1\$ discharges via the two resistors and eventually returns to its discharged state. In the meantime, the current through the two resistors declines and therefore also the voltage at \$V_\text{OUT}\$ gradually returns to \$+5\:\text{V}\$.

You can adjust the ratio of \$R_1\$ and \$R_2\$ to get different peak voltages. For example, if you change \$R_1\$ to \$2\:\text{k}\Omega\$ then \$V_\text{OUT}\$ will rise above \$8.3\:\text{V}\$ for a short time -- more than the \$7.5\:\text{V}\$ you see in your trace.


text:
Q: UITableViewHeader doesn't maintain position when device rotates I seem to be having issues with my UITableViewHeaderView not maintaining its position at the top when the device rotates. What seems to be happening is once the device rotates to landscape, the header completely disappears at the top. When I then rotate it back to portrait, the header seems to become massive and not reset to its original size. The header itself has imageviews and labels laid out inside the view using auto-layout.
Is there a way to adjust the header to stay where it is when the device rotates? I've tried looking at other questions but can't find a solution.

A: Some thing to try is to use UITableViewHeaderFooterView and put the content inside the contentView property.


text:
Q: How to set ExpandableListView child as not enabled Is there a way to set a child on an ExpandableListView as not enabled? I have a header in the children group and I don't want it to be highlighted when clicked. Not an actual header, just a child with a different layout.
What I'm looking for is something like ListAdapter#isEnabled() but there is no such method in the ExpandableListAdapter class.

A: Use isChildSelectable. This will allow you to set the group/child as selectable or not. Selectable is synonymous to enabled.


text:
Q: Problems with connection between PC and Android device - SocketException When i tryed to connect from PC to android device, i caught a socket exception "No Connection could be made because the target machine actively refused it".
Code of a server at android device:
private void networkOperations()
{
    Thread networkThread = new Thread (null, doBackgroundThreadProcessing, "Network");
    networkThread.start();
}

private Runnable doBackgroundThreadProcessing = new Runnable()
{
    public void run() {
        backgroundThreadProcessing();
    }
};

private void backgroundThreadProcessing()
{
    Socket s = null;
    ServerSocket ss = null;
    try {
        ss = new ServerSocket(8867);
    } catch (IOException e) {
        e.printStackTrace();
    }
    while(!Thread.currentThread().isInterrupted())
    {
        try {
            if (s == null)
                s = ss.accept();
            BufferedReader input = new BufferedReader(new InputStreamReader(s.getInputStream()));
            String st = null;
            st = input.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

networkOperations() is calling in the onCreate() method of the Main Activity.
Code of a client at PC(C#):
class Connection
{
    public Connection(String ip, String port)
    {
        Ip = IPAddress.Parse(ip);
        Port = Convert.ToInt32(port);
    }

    public IPAddress Ip
    {
        get;
        set;
    }

    public Int32 Port
    {
        get;
        set;
    }

    public Boolean ConnectionError;

    public Socket S;

    public void ConnectToServer()
    {
        IPEndPoint ipe = new IPEndPoint(Ip, Port);
        S = new Socket(ipe.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
        try
        {
            S.Connect(ipe);
        }
        catch (SocketException e)
        {
        }
    }

Can anyone help me with this problem please? Thanks.

A: Based on the comments, there are two things you should pay attention. First, you are contacting a device in your local network from your local network using the public address. I'm not sure that all of the routers will be able to do this properly, but nevertheless you need to forward the 8867 port if you want public access. Try it, it may help.
Search your router here and you will find an explanation how to do that:
http://portforward.com/
The phone should certainly be available when accessing the phone from outside the network after forwarding. Of course, your phone should always have the same local address. Reserve it in the router settings or set it manually on the phone.
For testing purposes, try to use the phones local IP address from your PC.


text:
Q: convert array of strings from CGO in GO Can I convert an array of strings (char**) returned from a C (cgo) function in Go?
The code below compiles and runs, but I'm unable to range through a list of strings.
And I'm not even sure if it breaks the rules on "passing pointers": https://golang.org/cmd/cgo/
Any thoughts would be helpful, it's been years since I coded in C!  Thanks in advance!
package main
/*
#include "stdlib.h"

char** getlist ()
{
    char **array = NULL;
    array = (char**)realloc(array, 2*sizeof(*array));
    array[0]="HELLO";
    array[1]="WORLD";
    return array;
}

*/
import "C"

import (
    "log"
    "unsafe"
)

func main() {
    list := C.getlist();
    log.Printf("\n========\n C.getList()=%s", list)
    ulist := unsafe.Pointer(list)
    log.Printf("\n========\nulist=%s", ulist)
}

A: In order to iterate over the strings in Go, you need to convert the array to a Go slice. We can skip allocation here, and convert it directly (your example statically sets the length to 2, but in practice you would likely have another source for this size)
cSlice := (*[1 << 28]*C.char)(unsafe.Pointer(list))[:2:2]

We can iterate over this directly, and use the C.GoString function to convert the C strings. This is safer to store since it's copying the data to Go memory, but if this slice were exceptionally large we could save the allocation with the same unsafe conversion as above, though you would first need to find the length of each string.
var slice []string
for _, s := range (*[1 << 28]*C.char)(unsafe.Pointer(list))[:2:2] {
    slice = append(slice, C.GoString(s))
}

A: After a couple hours of browsing, I found this concise solution (source):
list := C.getList()
length := 2
slice := make([]string, length)
for _, v := range unsafe.Slice(list, length) {
    slice = append(slice, C.GoString(v))
}

For your length guessing issue, you can just make your C function take a pointer to a string array and return the size. It would then look like this:
var list **C.char
length := C.getList(&list)
slice := make([]string, length)
for _, v := range unsafe.Slice(list, length) {
    slice = append(slice, C.GoString(v))
}


text:
Q: Fuchsian groups and automorphisms of Riemann surfaces Let $\Gamma \subseteq PSL_2(\mathbb{R})$ be a Fuchsian group, possibly containing elliptic elements. Is it true that $N(\Gamma) / \Gamma$, where $N(\Gamma)$ the normalizer of $\Gamma$ in $PSL_2(\mathbb{R})$, is isomorphic to the automorphism group of $\Gamma \backslash \mathcal{H}^*$?
Here, $\mathcal{H}^*$ is the union of the upper-half plane and the set of cusps of $\Gamma$.
If so, can you point me to a reference, please?

A: The compact Riemann surface $\Gamma\backslash\mathcal H^*$ may have authomorphisms that do not preserve the set of points corresponding to the cusps of $\Gamma$, so I believe the answer is no.

A: How about $\Gamma = PSL_2(\mathbf{Z})$, where $N(\Gamma)/\Gamma)$ is the trivial group but the automorphism group of $\Gamma \setminus \mathcal{H}^*$ is infinite?
In general the best you can do is that you have a map $N(\Gamma) \to \mathrm{Aut}(\Gamma \setminus \mathcal{H}^*)$ whose kernel is $\Gamma$. If you have no cusps, then you can say something else.


text:
Q: Place LinearLayout below FrameLayout with ListView I want to place a LinearLayout below a FrameLayout which contains a ListView, but the content of the LinearLayout is not shown.
I also tried this out with a surrounding LinearLayout instead of the RelativeLayout without success.
The FrameLayout cannot be changed to different layout type!
The LinearLayout below will be shown and hidden programmatically.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

<FrameLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_above="@id/framelayout_container" >

    <ListView
        android:id="@+id/content_list"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:divider="#FFFFFF"
        android:dividerHeight="1dp"
        android:padding="0dp" >
    </ListView>

    <LinearLayout
        android:id="@+id/description_container"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/white" >

        <include
            android:id="@+id/description_layout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            layout="@layout/included_layout" />
    </LinearLayout>
</FrameLayout>

<LinearLayout
    android:id="@+id/below_container"
    android:layout_width="match_parent"
    android:layout_height="0dip"
    android:layout_alignParentBottom="true"
    android:background="#33b5e5" >

    <include
        android:id="@+id/below_layout"
        layout="@layout/below_layout"
        android:visibility="visible" />
</LinearLayout>
</RelativeLayout>

Any ideas how to get this work?

A: The problem is your FrameLayout is set to match the parent width and height, so it will leave no room for the LinearLayout beneath it. You would need to revise it to use its layout_height set to wrap_content, and change the inner ListView to do the same.


text:
Q: Filepicker.io widget appending to "window.history" The Filepicker.io modal widget (specifically the "IMAGE_SEARCH" service) appends to the window.history in the DOM after a search is made. This creates an issue working with Backbone.js when attempting to go back a previous page.
What causes this, and is there any way to prevent it?
[edit] Incorrectly referenced "IMAGE_SEARCH"

A: What causes this:
Navigation around the modal manipulates window.location.hash for compatibility with the window view and a number of other conveniences. Why these changes are affecting the window.history outside the iframe sandbox, I'm not sure.
How to prevent it:
I'm looking into whether we are leaking state somehow, but one easy way to prevent it is to use the {container: 'window'} option for filepicker.pick(), so that the dialog is created in a separate window.


text:
Q: NavigationUI.setupActionBarWithNavController and setupActionBarWithNavController I'm learning android development, Im looking up information about navigation components and fragments but I havent understood what is the diferent between
NavigationUI.setupActionBarWithNavController(this,navHostFragment.navController) and setupActionBarWithNavController(navController,appBarConfig).
bellow you can find two codes, In one Im using NavigationUI but In the other I dont.
First one:
class MainActivity : AppCompatActivity() {

    private lateinit var binding: ActivityMainBinding

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding= ActivityMainBinding.inflate(layoutInflater)
        setContentView(binding.root)

        val navHostFragment = supportFragmentManager.findFragmentById(R.id.nav_host_fragment) as NavHostFragment
        NavigationUI.setupActionBarWithNavController(this,navHostFragment.navController)
        binding.bnNavBar.setupWithNavController(navHostFragment.navController)
    }

    override fun onSupportNavigateUp(): Boolean {
        val navController = this.findNavController(R.id.nav_host_fragment)
        return navController.navigateUp()
    }

}

Second one:
class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelectedListener {

    private lateinit var mainBinding: ActivityMainBinding
    private lateinit var appBarConfiguration: AppBarConfiguration

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        mainBinding = ActivityMainBinding.inflate(layoutInflater)
        setContentView(mainBinding.root)

        val toolBar = mainBinding.activityMainContent.mainToolbar

        //Setting up the tool bar as the app bar for the activity
        setSupportActionBar(toolBar)

        val host: NavHostFragment =
            supportFragmentManager.findFragmentById(R.id.nav_host_fragment_container) as NavHostFragment

        val navController = host.navController

        //appBarConfiguration = AppBarConfiguration(navController.graph)

        appBarConfiguration = AppBarConfiguration(
            setOf(R.id.continentFragment),
            mainBinding.drawerLayout
        )

        //First
        setUpActionBar(navController,appBarConfiguration)

        //Second
        setUpNavigationView(navController)

    }

    private fun setUpActionBar(navController: NavController, appBarConfig : AppBarConfiguration) {
        setupActionBarWithNavController(navController,appBarConfig)
    }

    private fun setUpNavigationView(controller: NavController) {
        mainBinding.navView.setupWithNavController(controller)
    }

    override fun onNavigationItemSelected(item: MenuItem): Boolean {
        mainBinding.drawerLayout.closeDrawer(GravityCompat.START)
        return true
    }

    override fun onSupportNavigateUp(): Boolean {
        val navController = findNavController(R.id.nav_host_fragment_container)
        return navController.navigateUp(appBarConfiguration)|| super.onSupportNavigateUp()
    }

    override fun onBackPressed() {
        if (mainBinding.drawerLayout.isDrawerOpen(GravityCompat.START)) {
            mainBinding.drawerLayout.closeDrawer(GravityCompat.START)
        } else {
            super.onBackPressed()
        }
    }
}

Please, I'd be very thankful if someone can explain me the diference.
Ive read a lot about navigation but I havent found anything useful


text:
Q: Getting text length in pixels for all languages in c# I wanted to know how we can calculate the length of a text in a checkbox in pixels. The language of the text can be changed to any language, like english, romanian, spanish, chinese, japanese, etc.
I have a checkbox followed by a combobox in the same line, so that when the length of the text of the checkbox changes(when language is changed) , I want to change the location of the combobox accordingly, so that the checkbox text is not truncated by the combobox.
I tried TextRenderer.MeasureText method. It works for chinese and japanese, but for other languages it is not returning the correct value.
Is there a better way to find out the text length in pixels?
Thanks in advance.

A: I assume you are using WPF.
You can bind actualWidth of your checkbox or a fake, invisible textbox to your ViewModel and put your text there.
When text changes a control width would change which will be reflected in you property changed
It's walkaround a bit but it's simple and will work :)


text:
Q: Insert value in xml file when field match i need to take field MASSIMALE from massimali.xml and put it on all massimale fiels on esercizi.xml where field UTENTE and ESERCIZIO match :
eg
I have one MASSIMALE to insert in many row of the same exercise.
in your solution the value of the MASSIMALE is loaded only in the first exercise and not in all the exercises with the same name and the same user
<?xml version="1.0"?>
<sessioni>
  <sessione position="1">
    <id>1739616101355231</id>
    <index>1</index>
    <nome_sessione>3</nome_sessione>
    <utente>USER1</utente>    **<- MATCH WITH USER1 IN massimali.xml**
    <esercizio>BENCH PRESS</esercizio> **<- MATCH WITH USER1 IN massimali.xml**
    <rep_sessione>1</rep_sessione>
    <percent_sessione>50</percent_sessione>
    <massimale>100</massimale> <- LOAD FROM massimali.xml

Thank You
esercizi.xml
<?xml version="1.0"?>
<sessioni>
  <sessione position="1">
    <id>1739616101355231</id>
    <index>1</index>
    <nome_sessione>3</nome_sessione>
    <utente>USER1</utente>
    <esercizio>BENCH PRESS</esercizio>
    <rep_sessione>1</rep_sessione>
    <percent_sessione>50</percent_sessione>
    <massimale/>
  </sessione>
  <sessione position="2">
    <id>1739616101355231</id>
    <index>2</index>
    <nome_sessione>3</nome_sessione>
    <utente>USER1</utente>
    <esercizio>BENCH PRESS</esercizio>
    <rep_sessione>1</rep_sessione>
    <percent_sessione>65</percent_sessione>
    <massimale/>
  </sessione>
  <sessione position="3">
    <id>1739616101355231</id>
    <index>3</index>
    <nome_sessione>3</nome_sessione>
    <utente>USER1</utente>
    <esercizio>BENCH PRESS</esercizio>
    <rep_sessione>1</rep_sessione>
    <percent_sessione>75</percent_sessione>
    <massimale/>
  </sessione>
  <sessione position="4">
    <id>1739616101355231</id>
    <index>4</index>
    <nome_sessione>3</nome_sessione>
    <utente>USER1</utente>
    <esercizio>BENCH PRESS</esercizio>
    <rep_sessione>1</rep_sessione>
    <percent_sessione>80</percent_sessione>
    <massimale/>
  </sessione>
  <sessione position="5">
    <id>1739720496368387</id>
    <index>5</index>
    <nome_sessione>1</nome_sessione>
    <utente>USER2</utente>
    <esercizio>BACK SQUAT</esercizio>
    <rep_sessione>1</rep_sessione>
    <percent_sessione>65</percent_sessione>
    <massimale/>
  </sessione>
  <sessione position="6">
    <id>1739720496368387</id>
    <index>6</index>
    <nome_sessione>1</nome_sessione>
    <utente>USER2</utente>
    <esercizio>BACK SQUAT</esercizio>
    <rep_sessione>1</rep_sessione>
    <percent_sessione>75</percent_sessione>
    <massimale/>
  </sessione>
  <sessione position="7">
    <id>1739720496368387</id>
    <index>7</index>
    <nome_sessione>1</nome_sessione>
    <utente>USER2</utente>
    <esercizio>BACK SQUAT</esercizio>
    <rep_sessione>1</rep_sessione>
    <percent_sessione>85</percent_sessione>
    <massimale/>
  </sessione>
</sessioni>

massimali.xml

<?xml version="1.0"?>
<massimali>
  <atleta position="1">
    <id>1739616101355231</id>
    <utente>USER1</utente>
    <esercizio>BENCH PRESS</esercizio>
    <massimale>100</massimale>
    <data>2022-07-30</data>
  </atleta>
  <atleta position="2">
    <id>1739720496368387</id>
    <utente>USER1</utente>
    <esercizio>BACK SQUAT</esercizio>
    <massimale>80</massimale>
    <data>2022-07-30</data>
  </atleta>
  <atleta position="3">
    <id>1739720496368387</id>
    <utente>USER2</utente>
    <esercizio>BACK SQUAT</esercizio>
    <massimale>100</massimale>
    <data>2022-07-30</data>
  </atleta>
  <atleta position="4">
    <id>1739616101355231</id>
    <utente>USER2</utente>
    <esercizio>BENCH PRESS</esercizio>
    <massimale>95</massimale>
    <data>2022-07-30</data>
  </atleta>
</massimali>

A: Since you're dealing with two xml files, you should be using an xml parser with xpath, like this:
#load the files
$ese = simplexml_load_file("esercizi.xml");
$mas = simplexml_load_file("massimali.xml");

#load each file into xml
$masdoc = new SimpleXMLElement($mas);
$esedoc = new SimpleXMLElement($ese);

#get the athletes in the first file
$masatletas = $masdoc->xpath('//atleta');

#now loop through them:
foreach($masatletas as $masatleta) {
 $masute =  $masatleta->xpath('.//utente')[0];
 $masese = $masatleta->xpath('.//esercizio')[0];
 $masmas = $masatleta->xpath('.//massimale')[0];

 #this is the critical directive: look for the each artist in the other file
 #and check to see if the credentials are the same:
 $target = $esedoc->xpath("//sessione[.//utente= '{$masute}'][.//esercizio= '{$masese}']");

 if (count($target) == 1) {
           #if so, change the value to fit that of its equivalent in the first:
           $newmas = $target[0]->xpath('.//massimale/text()')[0];
           $newmas[0] = $masmas;
           }
}
echo $esedoc->asXml();

EDIT:
For your modified files, change the for loop as follows:
foreach($masatletas as $masatleta) {
        $masute =  $masatleta->xpath('.//utente/.')[0];
        $masese = $masatleta->xpath('.//esercizio/.')[0];
        $masmas = $masatleta->xpath('.//massimale/.')[0];
        $targets= $esedoc->xpath("//sessione[.//utente = '{$masute}'][.//esercizio = '{$masese}']");
        foreach ($targets as $target){
                    $newmas = $target->xpath('.//massimale')[0];
                    $newmas[0] = $masmas;
                    };
    };

and it should work.

A: This work fine
$xmlFile = file_get_contents('files/esercizi_in_sessione.xml');
$xml_ese= str_replace(['<','>'],['<','>'], $xmlFile);

$xmlFile1 = file_get_contents('files/massimali.xml');
$xml_mas= str_replace(['<','>'],['<','>'], $xmlFile1);

#load the files
#$ese = simplexml_load_file("files/esercizi_in_sessione.xml");
#$mas = simplexml_load_file("massimali.xml");

#load each file into xml
$masdoc = new SimpleXMLElement($xml_mas);
$esedoc = new SimpleXMLElement($xml_ese);

#get the athletes in the first file
$masatletas = $masdoc->xpath('//atleta');

#now loop through them:

foreach($masatletas as $masatleta) {

 $masute =  $masatleta->xpath('.//utente')[0];
 $masese = $masatleta->xpath('.//esercizio')[0];
 $masmas = $masatleta->xpath('.//massimale')[0];

 #this is the critical directive: look for the each artist in the other file
 #and check to see if the credentials are the same:
 $target = $esedoc->xpath("//sessione[.//utente= '{$masute}'][.//esercizio= '{$masese}']");

 if (count($target) == 1) {
           #if so, change the value to fit that of its equivalent in the first:
           $newmas = $target[0]->xpath('.//massimale')[0];
           $newmas[0] = $masmas;
           }
}

echo $esedoc->asXml('files/prova.xml');


text:
Q: GoogleApiClient.connect() causes crash My app uses GoogleApiClient to get the current location. It works well for the first time but if I close my app and then open it again, it crashes (on Sony Xperia Z3, Google Pixel).
On Asus, Samsung, ... it doesn't crash
android.os.DeadObjectException
                                                   at android.os.BinderProxy.transactNative(Native Method)
                                                   at android.os.BinderProxy.transact(Binder.java:503)
                                                   at android.view.IWindow$Stub$Proxy.onAnimationStopped(IWindow.java:534)
                                                   at com.android.server.wm.WindowAnimator.updateWindowsLocked(WindowAnimator.java:286)
                                                   at com.android.server.wm.WindowAnimator.animateLocked(WindowAnimator.java:678)
                                                   at com.android.server.wm.WindowAnimator.access$000(WindowAnimator.java:53)
                                                   at com.android.server.wm.WindowAnimator$1.doFrame(WindowAnimator.java:123)
                                                   at android.view.Choreographer$CallbackRecord.run(Choreographer.java:856)
                                                   at android.view.Choreographer.doCallbacks(Choreographer.java:670)
                                                   at android.view.Choreographer.doFrame(Choreographer.java:603)
                                                   at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
                                                   at android.os.Handler.handleCallback(Handler.java:739)
                                                   at android.os.Handler.dispatchMessage(Handler.java:95)
                                                   at android.os.Looper.loop(Looper.java:234)
                                                   at android.os.HandlerThread.run(HandlerThread.java:61)
                                                   at com.android.server.ServiceThread.run(ServiceThread.java:46)

I found the line of code that causes a crash is GoogleApiClient.connect(), I also use try-catch, update to the latest Google API 11.8.0 but can not find a possible solution. Here is my code
@Override
public void onLocationChanged(Location location) {
    if (location != null) {
        Log.v(">>>", "onLocationChanged Longitude = " + Constants.location.getLongitude() + ", Latitude = " + Constants.location.getLatitude());
        //Toast.makeText(this, "onLocationChanged Longitude = " + Constants.location.getLongitude() + ", Latitude = " + Constants.location.getLatitude(), Toast.LENGTH_SHORT).show();
        saveLocation(location);
    }
}

@Override
public void onConnected(@Nullable Bundle bundle) {
    if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED
            && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
        return;
    }
    if (mGoogleApiClient != null && mGoogleApiClient.isConnected()) {
        try {
            Location mLastLocation = LocationServices.FusedLocationApi
                    .getLastLocation(mGoogleApiClient);
            if (mLastLocation != null) {...}

                //Toast.makeText(this, "onConnected Longitude = " + Constants.location.getLongitude() + ", Latitude = " + Constants.location.getLatitude(), Toast.LENGTH_SHORT).show();
            }
            startLocationUpdates();
        } catch (Exception ex) {
            // This will catch the exception, handle as needed
        }
    }
    //Toast.makeText(this, "onConnected", Toast.LENGTH_SHORT).show();
}

@Override
public void onConnectionSuspended(int i) {
    mGoogleApiClient.connect();
}

@Override
public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
    Log.d("Location service", "onConnectionFailed");
}

@Override
protected void onResume() {
    super.onResume();
    checkPlayServices();
    // Resuming the periodic location updates
    if (mGoogleApiClient != null && mGoogleApiClient.isConnected()) {
        startLocationUpdates();
    }
    Log.v(">>>", "onResume");
}

@Override
protected void onStart() {
    super.onStart();
    if (mGoogleApiClient != null) {
        mGoogleApiClient.connect(); // CRASH HERE
        Log.v(">>>", "GoogleApiClient.connect()");
    }
    Log.v(">>>", "onStart");
}

@Override
protected void onStop() {
    if (mGoogleApiClient != null && mGoogleApiClient.isConnected()) {
        mGoogleApiClient.disconnect();
        mGoogleApiClient = null;
        Log.v(">>>", "GoogleApiClient.disconnect()");
    }
    super.onStop();
    Log.v(">>>", "onStop");
}

@Override
protected void onPause() {
    stopLocationUpdates();
    super.onPause();
    Log.v(">>>", "onPause");
}

A: DeadObjectException - The object you are calling has died, because its hosting process no longer exists.That is service had already stopped - either killed from the OS, or stopped from your application.
Override your onDestroy() method and watch what event leads to DeadObjectException. If you catch DeadObjectException without going through this method, your service should have been killed by the OS.

A: In onLocationChanged(location), saveLocation(location) uses RealmIO to save user's last location.
If I remove saveLocation(location), everything works well.
I found that if I use (RealmIO) or (SharedPreferences with Gson) to save data, the problem occurs
The temporary solution is using SharedPreferences without Gson:
SharedPreferences prefs = context.getSharedPreferences(
           LAST_LOCATION, Context.MODE_PRIVATE);
    prefs.edit().putString(LAST_LOCATION_LONGITUDE, location.getLongitude() + "").apply();
    prefs.edit().putString(LAST_LOCATION_LATITUDE, location.getLatitude() + "").apply();

I don't know why the crash just happens in some specific devices. Hope this help someone!


text:
Q: Jupyterhub and nginx reverse proxy configuration I was trying to configure the jupyterhub proxy to route the content going to my-host-ip/notebook but it i cannot figure out the solution.
I am using the following Nginx configuration:
server {
        listen 80;
        server_name  localhost;

        location /notebook {
            proxy_pass http://localhost:8000;

            # proxy_set_header X-Real-IP $remote_addr;
            # proxy_set_header Host $http_host;
            # proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }

        location ~* /(user[-/][a-zA-Z0-9]*)/(api/kernels/[^/]+/(channels|iopub|shell|stdin)|terminals/websocket)/? {
            proxy_pass http://localhost:8000;

            # proxy_set_header X-Real-IP $remote_addr;
            # proxy_set_header Host $http_host;
            # proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

            # WebSocket support
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_read_timeout 86400;

        }
    }

A: I fixed this by using the following options with jupyterhub configuration file:
# Force the proxy to only listen to connections to 127.0.0.1
c.JupyterHub.ip = '127.0.0.1'
c.JupyterHub.base_url = u'/notebook'

A: This answer is valid only if you have another proxy configuration on your client computer ( if you are using a proxy on your browser or os to access the internet). This failure could be due to a poorly managed proxy by your company/school/telecom provider, reasons explained in here.
Solution
setup a self signed ssl certificate so that the websocket can tunnel through the TLS/SSL connection. Since you already have Nginx installed this is quite easy. Follow this guide at digital ocean to quickly setup a free self signed ssl certificate.
Further you need to add the following header in your nginx websocket config to work.
proxy_set_header Origin ""


text:
Q: C# How to unsubscribe all event handlers from a given event? Is there a simple way to iterate all over the handlers subscribed to a given event? My problem is that clients subscribe but forget to unsubscribe so a memory leak happens. I need a way for an object to disconnect all the handlers of its events in the Dispose method so a leak would not happen - at least not because of events.

A: An alternative approach is to use so-called "weak delegate" pattern. When you use this technique, the event references clients only using WeakReference which doesn't keep them in memory. The clients will be garbage collected when they are no longer referenced from other part of the application (and the handler can be also unregistered automatically when the client is collected).
This is usually used to solve the problem with clients "forgetting" to unsubscribe from a .NET event, so it sounds like this might be well suited for your problem.

*

*Dusing Campbell has a nice article about weak delegates.

*I also liked this overview at CodeProject, which discusses most of the scenarios.

*Weak Events are also used in WPF, but this approach seems a bit complicated (to me).

A: Memory leak happens only if another object (listener) dies before your object (event source). In this case, event source still keeps the reference to listener, which prevents listener to be collected. When event source dies, unsubscribed listener may be collected as well.
If event source dies before listener, this does not prevent listener to be collected later, when all other references to it are set to null.
This means, event source Dispose method is not correct place to solve this problem. It may be solved only in a listener code. Simply talking, you cannot do anything, except asking your clients to write clean code.

A: Set null to your event: MyEvent = null;
But it is really better to make clients unsubscribing from your event.

A: At the time of writing, the most accurate answer is the least popular.
You can nullify the event handler but this would be zapped anyway after its owner is zapped - its not wrong to be super tidy, but like Alex says, it's not where the issue is.
Adi's source class will allow listening objects to be collected when it itself is collected, there is no doubt. So the problem is that Adi's source object is being kept open, possibly from some long chain of references in his customer's code.
The following blog post also looks at a solution that Adi is decribing and explains why it's unnecessary.
http://weblogs.sqlteam.com/mladenp/archive/2007/10/24/C-Care-about-Event-Memory-Leaks-with-Delegate.GetInvocationList.aspx


text:
Q: Can Linux distros be installed without touching the boot volume AT ALL? Specifically, I'm trying to install Linux Mint 18.3 Cinnamon (the  suggested distro for development with the Xojo cross-platform development environment) to an EXTERNAL drive without touching the boot drive at all as I'm using a Mac and can boot the volume by just holding down the "Option" key upon booting the system.
I've tried using the option in the installer that says to put the boot loader on the external drive but it still touches the boot drive.
I already read the first two suggested answers as well.
Using a Virtual Machine isn't an option because my system only has 8gb of physical ram.


text:
Q: Different colors for grouped tableView and tableViewCell backgrounds How can I set different colors for GROUPED UITableView inside background vs. background, which is outside my table? That is the part which is visible when tableView is smaller than the screen or scrolled beyond limits of table.
UPDATE: that sample image is generated by my current code! I DO NOT NEED TIPS HOW TO MAKE IT !!! Please read the question before you (try to) answer. Would really appreciate this, but thanx anyway.
File AboutViewController.m
- (void)viewDidLoad
{
[super viewDidLoad];
self.tableView.backgroundView = [[CustomView alloc]
  initWithFrame:self.tableView.bounds]; // VISIBLE
self.tableView.backgroundColor = [UIColor redColor]; // NOT VISIBLE

}
In the sample image (generated by my current code) the background view contains sample gradient from yellow to green, each cell "bubble" background is texture, each label has own background - all this just to demonstrate what I could define. As you can see, background gradient is partially visible through each cell and remains static when you scroll the table.
What I want to do: I want DIFFERENT tableView background for GROUPED UITableView.
For plain UITableView style I have defined a custom background for each cell, but it doesn't seem to work with GROUPED tableView. This only sets the cell background inside the cell "bubble". How to define the cell area outside that cell "bubble"?

A: For this u set cell.backgroundColor =[UIColor redColor]; its work
and for background u tale image or set color

A: For this you can use the image as backgroundimage.
But I think you are using the grouped table,so
you need to go with the tableview background color
and set that to image color.
Like
winTableView.backgroundColor=[UIColor colorWithPatternImage:@"bg.png"];

Or you can even go with the Gradient layer,inserting that in you view.
Hope this will help you.
Get the image of different color as you want to show the background of your table view.

A: For cell color or view you can also use these.
Try to have different color for different cells by your logic.
cell.backgroundColor=[UIColor clearColor];
        //cell.selectionStyle=UITableViewCellSelectionStyleNone;
        cell.accessoryType=UITableViewCellAccessoryNone;
        UIView *backroundSelecView=[[[UIView alloc]init]autorelease];
        backroundSelecView.backgroundColor=[UIColor colorWithRed:203.0/255.0f green:218.0/255.0f blue:140.0/255.0f alpha:.80];
        cell.selectedBackgroundView=backroundSelecView;
        cell.backgroundView=[[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"table-grid@2x.png"]]autorelease];


text:
Q: Python - Move files between GCP Buckets I'm trying to move csv files between two existing buckets on GCP. But I'm stuck on an 'Not Found' Error.  Here is the code I'm using (This was built after reading GCP docs and SDK's):
from google.cloud import storage

def move_blob(bucket_name, blob_name, destination_bucket_name, destination_blob_name):
    """Moves a blob from one bucket to another with a new name."""
    storage_client = storage.Client()

    source_bucket = storage_client.bucket(bucket_name)
    source_blob = source_bucket.blob(blob_name)
    destination_bucket = storage_client.bucket(destination_bucket_name)

    blob_copy = source_bucket.copy_blob(
        source_blob, destination_bucket, destination_blob_name
    )

    print(
        "Blob {} in bucket {} moved to blob {} in bucket {}.".format(
            source_blob.name,
            source_bucket.name,
            blob_copy.name,
            destination_bucket.name,
        )
    )

def list_blobs():
    """Lists all the blobs in the bucket."""

    bucket_name = "BUCKET_1"
    destination_bucket_name = "BUCKET_2/folder"

    storage_client = storage.Client()

    blobs = storage_client.list_blobs(bucket_name)

    for blob in blobs:
        print(blob.name)

        destination_blob_name = blob_name = blob.name

        move_blob(bucket_name, blob_name, destination_bucket_name, destination_blob_name)

list_blobs()

And the content from the error message is:
'NotFound: 404 GET https://storage.googleapis.com/storage/v1/b/BUCKET_2/folder?projection=noAcl&prettyPrint=false: Not Found'

A: Your destination bucket name should just be the bucket name and should not have any prefixes. Just do the following:
destination_bucket_name = "BUCKET_2"
and add folder/ as a prefix to all blobs being transferred.

A: Here is a function I found (by dmlee8) that you can use when moving blobs between directories within the same bucket or to a different one:
from google.cloud import storage
import os

    os.environ["GOOGLE_APPLICATION_CREDENTIALS"]="path_to_your_creds.json"

def mv_blob(bucket_name, blob_name, new_bucket_name, new_blob_name):
    """
    Function for moving files between directories or buckets . it will use GCP's copy
    function then delete the blob from the old location.

    inputs
    -----
    bucket_name: name of bucket
    blob_name: str, name of file
        ex. 'data/some_location/file_name'
    new_bucket_name: name of bucket (can be same as original if we're just moving around directories)
    new_blob_name: str, name of file in new directory in target bucket
        ex. 'data/destination/file_name'
    """
    storage_client = storage.Client()
    source_bucket = storage_client.get_bucket(bucket_name)
    source_blob = source_bucket.blob(blob_name)
    destination_bucket = storage_client.get_bucket(new_bucket_name)

    # copy to new destination
    new_blob = source_bucket.copy_blob(
        source_blob, destination_bucket, new_blob_name)
    # delete in old destination
    source_blob.delete()

    print(f'File moved from {source_blob} to {new_blob_name}')


text:
Q: Angular loading spinner with [hidden] does not update I have an Angular material loading spinner in my program that is shown while a REST API is called. When the promise resolves, the visible variable gets set to false and the spinner should disappear.

My problem is that the spinner does not update when it is set to false again. I have to manually trigger a tooltip over a button or something, and only then does the page hide the spinner.
I know for a fact that the variable gets set correctly, but the page does not update the spinner state when it should disappear. Appearing works correctly.
Is the problem that the state is set and unset in the same function?
Here's the template
<div [hidden]="!visible" class="row justify-content-center">
      <mat-spinner></mat-spinner>
</div>

When I click the update button, this.visible = true; is called.
Then, an http service gets called:
this.httpService.getData(data).then(receivedData => {
    [...]
    this.visible = false;    // this is called correctly, but does not change the visibility.

But the spinner is still there, together with all the graphs that have been drawn now:

How can I fix this? The spinner should not be visible anymore, but it only disappears after I hover over a button or some other element.

A: You maybe using OnPush Strategy in your component. Inject ChangeDetectorRef and try calling detectChanges method of it.


text:
Q: Save figure using default stylesheet? I'm using the following to export a figure as .eps for use in latex:
p4 = Plot[ Sin[x], {x, 0, Pi}]
myExportForLatex[filename_, image_, allowRast_ : False] :=
 Module[{output, dir}, dir = Directory[];
  output = {Export[filename <> ".eps",
     First[ImportString[
       ExportString[image, "PDF", "AllowRasterization" -> allowRast,
        Background -> None], "PDF"]]],
    Export[filename <> "pn.png", image,
     "AllowRasterization" -> allowRast, Background -> None,
     ImageResolution -> 72*4]};
  {dir <> "/" <> output[[1]], dir <> "/" <> output[[2]]}]

myExportForLatex[ "SinPlotFig1", p4 ]

The export function above was the end result of a discussion on "best way to export figures from Mathematica", and works well provided the stylesheet being used is the default. If I'm using a different stylesheet, for example, the report stylesheet, this method saves the figure with stylesheet specific background, like so:

This is after running:
epstopdf SinPlotFig1.eps --outfile=SinPlotFig1.pdf

so that I can use the .pdf in my latex code.  Notice that the background has the pink of the report stylesheet, as well as the 3-sides black bounding box.
How can this export method be modified to effectively use the default stylesheet when exporting the .eps figure?

A: You might define
newStyleSheet = (SetOptions[InputNotebook[], StyleDefinitions -> #]&)

and then insert the lines
newStyleSheet["Default.nb"]

and
newStyleSheet["Report.nb"]

in the appropriate places in myExportForLatex. The second call of newStyleSheet being made to revert to your normal style.


text:
Q: How do you square an entire logarithm? How would you simplify $(\log_y x)^2$ ? This isn't an occasion where you can say that $(\log_y x)^2 = 2\log_y x$ right?

A: The function $(\log_y x)^2$ (sometimes written $\log_y^2 x$) cannot be simplified by bringing the 2 down as a coefficient. In other words,
$$(\log_y x)^2 \neq 2 \log_y x.$$
You may write $(\log_y x )^2 = (\log_y x) ( \log_y x)$.
Depending on what you are trying to accomplish, the change of base formula may also be useful, that is
$$(\log_y x)^2= \left (\frac{\log x}{\log y}\right )^2  $$
where the logarithms here may be taken to any base (as long as the base in the numerator and denominator is the same).
The case when you can make the exponent into a coefficient is when the argument of the logarithm is being raised to a power:
For example
$$ \log_y(x^2) = 2 \log_y (x)\ \textrm{for} \ x>0.$$


text:
Q: How to achieve Robot framework Parallel test execution on two different machines? I'm automating web application using RobotFramework with selenium2library.
I'm looking for parallel test execution of two different test suites on two different machines at the same time.
I tried pabot for parallel execution. If i am running 3 instances in parallel on a single machine it is running. But I want to run it in different machines, for that i have tried the below code:-
first I start hub
java -jar <selenium.jar> -role hub

(optional port f.e.: -port 4444)
Then I run up nodes:
java -jar <selenium.jar> -role webDriver (for selenium 2 library) -hub http://<selenium hub ip>:4444/grid/register

(optional parameter remoteHost f.e.: -remoteHost http://127.0.0.1:5555)
Nodes can be run separately and be specified by additional parameter -remoteHost . This host can be used in selenium keyword Open Browser
Open Browser | url | browser=ff | alias=None | remote_url=False
Example:
${REMOTE_DRIVER}=    Set Variable    127.0.0.1:5555/wd/hub
Open Browser    www.google.com    ff    None    ${REMOTE_DRIVER}

But after this suits are running in different machines one after another and not in parallel.
Is there any way to acheive it.

A: To run suites in parallel there are two components needed:

*

*Selenium Grid, or other centralized Grid infra (SauceLabs, Zalenium, Aerokube Selenoid).

*Parallel Executor (Pabot)

Natively Robot Framework only supports running 1 suite at a time. By extension this means that any Robot script that uses Selenium will only have 1 suite running at a time. In order to parallelize you will need to run multiple Robot Framework instances in parallel.
The Pabot project is a seperate application that runs a seperate robot framework instance per Suite (file). At the end it then merges all the seperate logs into a single log file. It has a few more features but that's the core.
From your description I take it that setting up a Grid where multiple nodes have joined succefully. If this is the case, then using the Grid server URL for connecting to your browser should suffice to have the nodes utilized.
Do make sure that the number of parallel Pabot processes (it's a parameter) do not exceed the number of available Selenium nodes.


text:
Q: Which series is growing more? I am a c# .NET programmer with a math question
I have a list of numbers.  Imagine they were test-scores of a set of students in different schools.
Is there a formula to will tell me which of these students is improving the most, the "most improved student"? I'd like to rank the students best to worst.
 John: 45, 65, 67, 65, 56, 80
 Sall: 78, 88, 89, 89, 90, 78, 88, 89
 Samy: 56, 78, 89, 87, 87

A: A simple and efficient way is computing for each student the average of the successive "improvements" to get an idea of how much the score of the student has improved so far.
Formally, if $\langle x_0,\dots,x_{n-1} \rangle$ are the scores of the student, you compute:
$$\frac{1}{n-1}\sum_{i = 1}^{n-1} (x_i - x_{i-1}).$$
(Note that, of course, you need at least two scores).
From your example you would get:
John: ((65-45) + (67-65) + (65-67) + (56-65) + (80-56)) / 5 = 7
Sall: ((88-78) + (89-88) + (89-89) + (90-89) + (78-90) + (88-78) + (89-88)) / 7 = 1.58
Samy: ((78-56) + (89-78) + (87-89) + (87-87)) / 4 = 7.75

So Sall has not improved much (the scores are high but quite similar), whereas Samy and John have improved much more.


text:
Q: Slow webservice problem I create a Python webservice on Linux machine (ubuntu):
import soaplib
import os

from soaplib.core.service import rpc, DefinitionBase, soap
from soaplib.core.model.primitive import String, Integer
from soaplib.core.server import wsgi
from soaplib.core.model.clazz import Array

def runcmd(cmd):
    fout = os.popen(cmd)
    out = fout.read()
    return out

class LinuxServices(DefinitionBase):
@soap(String, String,_returns=Array(String))
def df(self,server, user):
    L = []
    cmd = 'df -hP | grep "/"'
    output = runcmd(cmd).split('\n')
    for n in xrange(len(output)-1):
        out = output[n].split()
        L.append('%s;%s' % (out[5], out[4]))
    return L

if __name__=='__main__':
try:
    from wsgiref.simple_server import make_server
    soap_application = soaplib.core.Application([LinuxServices], 'tns')
    wsgi_application = wsgi.Application(soap_application)
    server = make_server('0.0.0.0', 7789, wsgi_application)
    server.serve_forever()
except ImportError:
    print "Error: example server code requires Python >= 2.5"

I created it based on this example: soaplib helloworld
Then (on Windows 7) I created a Silverlight project, where I use this ws to get disk status on my linux server:
Service in Silverlight project:
public class LinuxService
{
    [OperationContract]
    public List<dfItem> df()
    {
        List<dfItem> dfItems = new List<dfItem>();

        WebReference.Application app = new WebReference.Application();

        var result = app.df(new WebReference.df()/*...*/);

        foreach (var item in result.dfResult)
        {
            string[] info = item.Split(';');

            dfItem dfItem = new dfItem()
            {
                MountPoint = info[0].ToString(),
                Usage = info[1].ToString()
            };
            dfItems.Add(dfItem);
        }
        return dfItems;
    }
    //...
}

Calling service on page:
protected override void OnNavigatedTo(NavigationEventArgs e)
{
    LinuxServiceClient client = new LinuxServiceClient();

    client.dfCompleted += new EventHandler<dfCompletedEventArgs>(client_dfCompleted);

    client.dfAsync();
}

void client_dfCompleted(object sender, dfCompletedEventArgs e)
{
    DG.ItemsSource = e.Result;
    DG.Visibility = System.Windows.Visibility.Visible;
}

My problem is that when I navigate to this page, it takes 4-8 seconds to get data from ws (ws in LAN).
I really doubt that line bandwidth can create this wait time...
My question:
Do you have any suggestions what can I do to speed up this?
System Info:

*

*UbuntuServer 11.04

*Python: Python 2.7

*Soaplib: soaplib 2.0.0-beta2

*

*Windows: Windows 7 sp1

*Silverlight: Silverlight 4

A: I'd recommend using wireshark http://www.wireshark.org/ to 'listen' in on the conversation that is occurring over the network by recording ('capturing') copies of the network traffic that the device can see.
When you start a capture, the amount of data can seem overwhelming, but if you can spot any fragments that look like your SOAP message (should be easy to spot), then you can swiftly filter to just that conversation by right-clicking and selecting 'Follow TCP Stream'.
You can then see the entire conversation between the SOAP service you've written and the silverlight client in a pop-up window.
If that all looks fine, then close the popup window. As an added bonus, wireshark will have filtered out the list of fragments to just those in the conversation with timestamps as to when they happened. Use this to find out whether it's client or server that is being slow to respond.
If there appears to be no real delay, then I would suggest that there is a considerable lag between asking Silverlight to do a SOAP call and it actually making the network call.

A: Just a cursory benchmark using the suds client and the soaplib hello world example:
>>> def bench_soap(num):
...:     start = time.time()
...:     for i in range(num):
...:         hello_client.service.say_hello("Dave", 5)
...:     elapsed = time.time() - start
...:     print "Completed %s: ops in %.2f seconds : %.1f ops/sec" % (num, elapsed, num / elapsed)
...:
...:

>>> bench_soap(100)
Completed 100: ops in 0.40 seconds : 247.5 ops/sec

>>> bench_soap(1000)
Completed 1000: ops in 3.81 seconds : 262.5 ops/sec

I've not seen any "lag" or anything like that on my end. Soaplib, seems fast and responsive, so perhaps a Silverlight issue? Or some sort of incompatibility between the two?


text:
Q: How to compare images in selected ImageView objects? I'm trying to make a basic candy crush game. I have 9x9 grid layout to put imageviews.Images mixed on every execution. For now there are two images when I run the algorithms correctly, I will redound them. If selected imageviews contain same images, user will get 10 points per selected image.Problem is how can I compare and select many imageviews? These ImageViews have onclick buttons but how can I compare them?
Here's what I tried
public class MainActivity extends AppCompatActivity {
    TextView scoreText;
    ImageView imageView1,imageView2,imageView3,imageView4,imageView5,
            imageView6, imageView7,imageView8,imageView9;
    ImageView[]imageArray;
    int[]images;
    //Handler handler;
    //Runnable runnable;
    Drawable x,y;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        imageView1=findViewById(R.id.imageView1);
        imageView2=findViewById(R.id.imageView2);
        imageView3=findViewById(R.id.imageView3);
        imageView4=findViewById(R.id.imageView4);
        imageView5=findViewById(R.id.imageView5);
        imageView6=findViewById(R.id.imageView6);
        imageView7=findViewById(R.id.imageView7);
        imageView8=findViewById(R.id.imageView8);
        imageView9=findViewById(R.id.imageView9);
        images= new int[]{R.drawable.grapes,R.drawable.lemon};
        imageArray= new ImageView[]{imageView1, imageView2, imageView3, imageView4,
                imageView5, imageView6, imageView7, imageView8, imageView9};
        ImageSet();
    }
    public void ImageSet()
    {

        for(int j=0;j<imageArray.length;j++)
        {
            Random r =new Random();
            int i=r.nextInt(2-0);
            imageArray[j].setImageResource(images[i]);
        }
    }
    public void image1(View view)
    {

    }
    public void image2(View view)
    {

    }
    public void image3(View view)
    {

    }
    public void image4(View view)
    {

    }
    public void image5(View view)
    {

    }
    public void image6(View view)
    {

    }
    public void image7(View view)
    {

    }
    public void image8(View view)
    {

    }
    public void image9(View view)
    {

    }

 }

A: I think the better way is creating imageViews dinamically in code and add it to layout for example:
       for(int i=0;i<ar.lenght;i++) {
            ImageView imageView = new ImageView(activity);
            imageView.setImageDrawable(ar[i]);
            imageView.setOnClickListener((view)->{});
            yourLayout.addView(imageView);
        }

Or you can inflate them with your properties. And you can add tag or id to identify them. But in you case you should to store in your class a last number and compares it with current clicked image and after two clicks nullify it.
Maybe something like this would help...
        Integer lastClickedImageId;
        for(int i=0;i<ar.lenght;i++) {
            ImageView imageView = new ImageView(activity);
            imageView.setImageDrawable(ar[i]);
            imageView.setId(i);
            imageView.setOnClickListener((view)->{
                if(lastClickedImageId==null){
                    lastClickedImageId=imageView.getId();
                } else {
                    if(lastClickedImageId.equals(imageView.getId())){
                        //TODO hide cards?
                        lastClickedImageId=null;
                    }
                }
            });


text:
Q: Is there a way to write server side code on a unity photon cloud server I have been looking for a way to write server side code on a public cloud unity photon server. Is there a way to do this without self hosting?

A: No.
Custom (game) server plugins are only available for Enterprise Cloud customers or self-hosted.


text:
Q: Python Pandas Series failure datetime I think that this has to be a failure of pandas, having a pandas Series (v.18.1 and 19 too), if I assign a date to the Series, the first time it is added as int (error), the second time it is added as datetime(correct), I can not understand the reason.
For instance with this code:
import datetime as dt
import pandas as pd
series = pd.Series(list('abc'))
date = dt.datetime(2016, 10, 30, 0, 0)
series["Date_column"] =date
print("The date is {} and the type is {}".format(series["Date_column"], type(series["Date_column"])))
series["Date_column"] =date
print("The date is {} and the type is {}".format(series["Date_column"], type(series["Date_column"])))

The output is:
The date is 1477785600000000000 and the type is <class 'int'>
The date is 2016-10-30 00:00:00 and the type is <class 'datetime.datetime'>

As you can see, the first time it always sets the value as int instead of datetime.
could someone help me?,
Thank you very much in advance,
Javi.

A: The reason for this is that series is an 'object' type and the columns of a pandas DataFrame (or a Series) are homogeneously of type. You can inspect this with dtype (or DataFrame.dtypes):
series = pd.Series(list('abc'))
series
Out[3]:
0    a
1    b
2    c
dtype: object

In [15]: date = dt.datetime(2016, 10, 30, 0, 0)
date
Out[15]: datetime.datetime(2016, 10, 30, 0, 0)

In [18]: print(date)
2016-10-30 00:00:00

In [17]: type(date)
Out[17]: datetime.datetime

In [19]: series["Date_column"] = date
In [20]: series

Out[20]:
0                                a
1                                b
2                                c
Date_column    1477785600000000000
dtype: object

In [22]: series.dtype

Out[22]: dtype('O')

Only the generic 'object' dtype can hold any python object (in your case inserting a datetime.datetime object into the Series).
Moreover, Pandas Series are based on Numpy Arrays, which are not mixed types and defeats the purpose of using the computational benefit of Pandas DataFrames and Series or Numpy.
Could you use a python list() instead? or a DataFrame()?


text:
Q: Clearing a previous selection and selecting a row in datagridview in winforms My issue is entirely different one, initialy for example i will select the second row of the datagridview, after a button click i have to clear the second row selection and make the Selection on the First row, problem is the previous selection not at all clearing, and its not selecting the first row.
For clearing selection i used:
 dbgContCov.ClearSelection();

 this.dbgContCov.Rows.Clear();
 this.dbgContCov.Columns.Clear();
 dbgContCov.Refresh();
 dbgContCov.Parent.Refresh();

For  Selecting First Row:
 dbgContCov.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
 dbgContCov.Rows[0].Selected = true;

i Dont want  to use dbgContCov.CurrentCell = null; because after setting this, even though i use  dbgContCov.Rows[0].Selected = true; the currentselected cell will be null.

A: Ensure MultiSelect property is set to false.

A: You have to set the CurrentCell to [0, 0] to select the first row. No need to clear any selections or set null to CurrentCell.
dbgContCov.CurrentCell = dbgContCov[0, 0];


text:
Q: Represent white spots by rectangles I have this binary image with white spots:

I want to represent each white spot by a rectangle with the same size of spot and if possible with same orientation. There are any function that do that?
I can detect each spot using RP:

A: I would compute the smallest Feret diameter (shortest projection) with corresponding angle, and the perpendicular projection. That usually corresponds to the smallest bounding box.
See here for MATLAB code on computing Feret diameters: http://www.crisluengo.net/archives/408

A: You can try to use regionprops as follows:
I = imread('tHZhy.png');
stats = regionprops(I, 'centroid', 'Orientation', 'MajorAxisLength','MinorAxisLength',  'BoundingBox');
figure
imshow(I)
hold on
for i=1:length(stats)
    xc = stats(i).Centroid;
    ma = stats(i).MajorAxisLength/2;
    mi = stats(i).MinorAxisLength/2;
    theta = -deg2rad(stats(i).Orientation);
    dx = [-ma -mi; ma -mi; ma mi; -ma mi; -ma -mi];
    R = [cos(theta) -sin(theta); sin(theta) cos(theta)]; % rotation matrix
    x = xc + dx*R';
    plot(xc(1), xc(2), 'g*');
    plot(x(:, 1), x(:, 2), 'g');
end

Note that the result is not perfect, especially for rather square objects. The reason therefore is that the major dimension is the greatest when it is directed along a diagonal.


text:
Q: Create dataFrame from parent and child I'm working with data exported from Apple Health as an xml file.
workouts = [node for node in nodes if node.tag == 'Workout']
ET.dump(workouts[0])

Shows me there is a child element, WorkoutStatistics.
<Workout creationDate="2018-08-12 08:58:56 -0600" duration="7.757684383789698" durationUnit="min" endDate="2018-08-12 08:58:55 -0600" sourceName="Strongur" sourceVersion="9.2.0" startDate="2018-08-12 08:51:10 -0600" workoutActivityType="HKWorkoutActivityTypeTraditionalStrengthTraining">
  <WorkoutStatistics endDate="2018-08-12 08:58:55 -0600" startDate="2018-08-12 08:51:10 -0600" sum="30.7305" type="HKQuantityTypeIdentifierActiveEnergyBurned" unit="Cal" />
 </Workout>

I created the dataframe for the parent as follows...
workout_list = [x.attrib for x in root.iter('Workout')]

This provides the results from the parent data with the correct columns minus some formatting I'll do later. Similarly, I can put the child data into a df. However, I'm not sure how to also include the child WorkoutStatistics data in the dataframe.
How do I create a dataFrame that includes the child data and the parent data? Is there a key that matches to parent and child data such that it will only pull the data where parent and child match? Or can I use the startDate and endDate to match the records? If so, how do I do that in a merge? Thx!


text:
Q: IEnumerable yield return function with excel I start in C #, as well as in the use of Interop.
My goal was to create a windows application that can return the value of the Excel.
My problem is that when it came to making a loop, I ended up with only the first value because the "return" closed the loop.
What i did To try to solve this I used "IEnumerable" on my function while keeping the type "string".
return of function SDExpFormsApp1.Excel+d__6
i dont understand why the return is the the name of the class following by "d__6"
I tried to find something interesting here :
https://learn.microsoft.com/fr-fr/dotnet/api/system.collections.generic.ienumerator-1?view=netcore-3.1
My event fucntion
private void button1_Click(object sender, EventArgs e)
    {
        openFileDialog1.ShowDialog();
        string filename = openFileDialog1.FileName;
        int sheet = int.Parse(textBox1.Text);
        Excel excel = new Excel(filename, sheet);
        string SuperClass = excel.ReadCell(1, 1);
        string ClassName = excel.ReadCell(2, 1);
        string ClassLabel = excel.ReadCell(3, 1);
        string AttrName = excel.ReadCell2(8, 1).ToString();
        richTextBox1.Text =  "" + AttrName;

    }

My function to read the excel
public IEnumerable<string> ReadCell2(int i, int j)
    {
        try
        {

            while (ws.Cells[i, j].Value2 != null)
            {
                Console.WriteLine(ws.Cells[i, j].Value2);
                yield return ws.Cells[i, j].Value2;
                i++;
            }
        }
        finally
        {

        }
        yield return "nothing";
    }

A: ToString is not usually overloaded for collection/enumerables and returns type name by default and will not enumerate underlying IEnumerable, so you need to use string.Join:
string AttrName = string.Join("", excel.ReadCell2(8, 1));

As for why ToString returns SDExpFormsApp1.Excel+d__6 in this particular case - it is because yield return is actually a syntactic sugar and compiler will generate IEnumerable<T> implementation for you which will have containing type name as a part of it's own. You can read more about it in answers to this question for example.


text:
Q: USB mount doesn't work on Centos 6.4 I have a problem. After an update, my USB drives are not mounted automatically and I'm unable to mount them manually...
The output of my fdisk -l command is:
Disk /dev/sdb: 15.8 GB, 15762194432 bytes
2 heads, 63 sectors/track, 244329 cylinders
Units = cylinders of 126 * 512 = 64512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x018d6a09

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1      244330    15392736    b  W95 FAT32

I tried with
mount -t nfs /mnt/usb /dev/sdb1

but it dowsn't work. Any ideas?

A: You need to use mount command as below :
sudo mount /dev/sdb1 /mnt/

it will check and automatically detect and mount filesystem i.e vfat

A: If mount is an issue and your system uses udisks try:
udisks --mount /dev/device
e.g.:
udisks --mount /dev/sdc1

And / or have a look at e.g.
ls -l /dev/disk/by-label/

And mount by e.g.:
udisks --mount /dev/disk/by-label/MyUSBDevice

etc.

A: create a directory on for example:
/home/YourUserName/Desktop/MyUsb

Then run the command:
$ mount -t vfat /dev/sdb1 /home/YourUserName/Desktop/MyUsb

-t vfat = for msdos (fat-fat16-fat32 etc.)
-t ntfs = for ntfs
-t ext2 = for ext2
-t ext3 = for ext3
-t ext4 = for ext4

A: On linux systems and many Unix systems, entries in the file /etc/fstab govern whether and where a device is mounted at startup.  Use the command man fstab for details about fstab entries.  Here are some examples:
/dev/sdf1  /sf1  fuseblk user,rw,nosuid,nodev,noauto 0 0
/dev/sdg3  /sg3  ext2    user,auto,nosuid,nodev      0 0
UUID=994228d4-etc-7f1d7d0 /usr   ext4 defaults       0 2

Items with a user keyword in them allow the user to mount or umount the corresponding device without needing to use sudo or su.  Items with auto mount automatically on system startup (and if not present may cause startup problems).  Items with rw are mounted read-write.
When fstab entries specify both a device and a mount point the mount command only needs to give one of them. For example, given the above entries, /dev/sdf1 can be mounted by the user at /sf1 by either of the following commands:
mount /sf1
mount /dev/sdf1

On linux systems or Unix systems with /proc you can see a list of partitions, mounted or not, via
cat /proc/partitions

If you know the UUID's of partitions on your USB drive, you can use the UUID instead of the device name in its fstab entry.  On some linux systems, use
ls -l /dev/disk/by-uuid/

to see the correspondence of UUID's and devices.

A: I am using centOS 7 with the Mate desktop. I ran into a the problem of not being able to mount a USB disk. Short answer. Make sure that you have the desired users that you want to be able to mount USB devises  to the  disk group.


text:
Q: what is return value from print_r(PDO::getAvailableDrivers()); command mean print_r(PDO::getAvailableDrivers()); //

Array ( [0] => mysql [1] => sqlite )
Array ( [0] => mysql [1] => sqlite [2] => sqlite2 )
What is difference beween these 2 output
Thanks everone for answer my innocent question

A: http://php.net/manual/it/pdo.getavailabledrivers.php

This function returns all currently available PDO drivers which can be used in DSN parameter of PDO::__construct()

The sqlite driver is SQLite 3, while sqlite2 is SQLite 2 and therefore is older.
The SQLite 2 driver for PDO is provided primarily to make it easier to import legacy SQLite 2 database files into an application that uses the faster, more efficient SQLite 3 driver.


text:
Q: Brute force chromatic number in Java This is a brute force attempt at the chromatic number of a matrix. It seems to work in the sense that it gives me the correct number of colors required but instead of 1,2,3,4 it will display 1,2,3,6. For some reason even if the matrix is possibly successful with fewer colors it will still fail and keep going to the max number. Is there a reason why it continues to fail?
"n" is the max number of colors. "v" is the vertex, and "m" is the number of currently used colors.
pseudo code:
http://i42.tinypic.com/deoc2u.jpg
static int color(){
       int i;
       for(i = 1; i <= n; i++)
       {
               if(color(0,i)){
                       return i;}
       }
       return i;
}

    static boolean color(int v, int m) {

    if(v > n-1)
            return true;
    else
    {
            for(int i = 1; i <= m; i++)
            {
                    boolean match = false;
                    q[v] = i;

                            for(int j = 0; j < n; j++)
                            {
                                    if(input[v][j] == 1)
                                    {
                                            if(q[v] == j+1)
                                                    match = true;
                                    }
                            }

                    if(match == false)
                    {
                            if(color(v+1,m))
                                    return true;
                    }
            }
            q[v] = 0;
            return false;
    }

}

sample output:
File Name: file1
Input
6
0 1 1 0 1 1
1 0 1 1 1 1
1 1 0 1 0 1
0 1 1 0 1 1
1 1 0 1 0 1
1 1 1 1 1 0
1 failed
2 failed
3 failed
4 failed
5 failed
Colors:
1 2 3 1 3 6

A: Gah, I should be asleep! But I can't count the number of times I've put off an assigment to the absolute last possible moment, so I'm feeling sympathetic regarding your deadline.
It's not really a "brute-force" approach, since that would actually come down to trying each and every possible node coloring combination and check which ones don't conflict. Your approach is a heuristic known as greedy coloring. It can find optimal results but can also yield an arbitrarily bad solution. That said, I've tried manually going through the sample input you've provided (thank you, Microsoft Paint) and following that algorithm the result should indeed be 4 when starting from vertex 0.
So here's what I believe might be wrong with your code. In the following extract...
if(input[v][j] == 1)
{
    if(q[v] == j+1)
    match = true;
}

You seem to be comparing the color of the current vertex (which will just be i anyway) to a vertex index, rather than the color of that other vertex. I think you'll need to alter the inner test to...
if(i == q[j])

or, if you wish (won't make a difference)...
if(q[i] == q[j])

Also, you're doing a bit too many checks. Vertex 0 can be assigned color 1. Vertex 1 then needs to be checked against vertex 0 if it's adjacent. Vertex 2 needs to be checked against 0 and 1 if they're adjacent, and so on. You're checking against vertices that couldn't have been assigned a color yet. So don't limit j to n but limit it to your current vertex v.
Finally, using a construct like if(match == false) is rather confusing and not necessary. Just use if(!match) instead.
Hope this helps. If you're still stuck and I happen to catch the comments in time, I can provide more pointers.


text:
Q: UPSERT using ID only when provioded in PostgreSQL With the following PostgreSQL query, I would like to "upsert" a row such that if the row data I provide contains data for the field "id", it will be used, and if if not, it will be autogenerated by postgres. Is this possible to carry out?
Schema
create table if not exists spotify_crons (
      id uuid default uuid_generate_v4 () primary key
    , name varchar(32) unique
    , seed_artists varchar(32)
    , seed_tracks varchar(32)
    , seed_genres varchar(256)
    , created_at timestamptz not null default now()
    , updated_at timestamptz not null default now()
);
comment on column spotify_crons.id is 'The UUID of the cron entry';
comment on column spotify_crons.name is 'The unique name of the cron entry';
comment on column spotify_crons.seed_artists is 'The spotify artist seed of the cron entry';
comment on column spotify_crons.seed_tracks is 'The spotify track seed of the cron entry';
comment on column spotify_crons.seed_genres is 'The spotify genre seed of the cron entry';
comment on column spotify_crons.created_at is 'The time of creation for the cron entry';
comment on column spotify_crons.updated_at is 'The time of last update for the cron entry';

Query
insert into spotify_crons
    (
          id
        , name
        , seed_artists
        , seed_tracks
        , seed_genres
        , created_at
        , updated_at
    )
values
    (
          case
            when %(id)s is distinct from null
            then %(id)s
            else gen_random_uuid()
          end
        , %(name)s
        , %(seed_artists)s
        , %(seed_tracks)s
        , %(seed_genres)s
        , now()
        , now()
    )
on
    conflict (id)
do
    update
set
    name = %(name)s
  , seed_artists = %(seed_artists)s
  , seed_tracks = %(seed_tracks)s
  , seed_genres = %(seed_genres)s
  , updated_at = now()
returning id
;

Examples:
# Should insert new row with auto generated ID
{ "id": None, "name": "Hello", ...}

# Should insert the row with the provided UUID
{ "id": "some_uuid_that_doesn't exist", "name": "Hello", ...}

# Should update the row with the matching UUID with new data
{ "id": "some_uuid_that_exists", "name": "Hello", ...}

PS: I am using Python 3.7 with psycopg 3 if that matters

A: Something like this should work:
INSERT INTO spotify_crons (id, name,
                          -- ...
                          )
VALUES (COALESCE(%(id)s::UUID, uuid_generate_v4()),
        %(name)s,
        -- ...
       )
ON CONFLICT (id)
DO UPDATE SET name=EXCLUDED.name,
              -- ...

*

*Using the DEFAULT keyword in the COALESCE expression like this wouldn't work, but it shouldn't really be an issue if you know you want to generate a v4 random UUID anyway: COALESCE(%(id)s::UUID, DEFAULT).

*You may also run into other problems if you get conflicts with the unique name constraint, in which case this other question may be of interest.


text:
Q: Not clearing the data after form submission in codeigniter php I am having a registration form once user submit the form not clearing the data and it is not displaying the success message as well.here the code which i have written for registration form.
Controller:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Login extends CI_Controller {
public function __construct() {
    parent::__construct();
    $this->lang->load('error_messages', 'english');
    $this->load->model(VERSION . DOCTOR_MODEL_FOLDER . 'Doctor_model', 'doctors');
    $this->load->helper('gmaps');
    $this->load->library('locations');
}
 public function createAccount() {
    $first_name = $this->input->post('first_name');
    $last_name = $this->input->post('last_name');
    $email = $this->input->post('email_id');
    $password = $this->input->post('password');
    $phone_number = $this->input->post('phone_number_with_ext');
    $reg_no = $this->input->post('reg_no');
    $regDetails = array(
        'first_name' => $first_name,
        'last_name' => $last_name,
        'email_id' => $email,
        'password' => $password,
        'reg_no' => $reg_no,
        'mobile_no' => $phone_number,
    );
    $regMessage = $this->doctors->register($regDetails);
    //if registration done successfully
    if (is_string($regMessage)) {
        $data['success'] = true;
        $data['response'] = $phone_number;

    } else {
        //if there is error
        $data['success'] = false;
        $data['error_msg'] = $regMessage;
    }
    die(json_encode($data));
}

View:

                        <form class="form-validate form-horizontal " id="register_form" method="post" action="" enctype="multipart/form-data">

                                    <input class=" form-control" placeholder="First Name" id="first_name" name="first_name" type="text" />

                                    <input class=" form-control" placeholder="Last Name" id="last_name" name="last_name" type="text" />

                                    <input class=" form-control" placeholder="Email Address" id="email_id" name="email_id" type="text" />

                                    <input class="form-control country-code" placeholder="Phone Number" id="phone_number" name="phone_number" type="tel" />

                                    <input type="text" class="form-control " placeholder="Registration number" id="reg_no" name="reg_no">

                                    <input class="form-control " placeholder="Password" id="password" name="password" type="password" />

                                    <input class="form-control " placeholder="Re-enter Password" id="confirm_password" name="confirm_password" type="password" />

                                    <button type="submit" id="btnRegister" class="btn btn-primary btn-lg btn-block">Submit</button>

                        </form>

JS:
 // Submit registration form on button click last_name:{ required: true},
 $('form#register_form').validate({
  rules: {
    first_name: {
        required: true,
        alpha: true
    },
    email_id: {
        required: true,
        email: true
    },
    phone_number: {
        required: true,
        number: true,
        minlength: 8,
        maxlength: 10
    },

    password: {
        required: true,
        minlength: 6
    },
    confirm_password: {
        required: true,
        minlength: 6,
        equalTo: "#password"
    },
},
messages: {
    first_name: {
        required: "Please enter First Name.",
        alpha: "Special Characters not allowed."
    },
    email_id: {
        required: "Please enter a email address.",
        email: "Please enter a valid email address."
    },
    phone_number: {
        required: "Please enter Phone Number." ,
        number: "Please enter Numeric values for Phone Number."
    },
    password: {
        required: "Please provide a password.",
        minlength: "Your password must be at least 6 characters long."
    },
    confirm_password: {
        required: "Please provide a password.",
        minlength: "Your password must be at least 6 characters long.",
        equalTo: "Please enter the same password as above."
    },
},
submitHandler: function(form) {
    var post_data = $("#register_form").serializeArray();

    //var phoneExten = $("ul.country-list li.active").attr('data-dial-code');
    var phoneExt = $("#phone_number").intlTelInput("getNumber");
    post_data.push({name: "phone_number_with_ext", value: phoneExt});
    //console.log(post_data);

    $.ajax({
        url: "/createAccount",
        type: "POST",
        data: post_data
    }).done(function(res) {
        //console.log(res);
        var data = $.parseJSON(res);
        if( data.success){
        $('form#register_form div.form div.alert').removeClass('alert-danger').addClass('alert-success').text('User Created Successfully.').show().delay(2000).fadeOut('slow');
        }else{
            $('div.form div.alert').addClass('alert-danger').text(data.error_msg.message).show().delay(2000).fadeOut('slow');
            $("div.form").scrollTop();
        }
    });
     }
    });

Added success message in javascript it is working fine for failure message but not working for success message and once data is submitting it is displaying the data still in form fields.Not getting the data cleared.

A: Following line work like: first it find from#register_form withing the elements it next find div.form (which isn't inside the form#register_form) then jquery try to find div.alert withing div.form which is not found in your current HTML structure.
div.form is parent node of form#register_form.
$('form#register_form div.form div.alert').removeClass('alert-danger').addClass('alert-success').text('User Created Successfully.').show().delay(2000).fadeOut('slow');

You should change it to:
$('div.alert').removeClass('alert-danger').addClass('alert-success').text('User Created Successfully.').show().delay(2000).fadeOut('slow');

As far as you're submitting form through AJAX you need to clear out all form fields using jquery. You can do it like.
$('form#register_form').trigger("reset");

A: After end of the code use this line to refresh the page:
redirect('Login/createAccount','refresh');

For Success message:
In Controller Code:
$this->session->set_flashdata('Add', 'Your da`ta added Successfully..');
 redirect('Login/createAccount','refresh');

In View page after body:
<?php if($this->session->flashdata('Add')){ ?>

    <button type="button" class="close" data-dismiss="alert">×Close</button>
    <?php echo  $this->session->flashdata('Add'); ?>

<?php }  ?>

Javascript code for disable the flash data after particular time: