text:
Q: Android app returning inner arrays as [ ] or ArrayList memory allocation? Hi I am new to Java and android and I'm trying to parse data from linked classes but I can not work out how to retrieve jsonObjects from some of the inner/nested JSONArrays?
I can retrieve objects from the outer JSONArray's but I can not see how to retrieve the nested JSONArray list  objects from segments inner JSONArrays within the StorlineData class.
When I try to parse data from the inner/nested JSONArrays the response looks like this:

Thanks in advance for your help.
JSON (I am unable to get data from trackPointsData and PlacesData)
[
    {
        "date": "20121212",
        "summary": [
            {
                "activity": "walking",
                "group": "walking",
                "duration": 3333,
                "distance": 3333,
                "steps": 3333,
                "calories": 300
            },

        ],
        "segments": [
            {
                "type": "place",
                "startTime": "20121212T000000+0200",
                "endTime": "20121212T071430+0200",
                "place": {
                    "id": 1,
                    "type": "unknown",
                    "location": {
                        "lat": 55.55555,
                        "lon": 33.33333
                    }
                },
                "lastUpdate": "20130317T121143Z"
            },
            {
                "type": "move",
                "startTime": "20121212T071430+0200",
                "endTime": "20121212T074617+0200",
                "activities": [
                    {
                        "activity": "walking",
                        "group": "walking",
                        "manual": false,
                        "startTime": "20121212T071430+0200",
                        "endTime": "20121212T072732+0200",
                        "duration": 782,
                        "distance": 1251,
                        "steps": 1353,
                        "calories": 99,
                        "trackPoints": [
                            {
                                "lat": 55.55555,
                                "lon": 33.33333,
                                "time": "20121212T071430+0200"
                            },
                            {
                                "lat": 55.55555,
                                "lon": 33.33333,
                                "time": "20121212T072732+0200"
                            }
                        ]
                    },
                    {
                        "activity": "transport",
                        "group": "transport",
                        "manual": false,
                        "startTime": "20121212T072732+0200",
                        "endTime": "20121212T074616+0200",
                        "duration": 1124,
                        "distance": 8443,
                        "trackPoints": [
                            {
                                "lat": 55.55555,
                                "lon": 33.33333,
                                "time": "20121212T072732+0200"
                            },
                            {
                                "lat": 55.55555,
                                "lon": 33.33333,
                                "time": "20121212T074208+0200"
                            },
                            {
                                "lat": 55.55555,
                                "lon": 33.33333,
                                "time": "20121212T074617+0200"
                            }
                        ]
                    }
                ],
                "lastUpdate": "20130317T121143Z"
            },
            {
                "type": "place",
                "startTime": "20121212T074617+0200",
                "endTime": "20121212T100051+0200",
                "place": {
                    "id": 2,
                    "type": "unknown",
                    "location": {
                        "lat": 55.55555,
                        "lon": 33.33333
                    }
                },
                "activities": [
                    {
                        "activity": "walking_on_treadmill",
                        "group": "walking",
                        "manual": true,
                        "duration": 270,
                        "steps": 303,
                        "calories": 30,
                        "trackPoints": []
                    }
                ],
                "lastUpdate": "20130317T121143Z"
            },

            {
                "type": "place",
                "startTime": "20121212T100715+0200",
                "endTime": "20121212T110530+0200",
                "place": {
                    "id": 4,
                    "name": "test",
                    "type": "foursquare",
                    "foursquareId": "4df0fdb17d8ba370a011d24c",
                    "foursquareCategoryIds": ["4bf58dd8d48988d125941735"],
                    "location": {
                        "lat": 55.55555,
                        "lon": 33.33333
                    }
                },
                "activities": [
                    {
                        "activity": "walking",
                        "group": "walking",
                        "manual": false,
                        "startTime": "20121212T101215+0200",
                        "endTime": "20121212T101255+0200",
                        "duration": 40,
                        "distance": 18,
                        "steps": 37,
                        "calories": 99,
                        "trackPoints": [
                            {
                                "lat": 55.55555,
                                "lon": 33.33333,
                                "time": "20121212T101215+0200"
                            },
                            {
                                "lat": 55.55555,
                                "lon": 33.33333,
                                "time": "20121212T101255+0200"
                            }
                        ]
                    }
                ],
                "lastUpdate": "20130317T121143Z"
            },
            {
                "type": "move",
                "startTime": "20121212T110530+0200",
                "endTime": "20121212T111129+0200",
                "activities": [
                    {
                        "activity": "walking",
                        "group": "walking",
                        "manual": false,
                        "startTime": "20121212T110530+0200",
                        "endTime": "20121212T111128+0200",
                        "duration": 358,
                        "distance": 493,
                        "steps": 441,
                        "calories": 99,
                        "trackPoints": [
                            {
                                "lat": 55.55555,
                                "lon": 33.33333,
                                "time": "20121212T110531+0200"
                            },
                            {
                                "lat": 55.55555,
                                "lon": 33.33333,
                                "time": "20121212T110536+0200"
                            },
                            {
                                "lat": 55.55555,
                                "lon": 33.33333,
                                "time": "20121212T110947+0200"
                            },
                            {
                                "lat": 55.55555,
                                "lon": 33.33333,
                                "time": "20121212T111017+0200"
                            },
                            {
                                "lat": 55.55555,
                                "lon": 33.33333,
                                "time": "20121212T111129+0200"
                            }
                        ]
                    }
                ],
                "lastUpdate": "20130317T121143Z"
            },
            {
                "type": "place",
                "startTime": "20121212T111129+0200",
                "endTime": "20121212T153638+0200",
                "place": {
                    "id": 2,
                    "type": "unknown",
                    "location": {
                        "lat": 55.55555,
                        "lon": 33.33333
                    }
                },
                "activities": [
                    {
                        "activity": "zumba",
                        "manual": true,
                        "duration": 570,
                        "calories": 200,
                        "trackPoints": []
                    }
                ],
                "lastUpdate": "20130317T121143Z"
            },

            {
                "type": "place",
                "startTime": "20121212T160744+0200",
                "endTime": "20121212T232730+0200",
                "place": {
                    "id": 1,
                    "type": "unknown",
                    "location": {
                        "lat": 55.55555,
                        "lon": 33.33333
                    }
                },
                "lastUpdate": "20130317T121143Z"
            }
        ],
        "caloriesIdle": 1785,
        "lastUpdate": "20130317T121143Z"
    }
]

Main Activity:
...
    private MovesHandler<ArrayList<StorylineData>> storylineHandler = new MovesHandler<ArrayList<StorylineData>>() {
                @Override
                public void onSuccess(ArrayList<StorylineData> result) {
                    toggleProgress(false);
                    updateResponse(
...
                                + "-----------Segment 1-------\t"
                                + "StartTime:\t" + result.get(0).getSegments().get(0).getStartTime() + "\n"
                                + "             -Activities Array-\t" + "\n"
                                + "- StartTime:\t" +

 ...

                        + "-----------Segment 2-------\t" + "\n"
                        + "- TrackPoints :\t" + result.get(0).getTrackPoints()+ "\n"//====Array Add
                        + "- FoursquareId:\t" + result.get(0).getFoursquareId() + "\n"
                        + "- ACt:\t" + result.get(0).getActivities()+ "\n"
                            + "- Foursquare Id:\t" + result.get(0).getSegments().get(0).getPlace().getFoursquareId() + "\n"
                            + "- Foursquare Id:\t" + result.get(0).getFoursquareId() + "\n"
                            + "- Foursquare Category Ids:\t" + result.get(0).getSegments().get(0).getPlace().getFoursquareCategoryIds()+ "\n"
                            + "- Activities:\t" + result.get(0).getSegments().get(0).getActivities()+ "\n"
);

        }

...
StorylineData Class (I would like to retrieve jsonObjects from inner JSONArrays here in the storylineData class):
/**
 * Parse a {@link org.json.JSONObject} from storyline {@link org.json.JSONArray}, then return the corresponding {@link StorylineData} object.
 *
 * @param jsonObject : the storyline JSON object received from server
 * @return corresponding {@link StorylineData}
 */
public static StorylineData parse(JSONObject jsonObject) throws JSONException {
    if (jsonObject != null) {

        StorylineData storylineData = new StorylineData();

        storylineData.date = jsonObject.optString("date");
        storylineData.caloriesIdle = jsonObject.optInt("caloriesIdle");
        storylineData.lastUpdate = jsonObject.optString("lastUpdate");
        storylineData.summary = new ArrayList<>();
        storylineData.segments = new ArrayList<>();

        JSONArray summariesJsonArray = jsonObject.optJSONArray("summary");

        if (summariesJsonArray != null)
        for (int i = 0; i < summariesJsonArray.length(); i++) {

            JSONObject summaryJsonObject = summariesJsonArray.optJSONObject(i);

                    if (summaryJsonObject != null) {
                    summariesJsonArray.getJSONObject(i).getString("distance");

                        String group = summaryJsonObject.optString("group");

                        Integer distance = summaryJsonObject.optInt("distance");
                        storylineData.setDistance(distance);
...
                    storylineData.summary.add(SummaryData.parse(summaryJsonObject));

                        Log.d("StorylineDataCls \t sJo", summaryJsonObject.toString() + "Log\n");
                        System.out.println("print distance" + summariesJsonArray.getJSONObject(i).getString("distance"));
                        System.out.println("print summary" + summaryJsonObject);

                }
            }

        JSONArray segmentsJsonArray = jsonObject.optJSONArray("segments");
        if (segmentsJsonArray != null) {

            for (int i = 0; i < segmentsJsonArray.length(); i++) {
                JSONObject segment = segmentsJsonArray.optJSONObject(i);

                if (segment != null) {

                    JSONArray activitiesJsonArray = segment.optJSONArray("activities");
                    if (activitiesJsonArray!=null) {

                        for (int j = 0; j < activitiesJsonArray.length(); j++) {
                            JSONObject trackPoints = activitiesJsonArray.optJSONObject(j);
                            if(trackPoints != null){
                        ...
                    storylineData.trackPoints.add(TrackPointsData.parse(trackPoints));
                                 }
                        }
                    }

            ..
                    Log.d("StorylineDataCls \t sSo", segment.toString());
                    System.out.println("print segment" + segment);
                    //System.out.println("print segments" + segments);
                    System.out.println("print segmentsJsonArray" + segmentsJsonArray);

                }
            }
        }

        return storylineData;
    }
    return null;

}

============PARSER METHODS IN LINKED CLASSES================
PlaceData Class:
/**
     * Parse a {@link org.json.JSONObject} of place, then return the corresponding {@link PlaceData} object.
     * @param jsonObject : the 'place' JSON object to parse
     * @return corresponding {@link PlaceData}
     */
    public static PlaceData parse(JSONObject jsonObject) {
        if (jsonObject != null) {
            PlaceData placeData = new PlaceData();

        placeData.id            = jsonObject.optString("id");
        placeData.name          = jsonObject.optString("name");
        placeData.type          = jsonObject.optString("type");
        placeData.foursquareId  = jsonObject.optString("foursquareId");

        JSONObject location = jsonObject.optJSONObject("location");
        if (location != null) {
            placeData.location = LocationData.parse(location);
        }

        JSONArray trackPointsJSONArray      = jsonObject.optJSONArray("foursquareCategoryIds");
        placeData.foursquareCategoryIds = new ArrayList<String>();
        if (trackPointsJSONArray != null) {
            for (int i = 0; i < trackPointsJSONArray.length(); i++) {
                String categoryId  = trackPointsJSONArray.optString(i);
                if (categoryId != null && categoryId.length() > 0) {

                    placeData.foursquareCategoryIds.add(categoryId);
                }
            }
        }

        return placeData;
    }
    return null;
}

}
LocationData Class:
/**
     * Parse a {@link org.json.JSONObject} from trackPoints {@link org.json.JSONArray}, then return the corresponding
     * {@link LocationData} object.
     * @param jsonObject : the 'trackPoint' JSON object to parse
     * @return corresponding {@link LocationData}
     */
    public static LocationData parse(JSONObject jsonObject) {
        if (jsonObject != null) {
                LocationData trackPointsData = new LocationData();
                trackPointsData.lat     = jsonObject.optString("lat");
                trackPointsData.lon     = jsonObject.optString("lon");

            return trackPointsData;
        }
        return null;
    }

}

TrackPointData Class:
/**
 * Parse a {@link org.json.JSONObject} from trackPoints {@link org.json.JSONArray}, then return the corresponding
 * {@link TrackPointsData} object.
 * @param jsonObject : the 'trackPoint' JSON object to parse
 * @return corresponding {@link TrackPointsData}
 */
public static TrackPointsData parse(JSONObject jsonObject) {
    if (jsonObject != null) {
            TrackPointsData trackPointsData = new TrackPointsData();
            trackPointsData.lat     = jsonObject.optString("lat");
            trackPointsData.lon     = jsonObject.optString("lon");
            trackPointsData.time    = jsonObject.optString("time");

            return trackPointsData;
    }
    return null;
}

}

ActivityData Class:
/**
     * Parse a {@link org.json.JSONObject} from activities {@link org.json.JSONArray}, then return the corresponding
     * {@link ActivityData} object.
     * @param jsonObject : the 'activity' JSON object to parse
     * @return corresponding {@link ActivityData}
     */
    public static ActivityData parse(JSONObject jsonObject) {
        if (jsonObject != null) {
            ActivityData activityData = new ActivityData();
                activityData.activity       = jsonObject.optString("activity");
                activityData.group          = jsonObject.optString("group");
                activityData.manual         = jsonObject.optString("manual");
                activityData.startTime      = jsonObject.optString("startTime");
                activityData.endTime        = jsonObject.optString("endTime");
                activityData.duration       = jsonObject.optInt("duration");
                activityData.distance       = jsonObject.optInt("distance");
                activityData.steps          = jsonObject.optInt("steps");
                activityData.calories       = jsonObject.optInt("calories");
            JSONArray trackPointsJSONArray      = jsonObject.optJSONArray("trackPoints");

                activityData.trackPoints = new ArrayList<TrackPointsData>();
                if (trackPointsJSONArray != null) {
                    for (int i = 0; i < trackPointsJSONArray.length(); i++) {
                        JSONObject summaryJsonObject = trackPointsJSONArray.optJSONObject(i);
                        if (summaryJsonObject != null) {

                            activityData.trackPoints.add(TrackPointsData.parse(summaryJsonObject));

                        }
                    }
                }

                return activityData;
        }
        return null;

    }

}

SegmentData Class:
/**
     * Parse a {@link org.json.JSONObject} from segments {@link org.json.JSONArray}, then return the corresponding {@link SegmentData} object.
     * @param jsonObject : the 'segment' JSON object to parse
     * @return corresponding {@link SegmentData}
     */
    public static SegmentData parse(JSONObject jsonObject) {
        if (jsonObject != null) {
            SegmentData segmentData = new SegmentData();
            segmentData.type        = jsonObject.optString("type");
            segmentData.startTime   = jsonObject.optString("startTime");
            segmentData.endTime     = jsonObject.optString("endTime");
            segmentData.lastUpdate  = jsonObject.optString("lastUpdate");
            segmentData.name    = jsonObject.optString("name");

            JSONArray activitiesJSONArray = jsonObject.optJSONArray("activities");
            segmentData.activities = new ArrayList<ActivityData>();
            if (activitiesJSONArray != null) {
                for (int i = 0; i < activitiesJSONArray.length(); i++) {
                    JSONObject activityJsonObject = activitiesJSONArray.optJSONObject(i);
                    if (activityJsonObject != null) {

                        placeData = (PlaceData) activityJsonObject.opt(String.valueOf(placeData));
                        segmentData.setPlace(placeData);

                        segmentData.activities.add(ActivityData.parse(activityJsonObject));
                    }
                }
            }

            JSONObject placeJsonObject = jsonObject.optJSONObject("place");
            if (placeJsonObject != null) {
                segmentData.place = PlaceData.parse(placeJsonObject);
            }

            return segmentData;
        }
        return null;
    }
}

SummaryData Class:
/**
     * Parse a {@link org.json.JSONObject} from summary {@link org.json.JSONArray}, then return the corresponding {@link SummaryData} object.
     * @param jsonObject : the 'summary' JSON object to parse
     * @return corresponding {@link SummaryData}
     */
    public static SummaryData parse(JSONObject jsonObject) {
        if (jsonObject != null) {
                SummaryData summary = new SummaryData();
                summary.activity        = jsonObject.optString("activity");
                summary.group           = jsonObject.optString("group");
                summary.duration        = jsonObject.optInt("duration");
                summary.distance        = jsonObject.optInt("distance");
                summary.steps           = jsonObject.optInt("steps");
                summary.calories        = jsonObject.optInt("calories");

            //Log.d("json", summary.toString());

            return summary;
        }
        return null;
    }
}

HTTPCall Class:
...
    public static void getDailyStorylineList(final MovesHandler<ArrayList<StorylineData>> handler,
                                             final String specificSummary,
                                             final String from,
                                             final String to,
                                             final String pastDays,
                                             final String updatedSince,
                                             final boolean needTrackPoints) {
        new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    /* Refresh access token if only AuthData.MOVES_REFRESHBEFORE days are there to expire current token */
                    AuthData.refreshAccessTokenIfNeeded();

                    /* Exchange the authorization code we obtained after login to get access token */
                    HashMap<String, String> nameValuePairs = new HashMap<String, String>();
                    nameValuePairs.put("access_token", AuthData.getAuthData().getAccessToken());

                   // if (specificSummary != null && specificSummary.length() > 0) nameValuePairs.put("specificSummary", specificSummary);//att

                    if (from != null && from.length() > 0) nameValuePairs.put("from", from);
                    if (to != null && to.length() > 0) nameValuePairs.put("to", to);
                    if (pastDays != null && pastDays.length() > 0) nameValuePairs.put("pastDays", pastDays);
                    if (updatedSince != null && updatedSince.length() > 0) nameValuePairs.put("updatedSince", updatedSince);
                    if (needTrackPoints) nameValuePairs.put("trackPoints", "true");

                    URL url     = new URL(MovesAPI.API_BASE + MovesAPI.API_PATH_STORYLINE + (specificSummary != null ? specificSummary : "") + "?" + Utilities.encodeUrl(nameValuePairs));
                    HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
                    urlConnection.setRequestMethod("GET");
                    urlConnection.setDoInput(true);
                    urlConnection.connect();

                    if (urlConnection.getResponseCode() != 200) {
                        /* All other HTTP errors from Moves will fall here */
                        handler.onFailure(getErrorStatus(Utilities.readStream(urlConnection.getErrorStream()), urlConnection.getResponseCode()), "Server not responded with success ("+ urlConnection.getResponseCode() +")");
                        return;
                    }

                    String response = Utilities.readStream(urlConnection.getInputStream());
                    Object object = new JSONTokener(response).nextValue();
                    if (object instanceof JSONArray) {
                        JSONArray jsonArray = (JSONArray) object;
                        ArrayList<StorylineData> storylineData = new ArrayList<StorylineData>();
                        if (jsonArray != null) {
                            for (int i = 0; i < jsonArray.length(); i++) {
                                JSONObject storylineJsonObject = jsonArray.optJSONObject(i);
                                if (storylineJsonObject != null) {
                                    storylineData.add(StorylineData.parse(storylineJsonObject));
                                }
                            }
                        }
                        handler.onSuccess(storylineData);
                    } else {
                        handler.onFailure(MovesStatus.INVALID_RESPONSE, "Expected a JSONArray from server, but failed");
                    }

                } catch (Exception ex) {
                    ex.printStackTrace();
                    handler.onFailure(MovesStatus.UNEXPECTED_ERROR, "An unexpected error occured, please check logcat");
                }
            }
        }).start();
    }

MovesHandler Class
/**
 * This interface will act as a handler who notifies all success and failures
 *
 *
 * @param <T> : A generic class, which probably will be the response type after success
 * @see MovesStatus
 */
public interface MovesHandler<T> {//T stands for generic type

    /**
     * Implement this method to get success notifications along with the result
     * @param result : Result of the operation completed with this handler
     */
    public void onSuccess(T result);

    /**
     * Implement this method to get failure notifications along with the {@link MovesStatus} code and a brief message
     * @param status : Status code of the failure
     * @param message : A brief message about the reason behind failure
     */
    public void onFailure(MovesStatus status, String message);
}

MovesAPI Class
 /**
     * Get daily storylines for user.
     * @see <a href="https://dev.moves-app.com/docs/api_storyline">Moves Developer Page for Daily Storyline</a>
     * @see SummaryListData
     * @param handler : An implemented {@link MovesHandler} with an {@link ArrayList} of {@link StorylineData}.
     * This handler will get notified when the request completes.
     * @param date : date in yyyyMMdd or yyyy-MM-dd format
     * @param updatedSince : [optional] if set, return only days which data has been updated since
     * given time stamp in ISO 8601 (yyyyMMdd'T'HHmmssZ) format, pass <code>null</code> if not required.
     * @param needTrackPoints : if true, the returned activities also include {@link TrackPointsData} information.
     * Including track points limits the query range to 7 days.
     */
    public static void getStoryline_SingleDay(MovesHandler<ArrayList<StorylineData>> handler, String date, String updatedSince, boolean needTrackPoints) {
        if (AuthData.isAuthenticated()) {
            HTTPCall.getDailyStorylineList(handler, "/" + date, null, null, null, updatedSince, needTrackPoints);
        } else {
            handler.onFailure(MovesStatus.NOT_AUTHENTICATED, "You are not yet authenticated with required scopes!");
        }
    }

SummaryListData Class:
public static SummaryListData parse(JSONObject jsonObject) {
        if (jsonObject != null) {
                SummaryListData summary = new SummaryListData();

                summary.date            = jsonObject.optString("date");
                summary.caloriesIdle    = jsonObject.optString("caloriesIdle");
                summary.lastUpdate      = jsonObject.optString("lastUpdate");
                summary.summaries       = new ArrayList<SummaryData>();

                JSONArray summariesJsonArray= jsonObject.optJSONArray("summary");
                if (summariesJsonArray != null) {
                    for (int i = 0; i < summariesJsonArray.length(); i++) {
                        JSONObject summaryJsonObject = summariesJsonArray.optJSONObject(i);
                        if (summaryJsonObject != null) {
                            summary.summaries.add(SummaryData.parse(summaryJsonObject));

                            Log.d("summaryHandler", summaryJsonObject.toString());

                        }
                    }
                }

                return summary;
        }
        return null;
    }

}

A: Here is another way to solve your problem.
Follow this steps :
1) import Jackson library in your android project. How to import jackson library
2) Copy your json data and paste it in the text section http://jsonviewer.stack.hu/ and then click on the viewer tab.
3) Once the library is imported copy your JSON data and paste it in the edit text box Json2Schema

*

*Set source type as JSON

*Set annotation style as Jackson 2.x

*Then just click preview

*It will popup a window with all your boiler plate code, now copy this data in different classes in respective package e.g com.android.json.pojo

*Change the name of the classes accordingly as some class names will be Example

4) Now wherever you are getting your json string from server parse using the following code.
RootElement rootElement = null;
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.configure(Feature.AUTO_CLOSE_SOURCE, true);
// this line is very important
objectMapper.configure(

DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);

try {
        rootElement = objectMapper.readValue(result, RootElement.class);
    } catch (JsonParseException e) {
            e.printStackTrace();
    } catch (JsonMappingException e) {
            e.printStackTrace();
    }

RootElement class is nothing but the class which has json property same as the first elements for example
@JsonPropertyOrder({
"date",
"summary",
"segments",
"caloriesIdle",
"lastUpdate"
})

Your rootElement has the parsed data now.

A: this is your valid json response
[
    {
        "date": "20121212",
        "summary": [
            {
                "activity": "walking",
                "group": "walking",
                "duration": 3333,
                "distance": 3333,
                "steps": 3333,
                "calories": 300
            }
        ],
        "segments": [
            {
                "type": "place",
                "startTime": "20121212T000000+0200",
                "endTime": "20121212T071430+0200",
                "place": {
                    "id": 1,
                    "type": "unknown",
                    "location": {
                        "lat": 55.55555,
                        "lon": 33.33333
                    }
                },
                "lastUpdate": "20130317T121143Z"
            },
            {
                "type": "move",
                "startTime": "20121212T071430+0200",
                "endTime": "20121212T074617+0200",
                "activities": [
                    {
                        "activity": "walking",
                        "group": "walking",
                        "manual": false,
                        "startTime": "20121212T071430+0200",
                        "endTime": "20121212T072732+0200",
                        "duration": 782,
                        "distance": 1251,
                        "steps": 1353,
                        "calories": 99,
                        "trackPoints": [
                            {
                                "lat": 55.55555,
                                "lon": 33.33333,
                                "time": "20121212T071430+0200"
                            },
                            {
                                "lat": 55.55555,
                                "lon": 33.33333,
                                "time": "20121212T072732+0200"
                            }
                        ]
                    },
                    {
                        "activity": "transport",
                        "group": "transport",
                        "manual": false,
                        "startTime": "20121212T072732+0200",
                        "endTime": "20121212T074616+0200",
                        "duration": 1124,
                        "distance": 8443,
                        "trackPoints": [
                            {
                                "lat": 55.55555,
                                "lon": 33.33333,
                                "time": "20121212T072732+0200"
                            },
                            {
                                "lat": 55.55555,
                                "lon": 33.33333,
                                "time": "20121212T074208+0200"
                            },
                            {
                                "lat": 55.55555,
                                "lon": 33.33333,
                                "time": "20121212T074617+0200"
                            }
                        ]
                    }
                ],
                "lastUpdate": "20130317T121143Z"
            },
            {
                "type": "place",
                "startTime": "20121212T074617+0200",
                "endTime": "20121212T100051+0200",
                "place": {
                    "id": 2,
                    "type": "unknown",
                    "location": {
                        "lat": 55.55555,
                        "lon": 33.33333
                    }
                },
                "activities": [
                    {
                        "activity": "walking_on_treadmill",
                        "group": "walking",
                        "manual": true,
                        "duration": 270,
                        "steps": 303,
                        "calories": 30,
                        "trackPoints": []
                    }
                ],
                "lastUpdate": "20130317T121143Z"
            },
            {
                "type": "place",
                "startTime": "20121212T100715+0200",
                "endTime": "20121212T110530+0200",
                "place": {
                    "id": 4,
                    "name": "test",
                    "type": "foursquare",
                    "foursquareId": "4df0fdb17d8ba370a011d24c",
                    "foursquareCategoryIds": [
                        "4bf58dd8d48988d125941735"
                    ],
                    "location": {
                        "lat": 55.55555,
                        "lon": 33.33333
                    }
                },
                "activities": [
                    {
                        "activity": "walking",
                        "group": "walking",
                        "manual": false,
                        "startTime": "20121212T101215+0200",
                        "endTime": "20121212T101255+0200",
                        "duration": 40,
                        "distance": 18,
                        "steps": 37,
                        "calories": 99,
                        "trackPoints": [
                            {
                                "lat": 55.55555,
                                "lon": 33.33333,
                                "time": "20121212T101215+0200"
                            },
                            {
                                "lat": 55.55555,
                                "lon": 33.33333,
                                "time": "20121212T101255+0200"
                            }
                        ]
                    }
                ],
                "lastUpdate": "20130317T121143Z"
            },
            {
                "type": "move",
                "startTime": "20121212T110530+0200",
                "endTime": "20121212T111129+0200",
                "activities": [
                    {
                        "activity": "walking",
                        "group": "walking",
                        "manual": false,
                        "startTime": "20121212T110530+0200",
                        "endTime": "20121212T111128+0200",
                        "duration": 358,
                        "distance": 493,
                        "steps": 441,
                        "calories": 99,
                        "trackPoints": [
                            {
                                "lat": 55.55555,
                                "lon": 33.33333,
                                "time": "20121212T110531+0200"
                            },
                            {
                                "lat": 55.55555,
                                "lon": 33.33333,
                                "time": "20121212T110536+0200"
                            },
                            {
                                "lat": 55.55555,
                                "lon": 33.33333,
                                "time": "20121212T110947+0200"
                            },
                            {
                                "lat": 55.55555,
                                "lon": 33.33333,
                                "time": "20121212T111017+0200"
                            },
                            {
                                "lat": 55.55555,
                                "lon": 33.33333,
                                "time": "20121212T111129+0200"
                            }
                        ]
                    }
                ],
                "lastUpdate": "20130317T121143Z"
            },
            {
                "type": "place",
                "startTime": "20121212T111129+0200",
                "endTime": "20121212T153638+0200",
                "place": {
                    "id": 2,
                    "type": "unknown",
                    "location": {
                        "lat": 55.55555,
                        "lon": 33.33333
                    }
                },
                "activities": [
                    {
                        "activity": "zumba",
                        "manual": true,
                        "duration": 570,
                        "calories": 200,
                        "trackPoints": []
                    }
                ],
                "lastUpdate": "20130317T121143Z"
            },
            {
                "type": "place",
                "startTime": "20121212T160744+0200",
                "endTime": "20121212T232730+0200",
                "place": {
                    "id": 1,
                    "type": "unknown",
                    "location": {
                        "lat": 55.55555,
                        "lon": 33.33333
                    }
                },
                "lastUpdate": "20130317T121143Z"
            }
        ],
        "caloriesIdle": 1785,
        "lastUpdate": "20130317T121143Z"
    }
]

And this are your POJO classes accordingly
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Generated;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"activity",
"manual",
"duration",
"calories",
"trackPoints"
})
public class Activity {

@JsonProperty("activity")
private String activity;
@JsonProperty("manual")
private Boolean manual;
@JsonProperty("duration")
private Integer duration;
@JsonProperty("calories")
private Integer calories;
@JsonProperty("trackPoints")
private List<Object> trackPoints = new ArrayList<Object>();
@JsonIgnore
private Map<String, Object> additionalProperties = new HashMap<String, Object>();

/**
*
* @return
* The activity
*/
@JsonProperty("activity")
public String getActivity() {
return activity;
}

/**
*
* @param activity
* The activity
*/
@JsonProperty("activity")
public void setActivity(String activity) {
this.activity = activity;
}

/**
*
* @return
* The manual
*/
@JsonProperty("manual")
public Boolean getManual() {
return manual;
}

/**
*
* @param manual
* The manual
*/
@JsonProperty("manual")
public void setManual(Boolean manual) {
this.manual = manual;
}

/**
*
* @return
* The duration
*/
@JsonProperty("duration")
public Integer getDuration() {
return duration;
}

/**
*
* @param duration
* The duration
*/
@JsonProperty("duration")
public void setDuration(Integer duration) {
this.duration = duration;
}

/**
*
* @return
* The calories
*/
@JsonProperty("calories")
public Integer getCalories() {
return calories;
}

/**
*
* @param calories
* The calories
*/
@JsonProperty("calories")
public void setCalories(Integer calories) {
this.calories = calories;
}

/**
*
* @return
* The trackPoints
*/
@JsonProperty("trackPoints")
public List<Object> getTrackPoints() {
return trackPoints;
}

/**
*
* @param trackPoints
* The trackPoints
*/
@JsonProperty("trackPoints")
public void setTrackPoints(List<Object> trackPoints) {
this.trackPoints = trackPoints;
}

@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}

@JsonAnySetter
public void setAdditionalProperty(String name, Object value) {
this.additionalProperties.put(name, value);
}

}

your location class
import java.util.HashMap;
import java.util.Map;
import javax.annotation.Generated;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

@JsonInclude(JsonInclude.Include.NON_NULL)
@Generated("org.jsonschema2pojo")
@JsonPropertyOrder({
"lat",
"lon"
})
public class Location {

@JsonProperty("lat")
private Double lat;
@JsonProperty("lon")
private Double lon;
@JsonIgnore
private Map<String, Object> additionalProperties = new HashMap<String, Object>();

/**
*
* @return
* The lat
*/
@JsonProperty("lat")
public Double getLat() {
return lat;
}

/**
*
* @param lat
* The lat
*/
@JsonProperty("lat")
public void setLat(Double lat) {
this.lat = lat;
}

/**
*
* @return
* The lon
*/
@JsonProperty("lon")
public Double getLon() {
return lon;
}

/**
*
* @param lon
* The lon
*/
@JsonProperty("lon")
public void setLon(Double lon) {
this.lon = lon;
}

@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}

@JsonAnySetter
public void setAdditionalProperty(String name, Object value) {
this.additionalProperties.put(name, value);
}

}

Your Place class
import java.util.HashMap;
import java.util.Map;
import javax.annotation.Generated;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"id",
"type",
"location"
})
public class Place {

@JsonProperty("id")
private Integer id;
@JsonProperty("type")
private String type;
@JsonProperty("location")
private Location location;
@JsonIgnore
private Map<String, Object> additionalProperties = new HashMap<String, Object>();

/**
*
* @return
* The id
*/
@JsonProperty("id")
public Integer getId() {
return id;
}

/**
*
* @param id
* The id
*/
@JsonProperty("id")
public void setId(Integer id) {
this.id = id;
}

/**
*
* @return
* The type
*/
@JsonProperty("type")
public String getType() {
return type;
}

/**
*
* @param type
* The type
*/
@JsonProperty("type")
public void setType(String type) {
this.type = type;
}

/**
*
* @return
* The location
*/
@JsonProperty("location")
public Location getLocation() {
return location;
}

/**
*
* @param location
* The location
*/
@JsonProperty("location")
public void setLocation(Location location) {
this.location = location;
}

@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}

@JsonAnySetter
public void setAdditionalProperty(String name, Object value) {
this.additionalProperties.put(name, value);
}

}

Your RootElement class
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Generated;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"date",
"summary",
"segments",
"caloriesIdle",
"lastUpdate"
})
public class RootElement {

@JsonProperty("date")
private String date;
@JsonProperty("summary")
private List<Summary> summary = new ArrayList<Summary>();
@JsonProperty("segments")
private List<Segment> segments = new ArrayList<Segment>();
@JsonProperty("caloriesIdle")
private Integer caloriesIdle;
@JsonProperty("lastUpdate")
private String lastUpdate;
@JsonIgnore
private Map<String, Object> additionalProperties = new HashMap<String, Object>();

/**
*
* @return
* The date
*/
@JsonProperty("date")
public String getDate() {
return date;
}

/**
*
* @param date
* The date
*/
@JsonProperty("date")
public void setDate(String date) {
this.date = date;
}

/**
*
* @return
* The summary
*/
@JsonProperty("summary")
public List<Summary> getSummary() {
return summary;
}

/**
*
* @param summary
* The summary
*/
@JsonProperty("summary")
public void setSummary(List<Summary> summary) {
this.summary = summary;
}

/**
*
* @return
* The segments
*/
@JsonProperty("segments")
public List<Segment> getSegments() {
return segments;
}

/**
*
* @param segments
* The segments
*/
@JsonProperty("segments")
public void setSegments(List<Segment> segments) {
this.segments = segments;
}

/**
*
* @return
* The caloriesIdle
*/
@JsonProperty("caloriesIdle")
public Integer getCaloriesIdle() {
return caloriesIdle;
}

/**
*
* @param caloriesIdle
* The caloriesIdle
*/
@JsonProperty("caloriesIdle")
public void setCaloriesIdle(Integer caloriesIdle) {
this.caloriesIdle = caloriesIdle;
}

/**
*
* @return
* The lastUpdate
*/
@JsonProperty("lastUpdate")
public String getLastUpdate() {
return lastUpdate;
}

/**
*
* @param lastUpdate
* The lastUpdate
*/
@JsonProperty("lastUpdate")
public void setLastUpdate(String lastUpdate) {
this.lastUpdate = lastUpdate;
}

@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}

@JsonAnySetter
public void setAdditionalProperty(String name, Object value) {
this.additionalProperties.put(name, value);
}

}

Your Segment class
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Generated;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"type",
"startTime",
"endTime",
"place",
"lastUpdate",
"activities"
})
public class Segment {

@JsonProperty("type")
private String type;
@JsonProperty("startTime")
private String startTime;
@JsonProperty("endTime")
private String endTime;
@JsonProperty("place")
private Place place;
@JsonProperty("lastUpdate")
private String lastUpdate;
@JsonProperty("activities")
private List<Activity> activities = new ArrayList<Activity>();
@JsonIgnore
private Map<String, Object> additionalProperties = new HashMap<String, Object>();

/**
*
* @return
* The type
*/
@JsonProperty("type")
public String getType() {
return type;
}

/**
*
* @param type
* The type
*/
@JsonProperty("type")
public void setType(String type) {
this.type = type;
}

/**
*
* @return
* The startTime
*/
@JsonProperty("startTime")
public String getStartTime() {
return startTime;
}

/**
*
* @param startTime
* The startTime
*/
@JsonProperty("startTime")
public void setStartTime(String startTime) {
this.startTime = startTime;
}

/**
*
* @return
* The endTime
*/
@JsonProperty("endTime")
public String getEndTime() {
return endTime;
}

/**
*
* @param endTime
* The endTime
*/
@JsonProperty("endTime")
public void setEndTime(String endTime) {
this.endTime = endTime;
}

/**
*
* @return
* The place
*/
@JsonProperty("place")
public Place getPlace() {
return place;
}

/**
*
* @param place
* The place
*/
@JsonProperty("place")
public void setPlace(Place place) {
this.place = place;
}

/**
*
* @return
* The lastUpdate
*/
@JsonProperty("lastUpdate")
public String getLastUpdate() {
return lastUpdate;
}

/**
*
* @param lastUpdate
* The lastUpdate
*/
@JsonProperty("lastUpdate")
public void setLastUpdate(String lastUpdate) {
this.lastUpdate = lastUpdate;
}

/**
*
* @return
* The activities
*/
@JsonProperty("activities")
public List<Activity> getActivities() {
return activities;
}

/**
*
* @param activities
* The activities
*/
@JsonProperty("activities")
public void setActivities(List<Activity> activities) {
this.activities = activities;
}

@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}

@JsonAnySetter
public void setAdditionalProperty(String name, Object value) {
this.additionalProperties.put(name, value);
}

}

Your Summary Class
import java.util.HashMap;
import java.util.Map;
import javax.annotation.Generated;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"activity",
"group",
"duration",
"distance",
"steps",
"calories"
})
public class Summary {

@JsonProperty("activity")
private String activity;
@JsonProperty("group")
private String group;
@JsonProperty("duration")
private Integer duration;
@JsonProperty("distance")
private Integer distance;
@JsonProperty("steps")
private Integer steps;
@JsonProperty("calories")
private Integer calories;
@JsonIgnore
private Map<String, Object> additionalProperties = new HashMap<String, Object>();

/**
*
* @return
* The activity
*/
@JsonProperty("activity")
public String getActivity() {
return activity;
}

/**
*
* @param activity
* The activity
*/
@JsonProperty("activity")
public void setActivity(String activity) {
this.activity = activity;
}

/**
*
* @return
* The group
*/
@JsonProperty("group")
public String getGroup() {
return group;
}

/**
*
* @param group
* The group
*/
@JsonProperty("group")
public void setGroup(String group) {
this.group = group;
}

/**
*
* @return
* The duration
*/
@JsonProperty("duration")
public Integer getDuration() {
return duration;
}

/**
*
* @param duration
* The duration
*/
@JsonProperty("duration")
public void setDuration(Integer duration) {
this.duration = duration;
}

/**
*
* @return
* The distance
*/
@JsonProperty("distance")
public Integer getDistance() {
return distance;
}

/**
*
* @param distance
* The distance
*/
@JsonProperty("distance")
public void setDistance(Integer distance) {
this.distance = distance;
}

/**
*
* @return
* The steps
*/
@JsonProperty("steps")
public Integer getSteps() {
return steps;
}

/**
*
* @param steps
* The steps
*/
@JsonProperty("steps")
public void setSteps(Integer steps) {
this.steps = steps;
}

/**
*
* @return
* The calories
*/
@JsonProperty("calories")
public Integer getCalories() {
return calories;
}

/**
*
* @param calories
* The calories
*/
@JsonProperty("calories")
public void setCalories(Integer calories) {
this.calories = calories;
}

@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}

@JsonAnySetter
public void setAdditionalProperty(String name, Object value) {
this.additionalProperties.put(name, value);
}

}


text:
Q: iOS 9 crash in WebCore::FrameView::contentsSizeRespectingOverflow: We just upgraded to Xcode 7 and when we run our e-reader app in a simulator with 9.0 it crashes in WebCore
WebCore::FrameView::contentsSizeRespectingOverflow:
We have to turn through a few pages (10 or 20) to reproduce it. The strange thing is I can't reproduce it on a device or when running on simulator with 8.4.
I know it helps to set the scalesPageToFit property of UIWebView to NO, but we are already doing that.
Has anyone else seen this issue and was able to come up with a work-around?
Thank you

A: Same here. That is my radar. Please also file one.
It might have been fixed in 9.1 beta 4 but I am getting a memory related crash in my test app on that version.

A: I have this issue too (I see in crashlitycs) but I can't reproduce it - I'm still work on it. Do You have any progress ?
I find this issue, maybe Yours:
https://openradar.appspot.com/22889402
------------------------------------------------------------------
Probably I find working workaround.
I create new viewcontroller object only once, and switch off scale for pages that have own mobile version. Issue happen when uiwebview want scale page and page is originally fit for screen - when website is "big" issue not happen. But that I say - probably.
In crashlitycs I dont have this issue for 4 days, but this is not long time, so we will see.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to setup syslog-ng with option TLS anyone knows how to setup TLS option in syslog-ng in Centos 6.x? I do have following syslog-ng.conf and it works just fine but when I add tls option it does not?
       syslog-nf-.conf
          # My Switches
                 source s_switch {
                       udp(ip(0.0.0.0) port(514));
                        tcp(ip(0.0.0.0) port(514));
                         };

destination d_switch {
             file(
            "/var/log/pan/$HOST-$YEAR$MONTH$DAY.log"
            perm(644)
            create_dirs(yes)
       );
   };

log { source(s_switch); destination(d_switch); };

change it to :

 source s_switch {
      tcp(ip(0.0.0.0) port(1999)
           tls( ca_dir("/etc/syslog-ng/ca.d")
             key_file("/etc/syslog-ng/key.d/privkey.pem")
                cert_file("/etc/syslog-ng/cert.d/cacert.pem")
                  peer_verify(optional-untrusted)) ); };

A: Which syslog-ng version do you use? The one in EPEL does not have TLS (openssl) support enabled, as that would be cross linking between / and /usr. If you don't mind that this packaging guide line is not followed, you can use my unofficial syslog-ng packages at https://copr.fedoraproject.org/coprs/czanik/syslog-ng37epel6/ which can be added on top of EPEL (some of the dependencies come from EPEL).


text:
Q: How can I prove that $\int_{0}^{\infty}\frac{\sin(x)}{x^{\lambda}}$ converges for $\lambda \in (0,2)$?
How can I prove that $\int_{0}^{\infty}\frac{\sin(x)}{x^{\lambda}}$
  converges for $\lambda \in (0,2)$?

I tried substituting $\sin(x)$ trough its series represantation in order to get rid of the $x^{\lambda}$ in the denominator when I realised that there the series represantation encompasses $(-1)^k$ and $!$.
How can I go about solving this?


text:
Q: Cancel button in card.io scanning screen Android I'm using card.io on Android. Is it possible to put a cancel button in the scanning view? iOS has that option.
I'm currently passing these extras to the scanIntent:
public void onScanPress() {
    scanIntent.putExtra(CardIOActivity.EXTRA_SUPPRESS_MANUAL_ENTRY, true);
    scanIntent.putExtra(CardIOActivity.EXTRA_SUPPRESS_CONFIRMATION, true);
}

A: In Android, card.io relies on the fact that there is a back button (hard or soft).  Therefore, there's no additional cancel button.  Sorry.


text:
Q: Java - Equal spacing between texts I have this list:

I have to put the text in a TextView with equal space beetween that 3 texts, like:
15/10/2015       +       Orale
17/10/2015       7½      Scritto/Grafico
20/11/2015       7       Orale

etc...
Obviously strings will splitted in the underscore and put in an array.
I have tried with the "\t" code but don't work, i also tried with This
but it also don't work, i think because of the different space occupied by texts even if they have the same number of characters. Anyone can help me?

A: replace method? will work if every char have same length (in pix)
String newString = oldStringWithOneLine.replace("_", "   ");


text:
Q: PHP: Get key in multidimensional Array I have an Array like this :
Array ( [48948171] => Array (

[0] => Array ( [name] => Kog'Maw's Deceivers [tier] => BRONZE [queue] => RANKED_SOLO_5x5 [entries] => Array (

[0] => Array ( [playerOrTeamId] => 46337778 [playerOrTeamName] => EmaOwnaBan [division] => IV [leaguePoints] => 57 [wins] => 19 [losses] => 15 [isHotStreak] => 1 [isVeteran] => [isFreshBlood] => [isInactive] => )

[1] => Array ( [playerOrTeamId] => 68938894 [playerOrTeamName] => KillerBrownieGRH [division] => V [leaguePoints] => 49 [wins] => 20 [losses] => 39 [isHotStreak] => [isVeteran] => [isFreshBlood] => [isInactive] => )
....

My question: How do I get the main-key just from having the playerOrTeamId, for example: I have playerOrTeamId=68938894, now I want to get [1] as result, so that I can get the division of a player with
$summoner_league[$summoner_id][0]["entries"][NUMBERINEEDTOKNOW]["division"]

How can I do this?

A: You can get 68938894 index as:
$reqArr = array();

foreach($yourArr as $value){
     foreach($value as $innerVal){
          if($innerVal["playerOrTeamId"] == 68938894){
               $reqArr = $innerVal;
          }
      }
}
print_r($reqArr);

A: you can loop you array by this way:
foreach($arr_main as $arr_internal) {
    foreach($arr_internal['entries'] as $arr_entries) {
        echo $arr_entries['division'];
    }
}


text:
Q: Facebook FQL - what is difference between normalized_url and url in link_stat table url is the indexed field in table link_stat for querying number of likes, etc. for a given url, but the table also contains a field normalized_url.  No explanation in the sparse Facebook documentation, other than "The normalized URL for the page being shared."
Once I've queried a record, should I refer to url or normalized_url, and what is the difference?


text:
Q: Convert Str to Int in from Yaml to Json How to force integer value in kubernetes template (without helm)
In variables.yaml
-name: PORT
 value: 80

In template.yaml
ports:
 - containerPort: $(PORT) --> output '80', expected: 80 (int)
   protocol: TCP


text:
Q: Probability Independence check similar to linear independence? Linear independence check can be done as: given vectors $v_1, v_2, \dots v_n$, if there exists $a_1, a_2, \dots a_n$, not all zero, such that $$a_1 v_1 + a_2 v_2 + \dots + a_n v_n  = 0$$, then $v_i$ are not linear independent; otherwise, $v_i$ are linear independent.
This check is quite straight-forward as it will lead to solve a $n\times n$ linear equation, or computing the det of a $n\times n$ matrix.
Probability independence check is a bit different. It's defined as:
Given a probability triple $(\Omega, F, P)$, a collection of events $\{A_1, A_2, \dots, A_n \}$ is independent if for all $k \in N$, and all possible $\{i_1, i_2, \dots, i_k\}$,
$$P(A_{i_1}\cap A_{i_2} \cap \dots \cap A_{i_k})=P(A_{i_1})P(A_{i_2}) \dots P(A_{i_k})$$
This is quite troublesome as there are so many combinations.
Is there a similar way to check the independent of a collection of events? Or even better is it possible to convert the problem to check of vectors' linear independence?

A: As noted by Ethan Bolker, there is no relation between the two meanings of "independent",
and no shortcut in general.
I might note that it is entirely possible that of these $2^n$ equations, $2^n - 1$ are true, but one is false.
However, in practice one almost never actually checks all these equations.  Rather,
some assumptions are made in setting up a probability model, as a consequence of which we can deduce the independence.  Thus if the $A_i$ depend only on
different parts of an experiment that have no physical connection to each other, then they are independent.


text:
Q: How can I tell programatically if a filename I am asking for exists on a webserver? I am helping somebody pull a bunch (tens of thousands) of pdf files from a website.  We have the pattern for the file names but not all of the files will exist.  I am assuming it is rude to ask for a file that does not exist, particularly at this scale.  I am using python and in my tests of urllib2 I have found that this snippet gets me the file if it exists
s=urllib.urlretrieve('http://website/directory/filename.pdf','c:\\destination.pdf')

If the file does not exist then I get a file that has the name I assigned but the text from their 404 page.  Now I can handle this after I am done (read the files and delete all of the 404 pages) but that does not seem very nice to their server nor is it very pythonic.
I tried messing with the looking at the various functions in urllib and urlretrieve and do not see anything that tells me if the file exists.

A: You can check the return code of the response. It will be 200 for existing PDFs and 404 for non-existing PDFs. You can use the requests library to make this a lot easier:
>>> import requests
>>> r = requests.get('http://cdn.sstatic.net/stackoverflow/img/sprites.png')
>>> r.status_code
200
>>> r = requests.get('http://cdn.sstatic.net/stackoverflow/img/sprites.xxx')
>>> r.status_code
404


text:
Q: Is there some easy way to specify a MaxWidth for a WPF DataGridTextColumn that only affects auto-sizing? In a WPF app I'm using a DataGrid to display data from a text file that has been parsed into multiple columns. One of the columns in particular contains text of very variable length. As the column widths auto-adapt to their content by default, some very long texts in this column often push the following columns out of sight, forcing the user to scroll horizontally.
At first I tried to remedy this by specifying a MaxWidth for the column but that will completely prevent users from resizing the column to see the full contents if they so desire. Simply setting Width to a fixed value is slightly better but then the column will often be wider than it needs to be...
So, what I'm looking for is a sort of "soft" MaxWidth that will only affect the column's auto-sizing but not the user's ability to resize it beyond that value... Is there a light-weight way to do this, ideally without code-behind (or at least very little)?

A: You have some options. You can set the DataGrid.ColumnWidth to a fixed width or to DataGridLength.SizeToHeader:
For all columns:
<DataGrid ColumnWidth="{x:Static DataGridLength.SizeToHeader}" />

For individual columns:
<DataGridTextColumn Width="{x:Static DataGridLength.SizeToHeader}" />

Additionally you can add an ellipsis character to the cell's content to indicate overflowing cell content to the user.
When auto generating columns:
<DataGrid AutoGeneratingColumn="OnDataGrid_AutoGeneratingColumn"
          ColumnWidth="{x:Static DataGridLength.SizeToHeader}">
  <DataGrid.Resources>
    <Style x:Key="DataGridTextColumnEditStyle"
           TargetType="{x:Type TextBlock}"
           BasedOn="{StaticResource {x:Type TextBlock}}">
      <Setter Property="TextTrimming"
              Value="CharacterEllipsis" />
    </Style>
  </DataGrid.Resources>
</DataGrid>

private void OnDataGrid_AutoGeneratingColumn(object sender, DataGridAutoGeneratingColumnEventArgs e)
{
  if (e.Column is DataGridTextColumn textColumn)
  {
    var dataGrid = sender as DataGrid;
    var textColumnEditStyle = dataGrid.FindResource("DataGridTextColumnEditStyle") as Style;
    textColumn.ElementStyle = textColumnEditStyle;
  }
}

When defining columns explicitly:
<DataGrid AutoGenerateColumns="False">
  <DataGrid.Columns>
    <DataGridTextColumn Width="{x:Static DataGridLength.SizeToHeader}">
      <DataGridTextColumn.ElementStyle>
        <Style TargetType="{x:Type TextBlock}"
               BasedOn="{StaticResource {x:Type TextBlock}}">
          <Setter Property="TextTrimming"
                  Value="CharacterEllipsis" />
        </Style>
      </DataGridTextColumn.ElementStyle>
    </DataGridTextColumn>
  </DataGrid.Columns>
</DataGrid>

Another solution is to allow the DataGrid to calculate the widths and validate and coerce each column width afterwards:
<DataGrid Loaded="OnDataGrid_Loaded" />

private const double MaxColumnWidth = 200;

private void OnDataGrid_Loaded(object sender, RoutedEventArgs e)
{
  var dataGrid = sender as DataGrid;

  // Alternatively, select the particular column of interest by index or Header value
  foreach (DataGridColumn column in dataGrid.Columns)
  {
    if (column.ActualWidth > MaxColumnWidth)
    {
      column.Width = MaxColumnWidth;
    }
  }
}


text:
Q: Is my JSON API doing something wrong? This seems to me like some fairly simple Jquery that should be retrieving a JSON object that I'm after
$.ajax({
    url: "test.json",
    datatype: 'json',
    success: function(results) {
    console.log(results);
    }
});

Whether I dynamically generate this JSON object or use a static document, the above code returns squat. Here's what the JSON object looks like:
{urls:['/ants/','/brick-report/','/the-pollution-intervention/','/barclay/','/broken-advertising/','/aldat-n-densom/','/thisisart/','/there-she-goes-again/']}

It's nothing more that a list of urls in an array. I cannot retrieve it using the above ajax code OR with $.getJSON. HALP!
(For clarity, I've edited this to show that the json file and the web page with the Jquery request are in the same directory.)

A: This is a valid Json
{
"urls": [
    "/ants/",
    "/brick-report/",
    "/the-pollution-intervention/",
    "/barclay/",
    "/broken-advertising/",
    "/aldat-n-densom/",
    "/thisisart/",
    "/there-she-goes-again/"
 ]
}

A: You are not only using invalid json, you are also using escape character in wrong way.

*

*wrap double quote in key

*replace to correct escape characeter \" instead of '/

*replace all single quotes to double quotes

Here's the correct the json
{\"urls\":[\"ants\",\"brick-report\",\"the-pollution-intervention\",\"barclay\",\"broken-advertising\",\"aldat-n-densom\",\"thisisart\",\"there-she-goes-again\"]}


text:
Q: How to read Deep-ocean Assessment and Reporting of Tsunamis (DART®) data in python I am trying to plot water column height with python from DART data,
http://www.ndbc.noaa.gov/data/dart_deployment_realtime/23228.dart
 import pandas as pd
 link = "http://www.ndbc.noaa.gov/data/dart_deployment_realtime/23228.dart"
 data = pd.read_table(link)

but data have only one column and I cant access seprated data

Site:                   23228
0   #Paroscientific Serial: W23228
  1   #YY  MM DD hh mm ss T   HEIGHT
  2   #yr  mo dy hr mn  s -        m
  3   2014 08 08 06 00 00 1 2609.494
  4   2014 08 08 05 45 00 1 2609.550
  5   2014 08 08 05 30 00 1 2609.605
  6   2014 08 08 05 15 00 1 2609.658
  7   2014 08 08 05 00 00 1 2609.703
  8   2014 08 08 04 45 00 1 2609.741
  9   2014 08 08 04 30 00 1 2609.769
  10  2014 08 08 04 15 00 1 2609.787
  11  2014 08 08 04 00 00 1 2609.799
  12  2014 08 08 03 45 00 1 2609.802

for example I just want HEIGHT value as numpy array, I dont know have to access this specific column

A: Perhaps you can modify the following:
import urllib2, numpy
response = urllib2.urlopen('http://www.ndbc.noaa.gov/data/dart_deployment_realtime/23228.dart')
all_lines = response.read().splitlines()
lines_of_interest = all_lines[4:len(all_lines)]
heights = numpy.zeros(len(lines_of_interest), dtype=float)
for idx, line in enumerate(lines_of_interest):
    heights[idx] = float(line.split()[7])

Then:
>>> heights.shape
(92551,)

>>> heights
array([ 2609.27 ,  2609.213,  2609.153, ...,  2611.157,  2611.084,
        2611.008])

Etc.

A: With pure Python (no NumPy) I would use the csv module:
import urllib2
import csv

u = urllib2.urlopen('http://www.ndbc.noaa.gov/data/dart_deployment_realtime/23228.dart')
r = csv.reader(r, delimiter=' ')

# skip the headers
for _ in range(3):
    next(r, None)

Now r contains an iterable which gives one row (list of 8 items) at a time for whatever you need. Of course, if you need a list of lists, you may just do list(r).

However, as you are handling rather a large amount of data, you may probably want to use NumPy. In that case:
import urllib2
import numpy as np

u = urllib2.urlopen('http://www.ndbc.noaa.gov/data/dart_deployment_realtime/23228.dart')
arr = np.loadtxt(u, skiprows=3)

This gives you an array of 92551 x 8 values.
Accessing the heights as a NumPy array is then simple:
arr[:,7]

Pandas is another possibility, as you correctly thought. It is just a matter of a few parameters...
import urllib2
import pandas as pd

link = 'http://www.ndbc.noaa.gov/data/dart_deployment_realtime/23228.dart'
df = pd.read_table(link, delimiter=r'\s+', skiprows=[1,3], header=1)

Now you have a nice DataFrame with df["HEIGHT"] as the height. (The column names are taken from row 2 of the file.)

And for the plotting...
df["HEIGHT"].plot()

creates

(Then I guess you will ask how to get the proper date on the X axis. I think that is worth a completely new question...)


text:
Q: react routing - rendering error (single page application) Hi I am learning react and trying to create SPA, but internal pages are not rendered.
Only  is rendered, it's not rendering Internal components like  &

Unable to find exact problem
I have tried multiple combinations for Route path like
<Route path="/about" component={About}/>
<Route path="about" component={About}/>

My Complete Code
import React, { Component } from 'react';
import {render} from 'react-dom';
// import { Router, Route, Link } from 'react-router';
import { BrowserRouter as Router, Route, Link, Switch} from 'react-router-dom';
import About from './About';
import Home from './Home';
import Repos from './Repos';
import AboutChild from './AboutChild';

class App extends Component {
    constructor() {
        super(...arguments);
    }
    render(){
        return (

                <menu>

<Link to="/">Home</Link>

<Link to="/about">About</Link>

<Link to="/repos">Repos</Link>

                </menu>

        );
    }
}

render((<Router>
            <App>
                <Route exact path="/" component={Home} />
                <Route path="/about" component={About}/>
                <Route path="/repos" component={Repos}/>
            </App>
</Router>), document.getElementById('root'));

Component versions from package.json
"dependencies": {
    "react": "^15.0.0",
    "react-dom": "^15.0.0",
    "react-router": "^4.1.1",
    "react-router-dom": "^4.1.1"
  }

A: In your App component in render you need to return children props. Try this
  render(){
    return (

            <menu>

<Link to="/">Home</Link>

<Link to="/about">About</Link>

<Link to="/repos">Repos</Link>

            </menu>
            {this.props.children}

    );
}

You can also remove constructor, because you don't use it in this example.

A: Fix your constructor:
constructor(props) {
    super(props);
}


text:
Q: System.TypeLoadException while using Dapper I'm attempting to use Dapper on Northwind database, and i have a problem that i'm unable to fix.
I get this error:
System.TypeLoadException: 'Cannot load type 'Dapper.SqlMapper' from set 'Dapper, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.'
My code:
class Employee
    {
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public string Title { get; set; }
        public string TerritoryDescription { get; set; }
        public string RegionDescription { get; set; }

        public override string ToString()
        {
            return $"{FirstName} {LastName} {Title} {TerritoryDescription} {RegionDescription}";
        }
    }
class Program
    {
        static void Main(string[] args)
        {
            var connStr = "Server = localhost; Database = Northwind; Trusted_Connection = True;";

            using (var connection = new SqlConnection(connStr))
            {
                connection.Open();

                var employees = connection.Query<Employee>
                (
                    @"SELECT e.FirstName FirstName, e.LastName LastName, e.Title Title, T.TerritoryDescription TerritoryDesc, r.RegionDescription RegionDesc FROM Employees e INNER JOIN EmployeeTerritories et ON e.EmployeeID = et.EmployeeID INNER JOIN Territories T ON et.TerritoryID = T.TerritoryID JOIN Region r ON T.RegionID = r.RegionID"
                ).ToList();

                foreach (var person in employees) Console.WriteLine(person);

                connection.Close();
            }
        }
    }

I can't even check where is the problem, because app goes into break mode.

A: This problem occurs generally when there is an object / class / type named
Dapper
dapper
Do following steps to remove this issue
Create a Fresh Project and do NOT name anything in it with Dapper (case insensitive). Even if you change name of exiting 'dapper' object in your existing project then too it might create problems so its better to create a fresh project! I think it has something to do with assembly or hardcoding somewhere in dapper or visual studio (not sure!).
Use Nuget Manager again to Install Dapper.
It should work fine now.
Reference : https://dapper-tutorial.net/knowledge-base/29410020/dapper-error--could-not-load-type--dapper-sqlmapper-


text:
Q: Split array into chunks based on timestamp in Haskell I have an array of records (custom data type) in Haskell which I want to aggregate based on a each records' timestamp.  In very general terms each record looks like this:
data Record = Record { event :: String,
                       time :: Double,
                       from :: Int,
                       to :: Int
                     } deriving (Show, Eq)

I used a Double for the timestamp since that is the same format used in the tracefile.
And I parse them from a CSV file into an array of records: [Record]
Now I'm looking to get an approximation of instantaneous events / time.  So I want to split the array into several arrays based on the timestamp (say. every 1 seconds) and then fold across each smaller array.
The problem is I can't figure out how to split an array based on the value of a record.  Looking on Hoogle I found several functions like splitEvery and splitWhen, but I'm lost.  I considered using splitWhen to break up the list when, say, (mod time 0.1) == 0, but even if that worked it would remove the elements it's splitting on (which I don't want to do).
I should note that the records are NOT evenly spaced in time.  E.g. the timestamp on sequential records is not going to differ by a fixed amount.
I am more than willing to store the data in a different format if you can suggest one that would make this sort of work easier.
A quick sample of the data I'm parsing (from a ns2 simulation):
r 0.114 1 2 tcp 1000 ________ 2 1.0 5.0 0 2
r 0.240 1 2 tcp 1000 ________ 2 1.0 5.0 0 2
r 0.914 2 1 tcp 1000 ________ 2 5.0 1.0 0 3

A: If you have [Record] and you want to group them by a specific condition, you can use Data.List.groupBy.  I'm assuming that for your time :: Double, 1 second is the base unit, so time = 1 is 1 second, time = 100 is 100 seconds, etc, so adjust this to whatever system you're actually using:
import Data.List
import Data.Function (on)

isInSameClockSecond :: Record -> Record -> Bool
isInSameClockSecond = (==) `on` (floor . time :: Record -> Integer)
-- The type signature is given for floor . time to remove any ambiguity
-- due to floor's polymorphic type signature.

groupBySameClockSecond :: [Record] -> [[Record]]
groupBySameClockSecond = groupBy isInSameClockSecond


text:
Q: Load all images for product without resizing in opencart 2.x I'm trying to load all images in the product page , but i don't want to resize them.
Does anybody know a simple solution tot do that?
The opencart version is 2.1.0.2

A: In-order to retrieve images without being re-sized on the product page, you need not re-size the images in the product controller file.
So in the Product Controller File, locate that in /catalog/controller/product/product.php
In the public function index()
Look out for $this->model_tool_image->resize remove the function call and use the link to the image instead to return to the template HTTPS_SERVER . 'image/'. $image_variable provided HTTPS_SERVER is defined in /config.php
Note: $image_variable could be $product_info['image'] or $result['image'] , use your best judgement.
Tip: Use vqmod as you would be modifying the core controller file

A: In order to use vQmod (according to the process described previously), you can take a look to this method for working with real images instead of thumbnails.
Note that there are other possible suggestions, such as:

*

*OCmod which can be found here

*Image Autosize extension which can be found here


text:
Q: Setting a specific character to another font set for page rendering at runtime My Client is using a font on the web that doesn't have a character "+" in it. I have a product that is called Clean + Fresh on an e-commerce website, and I can see that when inspecting the element the "+" is loading correctly. The problem is the font that doesn't have this character.
Instead I get "Clean 1 Fresh" rendering on a page.
Is there any way that a piece of code can detect for a PLUS sign in a specific CSS class, and then replace that character with another font that contains that character - for example Arial.
Here is an example of the product CSS entry:

Clean + Fresh

Thank you for your help.

A: This is easily solved by wrapping the plus sign in a span, and defining a standard font-family for it.

h1 {
  font-family: cursive;
}

span.plus {
  font-family: Arial, Helvetica, sans-serif;
}

Clean + Fresh


text:
Q: WindowsFormsHost in WPF Not Displaying Hosted Application In my WPF, I have a grid that contains a WindowsFormsHost which will host an .exe.
My .xaml code is:
<Window x:Class="PracticeWPF.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:PracticeWPF"
        mc:Ignorable="d"
        Title="MainWindow" Height="800" Width="1300">
    <Grid x:Name="grid">

        <Button x:Name="BtnRun" Content="Run"
                HorizontalAlignment="Left" Margin="10,10,0,0"
                VerticalAlignment="Top" Click="BtnRun_Click"/>

        <WindowsFormsHost x:Name="formshost" Margin="0,39,0,0"
            Height="720" Width="1280"/>

    </Grid>
</Window>

And my cs:
namespace PracticeWPF
{
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        [DllImport("user32.dll")]
        public static extern int SetParent(IntPtr hWndChild, IntPtr hWndNewParent);

        private void BtnRun_Click(object sender, EventArgs e)
        {
            Process proc = Process.Start("notepad.exe");
            proc.WaitForInputIdle();

            while (proc.MainWindowHandle == IntPtr.Zero)
            {
                Thread.Sleep(100);
                proc.Refresh();
            }
            SetParent(proc.MainWindowHandle, formshost.Handle);
        }
    }
}

Everything works when I'm using a WinForm but when I use the WindowsFormsHosting inside a WPF the .exe isn't visible.
Any help would be greatly appreciated.
Thank you.

A: At this link Docking Window inside another Window I think your answer. I matched it with your code
xaml
<Window x:Class="PracticeWPF.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
         xmlns:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
        xmlns:local="clr-namespace:PracticeWPF"
        mc:Ignorable="d"
        Title="MainWindow" Height="800" Width="1300">
    <Grid x:Name="grid">

        <Button x:Name="BtnRun" Content="Run"
                HorizontalAlignment="Left" Margin="10,10,0,0"
                VerticalAlignment="Top" Click="BtnRun_Click"/>

        <WindowsFormsHost x:Name="formshost" Margin="0,39,0,0"
            Height="720" Width="1280">
             <wf:Button Text="by button" Visible="False"></wf:Button>
        </WindowsFormsHost>
    </Grid>
</Window>

and mainwindow.cs
namespace PracticeWPF
{
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void BtnRun_Click(object sender, EventArgs e)
        {
            //Process proc = Process.Start("notepad.exe");
           //proc.WaitForInputIdle();

            //while (proc.MainWindowHandle == IntPtr.Zero)
            //{
            //    Thread.Sleep(100);
            //    proc.Refresh();
            //}
            this.Width = formshost.Width;
            this.Height = formshost.Height;
            dockIt();
        }

        [DllImport("user32.dll")]
        public static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);

        private Process pDocked;
        private IntPtr hWndOriginalParent;
        private IntPtr hWndDocked;

        [DllImport("user32.dll", SetLastError = true)]
        public static extern bool MoveWindow(IntPtr hWnd, int X, int Y, int nWidth, int nHeight, bool bRepaint);

        private void dockIt()
        {
            if (hWndDocked != IntPtr.Zero) //don't do anything if there's already a window docked.
                return;
            IntPtr hWndParent = IntPtr.Zero;

            pDocked = Process.Start(@"notepad");
            while (hWndDocked == IntPtr.Zero)
            {
                pDocked.WaitForInputIdle(1000); //wait for the window to be ready for input;
                pDocked.Refresh();              //update process info
                if (pDocked.HasExited)
                {
                    return; //abort if the process finished before we got a handle.
                }
                hWndDocked = pDocked.MainWindowHandle;  //cache the window handle
            }
            //Windows API call to change the parent of the target window.
            //It returns the hWnd of the window's parent prior to this call.
            hWndOriginalParent = SetParent(hWndDocked, formshost.Handle);

            //Wire up the event to keep the window sized to match the control
            formshost.SizeChanged += new SizeChangedEventHandler(Panel1_Resize);
            //Perform an initial call to set the size.
            Panel1_Resize(new Object(), new EventArgs());
        }

        private void undockIt()
        {
            //Restores the application to it's original parent.
            SetParent(hWndDocked, hWndOriginalParent);
        }

        private void Panel1_Resize(object sender, EventArgs e)
        {
            //Change the docked windows size to match its parent's size.
            MoveWindow(hWndDocked, 0, 0, (int)formshost.Width, (int)formshost.Height, true);
        }
    }
}

A: I am afraid a WindowsFormsHost cannot be used to host an entire Windows Forms application inside another application.
It is used to host an individual Windows Forms control in a WPF view.
If you want to get a handle to the WPF window, try with:
new System.Windows.Interop.WindowInteropHelper(this).Handle

You want to use this handle instead of formshost.Handle.


text:
Q: Draw CGImage in UITableView So, I have a custom cell and I need to draw all images as CGImage in tableView, but I can't get it working. I have created a test project and tested the code with simple views. Everything worked perfect, and when I copypasted the same code to my custom cell it stopped working. Here is the code:
-(void)drawRect:(CGRect)rect {
    CGRect contentRect = self.contentView.bounds;
    CGFloat boundsX = contentRect.origin.x;

    UIImage *karmaImage = [UIImage imageNamed:@"karma.png"];
    [self drawImage:karmaImage withRect:CGRectMake(boundsX + 255, 16, 14, 14)];
}
-(void)drawImage:(UIImage *)image withRect:(CGRect)rect {
    CGImageRef imageRef = CGImageRetain(image.CGImage);
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextTranslateCTM(context, 0, rect.size.height);
    CGContextScaleCTM(context, 1.0, -1.0);
    CGContextDrawImage(context, rect, imageRef);
}

Any solutions?

A: Apple recommends to add your custom view to the UITableViewCell's contentView instead of changing UITableViewCell itself.  See TimeZoneCell for an example.

A: In your drawRect method, you should probably call [super drawRect:rect];

A: OK, the problem was that contentView of the cell with custom background color was hiding the image. Here is the right code:
-(void) drawRect:(CGRect)rect{
    [super drawRect:rect];
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextSetFillColorWithColor(context, [UIColor colorWithRed:(232.0/255.0) green:(232.0/255.0) blue:(232.0/255.0) alpha:1.0].CGColor);
    CGContextFillRect(context, rect);
    UIImage *karmaImg = [UIImage imageNamed:@"karma.png"];
    [self drawImage:karmaImg withContext:context atPoint:CGPointMake(boundsX + 255, 16)];
}

-(void)drawImage:(UIImage *)image withContext:(CGContextRef)context atPoint:(CGPoint)point {
    if(image) {
        CGContextDrawImage(context, CGRectMake(point.x, point.y, image.size.width, image.size.height), image.CGImage);
    } else {
        NSLog(@"Error: Image failed to load.");
    }
}


text:
Q: Command to open a URL Is there a command I can use in Bash that will open a specific URL in the default browser?

A: There's a command that knows about your default browser:
xdg-open http://google.com

This will also work for every other type of URI (Uniform Resource Identifier), like images - which will automatically open with eog, openoffice documents, and so on, and also on filesystem paths (xdg-open /tmp/foobar.png).
There is also
xdg-email team@stackexchange.com

and
xdg-mime query default text/html

To find out what application is going to be used.
You can set your preffered application by going to System → Preferences → Preferred Applications:

These utilities are part of the freedesktop.org specification, so you can use them in your applications - and it's going to work on all of the desktops that adhere to the spec.

A: If you don't necessarily want to use the default browser, you can call any browser program directly and give the URL as argument, for example:
chromium-browser https://youtube.com

or
firefox https://youtube.com

A: gnome-open works as well as xdg-open but neither knows what to do with naked domain.
So gnome-open http://askubuntu.com works but not gnome-open askubuntu.com.
Here is a small function to make it easier to type and accept the stripped down domain name.
function go { gnome-open http://$1 ; }

Paste the above in your command line, hit enter and try it out. If you like it you can save it to your .bash_aliases or .bashrc file, then source ~/.bash_aliases (assuming it is in your home directory) and it will be persistent for that session and all new sessions.
So now we just type go askubuntu.com and wallah!

A: You can use xdg-open like so:
xdg-open http://askubuntu.com/

From the XDG-OPEN man page:

xdg-open opens a file or URL in the user's preferred application. If a
         URL is provided the URL will be opened in the user's preferred web
         browser.

A: Using x-www-browser URL will open the browser or a new tab at the given URL


text:
Q: get filename and extension of files in hdfs with Python Is there an equivalent of the os module in Python do read the filesystem (hadoop 2.6)?
In particular I am interested about getting extension of a file and base name (not including the full path).

A: No need for "an equivalent", os.path.basename is exactly the same for hdfs.
i.e.:
import os.path as path
print path.basename("/path/to/file.txt")
# file.txt

os.path — Common pathname manipulations


text:
Q: Fade out divs behind transparent nav but keep a background canvas visible behind it I'm trying to build my personal website where I have:

*

*A canvas element that's 100% screen height and width, with z-index -1

*The normal content in divs and section tags, with z-index 0

*The nav element that's at the highest z-index on the page

This arrangement allows me to have the canvas as the background of the entire website, it doesn't scroll because it's fixed. The nav is fixed as well so it stays at the top of the page with scrolling. (By "fixed" I mean "position: fixed" set in CSS on that element)
The nav has a transparent background, so it's "see-through", which shows the canvas content behind it, like this: navbar and canvas background
(sorry I don't enough points to embed images yet)
However, because the nav is transparent and fixed, content gets shown behind it on scroll, something like this image: content goes behind nav
I would like to have the content fade as it goes behind the nav's bottom edge, but I would also like to keep the nav transparent in order to show the canvas in the background. Here's what the fade would ideally look like: text fade example (taken from https://www.youtube.com/watch?v=-vbLeY-eDkQ but it uses text clip which doesn't apply to my case)
EDIT: Hiding the content without a fade is fine as well, the target is to make the content not appear beneath the transparent nav whilst showing the background canvas. It can be an abrupt cut-off instead of a gradient fade because after some more research I've found the fade effect I'm looking for isn't widely available or supported on all elements across browsers.
I have tried checking solutions from here: Hide scrollable content behind transparent fixed position divs when scrolling the page?
but they use a background image, which makes it relatively simpler. In my case, it's a canvas and the content of the canvas changes with time.
Here's my current webpage structure (Note: the CSS classes are from TailwindCSS but the naming is self-explanatory.
I'm also using React)

    <canvas id="vector_canvas" class="w-full h-full stroke-2"></canvas>

      Work
      showcase.

Is there a way to achieve this with CSS and/or JS?

A: Fading Content using Iframes (No JavaScript)
You will need to create an Iframe tag with src attribute set to the content file you would like fade. The main content has to have separate styles. The iframe must be in focus to allow scrolling. More details in the code below.
Demo: https://fadingiframe.netlify.app/
/* Index.html style style-sheet below */

iframe {
  position: absolute;
  top: 5rem;
  width: 100vw;
  height: calc(100vh - 6rem);
  border: none;
  -webkit-mask-image: linear-gradient( /* Mask iframe */
    transparent 1rem,
    #fff 5%,
    #fff 70%,
    transparent 90%
  );
  mask-image: linear-gradient(
    transparent 1rem,
    #fff 5%,
    #fff 70%,
    transparent 90%
  );
}

/* mainContent.html style style-sheet below */

body {
  position: absolute;
  overflow-x: hidden;
  margin-top: 2rem;
  color: aliceblue;
  width: 80vw;
  left: 5vw;
}

body::-webkit-scrollbar { /* Remove scroll bar */
  display: none;
}

body {
  -ms-overflow-style: none; /* keep in mind that it will only scroll if the iframe is in focus */
  scrollbar-width: none;
}

p {
  padding: 2rem;
  font-size: 2rem;
}

    <canvas id="canvas1"></canvas>

  <!DOCTYPE html>

    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <link rel="stylesheet" href="./mainContent.css" />

-------------------------------------------------------------------------
For Text only -
Body Tag Has Special/Hide Properties
I think your issue is that you do not use the "body" element selector. It has special properties, that by default set the body element height to match the screen. Although it still allows to scroll the inner content. I add and extra background div for the text as well. It provides a better reading experience. Have a look at my solution it may help you solve your problem. If you have any questions don't hesitate to ask.
Demo : https://jsfiddle.net/hexzero/5yjqk43a/
body {
  background-image: black;
  background-position: center center;
  -webkit-background-size: cover;
  background-size: cover;
  background-attachment: fixed;
  color: #fff;
}

section {
  position: absolute;
  padding: 3rem 25%;
  background-image: Linear-gradient(
    transparent 6rem, <-- Should be the same as nav Height
    #fff 30%,         <-- Can set this to nav Height for abrupt cut-off
    #fff 70%,
    transparent 90%
  );
  -webkit-background-clip: text;
  background-clip: text;
  background-attachment: fixed;
  scroll-behavior: auto;
  z-index: 3;
}

nav {
  background: rgba(0, 0, 0, 0.616);
  width: 100%;
  position: fixed;
  top: 0;
  height: 6rem; <-- Navigation Height
  z-index: 4;
}

section > p {
  margin-top: 12rem;
  color: transparent;
}

.text-background {  <-- Remove this style section to have no background for the content,
  width: 60%;       <-- along side the

 element
  height: 100vh;
  right: 20%;
  position: fixed;
  top: 0;
  background-image: Linear-gradient(
    transparent 6rem,   <-- Background to nav height
    rgba(102, 51, 153, 0.924) 20%,
    rgba(102, 51, 153, 0.931) 90%,
    transparent 100%
  );
  z-index: 0;
}

canvas {
  width: 100%;
  background-color: rebeccapurple;
  position: fixed;
  top: 0;
  z-index: -1;
}

footer {
  position: fixed;
  width: 100%;
  height: 1rem;
  background: rebeccapurple;
  z-index: 1;
  bottom: 0;
}

p {
  font-size: 2rem;
}

Tell me if you would be interested in a JavaScript version, for better browsers support. Thanks

A: By making the color of the nav transparent, you will be able to see through it to the canvas below. Since you did not provide your CSS for your classes; I threw together some new HTML instead. You can see the transparency effect below.

var c = document.getElementById("myCanvas");
        var ctx = c.getContext("2d");
        ctx.fillText("Hello World! This is text on a canvas that is behind the nav", 10, 10);
.nav-wrapper {
            height: 60px;
            top: 0;
            right: 0;
            left: 0;
            position: fixed;
            z-index: 5;
            background-color: #00000044;
        }

        #myCanvas {
            z-index:4;
            height: 100%;
            width: 100%;
        }
<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

            a simple nav

        <canvas id="myCanvas">

        </canvas>


text:
Q: Base controller error? I want to run "HELLO" line but it only run "BYE" line.
(1 BaseController for many other controllers, reuse code)
help me, thanks
public class BaseController : Controller
{
    public virtual ActionResult Index()
    {
        string str="HELLO";

        return View();
    }
}

public class TestController : BaseController
{
    public override ActionResult Index()
    {
        string str="BYE";

        return View();
    }
}

A: public class TestController : BaseController
{
    public override ActionResult Index()
    {
        return base.Index();
    }
}


text:
Q: Receiving 1971021 error when I try to finalize any install So Windows was giving me some troubles this weekend, and suffice it to say that I had to reinstall my OS.  Instead of wiping my drive, I just installed over the previous installation, preserving all my files so that they wouldn't need downloading again.
I've run the Oculus installer twice since reinstalling Windows, but when I try to install any game that requires additional actions after downloading (games and apps that require the "Finish Install" action), I get a 1971021 error.  This happens for both fresh installs (I uninstalled one of the apps and then tried to reinstall it, as well as installing an app I never downloaded prior to reinstalling Windows) as well as for the games that I had backed up.  The exact error text is:

Redistributable info missing. Internal error when we're missing info for a required redistributable package.

Presumably this means the Visual C++ redistributable packages, which I've run for the 2005, 2008, 2010, 2012, and 2015 versions (both x86 and x86_64).  I've also tried setting the owner of the folder to "Administrators" (as that is what most folders in Program Files are set to) without any luck.
Searching for this error code through Google and the Oculus site doesn't return anything useful.
What is causing this, and how do I fix it?

A: If you still have a copy of your old Redistributables folder, you might be fine.  Copy that, plus the Software folder into the Oculus installation folder, and restart Oculus Home.  The full instructions can be found here.
If you didn't back up that folder (or have since deleted it), you might be SOL, and will have to download those games again.

A: Create a new user with admin rights, then try again and it will work. This is  profile issue, while under new account go into old profile under Apps go into each folder and delete any folder titles oulus. Then sign into old profile, oculus setup will run again, but quickly, now open game.