Q: sql query takes too long to execute I am having trouble with this query. It takes 10 hours to execute.
    WITH CONSUM AS (
    SELECT C.ID_MEASURER,C.ID_MEASURING_POINT,C.CONSUM_TYPE
    FROM GCGT_RE_CONSUM_H_E C
    WHERE C.DAY BETWEEN 20130201    AND 20130228    AND ACTIVE = 1
    ),
    CORE AS (SELECT
            SS.NISS,
            CO.ID_CONTRACT,
            CO.FROM_DATE AS FECHA_INI_CONTRATO,
            SS.ID_DISTRIBUTER,
            SS.ID_SECTOR_SUPPLY,
            MP.CUPS,
            M.ID_COMBINATION_USAGE_TYPE,
            MP.MP_FUNCTION,
            NVL (MP.FLAG_TELEMETRY, 0) AS TELEMEDIDO,
            NVL (CTYP.RELEVANCE, 0) AS RELEVANT_CONSUM_TYPE,
            MP.ID_MEASURER,
            CTYP.COD_USAGE_TYPE AS CONSUM_TYPE,
            0 AS VALUE_1,
            0 AS VALUE_2,
            0 AS VALUE_3,
            0 AS VALUE_4,
            0 AS VALUE_5,
            0 AS VALUE_6,
            0 AS VALUE_7,
            0 AS VALUE_8,
            0 AS VALUE_9,
            0 AS VALUE_10,
            0 AS VALUE_11,
            0 AS VALUE_12,
            0 AS VALUE_13,
            0 AS VALUE_14,
            0 AS VALUE_15,
            0 AS VALUE_16,
            0 AS VALUE_17,
            0 AS VALUE_18,
            0 AS VALUE_19,
            0 AS VALUE_20,
            0 AS VALUE_21,
            0 AS VALUE_22,
            0 AS VALUE_23,
            0 AS VALUE_24,
            0 AS VALUE_25,
            '' AS SOURCE_1,
            '' AS SOURCE_2,
            '' AS SOURCE_3,
            '' AS SOURCE_4,
            '' AS SOURCE_5,
            '' AS SOURCE_6,
            '' AS SOURCE_7,
            '' AS SOURCE_8,
            '' AS SOURCE_9,
            '' AS SOURCE_10,
            '' AS SOURCE_11,
            '' AS SOURCE_12,
            '' AS SOURCE_13,
            '' AS SOURCE_14,
            '' AS SOURCE_15,
            '' AS SOURCE_16,
            '' AS SOURCE_17,
            '' AS SOURCE_18,
            '' AS SOURCE_19,
            '' AS SOURCE_20,
            '' AS SOURCE_21,
            '' AS SOURCE_22,
            '' AS SOURCE_23,
            '' AS SOURCE_24,
            '' AS SOURCE_25,
            0 AS QUALITY_1,
            0 AS QUALITY_2,
            0 AS QUALITY_3,
            0 AS QUALITY_4,
            0 AS QUALITY_5,
            0 AS QUALITY_6,
            0 AS QUALITY_7,
            0 AS QUALITY_8,
            0 AS QUALITY_9,
            0 AS QUALITY_10,
            0 AS QUALITY_11,
            0 AS QUALITY_12,
            0 AS QUALITY_13,
            0 AS QUALITY_14,
            0 AS QUALITY_15,
            0 AS QUALITY_16,
            0 AS QUALITY_17,
            0 AS QUALITY_18,
            0 AS QUALITY_19,
            0 AS QUALITY_20,
            0 AS QUALITY_21,
            0 AS QUALITY_22,
            0 AS QUALITY_23,
            0 AS QUALITY_24,
            0 AS QUALITY_25,
            20130228    AS DAY,
            TRUNC(20130228   ,-2) AS FIRST_DAY,
            TRUNC(20130228   ,-2) + 31 AS LAST_DAY,
            NVL (MTY.COD_USER, '') AS ORIGIN,
            SC.ID_CONTRACTED_SERVICE,
            0 AS BAJA,
            NVL(SC.IND_GUARANTOR, 0) AS GESTION_ATR,
            SC.NISC
            FROM GCGT_RE_MEASUREMENT_POINT MP
                    INNER JOIN GCCOM_SECTOR_SUPPLY SS ON MP.ID_SECTOR_SUPPLY = SS.ID_SECTOR_SUPPLY
                    INNER JOIN GCGT_ME_MEASURER M ON M.ID_MEASURER = MP.ID_MEASURER
                    INNER JOIN GCCOM_CONTRACTED_SERVICE SC ON SC.ID_SECTOR_SUPPLY = SS.ID_SECTOR_SUPPLY
                    INNER JOIN GCCOM_CONTRACT CO ON CO.ID_CONTRACT = SC.ID_CONTRACT
                    INNER JOIN GCGT_RE_MP_NATURE NAT ON NAT.ID_MP_NATURE = MP.ID_MP_NATURE
                    INNER JOIN GCGT_ME_MEA_CTYPE_HIST CTYP ON MP.ID_MEASURER = CTYP.ID_MEASURER
                    INNER JOIN GCGT_RE_MODE_TYPE MTY ON MTY.COD_DEVELOP = NAT.COD_MODO
            WHERE
                     1 = 1
                    AND  1 = 1
                    AND CTYP.FROM_DATE <= 20130228
                    AND (CTYP.TO_DATE IS NULL OR CTYP.TO_DATE >= 20130201 )
                    AND CTYP.COD_USAGE_TYPE  NOT IN  ('AEH', 'R1H', 'AEQ', 'R1Q')
                    AND MP.CUPS IS NOT NULL
                    AND SC.STATUS NOT IN ('ESTSC00004', 'ESTSC00005')
                    AND (SC.DROP_DATE is null or SC.DROP_DATE >= (TO_DATE(20130228   , 'YYYYMMDD')) )
                    /*and to_char(SC.FROM_DATE,'YYYYMM') <= SUBSTR (:P_INI_DATE, 1, 6) PMR */
                    AND SC.FROM_DATE <= LAST_DAY(TO_DATE(20130201   , 'YYYYMMDD'))
                    AND (CO.STATUS not in ('ESTCO00005','ESTCO00004') or (CO.END_DATE >= (TO_DATE (20130201   , 'YYYYMMDD')) and CO.STATUS = 'ESTCO00005' ) or (CO.DROP_DATE >= (TO_DATE (20130201   , 'YYYYMMDD')) and CO.STATUS = 'ESTCO00004'))
                    AND EXISTS
                              (SELECT UTM.ID_MEASURER
                                 FROM GCGT_ME_USAGE_TYPE_METER UTM
                                WHERE UTM.ID_MEASURER = MP.ID_MEASURER
                                  AND UTM.COD_USAGE_TYPE = CTYP.COD_USAGE_TYPE
                                )
                    AND NOT EXISTS(
                        SELECT 1
                        FROM CONSUM C
                        WHERE C.ID_MEASURER = MP.ID_MEASURER
                        AND C.ID_MEASURING_POINT = MP.ID_MEASURING_POINT
                        AND C.CONSUM_TYPE = CTYP.COD_USAGE_TYPE))
    SELECT
             CORE.NISS,
             CORE.ID_CONTRACT,
             '' AS MOT_BLOQ,
             CORE.FECHA_INI_CONTRATO,
             SUBSTR (CORE.DAY, 1, 6) AS PERIODO,
             EATT.FOREIGN_CONTRACT_NUMBER AS ATR_POLICY,
             COM.NAME_TYPE AS COD_DISTRIBUIDORA,
             --NVL (ROC.IND_CALC_ORDER, 0) AS IND_CALC_ORDER,
             (SELECT COUNT (1)
              FROM gccom_delivery_note dn
              WHERE dn.id_contracted_service = CORE.ID_CONTRACTED_SERVICE
                AND dn.delivery_note_status in ('BIDOCST001', 'BIDOCST003' )
                AND dn.ind_simulated = 0
                AND TO_CHAR (dn.forecast_billing_date, 'YYYYMM') >= SUBSTR (CORE.DAY, 1, 6)
                AND ROWNUM < 2)
             AS IND_CALC_ORDER,
             --NVL (ROC.IND_SENT_FACT, 0) AS IND_SENT_FACT,
             (SELECT COUNT (1)
              FROM gccom_delivery_note dn
              WHERE dn.id_contracted_service = CORE.ID_CONTRACTED_SERVICE
                AND dn.delivery_note_status = 'BIDOCST001'
                AND dn.ind_simulated = 0
                AND (dn.ind_not_billed = 0 or dn.ind_not_billed is null)
                AND TO_CHAR (dn.forecast_billing_date, 'YYYYMM') >= SUBSTR (CORE.DAY, 1, 6)
                AND ROWNUM < 2)
             AS IND_SENT_FACT,
             --NVL (ROC3.IND_SENT_FACT, 0) AS IND_SENT_FACT_ANT,
             (SELECT COUNT (1)
              FROM gccom_delivery_note dn
              WHERE dn.id_contracted_service = CORE.ID_CONTRACTED_SERVICE
                  AND dn.delivery_note_status = 'BIDOCST001'
                  AND dn.ind_simulated = 0
                  AND (dn.ind_not_billed = 0 or dn.ind_not_billed is null)
                  AND TO_CHAR(dn.forecast_billing_date, 'YYYYMM') = (select TO_CHAR(max(dn.forecast_billing_date),'YYYYMM')
                       FROM gccom_delivery_note dn
                       where dn.id_contracted_service = CORE.ID_CONTRACTED_SERVICE
                      and TO_CHAR(dn.forecast_billing_date, 'YYYYMM') < SUBSTR (CORE.DAY, 1, 6))
                  AND ROWNUM <2 )AS IND_SENT_FACT_ANT,
             CORE.CUPS,
             FAR.SHORT_NAME_TYPE AS TARIFA,
             CT.DESCRIPTION AS TIPO_CLIENTE,
             CORE.TELEMEDIDO,
             CORE.RELEVANT_CONSUM_TYPE,
             (
                SELECT COUNT (1)
                FROM GCGT_RE_READING_E RE
                WHERE RE.ID_MEASURER = CORE.ID_MEASURER
                     AND  RE.DAY BETWEEN CORE.FIRST_DAY AND CORE.LAST_DAY
             ) AS CLOSED,
             (
                SELECT COUNT (1)
                FROM GCGT_RE_MEASUREMENT_POINT  RRMP
                WHERE RRMP.ID_SECTOR_SUPPLY = CORE.ID_SECTOR_SUPPLY
             ) AS MULTIPLEPM,
             NVL(
                (
                    SELECT CGMV.NAME_TYPE
                    FROM GCCOM_LOST_HISTORY_SS GLH
                        INNER JOIN GCCOM_MASTER_VALUES CGMV ON GLH.COD_VALUE = CGMV.COD_VALUE
                    WHERE GLH.ID_SECTOR_SUPPLY = CORE.ID_SECTOR_SUPPLY
                        AND TO_DATE(CORE.DAY, 'YYYYMMDD') BETWEEN GLH.INIT_DATE AND GLH.END_DATE AND ROWNUM < 2
                ), '') AS ITC,
             CORE.CONSUM_TYPE,
             CORE.VALUE_1,
             CORE.VALUE_2,
             CORE.VALUE_3,
             CORE.VALUE_4,
             CORE.VALUE_5,
             CORE.VALUE_6,
             CORE.VALUE_7,
             CORE.VALUE_8,
             CORE.VALUE_9,
             CORE.VALUE_10,
             CORE.VALUE_11,
             CORE.VALUE_12,
             CORE.VALUE_13,
             CORE.VALUE_14,
             CORE.VALUE_15,
             CORE.VALUE_16,
             CORE.VALUE_17,
             CORE.VALUE_18,
             CORE.VALUE_19,
             CORE.VALUE_20,
             CORE.VALUE_21,
             CORE.VALUE_22,
             CORE.VALUE_23,
             CORE.VALUE_24,
             CORE.VALUE_25,
             CORE.SOURCE_1,
             CORE.SOURCE_2,
             CORE.SOURCE_3,
             CORE.SOURCE_4,
             CORE.SOURCE_5,
             CORE.SOURCE_6,
             CORE.SOURCE_7,
             CORE.SOURCE_8,
             CORE.SOURCE_9,
             CORE.SOURCE_10,
             CORE.SOURCE_11,
             CORE.SOURCE_12,
             CORE.SOURCE_13,
             CORE.SOURCE_14,
             CORE.SOURCE_15,
             CORE.SOURCE_16,
             CORE.SOURCE_17,
             CORE.SOURCE_18,
             CORE.SOURCE_19,
             CORE.SOURCE_20,
             CORE.SOURCE_21,
             CORE.SOURCE_22,
             CORE.SOURCE_23,
             CORE.SOURCE_24,
             CORE.SOURCE_25,
             CORE.QUALITY_1,
             CORE.QUALITY_2,
             CORE.QUALITY_3,
             CORE.QUALITY_4,
             CORE.QUALITY_5,
             CORE.QUALITY_6,
             CORE.QUALITY_7,
             CORE.QUALITY_8,
             CORE.QUALITY_9,
             CORE.QUALITY_10,
             CORE.QUALITY_11,
             CORE.QUALITY_12,
             CORE.QUALITY_13,
             CORE.QUALITY_14,
             CORE.QUALITY_15,
             CORE.QUALITY_16,
             CORE.QUALITY_17,
             CORE.QUALITY_18,
             CORE.QUALITY_19,
             CORE.QUALITY_20,
             CORE.QUALITY_21,
             CORE.QUALITY_22,
             CORE.QUALITY_23,
             CORE.QUALITY_24,
             CORE.QUALITY_25,
             CORE.DAY,
             ORI.DESCRIPTION AS ORIGIN,
             CORE.ID_CONTRACTED_SERVICE,
             CORE.BAJA,
             CORE.GESTION_ATR,
             NVL ((SELECT IND_COGENERATION
                   FROM GCCOM_CONTSERV_SPECIALTYPES SP
                   WHERE CORE.ID_CONTRACTED_SERVICE = SP.ID_CONTRACTED_SERVICE
                     AND (SP.END_DATE IS NULL OR SP.END_DATE >= TO_DATE (20130228   , 'YYYYMMDD'))
                     AND SP.INI_DATE <= TO_DATE (20130228   , 'YYYYMMDD')), 0) AS COGENERADOR,
             CORE.NISC
      FROM   CORE,
             GCGT_ELECTRIC_ATTRIBUTES EATT,
             GCCOM_COMPANY COM,
             GCGT_ME_RATE_METER RM,
             GCGT_ME_COMBINATION_USAGE_TYPE CUT,
             GCCOM_FARE FAR,
             GCGT_RE_MP_CUSTOMER_TYPE CT,
             GCGT_RE_ORIGIN ORI
    WHERE    EATT.ID_SECTOR_SUPPLY = CORE.ID_SECTOR_SUPPLY
             AND COM.ID_COMPANY = CORE.ID_DISTRIBUTER
             AND CUT.ID_COMBINATION_USAGE_TYPE (+) = CORE.ID_COMBINATION_USAGE_TYPE
             AND CUT.ID_RATE_METER = RM.ID_RATE_METER (+)
             AND FAR.ID_FARE (+) = RM.ID_FARE
             AND (CT.COD_DEVELOP = CORE.MP_FUNCTION or CORE.MP_FUNCTION is null)
             AND ORI.COD_DEVELOP = CORE.ORIGIN;

The explain plan shows like this:
    PLAN_TABLE_OUTPUT
    -------------------------------------------------------------------------------------------------------------------------------------------------------------
    Plan hash value: 398847285
    -------------------------------------------------------------------------------------------------------------------------------------------------
    | Id  | Operation                              | Name                           | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     | Pstart| Pstop |
    -------------------------------------------------------------------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT                       |                                |   186K|    63M|    |  1352K  (1)| 04:30:26 |  |       |
    |   1 |  SORT AGGREGATE                        |                                |     1 |    28 |    |       |          |       |       |
    |*  2 |   COUNT STOPKEY                        |                                |       |       |    |       |          |       |       |
    |   3 |    PARTITION RANGE ALL                 |                                |     2 |    56 |    |    75   (0)| 00:00:01 |     1 |   108 |
    |*  4 |     TABLE ACCESS BY LOCAL INDEX ROWID  | GCCOM_DELIVERY_NOTE            |     2 |    56 |    |    75   (0)| 00:00:01 |     1 |   108 |
    |*  5 |      INDEX RANGE SCAN                  | IDX_GCCOM_DELIVERY_NOTE_28     |    33 |       |    |    65   (0)| 00:00:01 |     1 |   108 |
    |   6 |  SORT AGGREGATE                        |                                |     1 |    30 |    |       |          |       |       |
    |*  7 |   COUNT STOPKEY                        |                                |       |       |    |       |          |       |       |
    |   8 |    PARTITION RANGE ALL                 |                                |     2 |    60 |    |    75   (0)| 00:00:01 |     1 |   108 |
    |*  9 |     TABLE ACCESS BY LOCAL INDEX ROWID  | GCCOM_DELIVERY_NOTE            |     2 |    60 |    |    75   (0)| 00:00:01 |     1 |   108 |
    |* 10 |      INDEX RANGE SCAN                  | IDX_GCCOM_DELIVERY_NOTE_28     |    33 |       |    |    65   (0)| 00:00:01 |     1 |   108 |
    |  11 |  SORT AGGREGATE                        |                                |     1 |    30 |    |       |          |       |       |
    |* 12 |   COUNT STOPKEY                        |                                |       |       |    |       |          |       |       |
    |* 13 |    FILTER                              |                                |       |       |    |       |          |       |       |
    |  14 |     PARTITION RANGE ALL                |                                |    32 |   960 |    |    75   (0)| 00:00:01 |     1 |   108 |
    |* 15 |      TABLE ACCESS BY LOCAL INDEX ROWID | GCCOM_DELIVERY_NOTE            |    32 |   960 |    |    75   (0)| 00:00:01 |     1 |   108 |
    |* 16 |       INDEX RANGE SCAN                 | IDX_GCCOM_DELIVERY_NOTE_28     |    33 |       |    |    65   (0)| 00:00:01 |     1 |   108 |
    |  17 |     SORT AGGREGATE                     |                                |     1 |    14 |    |       |          |       |       |
    |  18 |      PARTITION RANGE ALL               |                                |     2 |    28 |    |    75   (0)| 00:00:01 |     1 |   108 |
    |* 19 |       TABLE ACCESS BY LOCAL INDEX ROWID| GCCOM_DELIVERY_NOTE            |     2 |    28 |    |    75   (0)| 00:00:01 |     1 |   108 |
    |* 20 |        INDEX RANGE SCAN                | IDX_GCCOM_DELIVERY_NOTE_28     |    33 |       |    |    65   (0)| 00:00:01 |     1 |   108 |
    |  21 |  SORT AGGREGATE                        |                                |     1 |    12 |    |       |          |       |       |
    |* 22 |   INDEX RANGE SCAN                     | IDX_GCGT_RE_READING_E_16       |     1 |    12 |    |     1   (0)| 00:00:01 |  |       |
    |  23 |  SORT AGGREGATE                        |                                |     1 |     6 |    |       |          |       |       |
    |* 24 |   INDEX RANGE SCAN                     | IDX_GCGT_REMEASPOINT_SSMP_01   |     1 |     6 |    |     1   (0)| 00:00:01 |  |       |
    |* 25 |  COUNT STOPKEY                         |                                |       |       |    |       |          |       |       |
    |  26 |   NESTED LOOPS                         |                                |       |       |    |       |          |       |       |
    |  27 |    NESTED LOOPS                        |                                |     1 |    61 |    |     2   (0)| 00:00:01 |  |       |
    |* 28 |     TABLE ACCESS BY INDEX ROWID        | GCCOM_LOST_HISTORY_SS          |     1 |    30 |    |     1   (0)| 00:00:01 |  |       |
    |* 29 |      INDEX RANGE SCAN                  | IDX_GCCOMLOSTHISTORYSS_01      |     1 |       |    |     1   (0)| 00:00:01 |  |       |
    |* 30 |     INDEX UNIQUE SCAN                  | PK_GCCOM_MASTER_VALUES         |     1 |       |    |     1   (0)| 00:00:01 |  |       |
    |  31 |    TABLE ACCESS BY INDEX ROWID         | GCCOM_MASTER_VALUES            |     1 |    31 |    |     1   (0)| 00:00:01 |  |       |
    |* 32 |  TABLE ACCESS BY INDEX ROWID           | GCCOM_CONTSERV_SPECIALTYPES    |     1 |    24 |    |     1   (0)| 00:00:01 |  |       |
    |* 33 |   INDEX RANGE SCAN                     | IDX_GCCOMCONTSERVSPETYP_01     |     1 |       |    |     1   (0)| 00:00:01 |  |       |
    |* 34 |  FILTER                                |                                |       |       |    |       |          |       |       |
    |* 35 |   HASH JOIN                            |                                |   186K|    63M|    |   146K  (1)| 00:29:16 |  |       |
    |  36 |    TABLE ACCESS FULL                   | GCCOM_COMPANY                  |  1116 | 34596 |    |     9   (0)| 00:00:01 |  |       |
    |* 37 |    HASH JOIN                           |                                |   194K|    60M|    22M|   146K  (1)| 00:29:16 |       |       |
    |  38 |     PART JOIN FILTER CREATE            | :BF0000                        |   722K|    13M|    |  5316   (1)| 00:01:04 |  |       |
    |  39 |      PARTITION REFERENCE ALL           |                                |   722K|    13M|    |  5316   (1)| 00:01:04 |     1 |    10 |
    |  40 |       TABLE ACCESS FULL                | GCGT_ELECTRIC_ATTRIBUTES       |   722K|    13M|    |  5316   (1)| 00:01:04 |     1 |    10 |
    |* 41 |     HASH JOIN                          |                                |   207K|    61M|    |   136K  (1)| 00:27:21 |  |       |
    |  42 |      TABLE ACCESS FULL                 | GCGT_RE_ORIGIN                 |     3 |    42 |    |     3   (0)| 00:00:01 |  |       |
    |* 43 |      HASH JOIN                         |                                |   207K|    58M|    22M|   136K  (1)| 00:27:21 |       |       |
    |  44 |       PARTITION REFERENCE ALL          |                                |   486K|    17M|    |  4618   (1)| 00:00:56 |     1 |    10 |
    |* 45 |        TABLE ACCESS FULL               | GCCOM_CONTRACT                 |   486K|    17M|    |  4618   (1)| 00:00:56 |     1 |    10 |
    |* 46 |       HASH JOIN                        |                                |   207K|    50M|    19M|   128K  (1)| 00:25:41 |       |       |
    |  47 |        PART JOIN FILTER CREATE         | :BF0001                        |   286K|    16M|    |  7118   (1)| 00:01:26 |  |       |
    |  48 |         PARTITION HASH ALL             |                                |   286K|    16M|    |  7118   (1)| 00:01:26 |     1 |    16 |
    |* 49 |          TABLE ACCESS FULL             | GCCOM_CONTRACTED_SERVICE       |   286K|    16M|    |  7118   (1)| 00:01:26 |     1 |    16 |
    |* 50 |        HASH JOIN RIGHT OUTER           |                                |   559K|   104M|    |   114K  (1)| 00:22:57 |  |       |
    |  51 |         TABLE ACCESS FULL              | GCCOM_FARE                     |   374 |  3366 |    |     6   (0)| 00:00:01 |  |       |
    |* 52 |         HASH JOIN RIGHT OUTER          |                                |   559K|    99M|    |   114K  (1)| 00:22:57 |  |       |
    |  53 |          TABLE ACCESS FULL             | GCGT_ME_RATE_METER             |    59 |   590 |    |     3   (0)| 00:00:01 |  |       |
    |  54 |          NESTED LOOPS SEMI             |                                |   559K|    94M|    |   114K  (1)| 00:22:57 |  |       |
    |* 55 |           HASH JOIN                    |                                |   559K|    89M|    74M|   114K  (1)| 00:22:57 |       |       |
    |* 56 |            TABLE ACCESS FULL           | GCGT_ME_MEA_CTYPE_HIST         |  2115K|    50M|    | 50950   (1)| 00:10:12 |  |       |
    |* 57 |            HASH JOIN RIGHT OUTER       |                                |   521K|    70M|    | 56226   (1)| 00:11:15 |  |       |
    |  58 |             TABLE ACCESS FULL          | GCGT_ME_COMBINATION_USAGE_TYPE |   378 |  3024 |    |     4   (0)| 00:00:01 |  |       |
    |* 59 |             HASH JOIN                  |                                |   521K|    66M|    67M| 56219   (1)| 00:11:15 |       |       |
    |* 60 |              HASH JOIN                 |                                |   521K|    61M|    25M| 18543   (1)| 00:03:43 |       |       |
    |  61 |               PARTITION HASH AND       |                                |   771K|    16M|    |  8246   (1)| 00:01:39 |KEY(AP)|KEY(AP)|
    |  62 |                TABLE ACCESS FULL       | GCCOM_SECTOR_SUPPLY            |   771K|    16M|    |  8246   (1)| 00:01:39 |KEY(AP)|KEY(AP)|
    |* 63 |               HASH JOIN                |                                |   521K|    50M|    |  6235   (1)| 00:01:15 |  |       |
    |* 64 |                HASH JOIN               |                                |   260 | 11440 |    |    15   (7)| 00:00:01 |  |       |
    |  65 |                 MERGE JOIN CARTESIAN   |                                |    15 |   435 |    |    12   (0)| 00:00:01 |  |       |
    |  66 |                  TABLE ACCESS FULL     | GCGT_RE_MP_CUSTOMER_TYPE       |     5 |    70 |    |     3   (0)| 00:00:01 |  |       |
    |  67 |                  BUFFER SORT           |                                |     3 |    45 |    |     9   (0)| 00:00:01 |  |       |
    |  68 |                   TABLE ACCESS FULL    | GCGT_RE_MODE_TYPE              |     3 |    45 |    |     2   (0)| 00:00:01 |  |       |
    |  69 |                 VIEW                   | index$_join$_011               |    52 |   780 |    |     3  (34)| 00:00:01 |  |       |
    |* 70 |                  HASH JOIN             |                                |       |       |    |       |          |       |       |
    |  71 |                   INDEX FAST FULL SCAN | FK_RE_MP_NATUR_RE_MODE_TYPE_01 |    52 |   780 |    |     1   (0)| 00:00:01 |  |       |
    |  72 |                   INDEX FAST FULL SCAN | PK_GCGT_RE_MP_NATURE           |    52 |   780 |    |     1   (0)| 00:00:01 |  |       |
    |* 73 |                TABLE ACCESS FULL       | GCGT_RE_MEASUREMENT_POINT      |   454K|    25M|    |  6210   (1)| 00:01:15 |  |       |
    |  74 |              TABLE ACCESS FULL         | GCGT_ME_MEASURER               |  7195K|    68M|    | 26770   (1)| 00:05:22 |  |       |
    |* 75 |           INDEX UNIQUE SCAN            | IDX_GCGTMEUSAGETYPEMETER_08    |    10M|    96M|    |     1   (0)| 00:00:01 |  |       |
    |* 76 |   TABLE ACCESS BY GLOBAL INDEX ROWID   | GCGT_RE_CONSUM_H_E             |     1 |    25 |    |     7   (0)| 00:00:01 |    87 |    87 |
    |* 77 |    INDEX RANGE SCAN                    | IDX_GCGTRECONSUMHE02           |     1 |       |    |     1   (0)| 00:00:01 |  |       |
    -------------------------------------------------------------------------------------------------------------------------------------------------
    147 filas seleccionadas.

I tried with the indexes :
index IDX_GCCOM_DELIVERY_NOTE_30
on GCCOM_DELIVERY_NOTE("ID_CONTRACTED_SERVICE",TO_CHAR("FORECAST_BILLING_DATE",'YYYYMM'))
index IDX_GCCOM_DELIVERY_NOTE_31
on GCCOM_DELIVERY_NOTE("ID_CONTRACTED_SERVICE","DELIVERY_NOTE_STATUS","IND_SIMULATED",TO_CHAR("FORECAST_BILLING_DATE",'YYYYMM'));
index IDX_GCCOMLOSTHISTORYSS_02
on GCCOM_LOST_HISTORY_SS("ID_SECTOR_SUPPLY","END_DATE","COD_VALUE");
but the explain plan do not show great improvement:
    PLAN_TABLE_OUTPUT
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Plan hash value: 2244861761
    --------------------------------------------------------------------------------------------------------------------------------------------------
    | Id  | Operation                               | Name                           | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     | Pstart| Pstop |
    --------------------------------------------------------------------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT                        |                                |   186K|    63M|    |  1352K  (1)| 04:30:26 |  |       |
    |   1 |  SORT AGGREGATE                         |                                |     1 |    25 |    |       |          |       |       |
    |*  2 |   COUNT STOPKEY                         |                                |       |       |    |       |          |       |       |
    |   3 |    INLIST ITERATOR                      |                                |       |       |    |       |          |       |       |
    |*  4 |     INDEX RANGE SCAN                    | IDX_GCCOM_DELIVERY_NOTE_31     |     2 |    50 |    |     1   (0)| 00:00:01 |  |       |
    |   5 |  SORT AGGREGATE                         |                                |     1 |    27 |    |       |          |       |       |
    |*  6 |   COUNT STOPKEY                         |                                |       |       |    |       |          |       |       |
    |*  7 |    TABLE ACCESS BY GLOBAL INDEX ROWID   | GCCOM_DELIVERY_NOTE            |     2 |    54 |    |     1   (0)| 00:00:01 | ROWID | ROWID |
    |*  8 |     INDEX RANGE SCAN                    | IDX_GCCOM_DELIVERY_NOTE_30     |     1 |       |    |     1   (0)| 00:00:01 |  |       |
    |   9 |  SORT AGGREGATE                         |                                |     1 |    27 |    |       |          |       |       |
    |* 10 |   COUNT STOPKEY                         |                                |       |       |    |       |          |       |       |
    |* 11 |    TABLE ACCESS BY GLOBAL INDEX ROWID   | GCCOM_DELIVERY_NOTE            |     1 |    27 |    |     1   (0)| 00:00:01 | ROWID | ROWID |
    |* 12 |     INDEX RANGE SCAN                    | IDX_GCCOM_DELIVERY_NOTE_30     |     1 |       |    |     1   (0)| 00:00:01 |  |       |
    |  13 |      SORT AGGREGATE                     |                                |     1 |    19 |    |       |          |       |       |
    |  14 |       TABLE ACCESS BY GLOBAL INDEX ROWID| GCCOM_DELIVERY_NOTE            |     2 |    38 |    |     1   (0)| 00:00:01 | ROWID | ROWID |
    |* 15 |        INDEX RANGE SCAN                 | IDX_GCCOM_DELIVERY_NOTE_30     |     1 |       |    |     1   (0)| 00:00:01 |  |       |
    |  16 |  SORT AGGREGATE                         |                                |     1 |    12 |    |       |          |       |       |
    |* 17 |   INDEX RANGE SCAN                      | IDX_GCGT_RE_READING_E_16       |     1 |    12 |    |     1   (0)| 00:00:01 |  |       |
    |  18 |  SORT AGGREGATE                         |                                |     1 |     6 |    |       |          |       |       |
    |* 19 |   INDEX RANGE SCAN                      | IDX_GCGT_REMEASPOINT_SSMP_01   |     1 |     6 |    |     1   (0)| 00:00:01 |  |       |
    |* 20 |  COUNT STOPKEY                          |                                |       |       |    |       |          |       |       |
    |  21 |   NESTED LOOPS                          |                                |       |       |    |       |          |       |       |
    |  22 |    NESTED LOOPS                         |                                |     1 |    61 |    |     2   (0)| 00:00:01 |  |       |
    |* 23 |     TABLE ACCESS BY INDEX ROWID         | GCCOM_LOST_HISTORY_SS          |     1 |    30 |    |     1   (0)| 00:00:01 |  |       |
    |* 24 |      INDEX RANGE SCAN                   | IDX_GCCOMLOSTHISTORYSS_02      |     1 |       |    |     1   (0)| 00:00:01 |  |       |
    |* 25 |     INDEX UNIQUE SCAN                   | PK_GCCOM_MASTER_VALUES         |     1 |       |    |     1   (0)| 00:00:01 |  |       |
    |  26 |    TABLE ACCESS BY INDEX ROWID          | GCCOM_MASTER_VALUES            |     1 |    31 |    |     1   (0)| 00:00:01 |  |       |
    |* 27 |  TABLE ACCESS BY INDEX ROWID            | GCCOM_CONTSERV_SPECIALTYPES    |     1 |    24 |    |     1   (0)| 00:00:01 |  |       |
    |* 28 |   INDEX RANGE SCAN                      | IDX_GCCOMCONTSERVSPETYP_01     |     1 |       |    |     1   (0)| 00:00:01 |  |       |
    |* 29 |  FILTER                                 |

I am comparing the explain plans before and after applying indexes.
I see some changes in Access paths, but the overall result is the same.
So has the query any improvement ?
Those are the TABLE ACCESS FULL, Do I have to créate indexes on them ?
        Line 43:        |  36 |    TABLE ACCESS FULL                   | GCCOM_COMPANY                  |  1116 | 34596 |    |     9   (0)| 00:00:01 |  |       |
        Line 47:        |  40 |       TABLE ACCESS FULL                | GCGT_ELECTRIC_ATTRIBUTES       |   722K|    13M|    |  5316   (1)| 00:01:04 |     1 |    10 |
        Line 49:        |  42 |      TABLE ACCESS FULL                 | GCGT_RE_ORIGIN                 |     3 |    42 |    |     3   (0)| 00:00:01 |  |       |
        Line 52:        |* 45 |        TABLE ACCESS FULL               | GCCOM_CONTRACT                 |   486K|    17M|    |  4618   (1)| 00:00:56 |     1 |    10 |
        Line 56:        |* 49 |          TABLE ACCESS FULL             | GCCOM_CONTRACTED_SERVICE       |   286K|    16M|    |  7118   (1)| 00:01:26 |     1 |    16 |
        Line 58:        |  51 |         TABLE ACCESS FULL              | GCCOM_FARE                     |   374 |  3366 |    |     6   (0)| 00:00:01 |  |       |
        Line 60:        |  53 |          TABLE ACCESS FULL             | GCGT_ME_RATE_METER             |    59 |   590 |    |     3   (0)| 00:00:01 |  |       |
        Line 63:        |* 56 |            TABLE ACCESS FULL           | GCGT_ME_MEA_CTYPE_HIST         |  2115K|    50M|    | 50950   (1)| 00:10:12 |  |       |
        Line 65:        |  58 |             TABLE ACCESS FULL          | GCGT_ME_COMBINATION_USAGE_TYPE |   378 |  3024 |    |     4   (0)| 00:00:01 |  |       |
        Line 69:        |  62 |                TABLE ACCESS FULL       | GCCOM_SECTOR_SUPPLY            |   771K|    16M|    |  8246   (1)| 00:01:39 |KEY(AP)|KEY(AP)|
        Line 73:        |  66 |                  TABLE ACCESS FULL     | GCGT_RE_MP_CUSTOMER_TYPE       |     5 |    70 |    |     3   (0)| 00:00:01 |  |       |
        Line 75:        |  68 |                   TABLE ACCESS FULL    | GCGT_RE_MODE_TYPE              |     3 |    45 |    |     2   (0)| 00:00:01 |  |       |
        Line 80:        |* 73 |                TABLE ACCESS FULL       | GCGT_RE_MEASUREMENT_POINT      |   454K|    25M|    |  6210   (1)| 00:01:15 |  |       |
        Line 81:        |  74 |              TABLE ACCESS FULL         | GCGT_ME_MEASURER               |  7195K|    68M|    | 26770   (1)| 00:05:22 |  |       |

I did not took into account to execute the query with GATHER_TABLE_STATS's hint, let me try !!
I come back with the results !!


Q: how to manage file for import in Python? I want to get a common library from several files.
In order to reduce the amount of code, I want to create and manage a separate file for import.
Will it be possible?
import_lib.py
from django.shortcuts import render, get_object_or_404

other_1.py
import import_lib

render()
get_object_or_404()

other_2.py
import import_lib

render()
get_object_or_404()

A: Don't try to hide the imports needed in your module in another module - it'll make your code harder to read. And good editors will allow you to collapse the import section if it gets in the way of editing. There's ways of doing this, but they'll make your code harder to understand and it'll increase the odds of errors that are hard to figure out for yourself.
Having said that - this is how it can be done, if for some reason you know better, or actually have that rare use case where it makes sense:
import_lib.py
from django.shortcuts import render, get_object_or_404

other.py
from import_lib.py import *  # a rare case where a * import actually makes sense

Since * imports everything and makes it part of the name space of the module doing the importing, you get exactly what you need.
If you feel your use case does warrant this, at least consider a name for the imported module that's a bit more descriptive, like django_imports.py, or whatever the logical grouping for the imports in that file is.


Q: Paypal Callback url for android Am calling PayPal Here APpp from my application using the following url
"paypalhere://takePayment/?returnUrl={{returnUrl}}&invoice=%7B%22merchantEmail%22%3A%22%22,%22payerEmail%22%3A%22spotireddy-biz%40paypal.com%22,%22itemList%22%3A%7B%22item%22%3A%5B%7B%22name%22%3A%22{{name}}%22,%22description%22%3A%22{{description}}%22,%22quantity%22%3A%221.0%22,%22unitPrice%22%3A%22{{price}}%22,%22taxName%22%3A%22Tax%22,%22taxRate%22%3A%220.0%22%7D%5D%7D,%22currencyCode%22%3A%22{{currency}}%22,%22paymentTerms%22%3A%22DueOnReceipt%22,%22discountPercent%22%3A%220.0%22%7D";

Any idea how to replace the merchantEmail and payerEmail from this url

A: fixed.. :)
here s the code
"paypalhere://takePayment/?returnUrl={{returnUrl}}&invoice=%7B%22merchantEmail%22%3A%22{{merchantEmails}}%22,%22payerEmail%22%3A%22{{payerEmails}}%22,%22itemList%22%3A%7B%22item%22%3A%5B%7B%22name%22%3A%22{{name}}%22,%22description%22%3A%22{{description}}%22,%22quantity%22%3A%221.0%22,%22unitPrice%22%3A%22{{price}}%22,%22taxName%22%3A%22Tax%22,%22taxRate%22%3A%220.0%22%7D%5D%7D,%22currencyCode%22%3A%22{{currency}}%22,%22paymentTerms%22%3A%22DueOnReceipt%22,%22discountPercent%22%3A%220.0%22%7D"

url = url.replace("{{merchantEmails}}", "merchantEmails@merchantEmails.com");
          url = url.replace("{{payerEmails}}", "test@tesma.com");
         url = url.replace("{{price}}", "1");
         url = url.replace("{{name}}", Title);
         url = url.replace("{{description}}", "Title");
         url = url.replace("{{currency}}", "currencyType");


Q: Алгоритм формирования jar файла В jar файле есть папка META-INF/services. Вопрос кто и как туда вносит информацию?
Сейчас у меня при сборке одного и того-же проекта при помощи maven и IDEA в нескольких файлах из этой папки оказывается различная информация. В результате проект собранный maven у меня не работает.
maven собирается плагином maven-shade-plugin
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-shade-plugin</artifactId>
    <version>3.2.4</version>
    <configuration>
        <transformers>
            <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                <mainClass>org.example.Loader</mainClass>
                <manifestEntries>
                    <Multi-Release>true</Multi-Release>
                </manifestEntries>
            </transformer>
        </transformers>
    </configuration>
    <executions>
        <execution>
            <id>make-assembly</id>
            <phase>package</phase>
            <goals>
                <goal>shade</goal>
            </goals>
        </execution>
    </executions>
</plugin>

A: Плагин maven-shade-plugin по умолчанию помещает в итоговый jar первый попавшийся файл из META-INF/services зависимых модулей. Но если плагину указать трансформер org.apache.maven.plugins.shade.resource.ServicesResourceTransformer
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-shade-plugin</artifactId>
    <version>3.2.4</version>
    <configuration>
        <transformers>
            <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                <mainClass>org.example.Loader</mainClass>
                <manifestEntries>
                    <Multi-Release>true</Multi-Release>
                </manifestEntries>
            </transformer>
            <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
        </transformers>
    </configuration>
    <executions>
        <execution>
            <id>make-assembly</id>
            <phase>package</phase>
            <goals>
                <goal>shade</goal>
            </goals>
        </execution>
    </executions>
</plugin>

то тогда при обнаружении в зависимых модулях в папке META-INF/services файлов с одинаковым именем, в конечном jar эти все файлы будут объединены.


Q: how to efficiently decode h264 encoded rtsp stream and use it to opencv-python at 30 FPS I'm just doing yolo object detection with opencv code snippet:
cap = cv2.VideoCapture("rtsp://admin:asv@123@192.168.1.24:554/main?tcp", cv2.CAP_FFMPEG)
show = True
while show:

    ref, img = cap.read()
    img = cv2.resize(img, (1024, 720))
    img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
    res = model(img)

so, this is a normal code snippet for yolo object detection with opencv and torch
It's working good on with USB webcam, video files etc.
But with the RTSP stream and h264/h265 codec the cv2.VideoCapture() cannot decode it efficiently(at 30 FPS). But if it's on 6 FPS,it can. But I need to do it on 30 FPS.
I saw some documentation, i.e. opencv VideoCapture officially doesn't support h264/h265 codec. so is there any way to decode h264 encoded stream efficiently at 30 FPS in python and the use it to opencv and object detection?
Thanks.


Q: Simple Chechlist PHP Application Help needed I am building a simple PHP checklist application which takes sentences as input which are stored in MYSQL database then the list is echoed out with remove buttons in front of each list item such as:

*

*1) Do breakfast  [remove button]

*2) Go to College [remove button]

*3) Eat Lunch     [remove button]

*4) Get back Home [remove button]

Now what would be function that will be executed to remove the current list item being removed.
Here is how I am retrieving the list from database and their corresponding remove buttons:
$sql2 = "SELECT * FROM `info` LIMIT 0, 30 ";
$arr = mysql_query($sql2);
while($data = mysql_fetch_array($arr)){

echo ''.$data['id'].')'.' '.$data['text'].'<form action="list.php" method="POST">
<input type="submit" value="Remove" />
</form>'.'
';

Please help me how can we approach to a situation like this.
P.S The database has two columns only "ID" and the "List item"

A: You can use < input type='hidden' name='data' value="<?php echo $data[text]; ?>" > in the form
Finally, you can put this block to remove.
if(isset($_POST['submit']) {
    $query = "delete from info where text = '$_POST[data]'";
    //run the query here
}

A: What is it that you want particularly?
Do you mean you want the application to get check box elements and store them in the database.
Then get that data and apply to each a delete command?
be specific my friend and we can help.


Q: If $T$ is compact and self-adjoint then $S^3=T$ for some $S$ compact and self-adjoint I have this exercise:

Let $T$ a self-adjoint and compact operator in a Hilbert space. Show that there is some compact and self-adjoint operator $S$ such that $S^3=T$.

I have finished this exercise, however the part where I show that $S$ is compact seems longer than expected. I guess that probably will be a shorter way to show the same.
If $T$ is compact and self-adjoint in a Hilbert space $V$ then I know that
$$
Tf=\sum_{k\geqslant 0}\alpha _k \langle f,e_k \rangle e_k,\quad f\in V\tag1
$$
for some orthonormal sequence $(e_n)$ and some real-valued null sequence $(\alpha _n)$. Then its easy to see that setting
$$
Sf:=\sum_{k\geqslant 0}\sqrt[3]{\alpha _k}\langle f,e_k \rangle e_k,\quad f\in V\tag2
$$
then $S^3=T$ and $S$ is self-adjoint by a known result. Now what follows is the part that seems longer than expected:
If we order the sequence $(e_k)$ that defines $T$ such that $|\alpha _k|\geqslant |\alpha _{k+1}|$ for all $k\in \Bbb N $ then its easy to see that $\|T\|=|\alpha _0|$, and so $\|S\|=|\sqrt[3]{\alpha _0}|$. Then define $P_n$ as the orthogonal projection in the space $U_n:=\operatorname{span}(\{e_k:0\leqslant k\leqslant n\})$. Then $(P_nS)$ is a sequence of compact operators, and its immediate to see that $\|S-P_nS\|=|\sqrt[3]{\alpha _{n+1}}|$, and because $(\alpha _n)$ is a null sequence then $(P_nS)\to S$ and so $S$ is compact.

My question: there is a different way than what I did (maybe simpler or shorter) to show that $S$ must be compact?

A: You need not compute the norms of the operators explicitly due the following:
Lemma
If $(e_n)$ is orthonormal, $a_n \to 0$ and $Sf=\sum a_k\langle f , e_k \rangle e_k$ then $S$ is compact.
Proof: Let $S_Nf=\sum_{k=1}^{N} a_k\langle f , e_k \rangle e_k$. Then $\|Sf-S_Nf\|^{2}= \sum_{k=N+1}^{\infty} |a_k|^{2} |\langle f , e_k \rangle|^{2} \leq b_N \|f\|^{2}$ where $b_N= \sup \{|a_k|^{2}: k>N\}$. Hence the finite rank operators $S_N$ converge to $S$ in operator norm. This makes $S$ compact.


Q: Is there a onselect event for non-form elements? Say I want to hide a span when the user highlights a bit of text containing that span, with the intention of copying that text on to his clipboard.
For example:

The dragon a large, mythical beast belched
fire at St. George.

I have found that in Firefox Mac, span.tooltip will disappear from view (in accordance with my CSS declarations) but will show up in the clipboard when it's copied there. I figured (wrongly?) that if I said "onHighlight, hide tooltip," maybe this wouldn't happen.

A: Though it may be more complicated, why not just have an onmousedown event on the
 element, and thet event will then attach an onmousemove event and onmouseout event, so that if there is a mouse movement, while the button is down, then remove the class on the span elements, and once the user exits, the element then you can put them back.
It may be a bit tricky, and you may want to also look for key presses, or determine other times you want to know when to put back the css classes, but this would be one option, I believe.

A: It sounds like you need to go one step further and on highlight, remove the  and save a reference to it.  Once the highlight is finished, re-insert the reference to the object.
 // copy start detected
 var savedTooltip = $('.tooltip').remove();

 // later that day when copy finished
 $('p').append(savedTooltip);

If position of the  in your markup is important, you'd have to create a temporary reference element so you'd know where to re-insert it in the DOM.


Q: How do I draw a triangle? I know how to draw a rectangle and circles and ect with g.drawRect or g.drawOval. But there is no g.drawtriangle. Is there a way to draw a triangle with out me having to draw it out each side of the triangle?

A: You may use Graphics.drawPolygon(int[], int[], int) where the first int[] is the set of x values, the second int[] is the set of y values, and the int is the length of the array. (In a triangle's case, the int is going to be 3)
Example:
graphics.drawPolygon(new int[] {10, 20, 30}, new int[] {100, 20, 100}, 3);

Output:

A: I would use a Path2D object, and would place my first point with its moveTo(...) method, and then add additional points with its lineTo(...) method. Then I could draw it or fill it via Graphics2D#draw(...) and Graphics2D#fill(...). Also calling closePath() on it will make sure that your triangle closes appropriately.
For example, the following code produces:

import java.awt.Color;
import java.awt.Dimension;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Paint;
import java.awt.RenderingHints;
import java.awt.geom.Path2D;
import javax.swing.*;

public class Path2DExample extends JPanel {
   private static final int PREF_W = 600;
   private static final int PREF_H = PREF_W;
   private static final Color COLOR_1 = Color.blue;
   private static final Color COLOR_2 = Color.red;
   private static final Paint GRADIENT_PAINT = new GradientPaint(0, 0, COLOR_1, 20, 20, COLOR_2, true);
   private Path2D myPath = new Path2D.Double();

   public Path2DExample() {
      double firstX = (PREF_W / 2.0) * (1 - 1 / Math.sqrt(3));
      double firstY = 3.0 * PREF_H / 4.0;

      myPath.moveTo(firstX, firstY);
      myPath.lineTo(PREF_W - firstX, firstY);
      myPath.lineTo(PREF_W / 2.0, PREF_H / 4.0);
      myPath.closePath();
   }

   @Override
   protected void paintComponent(Graphics g) {
      super.paintComponent(g);
      Graphics2D g2 = (Graphics2D) g;

      // to smooth out the jaggies
      g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
            RenderingHints.VALUE_ANTIALIAS_ON);
      g2.setPaint(GRADIENT_PAINT);  // just for fun!
      g2.fill(myPath);  // fill my triangle
   }

   @Override
   public Dimension getPreferredSize() {
      if (isPreferredSizeSet()) {
         return super.getPreferredSize();
      }
      return new Dimension(PREF_W, PREF_H);
   }

   private static void createAndShowGui() {
      Path2DExample mainPanel = new Path2DExample();

      JFrame frame = new JFrame("Path2DExample");
      frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
      frame.getContentPane().add(mainPanel);
      frame.pack();
      frame.setLocationByPlatform(true);
      frame.setVisible(true);
   }

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

An  additional benefit to use of a Path2D object is that if you want to drag the Shape, it's not hard to do with a MouseListener and MouseMotionListener, say something like:
private class MyMouseAdapter extends MouseAdapter {
  private Point pPressed = null;

  @Override
  public void mousePressed(MouseEvent e) {
     if (e.getButton() != MouseEvent.BUTTON1) {
        return;
     }
     if (myPath.contains(e.getPoint())) {
        pPressed = e.getPoint();
     }
  }

  public void mouseDragged(MouseEvent e) {
     drag(e);
  }

  @Override
  public void mouseReleased(MouseEvent e) {
     drag(e);
     pPressed = null;
  }

  private void drag(MouseEvent e) {
     if (pPressed == null) {
        return;
     }
     Point p = e.getPoint();
     int tx = p.x - pPressed.x;
     int ty = p.y - pPressed.y;
     AffineTransform at = AffineTransform.getTranslateInstance(tx, ty);
     myPath.transform(at);
     pPressed = p;
     repaint();
  };

}

The whole thing could look like:
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Paint;
import java.awt.Point;
import java.awt.RenderingHints;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.geom.AffineTransform;
import java.awt.geom.Path2D;
import javax.swing.*;

@SuppressWarnings("serial")
public class Path2DExample extends JPanel {
   private static final int PREF_W = 600;
   private static final int PREF_H = PREF_W;
   private static final Color COLOR_1 = Color.blue;
   private static final Color COLOR_2 = Color.red;
   private static final Paint GRADIENT_PAINT = new GradientPaint(0, 0, COLOR_1,
         20, 20, COLOR_2, true);
   private Path2D myPath = new Path2D.Double();

   public Path2DExample() {
      double firstX = (PREF_W / 2.0) * (1 - 1 / Math.sqrt(3));
      double firstY = 3.0 * PREF_H / 4.0;

      myPath.moveTo(firstX, firstY);
      myPath.lineTo(PREF_W - firstX, firstY);
      myPath.lineTo(PREF_W / 2.0, PREF_H / 4.0);
      myPath.closePath();

      MyMouseAdapter myMouseAdapter = new MyMouseAdapter();
      addMouseListener(myMouseAdapter);
      addMouseMotionListener(myMouseAdapter);
   }

   @Override
   protected void paintComponent(Graphics g) {
      super.paintComponent(g);
      Graphics2D g2 = (Graphics2D) g;
      g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
            RenderingHints.VALUE_ANTIALIAS_ON);
      g2.setPaint(GRADIENT_PAINT);
      g2.fill(myPath);
   }

   @Override
   public Dimension getPreferredSize() {
      if (isPreferredSizeSet()) {
         return super.getPreferredSize();
      }
      return new Dimension(PREF_W, PREF_H);
   }

   private class MyMouseAdapter extends MouseAdapter {
      private Point pPressed = null;

      @Override
      public void mousePressed(MouseEvent e) {
         if (e.getButton() != MouseEvent.BUTTON1) {
            return;
         }
         if (myPath.contains(e.getPoint())) {
            pPressed = e.getPoint();
         }
      }

      public void mouseDragged(MouseEvent e) {
         drag(e);
      }

      @Override
      public void mouseReleased(MouseEvent e) {
         drag(e);
         pPressed = null;
      }

      private void drag(MouseEvent e) {
         if (pPressed == null) {
            return;
         }
         Point p = e.getPoint();
         int tx = p.x - pPressed.x;
         int ty = p.y - pPressed.y;
         AffineTransform at = AffineTransform.getTranslateInstance(tx, ty);
         myPath.transform(at);
         pPressed = p;
         repaint();
      };

   }

   private static void createAndShowGui() {
      Path2DExample mainPanel = new Path2DExample();

      JFrame frame = new JFrame("Path2DExample");
      frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
      frame.getContentPane().add(mainPanel);
      frame.pack();
      frame.setLocationByPlatform(true);
      frame.setVisible(true);
   }

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


Q: limit the max value for an input in haml I'm pretty new in coding with RoR and I'm using Haml, and since I'm doing a school project I decided to give it a try. The thing is that I encountered an issue. There's an attribute in my object producto, req_quantity which is the quantity of a certain product a client requested. In my views, I have an input box for the admin to authorize the quantity the client requested
.col-xs-2
  .text-center
     = product.input :auth_quantity, label: false, required: "required"

I'd like to limit :auth_quantity to be less or equal to req_quantity since currently is allowing values greater than req_quantity.
This is my first question since I googled and I don't seem to find the answer.

A: This is how I'd do it in haml:
.col-xs-2
  .text-center
     = product.input :auth_quantity, type: "number", max: "<%= producto.req_quantity  %>" label: false, required: "required"

Where producto.req_quantity is the numerical value of the quantity of a certain product a client requested.

A: So I basically solved it like this. Thanks for the answer, made me think a lot!!
.col-xs-2
  .text-center
     = producto.input :auth_quantity, input_html: { min: '0', max: product.object.req_quantity, step: 'any' }, label: false, required: "required"


Q: Lettrine number overlapping with texts Here i having an issue with the lettrine number with texts as it goes in overlapping , ussually the number 150 and the starting text should maintained by some distance, but here it goes on overlapping without maintaining the separation distance, here i am using parallel package to typeset the translation one language into english parallel, so here i used the parallel package, here left column is in another language(i.e Karbi), on right column is in English, Here is my MWE
 \documentclass[twoside,letterpaper]{book}
 \usepackage[margin=1.5cm]{geometry}
 \usepackage{hyphenat}
 \usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
 \usepackage{lettrine}
 \usepackage{fancyhdr}
 %\usepackage{fixltx2e}

 \usepackage[perpage]{footmisc} %%% To restart footnote numbering on every new pages

 \newcommand{\jLChapter}[1]{\par\bigskip\lettrine{{\textcolor{red}{#1}}}{}\markboth{\chaplabel\ #1:1}{\chaplabel\ #1:1}\renewcommand{\jnumChapters}{#1}}

 \newcommand{\jverseFormat}[1]{#1}
 \newcommand{\jChapterNumFormat}[1]{\textcolor{cyan}{\textbf{#1}}}

 \newcommand{\jverse}[3]{\noindent{\jChapterNumFormat{#1}\markboth{\chaplabel\ \jnumChapters :#1}{\chaplabel\ \jnumChapters :#1}} #2{\jverseFormat{#3}}\par\smallskip\renewcommand{\jnumVerses}{#1}}

 \newcommand{\jBracketWord}[1]{\emph{#1}}

 \newcommand{\jParaSymbol}[0]{{}}

 \setlength{\columnseprule}{0.0pt}

 \pagestyle{fancy}
 \fancyhf{}
 \fancyhead[RO]{\leftmark}
 \fancyhead[LE]{\rightmark}
 \renewcommand{\headrulewidth}{0pt}
 \setlength{\headwidth}{\textwidth}
 \addtolength{\headwidth}{\marginparsep}
 \addtolength{\headwidth}{\marginparwidth}

 \newcommand{\chaplabel}{}
 \newcommand{\jnumChapters}{0}
 \newcommand{\jnumVerses}{0}
 \usepackage{parallel}

  \newcommand \prelude[1] {\makebox[9.4cm][l]{#1}}

 \newcommand{\jRChapter}[1]{\lettrine[ante={\prelude{}}]{\textcolor{red}{#1}}{}}

 \usepackage{titlesec}

 \titleformat{\chapter}
     {\normalfont\Huge\bfseries}
     {}
     {0pt}
     {}

 \titlespacing*{\chapter}{0pt}{*11.5}{*8}

 \renewcommand{\chaptermark}[1]{\markright{\MakeUppercase{#1}}}

 \usepackage[colorlinks]{hyperref}

 \begin{document}
 \renewcommand{\thefootnote}{\emph{\alph{footnote}}}
 \frontmatter

 \title{The Holy Bible}
 \date{}
 \author{}
 \setlength{\columnseprule}{0pt}
 \maketitle
 %\renewcommand*\contentsname{The Old Testament}
 \tableofcontents
 \mainmatter
 \pagenumbering{gobble}

 \part*{The Old Testament}
 \setlength{\columnseprule}{0.0pt}
 \renewcommand{\jnumChapters}{0}
 \pagenumbering{arabic}
 \chapter{Genesis}
 \renewcommand{\chaplabel}{Kecheng}

 \begin{Parallel}{9.1cm}{9.1cm}

  \ParallelLText{\jverse{}{\jLChapter{150}}{}{Kechengsi, Arnam sining-heihei lapen pirthe kepinchong ahut, }}
  \ParallelRText{\jverse{}{\jRChapter{150}}{}{In the beginning when God created the heavens and the earth, }}
  \ParallelPar
  \ParallelLText{\jverse{2}{}{pirthe arje avelang lapen thangnatta ave, lapen lang-lom athak kangtingsi dolang; lapen Arnam Akarjong lang-heihei athak damlo.  }}
  \ParallelRText{\jverse{2}{}{the earth was a formless void and darkness covered the face of the deep, while a wind from God swept over the face of the waters. }}
  \ParallelPar

 \end{Parallel}

 \end{document}

A: The features of lettrine don't seem to be used fully, in particular the dropcaps (second argument of \lettrine, which is left empty). Therefore a simpler approach could be used, that allows more control.
Here an attempt with tabularx. The idea is to make a table with the number on the left and the first paragraph on the right.
There are some spacing adjustments: the table padding is set to 0 with \setlength\tabcolsep{0pt} to reduce the space on the left of the number, and a small space on the right of the number is added to compensate for the lack of colsep on this side. Furthermore the text on the right is shifted up a bit to align with the top of the number.
MWE (I have reduced the original code a bit):
\documentclass{article}
\usepackage[margin=1.5cm]{geometry}
\usepackage[none]{hyphenat}
\usepackage[usenames]{xcolor}
\usepackage{tabularx}
\usepackage{parallel}

\newcommand{\jverse}[2]{\noindent{\textcolor{cyan}{\textbf{#1}}} {#2}\par\smallskip}

\setlength\tabcolsep{0pt}
\newcommand{\printChapNum}[2]{%
\noindent%
\begin{tabularx}{9.1cm}{lX}{%
\Huge\color{red} #1}\hspace{1mm} &%
\vspace{-6mm}#2\\
\end{tabularx}%
}

\begin{document}
\begin{Parallel}{9.1cm}{9.1cm}
\ParallelLText{\printChapNum{150}{Kechengsi, Arnam sining-heihei lapen pirthe kepinchong ahut,}}
\ParallelRText{\printChapNum{150}{In the beginning when God created the heavens and the earth,}}
\ParallelPar
\ParallelLText{\jverse{2}{pirthe arje avelang lapen thangnatta ave, lapen lang-lom athak kangtingsi dolang; lapen Arnam Akarjong lang-heihei athak damlo.}}
\ParallelRText{\jverse{2}{the earth was a formless void and darkness covered the face of the deep, while a wind from God swept over the face of the waters.}}
\ParallelPar

\end{Parallel}

\end{document}

Result:


Q: How to run-android a shoutem clone project? When I react-native run-android a shoutem clone project, first it was showing a development server error code 500..I changed the react-native and babel preset for react native from package.json. And now there is no error but the app crashes right after build. What can I do to fix this?


Q: Python os.listdir and path with escape character I have a string variable that I have read from a file which is a path that contains an escape character i.e.
dir="...Google\\ Drive"

I would like to then list all the files and directories in that path with os.listdir i.e.
os.listdir(dir)

But I get this error (because I really only want one escape):
OSError: [Errno 2] No such file or directory: '....Google\\ Drive/'

I have tried using
os.listdir(r'....Google\ Drive')

os.listdir(dir.replace("\\","\"))

os.listdir(dir.decode('string_escape'))

all to no avail. I read this Python Replace \\ with \, but "...Google\ drive".decode('string_escape') != "...Google\ Drive".
Any ideas?

A: If the path could be arbitrary , you can split the the strings using \\ removing any '' you may get along the way and then do os.path.join , Example -
>>> import os.path
>>> l = "Google\Drive\\\\ Temp"
>>> os.path.join(*[s for s in l.split('\\') if l != ''])
'Google\\Drive\\ Temp'

Then you can use that in os.listdir() to list the directories.


Q: Charts in Ionic 2 I need to create charts in an app, which uses Ionic 2. I searched the web but found some very scarce models. And also http://www.chartjs.org, but his documentation is very poor.
I mostly need donut charts, with click events. Or is it possible for me to have a click event on the chartjs donut chart? How can I do this?

A: You should use ng2-charts which is a ChartJS wrapper for Angular 2/4.
Using this you can create a simple doughnut chart (with click event) as follows :
template
<div id="chart-container">
    <canvas baseChart
          [chartType]="chartType"
          [data]="chartData"
          [labels]="chartLabels"
          (chartClick)="chartClicked($event)">
  </canvas>
</div>

component
import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})

export class AppComponent {

  public chartType: string = 'doughnut';
  public chartLabels: Array<string> = ['Jan', 'Feb', 'Mar'];
  public chartData: Array<number> = [1, 1, 1];

  public chartClicked(e: any): void {
    if (!e.active.length) return; //return if not clicked on chart/slice
    alert('Clicked on Chart!');
  }

}

LIVE DEMO
( this shouldn't be too hard to implement in Ionic 2 )
note: this is just a basic example of a doughnut chart and you can customize it further to fit your need, following the official documentation.


Q: View Screen And Print Screen is Diverent on Laravel PHP This is The Problem Picture
View Screen
Print Screen
Why Screen is Diverent, I want All Screen is Same, I search for tutorial and not working on me
I create this for my report Invoice
This is The View Code all in one page
<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Kwitansi</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

                Invoice #{{ $kwitansi->id }}

              Received From
 Telah Diterima Dari
              {{ $kwitansi->received }}
 ..........................................................................................................................

                Received From
 Telah Diterima Dari
                {{ "Rp. ". format_uang($kwitansi->registration) }}
 ..........................................................................................................................

              Received From
 Telah Diterima Dari
              {{ "Rp. ". format_uang($kwitansi->course) }}
 ..........................................................................................................................

              Received From
 Telah Diterima Dari
              {{ "Rp. ". format_uang($kwitansi->trasnportation) }}
 ..........................................................................................................................

              Received From
 Telah Diterima Dari
              {{ terbilang($kwitansi->sum_rp) }}
 .....................................................................................................................................................

              Received From
 Telah Diterima Dari
              {{ $kwitansi->payment }}
 ..........................................................................................................................

{{ "Rp. ". format_uang($kwitansi->sum_rp) }}

                    Bandung, {{ $kwitansi->register_at }}

                    Penerima

                    {{ $kwitansi->received }}

I Use Single Page for it css and js in one page
What is my mistake
Can Help Me Please
Thanks for Helping


Q: Hex number to area I am using VB.net 2012 and I am trying to convert a HEX number to a checkbox.
I have 96 check boxes on a form. d1, d2, d3.. d96 (that is the name of the checkbox's).
I have a HEX number that I need to convert and tick the check box based on it's value.
For Example:
If the HEX value equals 0x5 then checkbox's d1 and d3 need to be ticked only.
If the HEX value equals 0x20 then only checkbox d6 need to be ticked.
If the HEX value equals 0x42400 then checkbox's d10, d13, d18 need to be ticked only.
I haven't been able to work out how to convert this hex value and select the checkbox based on this value.
I then need to do it the other way around. select the check boxes and then click on a button to work out the HEX value based on what has been selected.
Any help would be great.


Q: How to restore my System Python 2.6 on OS X 10.6.8 I was messing around with Python in Library/Frameworks as well as System/Library/Frameworks. I deleted System/Library/Frameworks/Python.framework/Version/2.6. Then I copied in the equivalent directory from Library/Frameworks...
Will that break my OSX? If so, is there any way to restore the system python setup.
Not sure if this is relevant:
$ which python
usr/local/bin
$ python -V
Python 2.6

A: There's a subtlety between /Library and /System/Library that I do not understand.  Therefore, this answer is flawed.
However.  Even with that gap, I suggest you do this.

*

*Backup your data.  All of it.  Backup any apps you installed.

*Buy 10.7 Lion.

*Install.  I don't think you need to do a "fresh" install.  But some Mac users strongly suggest fresh installs of each new OS  release.

*Restore your files.
Don't delete Python.  iLife (for one) requires it.

A: Don't mess with the pre-installed python. It will break dependencies on your mac. It happened to me, I had to re-install to fix it. A better thing to do is to install a new version of python.


Q: Determining Transitive Dependencies I am working on figuring out partial and transitive dependencies.  The Transitive ones are really confusing me because I can see a transitive dependency on nearly all of these.
The partial dependencies are Agree_No -> Agree_Date, Cust_No -> Cust_Name and Cust_Phone; Serial_No -> Item_Name and Item_Rate.
The Transitive Dependencies that I see are Item_Rate -> Item_Name.  But could Cust_Phone be a transitive to Cust_Name and the Agree_No/Date?  Are there others I am missing?

A: A FD (functional dependency) X -> Z is transitive when there exists a Y such that X -> Y AND Y -> Z AND NOT Y -> X AND NOT Y = Z. (X, Y & Z are attribute sets.)
There can be lots of X, Y & Zs where X -> Y AND Y -> Z but X -> Z is not transitive because Y -> X. Eg this happens whenever X and Y are CKs (candidate keys). (Because CKs functionally determine all attributes--each determines the other and Z.) And there can be lots of transitive FDs. Eg this happens whenever there is a FD whose attributes are non-prime. (Because a CK determines that FD's determinant which itself doesn't determine the CK--if it did then it would be a CK, which with non-prime attributes it isn't.) The FDs among all those ones that are important for normalization are transitive FDs of non-prime attributes on CKs when a relation is in 2NF. Because it is always possible to losslessly decompose such a relation to components free of them, ie in 3NF.


Q: Using the jQuery autocomplete widget in SharePoint search box I implemented the autocomplete widget for jQuery for my SharePoint 2010 text box. But I see that the suggestion terms appearing with a Bullet point as shown below. Can anyone tell how can it be averted.

Thanks in advance.

A: That's something you can fix with CSS. However, if you have a proper reference to the jQueryUI CSS file, I don't think you should be seeing this. Make sure that reference is present and correct.


Q: phpmailer eml file with rfc/822 not opening on outlook but open on gmail I am implementing some code to send an eml file with phpmailer.
When I'm using mime_type for eml attachements of rfc/822, it's opening in Gmail but not opening in Outlook. If I change mime_type to application/octet-stream, it's opening in Outlook but not in Gmail.
application/octet-stream -> gmail(not working) outlook(working)
application/vnd.ms-outlook   -> gmail(not working) outlook(working)
application/CDFV2-encrypted -> gmail(not working) outlook(working)
message/rfc822           -> gmail(working) outlook(not working)


Q: Skobbler Map : FreeDrive function integration in other app In skobbler map, Which frameworks or files should be imported in our app in order to use 'freedrive' function of NavigationUI? thanks


Q: Image.open can't handle random selected image-variable Python This is my first Python-script/program so I have googled everything and starting to get the grip a little.
I am trying to make a program that randomly picks a picture in a directory and display it as a label.
Everything goes well except one thing. I have made the random picture as a variable and try to tell Image.open to use the path in the variable. Thing is that Image.open does not recognise the variable as a filename/path but instead it recognize it as
"PIL.PngImagePlugin.PngImageFile image mode=P size=980x93 at 0xF185A8".

I have googled all night but cant find an answer or solution to this. If I print both img1-variable and path1-variable it comes out right.
Anyone have a clue how to solve this? I would be very grateful for any answers!
I have Python 2.7.3
And this is my script (not finished).
#! /usr/bin/env python
from Tkinter import *
import Tkinter
import random
from PIL import Image, ImageTk
import os

root = Tkinter.Tk()
w, h = root.winfo_screenwidth(), root.winfo_screenheight()
root.geometry("%dx%d+0+0" %(w, h))
root.configure(background="darkgreen")
dir = 'decks/'
img1 = random.choice(os.listdir(dir))
path1 = dir+img1
card1 = Image.open(path1)
card1 = card1.resize((140, 190), Image.ANTIALIAS)
magicback = Image.open("datapics/magicback.jpg")
magicback = magicback.resize((140, 190), Image.ANTIALIAS)
magicbutton = ImageTk.PhotoImage(magicback)
label = Label(root, image=magicbutton)
label.image = magicbutton
label.place(x=1, y=20)
label1 = Label(root, image=card1)
label1.image = card1
label1.place(x=1, y=230)
label2 = Label(root, image=magicbutton)
label2.image = magicbutton
label2.place(x=151, y =230)
label3 = Label(root, image=magicbutton)
label3.image = magicbutton
label3.place(x=301, y=230)
label4 = Label(root, image=magicbutton)
label4.image = magicbutton
label4.place(x=451, y=230)
label5 = Label(root, image=magicbutton)
label5.image = magicbutton
label5.place(x=601, y=230)
label6 = Label(root, image=magicbutton)
label6.image = magicbutton
label6.place(x=751, y=230)
label7 = Label(root, image=magicbutton)
label7.image = magicbutton
label7.place(x=901, y=230)
root.mainloop(0)

A: If I understand the question correctly, your issue is with image.open(), I believe the problem is that you are treating the directory and file name as strings when you join them together:
path1 = dir + img1

Instead you should try using the os.path module to combine the two:
path1 = os.path.join(dir, img1)


Q: saml2 bearer oAuth : audience verification failed I try to implement a SSO mechanism with SAM2 bearer oAuth over WSO2.
1. User call WebAPP1
2. WebAPP1 (SP) redirect the user on the IDP login Page (OpenAM)
3. WebAPP1 (SP) call oAuth server (WSO2 IS or AM) with SAML2 to get oAuth token

At this step WSO2 IS (or AM) fails with the error : "SAML assertion audience verification failed".
I don't understand why because the audience value set in my SAML2 sent to oAuth server is the same as defined in the "Trusted Identity Provider" on IS or AM.

I don't understand why ... please help me !
Nicolas

A: I guess SAML assertion may not contain the all audience urls. In Trusted IDP UI, you can configure identity provider audiences. If you have defined them,  those urls must be in the assertion. Also..  value that is defined by "OAuth2 Token Endpoint Name:" must be also as an audience url in assertion.


Q: If $f_n→f$ in $L^p(E)$, does that imply that $(f_n)^p→f^p$ in $L^1(E)$? The question is just like the title.
(For $E$ measurable and $1\le p<∞$, define $L^p(E)$ to be the collection of measurable functions $f$ for which $|f|^p$ is integrable over $E$; thus $L^1(E)$ is the collection of integrable functions.)

A: Let $X = [1, \infty]$, $f_n(x) = \dfrac{1}{nx} + 1$ and $f(x) = 1$. We have:
$$
\|f_n - f\|_2 = \left\{\int_1^\infty \left|\dfrac{1}{nx}\right|^2\,dx\right\}^{1/2} = \dfrac{1}{n}
$$
Therefore, $f_n \to f$ in $L^2([1, \infty])$.
On the other hand:
\begin{align*}
\|f_n^2 - f^2\|_1 &= \int_1^\infty \left|\left(\dfrac{1}{nx} + 1\right)^2 - 1\right| \,dx \\
&= \int_1^\infty \left|\left(\dfrac{1}{nx}\right)^2 + \dfrac{2}{nx}\right| \,dx \\
&\ge \dfrac{2}{n} \int_1^\infty \dfrac{1}{x} \,dx
\end{align*}
Which diverges no matter what $n$ is.

A: In a question of this type, always check $f(x)=1/x$ in the sets $E_1=(0,1)$ and $E_2=(1,\infty)$. Notice that $f(x)$ is not integrable on either set in $L^1$, but it is integrable on one of them in $L^p$.

A: If $E \subset \mathbb R^n$ is bounded, this is true if I'm not mistaken. Consider the superposition operator corresponding to $\operatorname{id}^p$, i.e. the operator $$T \colon L^p(E) \to L^1(E)$$ with $$(Tg)(x) = g(x)^p$$ for every $g \in L^p(E)$. A well-known result for superposition operators (see e.g. Theorem 1.2.1 in Progress In Nonlinear Differential Equations and Their Applications or Remark 2.5 in A Primer of Nonlinear Analysis) says that, because of its limited growth and pointwise continuity, $T$ is continuous. In other words, $f_n^p = Tf_n \to Tf = f^p$ in $L^1$.


Q: Disable Path MTU discovery on per socket on OS X Is there a way to disable Path MTU discovery on per socket basis on OS X?
This is how to set don't fragment bit on socket on Linux
But IP_MTU_DISCOVER is not recognized on OS X.
Only recognized options as per netinet/in.h on OS X are:
/*
 * Options for use with [gs]etsockopt at the IP level.
 * First word of comment is data type; bool is stored in int.
 */
#define IP_OPTIONS      1    /* buf/ip_opts; set/get IP options */
#define IP_HDRINCL      2    /* int; header is included with data */
.....


Q: Visual Studio 2010 script debugger doesn't work for me I just installed VS 2010 Beta 2 and wanted to play with an ASP.NET MVC 2 project.  I simply added some script (alert('hello');) into the Home controller's index.aspx view, and I can see it executing.  When I try to set a breakpoint, however, it never gets hit.  I also tried to use the "debugger" keyword, and when I do, I get a disappointing "there is no source code available for the current location" message.  I also get this message when I try to independently attach to an IE process where my app is running.
What do I need to do to get a friendly script debugging experience?  (I have successfully used Firebug to debug this, but for some reason I prefer the VS debugger.)
Here are some details of my configuration:

*

*I am launching my stuff in VS 2010 Beta 2.

*IE8 version 8.0.7600.16385 is my default browser.

*The "Disable script debugging (Internet Explorer)" advanced option is unchecked.

*The "Disable script debugging (Other)" option is unchecked.

*In my ASP.NET MVC 2 project's "web" properties tab, the ASP.NET debugger is checked.  All others are unchecked.

*Visual Studio 2008 script debugging seems to work just fine.

A: I was having the same issues. I was not able to get the IDE to even break at a breakpoint set inside a script tag. However when I added "debugger;" as the first line in the script tag was able to get the IDE to respond but then only to say that the disassebly was not availble.
However, I was able to click on the debug tools like "step into" and "step over". When I did this the IDE did progress into some of the external scripts that I am using (JQuery and Google Maps). So I took the JavaScript code block out of the view and put it into a separate .js file in the "Content" folder. Then I added a script tag to reference this new .js file (url = "/Content/Test.js").
It worked... a little bothersome that you have to go through this effort but maybe there is something to be said for JavaScript not being included directly in a view. I hope this is a bug they intend to fix.

A: When debugging on IE, VS seems to add a folder called 'Script Documents' to the Solution Explorer. Inside this folder there is another folder called 'Windows Internet Explorer', and inside of it I see all the loaded js scripts and the (compiled) HTML file currently being displayed on IE. Setting breakpoints on the script tags in this HTML file does work for me.

A: The debugger cannot debug both Silverlight code and Script code at the same time, if the Silverlight debugger is selected JavaScript debugging is switched off.

*

*Go to the Project's Properties (Alt+Enter).

*For a Web Site Project: Select "Start Options". Or for a Web Appliction: Go to the Web tab and at the bottom you will see the Debuggers option.

*Check that the Silverlight checkbox is NOT ticked if you want to be able to debug JavaScript.  (It is unfortunate that the UI here is not clear about this side effect.)

A: To resolve this go to the Project's Properties and select "Start Options". Then Check the Native Code Check Box. and Uncheck  the Silverlight Checkbox because both options not works together.

A: CTRL+Alt+P (Attach to Process), select IE, select 'script' for the debugging type.

A: As Ryan noted above, I moved my script to a seperate file under the Scripts folder.
I also added debug into the name of the script so it became MyTestScript.debug.js.  I included the script via a script tag and could set break points in the script file which the debugger hit.

A: I have found that the Google Chrome devloper tool shows the JavaScript perfectly.  In my case, I'm normally loading the script with jQuery's getScript function and execution of the code is typically by way of a jQuery callback upon loading a page or handling an event.  With Visual Studio 2010, I frequently encountered the "No source" bug.  Sad I need Chrome to debug JavaScript that is part of my Visual Studio project.

A: Using a separate js file has its drawbacks.  For instance, you can't use MVC helpers.  Microsoft really needs to figure this one out.
Intellisense also does not work properly in script blocks on a view, even if you include the reference comments like this:
/// <reference path="/Scripts/jquery-1.6-vsdoc.js" />
/// <reference path="/Scripts/jquery-1.6.js" />

Intellisense works fine in the js file with this approach though.


Q: Liskov substitution principle VS Interface Segregation principle I have some troubles with understanding these two principles. This is a bit long-read-question, so be patient.
Lets assume that we have a class
abstract class Shape {
    abstract void onDraw();
}

and interface
interface SideCountable {
  int getSidesCount();
}

And then we create two children classes
class Quad extends Shape {

   @Override
   public void onDraw() {
   //some draw logic here
   }
}

class Triangle extends Shape {

   @Override
   public void onDraw() {
   //some draw logic here
   }
}

And now we will make Shape implements SideCountable
abstract class Shape implements SideCountable{
    abstract void onDraw();
}

and make changes in children classes
class Quad extends Shape {

   @Override
   public int getSidesCount() {
       return 4;
   }

   @Override
   public void onDraw() {
   //some draw logic here
   }
}

class Triangle extends Shape {

   public int getSidesCount() {
       return 3;
   }

   public void onDraw() {
   //some draw logic here
   }
}

And create test function for this structure (following LSP) :
public void printSidesCount(List<Shape> shapes) {
    for(int i=0; i < shapes.size(); i++) {
        System.out.println(shapes.get(i).getSidesCount());
    }
}

And here I want to stop because actually in the next step I was stucked.
What if we'll create a third class Circle?
class Circle extends Shape {

   public int getSidesCount() {
       return ???;
   }

   @Override
   public void onDraw() {
   //some draw logic here
   }
}

Circle has no sides, so implementation of SideCountable for this children sounds ridiculous. Ok, we can move implementation to Quad and Triangle only, but in this case LSP will not working anymore. Can someone describe what the best way I should to do?

*

*Leave SideCountable in Shape class and return 0 for Circle and break interface segregation principle?

*Move SideCountable to Quad and Triangle and break LSP principle?

A: First of all, your method printSidesCount only needs to know that the list contains SideCountable objects. So giving its parameter the type List<Shape> is more specific than necessary. Give it a List<SideCountable> instead:
public void printSidesCount(List<SideCountable> sideCountables) {
    for(int i=0; i < (); i++) {
        System.out.println(sideCountables.get(i).getSidesCount());
    }
}

Or even List<? extends SideCountable> which means "a list of some arbitrary unknown type that implements SideCountable":
public void printSidesCount(List<? extends SideCountable> sideCountables) {
    for(int i=0; i < sideCountables.size(); i++) {
        System.out.println(sideCountables.get(i).getSidesCount());
    }
}

If not all shapes have a countable number of sides, then class Shape should not implement interface SideCountable. Instead, make classes Quad and Triangle implement interface SideCountable besides extending class Shape:
class Quad extends Shape implements SideCountable {
    // ...
}

class Triangle extends Shape implements SideCountable {
    // ...
}

And make class Circle extend Shape but not implement SideCountable:
class Circle extends Shape { // Not SideCountable
    // ...
}

When you do it like this, the type system will help you:

*

*you can pass a List<Quad> or List<Triangle> to printSidesCount since those types implement SideCountable

*you cannot pass a List<Circle> to printSidesCount, which is good because trying to do this would not make sense for a list of circles


Q: EBNF: one or more and zero or more, in no particular order In an EBNF grammar I have two tokens shape and attr. How would I express that shape should occur one or more times and attr zero or more times, but in no particular order, i.e.:
shape1 shape2 shape3
attr1 shape1
shape1 attr1
shape1 shape2 attr1 shape3

Would all be parsed, but
attr1 attr2 ..
would not?

A: Answering my own question:
seq = shape as_seq | attr seq
as_seq = (shape | attr)*

does the trick
(where shape and attr are defined elsewhere in the grammar.
e.g. shape = 'a' and attr = 'b'. Then 'a' 'ab' 'aaab' 'bbbab' will all match but 'b' 'bb' 'bbb..' etc will not)


Q: XML string to JSON javascript I have a xml string which i want to convert in JSON string
var txt = "<?xml version='1.0' encoding='UTF-8' ?>
                 <result>
                   <info>
                      <id>1</id>
                      <type>HL</type>
                      <ven>DEMOMA</ven>
                   </info>
                   <info>
                      <id>2</id>
                      <type>HL</type>
                      <ven>DEMOMB</ven>
                   </info>
               <result>";

i tried to initially convert it in DOM object using parser but it throws parsing error.
parser = new DOMParser();
xmlDoc = parser.parseFromString(txt,"text/xml");

i want my output json string like only by using Javascript
{"result":[{"id":"1","type":"HL","ven":"DEMOMA"},{"id":"2","type":"HL","ven":"DEMOMB"}]}

A: I will try to explain with an example with use x2js.js https://github.com/abdmob/x2js and jquery (and without jQuery) library.
GET XML data from the API and convert this data to JSON
With jQuery
<!DOCTYPE html>

    <meta charset="UTF-8">
    <title></title>

without jQuery
<!DOCTYPE html>

    <meta charset="UTF-8">
    <title></title>

and using the example that you gave in question. Fix closed <result> to </result>
<!DOCTYPE html>

    <meta charset="UTF-8">
    <title></title>

A: Check out this https://github.com/metatribal/xmlToJSON
Its a very small and useful script. Usage is very easy.
Include the src

and enjoy! xmlToJSON is packaged as a simple module, so use it like this
testString = '<xml>It Works!</xml>';   // get some xml (string or document/node)
result = xmlToJSON.parseString(testString);   // parse

'result' is your JSON object.


Q: Buffer implementing io.WriterAt in go I'm using the aws-sdk to download a file from an s3 bucket. The S3 download function want's something that implements io.WriterAt however bytes.Buffer doesn't implement that. Right now I'm creating a file which implements io.WriterAt but I'd like something in memory.

A: For cases involving the AWS SDK, use aws.WriteAtBuffer to download S3 objects into memory.
requestInput := s3.GetObjectInput{
    Bucket: aws.String(bucket),
    Key:    aws.String(key),
}

buf := aws.NewWriteAtBuffer([]byte{})
downloader.Download(buf, &requestInput)

fmt.Printf("Downloaded %v bytes", len(buf.Bytes()))

A: I don't know of any way to do this in the standard library, but you can write your own buffer.
It really wouldn't be all that hard...
EDIT: I couldn't stop thinking about this, and I ended up acidentally the whole thing, enjoy :)
package main

import (
    "errors"
    "fmt"
)

func main() {
    buff := NewWriteBuffer(0, 10)

    buff.WriteAt([]byte("abc"), 5)
    fmt.Printf("%#v\n", buff)
}

// WriteBuffer is a simple type that implements io.WriterAt on an in-memory buffer.
// The zero value of this type is an empty buffer ready to use.
type WriteBuffer struct {
    d []byte
    m int
}

// NewWriteBuffer creates and returns a new WriteBuffer with the given initial size and
// maximum. If maximum is <= 0 it is unlimited.
func NewWriteBuffer(size, max int) *WriteBuffer {
    if max < size && max >= 0 {
        max = size
    }
    return &WriteBuffer{make([]byte, size), max}
}

// SetMax sets the maximum capacity of the WriteBuffer. If the provided maximum is lower
// than the current capacity but greater than 0 it is set to the current capacity, if
// less than or equal to zero it is unlimited..
func (wb *WriteBuffer) SetMax(max int) {
    if max < len(wb.d) && max >= 0 {
        max = len(wb.d)
    }
    wb.m = max
}

// Bytes returns the WriteBuffer's underlying data. This value will remain valid so long
// as no other methods are called on the WriteBuffer.
func (wb *WriteBuffer) Bytes() []byte {
    return wb.d
}

// Shape returns the current WriteBuffer size and its maximum if one was provided.
func (wb *WriteBuffer) Shape() (int, int) {
    return len(wb.d), wb.m
}

func (wb *WriteBuffer) WriteAt(dat []byte, off int64) (int, error) {
    // Range/sanity checks.
    if int(off) < 0 {
        return 0, errors.New("Offset out of range (too small).")
    }
    if int(off)+len(dat) >= wb.m && wb.m > 0 {
        return 0, errors.New("Offset+data length out of range (too large).")
    }

    // Check fast path extension
    if int(off) == len(wb.d) {
        wb.d = append(wb.d, dat...)
        return len(dat), nil
    }

    // Check slower path extension
    if int(off)+len(dat) >= len(wb.d) {
        nd := make([]byte, int(off)+len(dat))
        copy(nd, wb.d)
        wb.d = nd
    }

    // Once no extension is needed just copy bytes into place.
    copy(wb.d[int(off):], dat)
    return len(dat), nil
}

A: Faking AWS WriterAt with an io.Writer
This isn't a direct answer to the original question but rather the solution I actually used after landing here. It's a similar use case that I figure may help others.
The AWS documentation defines the contract such that if you set downloader.Concurrency to 1, you get guaranteed sequential writes.
downloader.Download(FakeWriterAt{w}, s3.GetObjectInput{
    Bucket: aws.String(bucket),
    Key:    aws.String(key),
})
downloader.Concurrency = 1

Therefore you can take an io.Writer and wrap it to fulfill the io.WriterAt, throwing away the offset that you no longer need:
type FakeWriterAt struct {
    w io.Writer
}

func (fw FakeWriterAt) WriteAt(p []byte, offset int64) (n int, err error) {
    // ignore 'offset' because we forced sequential downloads
    return fw.w.Write(p)
}

A: I was looking for a simple way to get io.ReadCloser directly from an S3 object. There is no need to buffer response nor reduce concurrency.
import "github.com/aws/aws-sdk-go/service/s3"

[...]

obj, err := c.s3.GetObject(&s3.GetObjectInput{
    Bucket: aws.String("my-bucket"),
    Key:    aws.String("path/to/the/object"),
})
if err != nil {
    return nil, err
}

// obj.Body is a ReadCloser
return obj.Body, nil

A: With aws-sdk-go-v2, the codebase-provided example shows:
// Example:
// pre-allocate in memory buffer, where headObject type is *s3.HeadObjectOutput
buf := make([]byte, int(headObject.ContentLength))
// wrap with aws.WriteAtBuffer
w := s3manager.NewWriteAtBuffer(buf)
// download file into the memory
numBytesDownloaded, err := downloader.Download(ctx, w, &s3.GetObjectInput{
    Bucket: aws.String(bucket),
    Key:    aws.String(item),
})

Then use w.Bytes() as the result.
Import "github.com/aws/aws-sdk-go-v2/feature/s3/manager" and other needed components


Q: Override Function In WordPress Plugin Widget I need to override a setting in a widget included in a WordPress plugin (the plugin is woocommerce). I've found in the plugin's widget code where I need to make the change (for the product_categories widget, I want to add a $cat_args['depth'] = 1; so that I only see the parent categories) and everything works fine, but I want to be able to do it in a way so that if the plugin ever updates, it doesn't wipe out the change. I have a custom theme that I have developed...is there any way to make the change in that theme so that I can still update woocommerce safely?

A: The only way to do that would be to ask the Widget developer to do something like this:
$cat_args_depth = 1;
$cat_args_depth =  apply_filters('woocommerce_cat_args_depth', $cat_args_depth );
$cat_args['depth'] = $cat_args_depth;

and then you could just use
add_filter( 'woocommerce_cat_args_depth', function( $cat_args_depth ) {
    $cat_args_depth = 2; // your value
    return $cat_args_depth ;
});


Q: How to constructor in constructor I need add data in array Person. But program is not bug .
I do not know how to constructor  with type class in constructor  .
public Person[] personData =
{
    new Person {PersonId = 1, FirstName = "Adam", LastName ="Freeman",
        HomeAddress = { City = "SoKa" , Country = "Look" }  },
    new Person {PersonId = 2, FirstName = "Nhan", LastName ="Ga",
        HomeAddress = { City = "Dalat" , Country = "VungTau" } },
};

Declarations
public class Person
{
    public int PersonId { get; set; }
    public string FirstName { get; set; }
    public string LastName { get; set; }
    public Address HomeAddress { get; set; }

    public class Address
    {
        public string City { get; set; }
        public string Country { get; set; }
    }
}

A: You need to use
HomeAddress = new Person.Address{ City = "SoKa" , Country = "Look" }

instead of
HomeAddress = { City = "SoKa" , Country = "Look" }


Q: Trigger Outlook Mail Body using VBA In VBA scripting ,I am trying to write a Sub Function which has the following signature
Sub(taskName As String , myGroup As String, myFile As String ,myPer As String, RelatedTasks() As String    )

 Dim olApp As Outlook.Application
 Dim m As Outlook.MailItem

 Set olApp = New Outlook.Application
 Set m = olApp.CreateItem(olMailItem)

 With m
   .display
   .To = "somewhere@someplace.com"
   .Subject = "Test Events"
   .HTMLBody/.body = ...
End Sub

Email Body is as follows:
Hello All,
Please find the following information.
TASK: taskName
RELATED TASK:RelatedTasks()
FILE : myFile
PERSON : myPer
In the Sub function , the pattern to the left of colon is always constant.And the right side will change based on the inputs to the function.
For that I am reading the Template.htm which contains the required signature.
Template.htm contains:
Hello All,

Please find the following information.

TASK: {{mytask}}

RELATED TASK:{{myRelatedTasks}}

FILE : {{myFile}}

PERSON : {{myPerson}}

In VBA code,I am replacing all the fields.
The issue that I am facing is {{mytask}} and {{related tasks}} also should have a HTML reference. I have succeeded in adding the link to mytask .Clicking on the mytask in the mail will jump to the respective weblink.

{{mytask}}.....{{myRelatedTasks}}

but having trouble in adding the same to Related tasks since it is an array.
My VBA code :
Option Explicit

Sub CreateNewMail()

 Dim olApp As Outlook.Application
 Dim m As Outlook.MailItem
 Dim sigPath As String, sigText As String
 Dim fso As Scripting.FileSystemObject
 Dim ts As Scripting.TextStream

 Dim t As String
 Dim r(5) As Variant

 t = "233444:dshfjhdjfdhjfhjdhfjdhfjd"

 r(0) = "122343:dsjdhfjhfjdh"
 r(1) = "323243:jfjfghfjhjddj"
 r(2) = "834783:gffghjkjkgjkj"

 Set olApp = New Outlook.Application
 Set m = olApp.CreateItem(olMailItem)

 sigPath = "C:\Users\Pavan-Kumar\Desktop\vbs\TestEvents.htm"

 Set fso = New Scripting.FileSystemObject
 Set ts = fso.OpenTextFile(sigPath)

 sigText = ts.ReadAll

 ts.Close

 Set fso = Nothing

 sigText = Replace(sigText, "{{mytask}}", t)
 sigText = Replace(sigText, "{{myRelatedTasks}}", Join(r, "
"))

 With m
   .display
   .To = "somewhere@someplace.com"
   .Subject = "Test Events"
   .HTMLBody = sigText

 End With
End Sub

And also when I am joining the related tasks , I want them to come one below another with indentation. I tried it with giving "\t" as the delimiter with no success.
I want to give references to my Related tasks and also want them to neatly align them. Thanks.
This is what I am able to print in my outlook mail:
Hello All,
Please find the following information.
TASK: 233444:dshfjhdjfdhjfhjdhfjdhfjd
RELATED TASK:122343:dsjdhfjhfjdh
"\t"323243:jfjfghfjhjddj
"\t"834783:gffghjkjkgjkj
"\t"
"\t"
"\t"
 FILE : TImers
PERSON : Charvaka

A: For the Alignments:  You can either drop the Related Tasks into a Table, or you can use a Tab (vbTab, not "\t")
For the multiple-rows:  This would be simpler if you had a 2D Array (e.g. r(0,0)="RelatedTaskName" and r(0,1)="RelatedTaskID") instead of splitting it based on a Colon, but it's doable, and there are several different ways to go about it.
The method that I am going to use here is to build all of your string at once, then use Replace to dump the finished product:  (using Tab instead of a Table for the indents)
Dim taskID As String, taskName As String, lTaskNum As Long, TaskList As String
TaskList = "" 'Start with an empty list
For lTaskNum = LBound(r) To UBound(r)
    If Len(TaskList) > 0 Then TaskList = TaskList & vbTab 'We are using Tab instead of a table here
    taskName= r(lTaskNum) 'Grab element from the array
    taskID = Left(taskName, InStr(taskName, ":") - 1) 'Just the number
    taskName = Replace(taskName, taskID & ":", "",count:=1) 'Just the Link text
    TaskList = TaskList & "" & taskName & "
" 'Add the task to the stack
Next lTaskNum
'If Len(TaskList) < 1 Then TaskList = "No Related Tasks" 'Optional bonus!
sigText = Replace(sigText, "{{myRelatedTasks}}", TaskList) 'Push the finished list into the email


Q: PHPUnit - Problem generating Code Coverage report with Zend Framework application I have been searching for an answer to this problem for hours in Google and various other sites with no luck. I have created some unit tests for my Zend Framework project using PHPUnit. All goes well with the tests up until the point of the the PHPUnit Code Coverage report. At this point I get the following error:

Generating code coverage report, this
  may take a moment. Fatal error: Call
  to a member function pushStack() on a
  non-object in
  C:\htdocs\ZendFWTutorials\ZendStorefront\library\SF\Plugin\Action.php
  on line 32

This error references the following block of code:
public function
dispatchLoopStartup(Zend_Controller_Request_Abstract $request)
{
     $stack = $this->getStack();

     // category menu
     $categoryRequest = new Zend_Controller_Request_Simple();
     $categoryRequest->setControllerName('category')
                     ->setActionName('index')
                     ->setParam('responseSegment', 'categoryMain');

     // push requests into the stack
     $stack->pushStack($categoryRequest);
 }

 public function getStack()
 {
     if (null === $this->_stack) {
         $front = Zend_Controller_Front::getInstance();
         if (!$front->hasPlugin('Zend_Controller_Plugin_ActionStack'))
         {
             $stack = new Zend_Controller_Plugin_ActionStack();
             $front->registerPlugin($stack);
         } else {
             $stack = $front->getPlugin('ActionStack');
         }
         $this->_stack = $stack;

     }
     return $this->_stack;
 }

This code is from a library that I did not write so that probably adds complexity to my problem because I'm less likely to understand what is going on. I also don't know what the PHPUnit logic is doing when it creates the code coverage report so I don't know how to remedy the problem. This problem only occurs when I run PHPUnit and I have run xdebug to trace the code in this function under normal operational conditions. I have a feeling that PHPUnit enters a condition where the variable is null but in normal operation $stack and $categoryRequest are not null.
My directory structure is as follows:

application
  ----->bootstrap
  ----->config
  ----->layouts
  ----->modules
  -------->storefront
  -------------->controllers
  -------------->forms
  -------------->models
  -------------->services
  -------------->views
  build
  data
  library
  ----->SF
  ----->Zend
  Public
  ----->css
  ----->images
  tests
  ----->application
  ------------->modules
  ------------->controllers
  ------------->models
  ----TestHelper.php
  ----phpunit.xml

phpunit.xml is as follows:

          ./application/

<filter>
    <whitelist>
        <directory suffix=".php">../application/</directory>
        <exclude>
            <directory suffix=".phtml">../application/</directory>
            <directory suffix=".php">../library/</directory>
        </exclude>
    </whitelist>
</filter>

<logging>
    <log type="coverage-html" target="./log/report" charset="UTF-8"
    yui="true" highlight="true" lowUpperBound="50"

highLowerBound="80"/>

TestHelper.php:
<?php // set our app paths and
 environments define('BASE_PATH',
 realpath(dirname(__FILE__) . '/../'));
 define('APPLICATION_PATH', BASE_PATH .
 '/application'); define('TEST_PATH',
 BASE_PATH . '/tests');
 define('APPLICATION_ENV', 'testing');

 //include path set_include_path('.' .
 PATH_SEPARATOR . BASE_PATH .
 '/library'  . PATH_SEPARATOR .
 get_include_path());

 // set the default timezone
 date_default_timezone_set('America/Argentina/Buenos_Aires');

 require_once 'Zend/Application.php';
 $application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/config/store.ini');

 $application->bootstrap();

A: After talking to @derickr on twitter, I used xdebug.auto_trace=1 in my PHP INI to trace the problem. The problem was in this line of code:
$stack = $front->getPlugin('ActionStack');

This is found in the function above named getStack(). The auto_trace showed that the first time getStack() runs, it runs correctly. The reason that PHPUnit was causing the error to show up is that when it runs the Code Coverage report, the dispatcher runs multiple times thus entering getStack() again and triggering the aforementioned line of code. The code needed the following change to remove the error and properly locate the plug-in in memory:
$stack = $front->getPlugin('Zend_Controller_Plugin_ActionStack');

The Code Coverage report now generates properly. Hopefully this will help explain the problem for others who find themselves with similar errors.
-Ross

A: Properly your PHPUnit test is not correct.


Q: Force a right-click to act as a left-click? I have looked at other code, and I just can't get any of it to work. I'm able to suppress the right-click context menu, but I need more than that. I need every right-click to act as if the left button were clicked, and I need to know exactly where to put it in my html code. This is a hot issue, as I can't progress on an important project until I can make this happen reliably. HELP!

A: You can use the following code to convert the right button click into left button click.
Here when you click inside the div the right button click is converted into left button. So that when you press left or right button both will behave on the same way.

 $(document).ready(function() {
      $("#rightclickDemo").bind('contextmenu', function(event) {
         if (event.which == 3)
         {
           // prevent right click from being interpreted by the browser:
            event.preventDefault();

            $(this).click(); // simulate left click
         }
      });

       $('#rightclickDemo').click(function() {
           $(this).html("Left clicked!");
      });
    });

This is a web page Demo.

    Click me with the right or left mouse button. Both will work as left button clicked!

A: I found my answer after MUCH research. this code works exactly the way I want it to! Added the jquery.min.js to my file structure and it works perfectly for standalone use!