text:
Q: Shadow doesn't overflow when using React Native FlatList. It's works without FlatList Image
https://ibb.co/vJM305f
I am using FlatList to display a horizontal list. Each item has a showdow, which overflows over other items. It works without FlatList. But unfortunality not with FlatList.
I have attached a image above. Its shows a shadow line which is the issue.
Instead is should look like the below image.
https://ibb.co/6NWtcTK
 <FlatList
    data={[1, 1, 1]}
    horizontal
    showsHorizontalScrollIndicator={false}
    contentContainerStyle={{padding: RFPercentage(2)}}
    renderItem={() => {
      return (
        <Card style={[infoCardStyle, styles.infoCard]}>
          <View style={{flex: 1}}>
            <View style={styles.header}>
              <View style={{flex: 0.1}}>
                <Icon
                  name={'lightbulb-on-outline'}
                  size={RFValue(20)}
                  color="#fff"
                />
              </View>
              <View style={{flex: 0.9}}>
                <Title style={styles.didYouKnow}>Did you know?</Title>
              </View>
            </View>
            <View style={styles.description}>
              <View style={{flex: 0.1}} />
              <View style={{flex: 0.9}}>
                <Text style={styles.descriptionText}>
                  Your can watch your game clip play by{'\n'}play in REPS
                  application
                </Text>
              </View>
            </View>
          </View>
          <View style={styles.trailingText}>
            <Text style={styles.getAppNow}>Get the app now...</Text>
          </View>
        </Card>
      );
    }}
    keyExtractor={item => item.id}
  />


text:
Q: Merging all Word documents in folder in c# I'm trying to merge multiple Word documents from a folder, and save it in another folder.
I found this example and tried to implement the same method in my application. When i debug it it throws the following error:
System.NullReferenceException: 'Object reference not set to an instance of an object.'
objDocLast was null.
    public void Merge(string strOrgDoc, string[] arrCopies, string strOutDoc)
    {
        ApplicationClass objApp = null;

        //boxing of default values for COM interop purposes
        object objMissing = Missing.Value;
        object objFalse = false;
        object objTarget = WdMergeTarget.wdMergeTargetSelected;
        object objUseFormatFrom = WdUseFormattingFrom.wdFormattingFromSelected;

        try
        {
            objApp = new ApplicationClass();
            object objOrgDoc = strOrgDoc;

            Document objDocLast = null;
            Document objDocBeforeLast = null;

            objDocLast = objApp.Documents.Open(
              ref objOrgDoc,    //FileName
              ref objMissing,   //ConfirmVersions
              ref objMissing,   //ReadOnly
              ref objMissing,   //AddToRecentFiles
              ref objMissing,   //PasswordDocument
              ref objMissing,   //PasswordTemplate
              ref objMissing,   //Revert
              ref objMissing,   //WritePasswordDocument
              ref objMissing,   //WritePasswordTemplate
              ref objMissing,   //Format
              ref objMissing,   //Enconding
              ref objMissing,   //Visible
              ref objMissing,   //OpenAndRepair
              ref objMissing,   //DocumentDirection
              ref objMissing,   //NoEncodingDialog
              ref objMissing    //XMLTransform
              );

            foreach (string strCopy in arrCopies)
            {
                Debug.WriteLine("Merging file " + strCopy);
                //!!!!!!!!!!!!!!!!!!!!!!!Error shows up here:
                objDocLast.Merge(
                  strCopy,                //FileName
                  ref objTarget,          //MergeTarget
                  ref objMissing,         //DetectFormatChanges
                  ref objUseFormatFrom,   //UseFormattingFrom
                  ref objMissing          //AddToRecentFiles
                  );
                objDocBeforeLast = objDocLast;
                objDocLast = objApp.ActiveDocument;
                Debug.WriteLine("The active document is " + objDocLast.Name);

                if (objDocBeforeLast != null)
                {
                    Debug.WriteLine("Closing " + objDocBeforeLast.Name);
                    objDocBeforeLast.Close(
                      ref objFalse,     //SaveChanges
                      ref objMissing,   //OriginalFormat
                      ref objMissing    //RouteDocument
                      );
                }

            }

            object objOutDoc = strOutDoc;

            objDocLast.SaveAs(
              ref objOutDoc,      //FileName
              ref objMissing,     //FileFormat
              ref objMissing,     //LockComments
              ref objMissing,     //PassWord
              ref objMissing,     //AddToRecentFiles
              ref objMissing,     //WritePassword
              ref objMissing,     //ReadOnlyRecommended
              ref objMissing,     //EmbedTrueTypeFonts
              ref objMissing,     //SaveNativePictureFormat
              ref objMissing,     //SaveFormsData
              ref objMissing,     //SaveAsAOCELetter,
              ref objMissing,     //Encoding
              ref objMissing,     //InsertLineBreaks
              ref objMissing,     //AllowSubstitutions
              ref objMissing,     //LineEnding
              ref objMissing      //AddBiDiMarks
              );

            foreach (Document objDocument in objApp.Documents)
            {
                objDocument.Close(
                  ref objFalse,     //SaveChanges
                  ref objMissing,   //OriginalFormat
                  ref objMissing    //RouteDocument
                  );
            }

        }
        finally
        {
            objApp.Quit(
              ref objMissing,     //SaveChanges
              ref objMissing,     //OriginalFormat
              ref objMissing      //RoutDocument
              );
            objApp = null;
        }

    }

    /// Merge a document with a set of copies

    // name = "strOrgDoc">
    // Original file name

    // name = "strCopyFolder">
    // Folder in which the copies are located

    // name = "strOutDoc">
    // The result filename

    public void Merge(string strOrgDoc, string strCopyFolder, string strOutDoc)
    {
        string[] arrFiles = Directory.GetFiles(strCopyFolder);
        Merge(strOrgDoc, arrFiles, strOutDoc);
    }
}

I'm calling the method from another class:
        string orgFile = @"C:\M-Files Add-on\Styrerom Protokoll\Processing\10\Dokument dlij.docx";
        string cpyDir = @"C:\M-Files Add-on\Styrerom Protokoll\Processing\10\";
        string outFile = @"C:\M-Files Add-on\Styrerom Protokoll\Ready\10.docx";

        DocumentMerge docMerge = new DocumentMerge();
        docMerge.Merge(orgFile, cpyDir, outFile);

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to Map and reduce an array of Strings to a single object with multiple values I have a document that looks like such:
{
  _id: ObjectId("6222ca4252925ad4c3faec08"),
  value: ["test1","test2"]
}

I would like to get:
{
  _id: ObjectId("6222ca4252925ad4c3faec08"),
 "value":
    {
      "value1": "test1",
      "value2": "test2"
     }
}

I have tried to use reduce but I get each value in one object but am very close.  Please let me know what I am doing wrong:
Code:
{
  "$project": {
    "value": {
      $reduce: {
        input: "$value",
        initialValue: [],
        in: {$concatArrays: [
          "$$value",
          [{"name": "$$this"}]
        ]}
      }
    }
  }
}

Results:
{
    "_id" : ObjectId("6222ca4252925ad4c3faec08"),
    "value" : [
        {
            "name" : "test1"
        },
        {
            "name" : "test2"
        }
    ]
}

A: Currently you are just creating an array using $reduce, Instead you can try using $map to create an array of format [key, value] and then use $arrayToObject to convert that to a map as shown below:
[
  {
    "$project": {
      "provider": {
        "$arrayToObject": {
          "$map": {
            "input": "$value",
            "as": "v",
            "in": [
              {
                "$concat": [
                  "value",
                  {
                    "$toString": {
                      "$indexOfArray": [
                        "$value",
                        "$$v"
                      ]
                    }
                  }
                ]
              },
              "$$v"
            ]
          }
        }
      }
    }
  }
]

The $indexOfArray is just to get key of format value(N).
Mongo Playground


text:
Q: save the file in users desktop I have a file where i m able to generate the pdf, but i want the path to be users desktop which would save it automatically.
$pdf->Output("sample.pdf");

What should be path.

A: No matter what you have server side you won't be able to automatically save a file on a user's system via their browser with no interaction from them as that would be a massive security hole.  The user will always have to confirm the save of a file.
For similar reasons you won't be able to query the directory structure of a User's system via the browser, and even if you could I don't think you can give a browser a suggested directory in which to save something.

A: You can't do that with PHP. PHP runs on your server, not on your user's desktop. You probably want to store the file somewhere on the server, and then show the user a link to download the generated file.
Unless of course, you're talking about running PHP locally on your user's computer (i.e. apache or some other webserver is installed on your user's computer, in which case please clarify your question.

A: Assuming your php script is running as a client-side app through the Command Line Interface or PHP-GTK, you should first check if the system it runs on actually is a Win32 type machine.
Next you'd need to use the Windows Only Extensions to invoke the native Win32 API Function call returning a well-known location such as user's desktop folder, that is SHGetFolderPath() with a CSIDL_DESKTOP as a second parameter.
If however your script runs on a server, there's no way to put the file on user's desktop directly without her actually being instructed to do so.

A: You should output the PDF to the browser and provide the appropriate headers to have the file be recognised as PDF (or merely as downloadable to force a download). Also make sure not to output anything other than the PDF as that might corrupt the file.
EDIT: Note that if you use a webbrowser it is, for security reasons, not possible to FORCE an automatic download. You can only prompt a download, not activate it.
If you're talking about a PHP script (e.g. on a Linux workstation), you probably want to do something completely different. If the PDF library doesn't let you specify a path, do the same you would do in a web browser sans the headers and use an output buffer to catch the output and write it to a file -- if you run the script directly, it'll have the necessary privileges to write to your home directory.


text:
Q: TeX Live tools on command line unreferenced I've just installed TeX Live 2013 from tug.org
The installation was pretty long because my connection is slow and It had to download all the files.
My problem is I think I did the wrong way, I've installed the update of TeX Live but I didn't uninstall TeX Live 2009 just before, I guess this is not really a big problem because the installation directory is different from 2009 and 2013 (/usr/share/texmf/ and /usr/local/texlive/2013/) But now I seem not able to use the tools properly (TeXworks can't find my Live distro and I can't even use the binaries from the command line).
I uninstalled TeX Live 2009 after the installation of the 2013, How can I tell the system to include the binaries of the TeX live bundle, do I have to go through all that manually ?
I'm using ubuntu

A: Add the followwing lines to your .profile file:
PATH=/usr/local/texlive/2013/bin/i386-linux:$PATH
MANPATH=/usr/local/texlive/2013/texmf/doc/man:$MANPATH
INFOPATH=/usr/local/texlive/2013/texmf/doc/info:$INFOPATH

Log-out and then log-in once again.


text:
Q: What the unit of this date calculation? What is the unit in s or mn of this element?
$date = date('F d Y H:i:s.', filectime($filename))
$result = time() - $date;

$result  = 1492181252;

Is it in second?

A: PHP timestamps are seconds. It says it clearly in the documentation of time:

Returns the current time measured in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT).


text:
Q: play sound on click i have asked this question in a couple of places, but have yet to find or receive an answer. i am a code newbie, so any help would be greatly appreciated.
i am using in-page javascript on some of my pages to play a sound on clicking an image which loops a backing track to practise scales / lead guitar to.
here's the script:

and here's how i'm calling it for each image / mp3:

  Blues in C : backing for lead melody. Chords: C,F, G

my first question - the track isn't looping - is there something wrong with the script?
my second question - how do i extend the function so that on clicking the png to play the file it is swapped for another - stop button - which stops the loop when clicked.
many thanks, jan

A: Welcome to Stack Overflow.
Embedding sounds into web pages is a really tricky business and getting a solution that will work across all browsers and on mobile devices is a real challenge.
Fortunately there are libraries that you can use to make the embedding, playing, looping, switching of mp3s much, much easier.
I'd recommend looking into Soundmanager2, before you get too much further into this project to see if it could save you a lot of coding time, effort and frustration!


text:
Q: How to lookup a value and Index Match Table if a Date is between 2 dates with criteria? I would like to look up first ID match with second ID, if found then match first date with the given range date within same raw and then add type of leave according to the first date if matched
by using Vlookup / Match index /if

A: Assuming the columns shown are A to H, starting in row 1, this is the formula for C2:
=INDEX($F$2:$F$7,MATCH(1,(A2=$E$2:$E$7)*(B2>=$G$2:$G$7)*(B2<=$H$2:$H$7),0))

Note that this is an array formula. For it to work, you need to double click in cell C2 so you're in edit mode, then paste in the formula, then press CTRL-SHIFT-ENTER to save the formula.
You'll need to adjust the references to columns E,F,G and H to include all rows. Remember to press CTRL-SHIFT-ENTER each time.


text:
Q: Video decoding and rendering library for XLib Currently what I have a Linux application that was written using Xlib and I needed to add video playing capabilities into it.
What libraries would you recommend that I could use for video decoding and rendering that works well with Xlib?

A: The options are plentiful.

*

*xine-lib.

*GStreamer (works best with glib-based programs).

*Phonon (works best with Qt-based programs).

*FFmpeg.

*libVLC.

*MPlayer + XEmbed.

Xine is probably the easiest (easier than FFmpeg, anyhow) without requiring anything beyond itself and Xlib.  There's a short, complete example in under 180 lines of actual code.

muxine is a very small player that just creates a X11 window and play a given stream MRL. Source code: muxine.c.
You can compile muxine with:

gcc -Wall -O2 `xine-config --cflags`
    -o muxine muxine.c `xine-config --libs`

On the other hand, using MPlayer+XEmbed is pretty easy too, much easier if you don't care to have much control over the video playback.  Create a X11 window, and run mplayer -wid <window-id>.

A: You could try using either FFMpeg or Mplayer.


text:
Q: Swift3, Got message from using SDK When I try to use one framework, I got this message.
2017-07-13 15:51:17.966401+0700 testApp[44963:11841246] SDK Version : 1.2.6_20170419
2017-07-13 15:51:22.572884+0700 testApp[44963:11841267] libMobileGestalt MobileGestaltSupport.m:153: pid 44963 (testApp) does not have sandbox access for frZQaeyWLUvLjeuEK43hmg and IS NOT appropriately entitled
2017-07-13 15:51:22.572933+0700 testApp[44963:11841267] libMobileGestalt MobileGestalt.c:550: no access to InverseDeviceID (see <rdar://problem/11744455>)
2017-07-13 15:51:23.182125+0700 testApp[44963:11841298] WF: === Starting WebFilter logging for process testApp
2017-07-13 15:51:23.182506+0700 testApp[44963:11841298] WF: _userSettingsForUser mobile: {
     filterBlacklist =     (
     );
     filterWhitelist =     (
     );
     restrictWeb = 1;
     useContentFilter = 0;
     useContentFilterOverrides = 0;
     whitelistEnabled = 0;
  }
2017-07-13 15:51:23.182586+0700 testApp[44963:11841298] WF: _WebFilterIsActive returning: NO

I try to research but I have no idea what it is


text:
Q: Term for non-quantitative, non-qualitative variables? Disclaimer: I am a coder -- not at all a research scientist, data scientist, or statistician.
I support an online survey application that is then used to generate aggregate and individual data reports and visualizations.  For the sake of internal bookkeeping, we categorize all of our variables according to type (categorical, ratio, numeric, etc). We don't really gather qualitative data (and I have to admit, I'm not familiar with any ways these might be categorized).
We also collect a lot of data, that for want of a better term, we call nonresearch data -- e.g. person names, organizational names, and address information. I'm wondering if there's a better term that we could be using when talking about (and more importantly, categorizing) this data.

A: In principle, this is categorical (also called "nominal") data. In a four-data-type system, that's the catch-all type for unordered, non-numerical data.
But you've unfortunately found the limit of the four-type classification system. The term "categorical" implies that the data can fall into a relatively small number of categories and follows a categorical distribution. That's technically also true for addresses, but isn't a helpful mental model. And if you're developing automated data-cleaning procedures that operate based on assigned data type, you might run into problems dealing with a large number of unique and unusually long "category" values like "4 Privet Drive, Little Whinging, Surrey, England."
I don't think there's one accepted term for this, but if you're just looking for a name for this type of category I'd consider terms like "administrative," or your own term "nonresearch." You could also just call it "qualitative" in order to distinguish it from the more-but-not-entirely-quantitative "categorical/nominal" type. You could also call it "metadata," but I feel like that would be confusing: is it "meta" with respect to observations, or "meta" with respect to the data set?


text:
Q: pass function into JSON.stringify I need to pass the handleUpdateHours function in my payload below, how can I do
const handleUpdateHours = async () => {
            firestore()
                .collection('Providers')
                .doc(req.body.providerId)
                .collection('ServiceHistory')
                .doc(req.body.serviceProviderId)
                .update({
                    additionalHours: Number(req.body.hours)
                });

            firestore()
                .collection('Clients')
                .doc(req.body.clientId)
                .collection('ServiceHistory')
                .doc(req.body.serviceClientId)
                .update({
                    additionalHours: Number(req.body.hours)
                });
        }

payload:

I was trying what's with // commented on the payload but it didn't work.
he is not adding my function to the object I do not receive any error but also does not add the function
const payload = {
            tokens: [clientFcmToken],
            data: {
                // notification: {
                //         typeObj: () => handleUpdateHours(),
                //         data: {
                //             type: () => handleUpdateHours(),
                //         }
                //     },
                notifee: JSON.stringify({
                    title: 'O Helper está solicitando horas adicionais ao serviço',
                    body: 'Você deseja aceitar?',
                    data: {
                        type: '() => handleUpdateHours()',
                    },
                    // notification: {
                    //     typeObj: () => handleUpdateHours(),
                    //     data: {
                    //         type: () => handleUpdateHours(),
                    //     }
                    // },
                    android: {
                        channelId: 'default',
                        actions: [
                            {
                                title: 'Aceitar',
                                pressAction: {
                                    id: 'acceptHours',
                                    type: () => handleUpdateHours(),
                                },
                            },
                            {
                                title: 'Recusar',
                                pressAction: {
                                    id: 'refuseHours',
                                },
                            },
                        ],
                    },
                }),
            },
        }


text:
Q: Masstransit rabbitMQ publishing on many threads I have an application that spins up a lot threads. Each thread submits the same message type via masstransit / rabbitmq. I've created a singleton to store one instance of IBus. The application only publishes messages so no endpoints are in the configuration.
Is a singleton message bus the correct thing to do when only publishing? I did performance testing by setting up a loop to constantly publish a message. When running just one thread 52000 messages where added to the queue in 60 seconds. When 5 threads where run, each doing the same loop, only 8000 messages where added to the queue in 60 seconds.
Why when running 5 threads is the performance much worse? Should each thread have its own bus instance?

A: A single bus instance will create a single connection to RabbitMQ. And that is typically enough for most situations. If you want to scale out the connections, currently additional bus instances would need to be created.
However, you should be able to publish at a fairly high rate, particularly if you have multiple threads which play nicely with the TPL (Task Parallel Library). You can also combine multiple Publish calls into a single Task.WhenAll(), to avoid the latency between each message.
A good test is to use the MassTransit-Benchmark project to get an idea of the throughput of your broker. Typically I see anywhere from 8000-12000 messages per second published and consumed through RabbitMQ (non-durable, with publisher confirmation disabled). Adding durability, and confirmation, can slow down single-threaded publishing but shouldn't impact multiple source threads significantly. The durable writes to disk can slow things down for sure.
I'd be curious of the code you used where multiple threads were slower. I find it best to use Task.Run() rather than Thread.Create() (or whatever the syntax is now, I never use threads anymore).


text:
Q: How to restrict HATEOAS navigation links based on WebAPI permissions? I'm toying with the idea of adding HATEOAS type links to the data being returned from my WebAPI routes that will provide clues to the client as to what actions are available on any given piece of data.
So, I might have something like:
clients: {
  data: [
    {data: {id: 1, name: "Client One", age: 1},
     _links: {
       self: {href: ".../api/clients/1}, method: "get"}
       edit: {href: ".../api/clients/1}, method: "put"}
       delete: {href: ".../api/clients/1}, method: "delete"}
     }
    }
  ],
  _links: {
    self: {href: ".../api/clients", method: "get"},
    add: {href: ".../api/clients", method: "post"}
  }
}

I've seen a number of posts that talk about how to include the links so that part isn't an issue.
The Problem
Part of the idea behind HATEOAS is to make your data self-defining / self-navigating.  So, what I'd like to see is to have my _links only include those that are available to the user based on his/her permissions.  IOW, if the user was allowed to Edit a client but not Delete the client, then the _links should include the edit but not the delete.
The problem then is that in generating the links, I would actually need to evaluate the Authorization Policy of the Action/Route in order to determine if the link should be included.
So given something like this (this is intended as a talking point -- not actual code):
[Route("api/v1/[controller]")]
[APIController]
[Authorize(Policy="HR")]
public class UsersController : ControllerBase {

   [HttpGet]
   public async Task<IActionResult> GetClients() {
       var results = new List<dynamic>();
       var list = context.Clients.Select(u => new BasicClient(u.Id, u.Name))
          .ToList();

       foreach(var client in list){
         //If user has access to GetClient Action
         if(??) {
           client._links.Self.Href = Url.Action("GetClient", new {id = client.Id});
         }

         //If user has access to DeleteClient Action
         if(??) {
           client._links.Delete.Href = Url.Action("DeleteClient", new {id = client.Id});
        }
        ...
   }

   [HttpGet("{id}", Name="GetClient")]
   [Authorize(Policy="ViewClient")]
   public async Task<IActionResult> GetClient(int id){ ... }

   [HttpDelete("{id}", Name="DeleteClient")]
   [Authorize(Policy="DeleteClient")]
   public async Task<IActionResult> DeleteClient(int id) { ... }

A user would need the permissions necessary to satisfy both the HR and ViewClients policies in order to get the self link and additionally the DeleteClients policy to get the delete link.
Is this possible?  Am I thinking about this wrong?  Is there a better way?
Clarification
While it is possible to use the AuthorizationService to check a specific Policy, what I'm trying to do is avoid the use of hard-coded policies.  The Policies have already been defined on the Controller and Actions that I'm trying to access.  I want to know if there is a way to validate a user against an Action (and let the framework sort out what Policy needs to be applied).
So, in the same way that Url.Action("GetClient",...) takes the name of an Action and builds the correct link based on the defined routes, I want something like AuthService.AuthorizeAction("GetClient", User) that will figure out what permissions are necessary and if the User has those permissions.
Was hoping that .NetCore has something built in that does that.  If not, I suppose I could use reflection and the IAuthorizationService to do this.

A: IAuthorizationService is the service you're looking for. Here is a code snippet:
var result = await authorization.AuthorizeAsync(User, "IsLucky");
IsLucky = result.Succeeded;

Credit: https://odetocode.com/blogs/scott/archive/2019/05/30/evaluating-asp-net-core-authorization-policies.aspx


text:
Q: java swing get or set unique id for new JButton while create thim on for loop i have java swing Class that create JButton
it is working but what i need is when i pressed a JButton lets seed that it is number 1 the code in the ActionEvent is to change the Background of the JButton but what i need is if i pressed another JButton the first one i need it to go back to red Color :
Example :
  package Classes;

import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;

       public class testbtn {

            public JFrame frame = new JFrame();

            public int copcounter = 5;

            public testbtn() {

                JPanel jdb = new JPanel();

                jdb.setLayout(new FlowLayout());

                for (int x = 1; x <= copcounter; x++) {

                    JButton btn = new JButton();

                    btn.setText(String.valueOf(x));

                    if (x == 1) {

                        btn.setBackground(Color.yellow);

                    } else {

                        btn.setBackground(Color.red);

                    }

                    btn.putClientProperty("id", x);

                    btn.addActionListener((ActionEvent e) -> {

                        btn.setBackground(Color.yellow);

                        System.out.println(e.getID());

                    });

                    jdb.add(btn);

                }

                frame.add(jdb);

                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                frame.pack();
                frame.setLocationRelativeTo(null);
                frame.setVisible(true);

            }

            public static void main(String[] args) {
                SwingUtilities.invokeLater(new Runnable() {
                    public void run() {
                        new testbtn();
                    }
                });
            }
        }

this code will show form like this :

when i press JButton 4 the output become like this :

but i need it to be like this so the other button will become red color but what i pressed i need it to become yellow ! :

i know that i can use id but how to get the id for them ! or if there is better way ?

A: No need for an id, simply put all the JButtons into a List<JButton>, say called buttonList, and then iterate through the list in the button's ActionListener, turning backgrounds red for all the buttons in the list, and then turn the current button's background yellow.
And then in the code that uses it:
public void actionPerformed(ActionEvent e) {
    // iterate through the list
    for (JButton button : buttonList) {
        button.setBackground(Color.RED);
    }

    // then set *this* button's color yellow:
    ((JButton) e.getSource).setBackground(Color.YELLOW);
}

That's it
or for your code...
public class TestBtn {
    public JFrame frame = new JFrame();
    public int copcounter = 5;
    private List<JButton> buttonList = new ArrayList<>();

    public TestBtn() {
        JPanel jdb = new JPanel();
        jdb.setLayout(new FlowLayout());
        for (int x = 1; x <= copcounter; x++) {
            JButton btn = new JButton();

            // add this
            buttonList.add(btn);

            btn.setText(String.valueOf(x));
            if (x == 1) {
                btn.setBackground(Color.yellow);
            } else {
                btn.setBackground(Color.red);
            }
            // btn.putClientProperty("id", x);
            btn.addActionListener((ActionEvent e) -> {
                // iterate through the list
                for (JButton button : buttonList) {
                    button.setBackground(Color.RED);
                }

                // then set *this* button's color yellow:
                ((JButton) e.getSource).setBackground(Color.YELLOW);

                // show button text
                System.out.println(e.getActionCommand());
            });
            jdb.add(btn);
        }
        frame.add(jdb);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.pack();
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
    }

    public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                new testbtn();
            }
        });
    }
}

Also, the ActionEvent's actionCommand String should match the button's text (with some exceptions).


text:
Q: Ubuntu 15.04 nvidia 346.59 external monitor display - windows stretched; click offset is off I have used the same hardware setup with Ubuntu 14 and didn't have any problems with the nvidia driver (not sure which one I used back then).
Seems to work fine in "only external monitor" "only built-in display" or "screen mirroring" mode. But when it comes to extending desktop on multiple displays, windows look extremely stretched horizontally and click offset if off by a lot.
Tried the following:
- X.org driver is O.K but slow and flickers on the external monitor
- Cycling through display modes with no avail
- Couldn't find any BIOS setting for nvidia optimus to try turning it off
Any help would be greatly appreciated!

A: I've had the same problem for months and even downgraded to 14.04.2 to see if that would help with Nvidia 331-updates. After a bit of research I found a bug on launchpad and the [fix] (https://bugs.launchpad.net/ubuntu/+source/xorg/+bug/1382462/comments/35) suggested here sorted it for me at last (Asus N56VM with Nvidia 630M/Intel). Phew!

[Install] CompizConfig Settings Manager, go to "General Options", then
  "Display Settings" and do the following:

*

*Uncheck "Detect Outputs"

*In the Outputs array, set the resolutions of each of your screens. The numbers after the resolution "1920x1080+0+0" are the offset. It's
  important to add this offset according to your needs. I have two full
  HD screens, so I added the following configuration: 1920x1080+0+0
  1920x1080+1920+0

  The second output has an offset of 1920, because it is on the right
  side of the first output, which has a width of 1920.


text:
Q: How can my model for a compound angular arm be adjusted to account for a special case? I'm creating a robot.  More specifically, I'm creating a robotic arm that can pick up objects and place them accurately in egg-carton slots.  This is for the Science Olympiad(I'm a high school student).  I feel it would be ineffective to try to explain my robot through text, so here's a LaTex document(with diagrams and my current model) to help explain it.
Essentially, my robot is two lengths of material on a flat plane.  There is a joint fixed in space on which the first length is placed.  Then, a second joint it fixed onto the end of that length, and the second length is fixed onto that joint.
The angle which the first length makes with the horizontal is referred to as $\alpha$.  The angle which the second length makes with the horizontal is referred to as $\beta$.
At the end of the second length, there is a particle that is moving with a Cartesian velocity $\vec{v}=\langle\frac{dx}{dt},\frac{dy}{dt}\rangle$.
You have the knowledge of the current values of $\alpha$ and $\beta$.  You also have the ability to set the current values of $\frac{d\alpha}{dt}$ and $\frac{d\beta}{dt}$.
We define the compound angular-velocity vector as $\vec{\omega}=\langle\frac{d\alpha}{dt},\frac{d\beta}{dt}\rangle$
At the end of my solution, I result in the following.
$
\vec{\omega}(\alpha,\beta,\frac{dx}{dt},\frac{dy}{dt})=\bigg\langle-\frac{1}{\ell_1sin(\alpha)}\bigg[\frac{dx}{dy} + sin(\beta)\frac{\frac{dy}{dt}sin(\alpha) + \frac{dx}{dt}cos(\alpha)}{sin(\alpha)cos(\beta) -cos(\alpha)sin(\beta)}\bigg],\frac{1}{\ell_2}\bigg[\frac{\frac{dy}{dt}sin(\alpha) + \frac{dx}{dt}cos(\alpha)}{sin(\alpha)cos(\beta) -cos(\alpha)sin(\beta)}\bigg]\bigg\rangle
$
I'm pretty happy with this solution.  However, there are some times when the model breaks down.  The most important one, in my eyes, is the case when $\alpha$=$\beta$.
If $\alpha=\beta$, then $sin(\alpha)cos(\beta) -cos(\alpha)sin(\beta)=0$.  That turns out to be a problem, because that motif is in the denominator of both $\frac{d\beta}{dt}$ and $\frac{d\beta}{dt}$.  It makes intuitive sense, too.  I give the following example in the paper.
Imagine that $\alpha=\beta=\frac{\pi}{4}$ and $\vec{v}=\langle1,1\rangle$.  It is clear that there ought to be no vector $\vec{\omega}$, since you are trying to push the particle directly outside of the locus of points the compound arm can inhabit.  That motif in the denominator is a safe-guard against this.
However, imagine a similar kind of situation.  In this case, $\alpha=\beta=\frac{\pi}{4}$ like before, but $\vec{v}=\langle0,-1\rangle$.
In this case, you're attempting to push the particle in such a way that it stays in the locus of points the arm can inhabit.  My intuition tells me there should be some well-defined value of $\vec{\omega}$ for this situation, but because $\alpha=\beta$, my model fails.
Now, I could just implement some sketchy solution to this problem in my code.  I just wanted to check with you all if there was a more elegant solution.
What do you think?  Is there some kind of way that I can get a meaningful result from the cases when $\alpha=\beta$?  Perhaps a kind of piecewise function?
I appreciate the help. :)


text:
Q: Solving $4^{x+\sqrt{x^2-2}}-5\cdot 2^{\sqrt{x^2-2}-1}=6$ for real $x$ I was given the following equation:
$$4^{x+\sqrt{x^2-2}}-5\cdot 2^{\sqrt{x^2-2}-1}=6; x\in \mathbb{R}$$
Here is how I tried to solve it:
$$2^{2x+2\sqrt{x^2-2}+1}-5\cdot 2^{\sqrt{x^2-2}}=12$$
$$2^{\sqrt{x^2-2}}(2^{2x+1+\sqrt{x^2-2}}-5)=2^2\cdot 3$$
Where $$2^{\sqrt{x^2-2}}=2^2 \land 2^{2x+1+\sqrt{x^2-2}}-5=3$$
$$\Updownarrow$$
$$\sqrt{x^2-2}=2 \land 2x+1+\sqrt{x^2-2}=3.$$
As well as we must note that $$x\in \left( -\infty ; -\sqrt2 \right]\cup \left[ \sqrt{2};\infty\right)$$
However
$$2x+1+\sqrt{x^2-2}=3 \Leftrightarrow -3x^2+8x-6=0$$
$$x_{1,2}=\frac{8\pm\sqrt{-8}}{6}$$
Thus, it's not satisfying given domain.
So I tried to use substitution
Let $\sqrt{x^2-2}=t, t\geq 0,$ then $x^2=t^2+2 \Leftrightarrow x=\pm \sqrt{t^2+2}$
If $$x=\sqrt{t^2+2}$$ then $$4^{x+\sqrt{x^2-2}}-5\cdot 2^{\sqrt{x^2-2}-1}=6$$
$$\Updownarrow$$ $$2^{2\sqrt{t^2+2}+2t}-5\cdot 2^{t-1}=6$$
$$\Updownarrow$$
$$2^{2\sqrt{t^2+2}+2\sqrt{t^2}}-5\cdot 2^{\sqrt{t^2}-1}=6$$
From here if I continued using substitution to make it into a quadratic equation, I would reach a result, however, I doubt this is the right way as I only had 10 minutes to solve this in class and I'm only up to high school. Can someone provide me with any solution?

A: Comment: As you modified we have:
$2^{2x+1+2\sqrt{x^2-2}}-5\cdot 2^{\sqrt {x^2-2}}-12=0$
$2^{2x+1+2\sqrt{x^2-2}}=2^{2x+1}\cdot 2^{2\sqrt {x^2-2}}=2^{2x+1}\cdot (2^{\sqrt{x^2-2}})^2$
$2^{2x+1}\cdot (2^{\sqrt{x^2-2}})^2-5\cdot 2^{\sqrt{x^2-2}}-12=0$
Let $2^{\sqrt{x^2-2}}=y$ , we can write:
$(2^{2x+1})\cdot y^2-5y-12=0$
$y=\frac {5\pm\sqrt{25+48\cdot 2^{2x+1}}}{2\times 2^{2x+1}}$
Now you have to search whether following system of equations is  consistent or not:
$\begin {cases}\Delta=25+48\cdot 2^{2x+1}=k^2\\y=2^{\sqrt{x^2-2}}\end {cases}$
For solutions in $ R$ we take only positive solutions for y:
$y=\frac {5+\sqrt{25+48\cdot 2^{2x+1}}}{2\times 2^{2x+1}}$
Update:   we can see that:
$2^{2x+1}=11\rightarrow 2x+1\approx 3.5\rightarrow x=1.25$
$y=\frac{5+17}{2\times 11}=1=2^{\sqrt{x^2-2}}\Rightarrow X^2-2=0$
which gives $x=\sqrt 2\approx 1.4...$
1- $\sqrt 2$ gives $LHS=5.6$
2-$x=2$, gives $LHS=39.3$
3- In fact we must have $\sqrt 2<x< 2$, $x=1.6$ works:
$LHS\approx 12$
No need a complicated analytic solution; these three steps can be done using a calculator in less that ten minutes. What is more important is to find the domain.


text:
Q: laravel 8 session doesn't save data I'm trying to save an array for checkout but when i print session it gives null
namespace App\Http\Livewire;
use App\Orders;
use Livewire\Component;
use Illuminate\Support\Facades\Auth;
use Illuminate\Http\Request;
use Cart;
use Carbon\Carbon;
public function setAmountForCheckout()
    {
        if(session()->has('coupon'))
        {
            session()->put('checkout',[
                'discount'=>$this->discount,
                'subtotal'=>$this->subtotalAfterDiscount,
                'total'=>$this->totalAfterDiscount,
            ]);
        }
        else
        {
            session()->put('checkout',[
                'discount'=>0,
                'tax'=>Cart::instance('cart')->tax(),
                'subtotal'=>Cart::instance('cart')->subtotal(),
                'total'=>Cart::instance('cart')->total(),
            ]);
            session()->save();
        }

    }
public function placeOrder(Request $request)
    {
        dd(session()->get('checkout'));
        $this->validate([
            'first_name' => 'required|min:4|string',
            'Phone_number' => 'required|digits:11'
        ]);
        $order=new Orders();
        $order->user_id=Auth::id();
        $order->cust_name=$this->first_name;
        $order->phone=$this->Phone_number;
        $order->subtotal=session()->get('checkout')['subtotal'];
        $order->discount=session()->get('checkout')['discount'];
        $order->total=session()->get('checkout')['total'];
        $order->status='ordered';
        $order->is_shipping=$this->haveShipping ? 1:0;
        foreach(Cart::instance('cart')->content() as $items)
        {
            $orderItem= new OrderItems();
            $orderItem->product_id=$items->id;
            $orderItem->price=$item->price;
            $orderItem->order_id=$order->id;
            $orderItem->quantity=$item->qty;
            $orderItem->save();
        }
        if($this->haveShipping)
        {
            $this->validate([
                'Address'=>'required|min:4',
                'shipping_fee'=>'required|numeric'
            ]);
            $order->address=$this->Address;
            $order->delivery=$this->shipping_fee;
        }
        $order->save();
        Cart::instance('cart')->destroy();
        session()->forget('checkout');
    }

when i remove dd it gives me the error "Trying to access array offset on value of type null"
I'm trying to find what's wrong with the session.
also i have checked the cart if it works or not but i found that it works well and delivers data.

A: Remove
session()->save();

This is not needed as per https://laravel.com/docs/8.x/session#storing-data


text:
Q: C++ : Accessing the contents of a pointer I have the following function,
void swappingPieceState(std::vector<std::vector<Piece*> >* piecegrid) {

...

}

And I wish to access the Piece* stored inside that grid. Traditionally I'd do piecegrid[0][2] or something to that effect but since I'm using a pointer to it how do I access it? Sadly it isn't as simple as making a -> :x
Help. Thanks.

A: Easiest way is to dereference the pointers.
std::vector<..>* blah - dereference like (*blah)[0] to access element [0].
std::vector<std::vector<..*>*> blah - dereference like (*((*blah)[0]))[0] to access element [0][0].


text:
Q: Where can I find information about cmusphinx framework? Where can I find information or source code of Android sphinx framework? I need to make a report about speech recognition technology, especially sphinx framework, how does it works, about optimization of it and etc.

A: You can read the following publication about Pocketsphinx
https://www.cs.cmu.edu/~awb/papers/ICASSP2006/0100185.pdf
You can learn about Android from the corresponding wiki page
http://cmusphinx.sourceforge.net/wiki/tutorialandroid
For more in-depth review of speech recognition algorithms used in Pocketsphinx you can check the following thesis
http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.72.3560


text:
Q: How might one determine whether or not a substring in a body of html is part of a hyperlink? strange problem here that I've been pondering.  I have a string that contains HTML, possibly with hyperlinks in it.  Consider the text below:
Hello this is my EXAMPLE string of html here's a <tag> and here's another </tag>.  Blah blah I'm going to hyperlink some stuff with  anchor text  and then finish my sentence.
As you can see above, the phrase anchor text is the anchor text for a hyperlink to example.com.
I want to be able to search for a substring like anchor or example and determine whether or not each occurrence is part of a hyperlink, whether it be anchor text, the url, or the a tag.
Preferably, there would be an array returned with a true/false for each occurrence of the search term.  Case-insensitive search would be good, and it would be nice if it returned the matching occurrence, so we'd know the case and such.  An ideal response for the above example would be something like this:
$array[0][0] = "EXAMPLE"
$array[0][1] = false
$array[1][0] = "example"
$array[1][1] = true

The index of each occurrence might also be useful information to return.  Thanks!

A: You need to check all three cases, I think.
  #]*>[^<>]*YOURTEXT[^<>]*#

covers the first case,
  #][^<>]*YOURTEXT[^<>]*>[^<>]*#

would cover the second and third cases.
Or maybe you'd better check with a more tolerant regexp,
  #<a[^<>]*>*[^<>]*YOURTEXT[^<>]*>*[^<>]*#

and then verify with a HTML parser if the found text is indeed a valid A tag. The first test would ensure you that your text is in the captured snippet, and the second that the snippet is indeed a hyperlink.


text:
Q: Excel 2010 logic conditions vs. '#VALUE!' I would like to do logic against the return value of '#VALUE!' in Excel.
Setup: Let's say A1 = "Fu" and A2 = "Bar".  A3 = A1 - A2 will give me the #VALUE! Value Error.
I would like to do logic such as IF( (A1 - A2) != "#VALUE!", Do This, Else Do This).  If that expression is not allowed, then I can settle for IF( A3 != "#VALUE!", Do This, Else Do This).
My question:  Is this even possible?  Can you write logic against an Excel Value Error response?
Thanks in advance for any tips/tricks.

A: You can use the IFERROR function.
IF(ISERROR(A1-A2), DOTHIS, DOTHAT))


text:
Q: Accessing an EasyPHP local website on an Android device via Chrome's port forwarding I use chrome://inspect page on Chrome PC to use dev tools on Chrome Mobile.
I have my js+webgl games on a "local" website, http :// 127 .0. 0.1/site/, thanks to EasyPHP.
I use to upload the game to a real web server each time I make an edit and want to test it on Android, but I really would prefer the Android device to directly access the local website on my computer.
I know it is possible with the "port forwarding" feature on chrome://inspect, but I do not get it to work.
It uses 8000 as port and localhost:8080 as address.
There is a green dot aside the name of my Android device, so port forwarding is supposed to work.
But when I open  http :// 127 .0. 0.1/site/  on the Android device, it says "Oops! Google Chrome could not connect to 127.0.0.1".
What am I doing wrong ?

A: As long you are in the same network ( fe your home network) both devices can see each other. And if you enabled the ping-command on your operating system you can use to test this.
On the application layer they need the same ports to also talk to each other.
For this talking Easyphp runs the Apache webserver to listen the network for request.
As you remarked; Apache is listening the network on port 8080.
The flexibility of Apache is that you can change the number of that port yourself in the configuartion file. ( see https://collab.its.virginia.edu/wiki/toolbox/example%20httpd.conf%20file.html)
Once you completed this, you will get an error message that you have no access, and you should be happy because this means that both devices can already talk with each other :-)
The error message are thrown up by the build-in security-system of your webserver. This security is most of the time provided on folder level with text files ( see http://www.htaccess-guide.com/ )
Once made these changes your access your localweb folder (or htdocs in ?AMPP) from out the browser of your Android. And is the game on :-)


text:
Q: Sync two directories with NodeJS in both directions I've tried everything, looked everywhere, even tried to code my own program. I am lost.
The Idea: Two directories with the same set of files. Renaming a file in one renames it in the other. Editing a file in one edits it in the other. Same goes for deletion. And these changes should apply even if another program is autonomously making the changes.
And all of that, but also 2 ways. So making changes in Directory A makes the same changes to Directory B, but in addition, making changes to Directory B makes changes to Directory A.
The question is, can it be done?
/* Require Packages */
const $ = Object.assign.apply(0, ([
    'fs',
    'path',
    'readline'
]).map(a => ({ [a]: require(a) })));

/* Define Functions */
const _ = ({
    sls: {
        index: {},
        listen: function (a, b) {
            _.sls.index[a] = b;
        },
        trigger: function (a, b) {
            _.sls.index[a](b);
        }
    },
    inquire: function (a, b) {
        let x = $.readline.createInterface({
            input: process.stdin,
            output: process.stdout
        });
        x.question(a, c => _.sls.trigger('question', c));
        _.sls.listen('question');
        return _.sls.listen('question', b);
    },
    walk: function (a) {
        return $.fs.statSync(a).isDirectory() ? $.fs.readdirSync(a).map(b => _.walk($.path.join(a, b))) : a;
    },
    regex: function (a, b) {
        return new RegExp(a.replace(/[-\/\\^$+?.()|[\]{}]/g, '\\$&').split('*').join(b));
    },
    match: function (a, b, c) {
        let x = $.path.parse(a), y = null, z = false;
        for (let i = 0; i < b.length; ++b) {
            y = $.path.parse(c + b[i].context).dir.split('/');
            for (let j = 0; j < x.dir.split('/').length; ++j) {
                if (_.regex(y[j], '.').test(x.dir.split('/')[j])) {
                    for (let k = 0; k < b[i].match.length; ++k) {
                        if (b.type == 'regex') {
                            z = new RegExp(b[i].match[k]).test(x.base);
                        } else {
                            z = _.regex(b[i].match[k], '.*').test(x.base);
                            if (b.type == 'exclude') z = !z;
                        }
                    }
                }
            }
        }
        return z;
    },
    watch: function (a, b) {
        for (let i of b) $.fs.watch($.path.format({
            dir: $.path.parse($.path.normalize(i) + $.path.normalize(a).split($.path.normalize(b[0])).join('')).dir,
            base: $.path.parse(a).base
        }), {}, function (a, b) {
            console.log(b);
        });
    }
});

/* Execute Script */
$.fs.readFile('sync.json', function (a, b) {
    if (a) {
        console.log('No configuration file was found. One is being generated now.');
        $.fs.writeFile('sync.json', JSON.stringify({
            targets: [
                'C:/sync-this-directory',
                'C:/and-this-one',
                'D:/and-this-one'
            ],
            patterns: [{
                type: 'include',
                context: '/include-matches-only-in-this-directory',
                match: ['*.*', 'by default all files are excluded']
            }, {
                type: 'exclude',
                context: '/exclude-matches-only-in-the-subdirectories-of-this-directory/*',
                match: ['*.exclude_this_extension', 'exclude_this_filename.*']
            }, {
                type: 'include',
                context: '/*',
                match: ['(a,b,c,d)', 'would match any file with a, b, c, and d in the name']
            }, {
                type: 'include',
                context: '/*',
                match: ['[1,2,3,4].*', 'would match any file with 1, 2, 3, or 4 in the name']
            }, {
                type: 'include',
                context: '/*',
                match: ['{1,b,3,d}.*', 'would match any file with ONLY 1, b, 3, or d in the name']
            }, {
                type: 'include',
                context: '/*',
                match: ['these-characters{([1,a],[2,b]),([3,c],[4,d])}', 'patterns are checked in entry order']
            }, {
                type: 'regex',
                context: '/*',
                match: ['these matches are regex-enabled', 'all matches will be included, not excluded']
            }]
        }));
    } else {
        _.inquire('Once you have ensured all configured target directories and their contents match, press enter.', function () {
            let x = null;
            try { x = JSON.parse(String(b).split('/').join('\/')); } catch (g) {
                console.log('Parsing Error: Your config is fucked. Fix it.');
                throw new Error();
            }
            console.log('Your files are now in sync. A change to one is a change to all.');
            let y = Object.assign.apply(0, _.walk(x.targets[0]).map(function (a) {
                return a.constructor.name == 'Array' ? a : [a];
            }));
            for (let i of y) if (_.match(i, x.patterns, x.targets[0])) _.watch(i, x.targets);
        });
    }
});


text:
Q: How to get the output file format(with defined spaces) as same as input file format when passing through loops I need to get the output file same as the input file format after passing through the while loop.
eg:

cat samp.csv

a     b           c              d

cat samp.csv | while IFS= read -r line
do
echo $line
done

after passing samp.csv in while
output :

a b c d

expected output :

a     b           c              d

Could anyone please suggest me?

A: In bash, the string separated by spaces is split into words (word splitting). So four arguments are given to echo. If you want your blank spaces you need to add quotes to the variable $line, so only one argument is passed to echo.

cat samp.csv | while IFS= read -r line
do
echo "$line"
done

Output:

a     b           c              d


text:
Q: how to validate text for only , English characters and , Non English characters jquery validater I want to validate a text box to ensure only characters and Unicode characters can be added to it. For example, the following would be valid:
Gräfelfing
Gießen
München

But these should be invalid:
Gräfelfing123
Gießen!@#$
München123#@#

I know how to validate for characters using validator method:
jQuery.validator.addMethod("lettersonly", function(value, element) {
      return this.optional(element) || /^[a-zA-Z]+$/i.test(jQuery.trim(value));
    }, "Letters only please");

But how can I add Unicode character validation to this? Please help, thanks in advance.

* UPDATE *
I tried a solution with the help of this question - Regular expression to match non-English characters.
But it is not working:
jQuery.validator.addMethod("lettersonly", function(value, element) {
      return this.optional(element) || /^[a-zA-Z\u0000-\u0080]+$/i.test(jQuery.trim(value));
    }, "Letters only please");

A: Javascript lacks built-in character classe for "all latin-based letters with diactrics", so you must decide yourself what you really want to accept.
For example:

*

*do you want to accept Cyrillic (Russian, Bulgarian, Belorussian, etc)?

*Do you want to support kana (Japanese) or hangul (Korean)?

Those all are "non-Englih (or, more correctly: non-Latin) letters" after all.
After you've decided:

*

*consult code charts and just list all the ranges you want in your regexp

*You can use this tool to create a regex filtered by Unicode block.

Example
To add diactrics to list of allowed chars in the check in your code, you can use /^[a-zA-Z\u0080-\u024F]+$/i
That will cover

*

*Latin-1 Supplement

*Latin Extended-A

*Latin Extended-B ranges.

This should cover most of used diactrics and works will all examples you've provided.
Mix and match as you want.


text:
Q: Rejecting changes in table is too slow I am collecting revised and original text from documents. I do it by iterating through every sentence.
This works fine (except that sentence are often broken by the revisions themselves), but I am getting a HUGE performace hit when the documents contain lots of tables.
I'm talking a few hundred times longer than other files.
I used breakpoints to find that the perfo hit is around the sentence.revisions.rejectAll instruction. Each will take a few seconds.
Also, I take the two versions of text and write them into a spreadsheet.
Is there a trick anyone know of when working with revisions and tables?

A: As far as I was able to figure out, using different documents, rejecting revisions on tables are slow. Dead slow.
At first I thought the hit was largely due to formating revisions, but it is not the case. A document with 68 mixed revisions took 35 seconds to run. A similar one with 22 revisions took 23 seconds.
A document with just text revisions took about 4 minutes @ 178 revisions.
I also tried mixing a text document inside a table-filled one, and the performance was only as slow as when I did them separately (meaning there was no more impact from the text as when it was not in the table-filled document).
My conclusions are revision inside tables are slow to reject. Possibly due to the need to rearrange the layout after each change.


text:
Q: Add a value to a list everytime the user answers correctly I have a code written where a user has to answer a question true or false. What I want to do is everytime when a user answers correctly I add +1 to my arraylist. And then at the end of the game I display the number of answered questions. I tried to do it my way, however I get an error.
Here is how I create my list:
final ArrayList<Integer> points = new ArrayList<Integer>();

This is the button if the user presses True(For better understanding: When a user presses true a pop up window opens with the answer correct or false and the correct answer of the question. When the user clicks on the closepopup button an if method runs and checks if he pressed the right button and if its not the last question. If not,  it shows the next question and adds the +1 to the list):
mYes.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                initiatePopupWindow();
                if(type.get(count[0])){

                    ((TextView)pwindo.getContentView().findViewById(R.id.popupTekstasTiesaArNe)).setText("Correct!");
                } else {
                    ((TextView)pwindo.getContentView().findViewById(R.id.popupTekstasTiesaArNe)).setText("False!");
                }
               //Show the first answer on first button click.
                ((TextView)pwindo.getContentView().findViewById(R.id.popupTekstas)).setText(questions.get((count[0]) % questions.size()).answer);
        // When PopUp button closes open the next question with the if/else conditions.
            btnClosePopup.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    //if the question is true show next question/ else close app
                    if (type.get(count[0])) {
                        points.add(1); // if the answer is correct add +1 to the list.
                        if(questions.size()-1 == count[0]) // if you count[0] is init to 0
                        {

                            AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
                            builder.setTitle("WInner");
                            builder.setMessage("You won, play again?");
                            builder.setCancelable(false);
                            builder.setPositiveButton(android.R.string.yes,
                                    new DialogInterface.OnClickListener() {
                                        public void onClick(DialogInterface dialog, int id) {
                                            // just close dialog
                                            dialog.cancel();
                                        }
                                    });
                            builder.setNegativeButton(android.R.string.no,
                                    new DialogInterface.OnClickListener() {
                                        public void onClick(DialogInterface dialog, int id) {
                                         finish();

                                            mResult.setText(points.size());// here I try to print the number of answered questions.

                                        }
                                    });

                            // Create dialog from builder
                            AlertDialog alert = builder.create();

                            // Show dialog
                            alert.show();
                            count[0]=0;

                        }
                        else if(questions.size()-1 < count[0])
                            try {
                                throw new Exception("Invalid ");
                            } catch (Exception e) {
                                e.printStackTrace();
                            }
                        else
                        count[0]++;

                        mQuestion.setText(questions.get(count[0]).question); // you dont need calculate the module anymore
                        pwindo.dismiss();
                    } else {
                        count[0]++;

                        mQuestion.setText(questions.get(count[0]).question); // you dont need calculate the module anymore
                        pwindo.dismiss();
                    }

                }
            });

            }
        });

EDITED!!!
I figured out why SetText shows a blank textview. I want to show the answered question count in activity before the questions. I have a menuActivity>LevelselectActivity>GameActivity. In game activity I add to the list values. How to post them in LevelselectActivity? Should I use shared preferences? I have no idea now..


text:
Q: How to return the main nodes of json as array of object? I have created this code:
$lists = $this->db->select("SELECT * FROM LOGGER");

    $results = array();
    $results['information'] = array();

    $informations = $this->db->select("SELECT * FROM INFO WHERE code = :ccode", array("ccode" => "3"));

    foreach($informations as $item)
    {
            $results['information'][] = $item;
    }

    $response = array(
        "stack" => $lists,
        "information" => $results['information']
    );

    if(!empty($response['details']))
    {
        return '{"logger": ' . json_encode(array_values($response)) . '}';
    }

I take a stack information from my database and create two arrays. The first save all the informations stack that you can see below; the second array save only the description of the stack. Later I create a result array that save in each index stack and information the result of the two query. Now the final result is this:
{
"logger": {
   "stack": {
    "Code": "RB01",
    "Descri": null,
    "Created": "2016-03-09 04:36:04"
   },
    "information": [
      {
        "Id": "RB01",
        "numeric": 1
      },
      {
        "Id": "RB01",
        "numeric": 2
      },
      {
        "Id": "RB01",
        "numeric": 3
      }
    ]
  }
}

but my goal is create a structure like the following:
{
"logger": [
   {
    "stack": [
      {
        "Code": "RB01",
        "Descri": null,
        "Created": "2016-03-09 04:36:04"
      }
    ],
    "information": [
      {
        "Id": "RB01",
        "numeric": 1
      },
      {
        "Id": "RB01",
        "numeric": 2
      },
      {
        "Id": "RB01",
        "numeric": 3
      }
    ]
  }
]
}

which change I should do in my code?

A: For me, you should just change:
return '{"logger": ' . json_encode(array_values($response)) . '}';

with :
return '{"logger": ' . json_encode(array($response)) . '}';

A: It looks like you are just wrapping the object in another array?
if(!empty($response['details']))
{
    $encoded = array(array_values($response));
    return '{"logger": ' . json_encode($encoded) . '}';
}

Also, it is generally safer to create a new array json_encode that than writing your own json.
if(!empty($response['details']))
{
    $encoded = array(array_values($response));
    $result = array(
        'logger' => array(array_values($response)),
    );
    return json_encode($result);
}


text:
Q: How to fix this mysql error in ubuntu 16.04 LTS? Setting up mysql-server-5.7 (5.7.13-0ubuntu0.16.04.2) ...
debconf: unable to initialize frontend: Dialog
debconf: (Dialog frontend requires a screen at least 13 lines tall and 31 columns wide.)
debconf: falling back to frontend: Readline
update-alternatives: error: alternative path /etc/mysql/mysql.cnf doesn't exist
dpkg: error processing package mysql-server-5.7 (--configure):
 subprocess installed post-installation script returned error exit status 2
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-server-5.7; however:
  Package mysql-server-5.7 is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                          Errors were encountered while processing:
 mysql-server-5.7
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

How can I fix this error?

A: The error message

debconf: unable to initialize frontend: Dialog debconf: (Dialog frontend requires a screen at least 13 lines tall and 31 columns wide.)

is saying that, you're trying to install mysql from a very little terminal window which doesn't have required height (and/or width)  to display the questions needed to configure mysql. Without proper answers to those questions mysql configuration file could not be saved and without configuration settings file, mysql will be failing. probably you're using guake with little height or something.
Install mysql with a proper sized terminal and configure it answering the questions, mostly root password. The problem should go.


text:
Q: Time based workflow queue is getting emptied Couple of days ago I viewed a queue of Time-Based Workflow rules which notify a specific person (by creating tasks and emailing), but today I found this list is empty. This person mentioned that she turned off all notifications. How is that possible that it emptied workflow queue? I don't remember reading about it in any documentation. Is there a way to roll back changes?
UPDATE #1:
Workflow rules are active and were not changed in the last couple of days.
UPDATE #2:
Yesterday I fixed my rules and using apex triggered WFR to re-evaluate existing records and had my queue populated again... BUT I came in today and it's empty again. How is it possible?
UPDATE #3:
I found out that a scheduled apex class was causing an error and for some reason it cleared all WFR. Now it's fixed.

A: Are you sure it's actually triggering? It might be helpful to have a temporary checkbox which gets set as an immediate action to confirm the WFR is triggering. Also it's possible the record not longer matches the criteria, maybe someone has done a mass update?
Note:

Will the pending actions in the queue ALWAYS fire? No. Time-dependent
  actions remain in the workflow queue until processed or the rule
  criteria for the workflow rule is evaluated as false. If a record no
  longer matches the rule criteria when the rule is evaluated,
  Salesforce removes the time-dependent actions queued for that record.
For example, an opportunity workflow rule may specify: A criteria set
  to "Opportunity: Status not equals to Closed Won, Closed Lost." An
  associated time-dependent action with a time trigger set to seven days
  before the opportunity close date. If a record that matches the
  criteria is created on July 1st and the Close Date is set to July
  30th, the time-dependent action is scheduled for July 23rd. However,
  if the opportunity is set to "Closed Won" or "Closed Lost" before July
  23rd, the time-dependent action is automatically removed from the
  queue.

Taken from:
https://help.salesforce.com/HTViewSolution?id=000005245


text:
Q: Efficient way / right way to retrieve JSON data I am new to Android Studio, and I am trying to request API data from the Github API (e.g. https://api.github.com/users/froala) and display in my app.
I somehow made the app retrieve the JSON from the API by doing:
public class MainActivity extends AppCompatActivity {

    private TextView tvData;
    private static final String TAG = "MainActivity";

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

        Log.d(TAG, "onCreate: Starting.");

        // Set up the ViewPager with the sections adapter

        // Github tab

        Button buttonHit = (Button) findViewById(R.id.buttonHit);
        tvData = (TextView) findViewById(R.id.tvJsonItem);

        buttonHit.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                new JSONTask().execute("https://api.github.com/users/froala");

            }
        });

    }

    public class JSONTask extends AsyncTask<String, String, String> {
        @Override
        protected String doInBackground(String... params) {

            HttpURLConnection connection = null;
            BufferedReader reader = null;

            try {
                // Pass in a String and convert to URL
                URL url = new URL(params[0]);
                connection = (HttpURLConnection) url.openConnection();
                connection.connect();

                InputStream stream = connection.getInputStream();

                // for reading data line by line
                reader = new BufferedReader(new InputStreamReader(stream));
                StringBuffer strBuffer = new StringBuffer();

                String line = "";
                while ((line = reader.readLine()) != null) {
                    strBuffer.append(line);
                }

                // If we are able to get the data

                String retreivedJson = strBuffer.toString();
                JSONObject parentObject = new JSONObject(retreivedJson);
                JsonReader jsonReader = new JsonReader(responseBody);

                return retreivedJson;

            } catch (MalformedURLException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            } catch (JSONException e) {
                e.printStackTrace();
            } finally {
                //cant close null

                if (connection != null) {
                    // close both connection and the reader
                    connection.disconnect();
                }
                try {
                    if (reader != null) {
                        reader.close();
                    }

                } catch (IOException e) {
                    e.printStackTrace();
                }
            }

            return null;

        }

        @Override
        protected void onPostExecute(String result) {
            super.onPostExecute(result);
            tvData.setText(result);
        }
    }
}

In it looks like:

Now I just need to use this to parse the JSON. But the problem is, when I use a different URL in the JSON like https://api.github.com/users/froala/repos, retrieving the JSON data does not work and the app displays nothing when the buttons is clicked. This is weird because /users/id page and the /users/id/repos page are both JSONs and do not seem that different. I don't know why the other one does not work.
Two questions:

*

*Am I using the right way to retrieve JSON from the API?

*Why is the other link (https://api.github.com/users/froala/repos) not working with my code implementation?

Please help! I am really confused.

A: *

*You can use Retrofit and get data from URL:
You can refer to :
https://www.androidhive.info/2016/05/android-working-with-retrofit-http-library/

*You can use the object above
With your JSON string, i use http://www.jsonschema2pojo.org/  and create object :
-----------------------------------com.example.Example.java-----------------------------------

package com.example;

import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

public class Example {

@SerializedName("id")
@Expose
private Integer id;
@SerializedName("name")
@Expose
private String name;
@SerializedName("full_name")
@Expose
private String fullName;
@SerializedName("owner")
@Expose
private Owner owner;
@SerializedName("private")
@Expose
private Boolean _private;
@SerializedName("html_url")
@Expose
private String htmlUrl;
@SerializedName("description")
@Expose
private String description;
@SerializedName("fork")
@Expose
private Boolean fork;
@SerializedName("url")
@Expose
private String url;
@SerializedName("forks_url")
@Expose
private String forksUrl;
@SerializedName("keys_url")
@Expose
private String keysUrl;
@SerializedName("collaborators_url")
@Expose
private String collaboratorsUrl;
@SerializedName("teams_url")
@Expose
private String teamsUrl;
@SerializedName("hooks_url")
@Expose
private String hooksUrl;
@SerializedName("issue_events_url")
@Expose
private String issueEventsUrl;
@SerializedName("events_url")
@Expose
private String eventsUrl;
@SerializedName("assignees_url")
@Expose
private String assigneesUrl;
@SerializedName("branches_url")
@Expose
private String branchesUrl;
@SerializedName("tags_url")
@Expose
private String tagsUrl;
@SerializedName("blobs_url")
@Expose
private String blobsUrl;
@SerializedName("git_tags_url")
@Expose
private String gitTagsUrl;
@SerializedName("git_refs_url")
@Expose
private String gitRefsUrl;
@SerializedName("trees_url")
@Expose
private String treesUrl;
@SerializedName("statuses_url")
@Expose
private String statusesUrl;
@SerializedName("languages_url")
@Expose
private String languagesUrl;
@SerializedName("stargazers_url")
@Expose
private String stargazersUrl;
@SerializedName("contributors_url")
@Expose
private String contributorsUrl;
@SerializedName("subscribers_url")
@Expose
private String subscribersUrl;
@SerializedName("subscription_url")
@Expose
private String subscriptionUrl;
@SerializedName("commits_url")
@Expose
private String commitsUrl;
@SerializedName("git_commits_url")
@Expose
private String gitCommitsUrl;
@SerializedName("comments_url")
@Expose
private String commentsUrl;
@SerializedName("issue_comment_url")
@Expose
private String issueCommentUrl;
@SerializedName("contents_url")
@Expose
private String contentsUrl;
@SerializedName("compare_url")
@Expose
private String compareUrl;
@SerializedName("merges_url")
@Expose
private String mergesUrl;
@SerializedName("archive_url")
@Expose
private String archiveUrl;
@SerializedName("downloads_url")
@Expose
private String downloadsUrl;
@SerializedName("issues_url")
@Expose
private String issuesUrl;
@SerializedName("pulls_url")
@Expose
private String pullsUrl;
@SerializedName("milestones_url")
@Expose
private String milestonesUrl;
@SerializedName("notifications_url")
@Expose
private String notificationsUrl;
@SerializedName("labels_url")
@Expose
private String labelsUrl;
@SerializedName("releases_url")
@Expose
private String releasesUrl;
@SerializedName("deployments_url")
@Expose
private String deploymentsUrl;
@SerializedName("created_at")
@Expose
private String createdAt;
@SerializedName("updated_at")
@Expose
private String updatedAt;
@SerializedName("pushed_at")
@Expose
private String pushedAt;
@SerializedName("git_url")
@Expose
private String gitUrl;
@SerializedName("ssh_url")
@Expose
private String sshUrl;
@SerializedName("clone_url")
@Expose
private String cloneUrl;
@SerializedName("svn_url")
@Expose
private String svnUrl;
@SerializedName("homepage")
@Expose
private String homepage;
@SerializedName("size")
@Expose
private Integer size;
@SerializedName("stargazers_count")
@Expose
private Integer stargazersCount;
@SerializedName("watchers_count")
@Expose
private Integer watchersCount;
@SerializedName("language")
@Expose
private String language;
@SerializedName("has_issues")
@Expose
private Boolean hasIssues;
@SerializedName("has_projects")
@Expose
private Boolean hasProjects;
@SerializedName("has_downloads")
@Expose
private Boolean hasDownloads;
@SerializedName("has_wiki")
@Expose
private Boolean hasWiki;
@SerializedName("has_pages")
@Expose
private Boolean hasPages;
@SerializedName("forks_count")
@Expose
private Integer forksCount;
@SerializedName("mirror_url")
@Expose
private Object mirrorUrl;
@SerializedName("archived")
@Expose
private Boolean archived;
@SerializedName("open_issues_count")
@Expose
private Integer openIssuesCount;
@SerializedName("forks")
@Expose
private Integer forks;
@SerializedName("open_issues")
@Expose
private Integer openIssues;
@SerializedName("watchers")
@Expose
private Integer watchers;
@SerializedName("default_branch")
@Expose
private String defaultBranch;

public Integer getId() {
return id;
}

public void setId(Integer id) {
this.id = id;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getFullName() {
return fullName;
}

public void setFullName(String fullName) {
this.fullName = fullName;
}

public Owner getOwner() {
return owner;
}

public void setOwner(Owner owner) {
this.owner = owner;
}

public Boolean getPrivate() {
return _private;
}

public void setPrivate(Boolean _private) {
this._private = _private;
}

public String getHtmlUrl() {
return htmlUrl;
}

public void setHtmlUrl(String htmlUrl) {
this.htmlUrl = htmlUrl;
}

public String getDescription() {
return description;
}

public void setDescription(String description) {
this.description = description;
}

public Boolean getFork() {
return fork;
}

public void setFork(Boolean fork) {
this.fork = fork;
}

public String getUrl() {
return url;
}

public void setUrl(String url) {
this.url = url;
}

public String getForksUrl() {
return forksUrl;
}

public void setForksUrl(String forksUrl) {
this.forksUrl = forksUrl;
}

public String getKeysUrl() {
return keysUrl;
}

public void setKeysUrl(String keysUrl) {
this.keysUrl = keysUrl;
}

public String getCollaboratorsUrl() {
return collaboratorsUrl;
}

public void setCollaboratorsUrl(String collaboratorsUrl) {
this.collaboratorsUrl = collaboratorsUrl;
}

public String getTeamsUrl() {
return teamsUrl;
}

public void setTeamsUrl(String teamsUrl) {
this.teamsUrl = teamsUrl;
}

public String getHooksUrl() {
return hooksUrl;
}

public void setHooksUrl(String hooksUrl) {
this.hooksUrl = hooksUrl;
}

public String getIssueEventsUrl() {
return issueEventsUrl;
}

public void setIssueEventsUrl(String issueEventsUrl) {
this.issueEventsUrl = issueEventsUrl;
}

public String getEventsUrl() {
return eventsUrl;
}

public void setEventsUrl(String eventsUrl) {
this.eventsUrl = eventsUrl;
}

public String getAssigneesUrl() {
return assigneesUrl;
}

public void setAssigneesUrl(String assigneesUrl) {
this.assigneesUrl = assigneesUrl;
}

public String getBranchesUrl() {
return branchesUrl;
}

public void setBranchesUrl(String branchesUrl) {
this.branchesUrl = branchesUrl;
}

public String getTagsUrl() {
return tagsUrl;
}

public void setTagsUrl(String tagsUrl) {
this.tagsUrl = tagsUrl;
}

public String getBlobsUrl() {
return blobsUrl;
}

public void setBlobsUrl(String blobsUrl) {
this.blobsUrl = blobsUrl;
}

public String getGitTagsUrl() {
return gitTagsUrl;
}

public void setGitTagsUrl(String gitTagsUrl) {
this.gitTagsUrl = gitTagsUrl;
}

public String getGitRefsUrl() {
return gitRefsUrl;
}

public void setGitRefsUrl(String gitRefsUrl) {
this.gitRefsUrl = gitRefsUrl;
}

public String getTreesUrl() {
return treesUrl;
}

public void setTreesUrl(String treesUrl) {
this.treesUrl = treesUrl;
}

public String getStatusesUrl() {
return statusesUrl;
}

public void setStatusesUrl(String statusesUrl) {
this.statusesUrl = statusesUrl;
}

public String getLanguagesUrl() {
return languagesUrl;
}

public void setLanguagesUrl(String languagesUrl) {
this.languagesUrl = languagesUrl;
}

public String getStargazersUrl() {
return stargazersUrl;
}

public void setStargazersUrl(String stargazersUrl) {
this.stargazersUrl = stargazersUrl;
}

public String getContributorsUrl() {
return contributorsUrl;
}

public void setContributorsUrl(String contributorsUrl) {
this.contributorsUrl = contributorsUrl;
}

public String getSubscribersUrl() {
return subscribersUrl;
}

public void setSubscribersUrl(String subscribersUrl) {
this.subscribersUrl = subscribersUrl;
}

public String getSubscriptionUrl() {
return subscriptionUrl;
}

public void setSubscriptionUrl(String subscriptionUrl) {
this.subscriptionUrl = subscriptionUrl;
}

public String getCommitsUrl() {
return commitsUrl;
}

public void setCommitsUrl(String commitsUrl) {
this.commitsUrl = commitsUrl;
}

public String getGitCommitsUrl() {
return gitCommitsUrl;
}

public void setGitCommitsUrl(String gitCommitsUrl) {
this.gitCommitsUrl = gitCommitsUrl;
}

public String getCommentsUrl() {
return commentsUrl;
}

public void setCommentsUrl(String commentsUrl) {
this.commentsUrl = commentsUrl;
}

public String getIssueCommentUrl() {
return issueCommentUrl;
}

public void setIssueCommentUrl(String issueCommentUrl) {
this.issueCommentUrl = issueCommentUrl;
}

public String getContentsUrl() {
return contentsUrl;
}

public void setContentsUrl(String contentsUrl) {
this.contentsUrl = contentsUrl;
}

public String getCompareUrl() {
return compareUrl;
}

public void setCompareUrl(String compareUrl) {
this.compareUrl = compareUrl;
}

public String getMergesUrl() {
return mergesUrl;
}

public void setMergesUrl(String mergesUrl) {
this.mergesUrl = mergesUrl;
}

public String getArchiveUrl() {
return archiveUrl;
}

public void setArchiveUrl(String archiveUrl) {
this.archiveUrl = archiveUrl;
}

public String getDownloadsUrl() {
return downloadsUrl;
}

public void setDownloadsUrl(String downloadsUrl) {
this.downloadsUrl = downloadsUrl;
}

public String getIssuesUrl() {
return issuesUrl;
}

public void setIssuesUrl(String issuesUrl) {
this.issuesUrl = issuesUrl;
}

public String getPullsUrl() {
return pullsUrl;
}

public void setPullsUrl(String pullsUrl) {
this.pullsUrl = pullsUrl;
}

public String getMilestonesUrl() {
return milestonesUrl;
}

public void setMilestonesUrl(String milestonesUrl) {
this.milestonesUrl = milestonesUrl;
}

public String getNotificationsUrl() {
return notificationsUrl;
}

public void setNotificationsUrl(String notificationsUrl) {
this.notificationsUrl = notificationsUrl;
}

public String getLabelsUrl() {
return labelsUrl;
}

public void setLabelsUrl(String labelsUrl) {
this.labelsUrl = labelsUrl;
}

public String getReleasesUrl() {
return releasesUrl;
}

public void setReleasesUrl(String releasesUrl) {
this.releasesUrl = releasesUrl;
}

public String getDeploymentsUrl() {
return deploymentsUrl;
}

public void setDeploymentsUrl(String deploymentsUrl) {
this.deploymentsUrl = deploymentsUrl;
}

public String getCreatedAt() {
return createdAt;
}

public void setCreatedAt(String createdAt) {
this.createdAt = createdAt;
}

public String getUpdatedAt() {
return updatedAt;
}

public void setUpdatedAt(String updatedAt) {
this.updatedAt = updatedAt;
}

public String getPushedAt() {
return pushedAt;
}

public void setPushedAt(String pushedAt) {
this.pushedAt = pushedAt;
}

public String getGitUrl() {
return gitUrl;
}

public void setGitUrl(String gitUrl) {
this.gitUrl = gitUrl;
}

public String getSshUrl() {
return sshUrl;
}

public void setSshUrl(String sshUrl) {
this.sshUrl = sshUrl;
}

public String getCloneUrl() {
return cloneUrl;
}

public void setCloneUrl(String cloneUrl) {
this.cloneUrl = cloneUrl;
}

public String getSvnUrl() {
return svnUrl;
}

public void setSvnUrl(String svnUrl) {
this.svnUrl = svnUrl;
}

public String getHomepage() {
return homepage;
}

public void setHomepage(String homepage) {
this.homepage = homepage;
}

public Integer getSize() {
return size;
}

public void setSize(Integer size) {
this.size = size;
}

public Integer getStargazersCount() {
return stargazersCount;
}

public void setStargazersCount(Integer stargazersCount) {
this.stargazersCount = stargazersCount;
}

public Integer getWatchersCount() {
return watchersCount;
}

public void setWatchersCount(Integer watchersCount) {
this.watchersCount = watchersCount;
}

public String getLanguage() {
return language;
}

public void setLanguage(String language) {
this.language = language;
}

public Boolean getHasIssues() {
return hasIssues;
}

public void setHasIssues(Boolean hasIssues) {
this.hasIssues = hasIssues;
}

public Boolean getHasProjects() {
return hasProjects;
}

public void setHasProjects(Boolean hasProjects) {
this.hasProjects = hasProjects;
}

public Boolean getHasDownloads() {
return hasDownloads;
}

public void setHasDownloads(Boolean hasDownloads) {
this.hasDownloads = hasDownloads;
}

public Boolean getHasWiki() {
return hasWiki;
}

public void setHasWiki(Boolean hasWiki) {
this.hasWiki = hasWiki;
}

public Boolean getHasPages() {
return hasPages;
}

public void setHasPages(Boolean hasPages) {
this.hasPages = hasPages;
}

public Integer getForksCount() {
return forksCount;
}

public void setForksCount(Integer forksCount) {
this.forksCount = forksCount;
}

public Object getMirrorUrl() {
return mirrorUrl;
}

public void setMirrorUrl(Object mirrorUrl) {
this.mirrorUrl = mirrorUrl;
}

public Boolean getArchived() {
return archived;
}

public void setArchived(Boolean archived) {
this.archived = archived;
}

public Integer getOpenIssuesCount() {
return openIssuesCount;
}

public void setOpenIssuesCount(Integer openIssuesCount) {
this.openIssuesCount = openIssuesCount;
}

public Integer getForks() {
return forks;
}

public void setForks(Integer forks) {
this.forks = forks;
}

public Integer getOpenIssues() {
return openIssues;
}

public void setOpenIssues(Integer openIssues) {
this.openIssues = openIssues;
}

public Integer getWatchers() {
return watchers;
}

public void setWatchers(Integer watchers) {
this.watchers = watchers;
}

public String getDefaultBranch() {
return defaultBranch;
}

public void setDefaultBranch(String defaultBranch) {
this.defaultBranch = defaultBranch;
}

}

-----------------------------------com.example.Owner.java-----------------------------------
package com.example;

import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

public class Owner {

@SerializedName("login")
@Expose
private String login;
@SerializedName("id")
@Expose
private Integer id;
@SerializedName("avatar_url")
@Expose
private String avatarUrl;
@SerializedName("gravatar_id")
@Expose
private String gravatarId;
@SerializedName("url")
@Expose
private String url;
@SerializedName("html_url")
@Expose
private String htmlUrl;
@SerializedName("followers_url")
@Expose
private String followersUrl;
@SerializedName("following_url")
@Expose
private String followingUrl;
@SerializedName("gists_url")
@Expose
private String gistsUrl;
@SerializedName("starred_url")
@Expose
private String starredUrl;
@SerializedName("subscriptions_url")
@Expose
private String subscriptionsUrl;
@SerializedName("organizations_url")
@Expose
private String organizationsUrl;
@SerializedName("repos_url")
@Expose
private String reposUrl;
@SerializedName("events_url")
@Expose
private String eventsUrl;
@SerializedName("received_events_url")
@Expose
private String receivedEventsUrl;
@SerializedName("type")
@Expose
private String type;
@SerializedName("site_admin")
@Expose
private Boolean siteAdmin;

public String getLogin() {
return login;
}

public void setLogin(String login) {
this.login = login;
}

public Integer getId() {
return id;
}

public void setId(Integer id) {
this.id = id;
}

public String getAvatarUrl() {
return avatarUrl;
}

public void setAvatarUrl(String avatarUrl) {
this.avatarUrl = avatarUrl;
}

public String getGravatarId() {
return gravatarId;
}

public void setGravatarId(String gravatarId) {
this.gravatarId = gravatarId;
}

public String getUrl() {
return url;
}

public void setUrl(String url) {
this.url = url;
}

public String getHtmlUrl() {
return htmlUrl;
}

public void setHtmlUrl(String htmlUrl) {
this.htmlUrl = htmlUrl;
}

public String getFollowersUrl() {
return followersUrl;
}

public void setFollowersUrl(String followersUrl) {
this.followersUrl = followersUrl;
}

public String getFollowingUrl() {
return followingUrl;
}

public void setFollowingUrl(String followingUrl) {
this.followingUrl = followingUrl;
}

public String getGistsUrl() {
return gistsUrl;
}

public void setGistsUrl(String gistsUrl) {
this.gistsUrl = gistsUrl;
}

public String getStarredUrl() {
return starredUrl;
}

public void setStarredUrl(String starredUrl) {
this.starredUrl = starredUrl;
}

public String getSubscriptionsUrl() {
return subscriptionsUrl;
}

public void setSubscriptionsUrl(String subscriptionsUrl) {
this.subscriptionsUrl = subscriptionsUrl;
}

public String getOrganizationsUrl() {
return organizationsUrl;
}

public void setOrganizationsUrl(String organizationsUrl) {
this.organizationsUrl = organizationsUrl;
}

public String getReposUrl() {
return reposUrl;
}

public void setReposUrl(String reposUrl) {
this.reposUrl = reposUrl;
}

public String getEventsUrl() {
return eventsUrl;
}

public void setEventsUrl(String eventsUrl) {
this.eventsUrl = eventsUrl;
}

public String getReceivedEventsUrl() {
return receivedEventsUrl;
}

public void setReceivedEventsUrl(String receivedEventsUrl) {
this.receivedEventsUrl = receivedEventsUrl;
}

public String getType() {
return type;
}

public void setType(String type) {
this.type = type;
}

public Boolean getSiteAdmin() {
return siteAdmin;
}

public void setSiteAdmin(Boolean siteAdmin) {
this.siteAdmin = siteAdmin;
}

}

And using Retrofit, ex:
 Call<Example> call = apiService.getData(URL);

    call.enqueue(new Callback<Example>() {
        @Override
        public void onResponse(Call<Example> call, Response<Example> response) {

            Log.d(TAG, "response.body(): " + response.body().getExample());

        }

        @Override
        public void onFailure(Call<Example> call, Throwable t) {
            // Log error here since request failed

            Log.e(TAG, t.toString());
        }
    });

I hope it will help your problem!

A: Third party libraries like Retrofit of course work better then iterating through the data manually, but in case you're not willing to go through that way you could follow this procedure to retrieve results if the resulting data is an JSONObject:
public void formatJSONObjectData(String results){
    try {
        JSONObject jsonObject = new JSONObject(results);
        if(jsonObject.optString("login")!=null)
            tvData.append(jsonObject.getString("login"));
        if (jsonObject.optInt("id")!=null)
            tvData.append(jsonObject.getString("id"));
        if(jsonObject.optString("avatar_url")!=null)
            tvData.append(jsonObject.getString("avatar_url"));

        //you could accordingly retrieve the results from the jsonObject for a specfic key and append it to the TextView
    }catch (JSONException jsonException){
        Log.e("Error",jsonException.getMessage());
    }
}

If the resulting data is JSONArray then you need to parse it in this way:
public void formatJSONArray(String results){
    try {
        JSONArray jsonArray = new JSONArray(results);
        for(int i=0;i<jsonArray.length();i++){
            JSONObject jsonObject=jsonArray.getJSONObject(i);
            if(jsonObject.optString("name")!=null)
                tvData.append(jsonObject.getString("name"));
            if (jsonObject.optInt("id")!=null)
                tvData.append(jsonObject.getString("id"));
            if(jsonObject.optString("full_name")!=null)
                tvData.append(jsonObject.getString("full_name"));

            if(jsonObject.optJSONObject("owner")!=null){
                JSONObject ownerObject=jsonObject.getJSONObject("owner");
                if(ownerObject.optString("login")!=null)
                    tvData.append(ownerObject.getString("login"));
                if (ownerObject.optInt("id")!=null)
                    tvData.append(ownerObject.getString("id"));
                if(jsonObject.optString("avatar_url")!=null)
                    tvData.append(ownerObject.getString("avatar_url"));
            }
        }
    }catch (JSONException jsonException){

    }
}

Call the function as per your resulting data from your onPostExecute(..)
    @Override
    protected void onPostExecute(String result) {
        super.onPostExecute(result);
       /* for JSONObject data*/
       if(result!=null && !result.isEmpty())
            formatJSONData(result)

       /* for JSONArray data*/
       if(result!=null && !result.isEmpty())
            formatJSONArray(result)
    }