Tuesday, November 27, 2012

CPanel mailq

To check mailq, run this:
/usr/sbin/exim -bp

To resend a mail message with debugging on:
/usr/sbin/exim -d -M [msgid]

To delete a mail que:
/usr/sbin/exim -v -Mrm [msgid]

Tuesday, November 20, 2012

Zend file upload and addfilter rename isnt working

Ive had spent many days repeatly on different project, stumbling on one same issue.
AddFilter rename isnt working on my file upload.

It was one simple solution,
first, never ever getValue from the field before addfilter rename is in place.

Its very easy that we miss out lines of code where by it tries to populate data model from form.
Also its also easy to accidentally getting value from model to replace upload form field.

Make sure addfilter rename is called before isvalid is checked.

Hope this will solve your hair pulling days figuring why it isnt working.
The worst part is, Zend Framework isnt complaining about it!

Friday, November 9, 2012

modx setup blank page

After some research,
blank page could be caused by insufficient memory,
set php memory limit to higher

another possible issue is core/config/config.inc.php

it turn out , on my machine when i was migrating a remote modx to my local machine,
the write process onto config.inc.php somehow halted with some unknown error which caused blank page.
So, the page was a template file, and it turn out to be an invalid php script file.
ive to redownload my config.inc.php and try rerun..

But some how in the end, the final setup failed half way, with no errors again, content got loaded half way with no errors.

Yes, in the end, i applied the latest upgrade files onto the root,
and rerun setup,
but this time, it went well and it was a successful upgraded and the site is working!

Thursday, November 8, 2012

mongodb mapreduce to use as group by and sorted before running


//SQL: select siteref, panelno, count(*), sum(rental) as total rental, sum(lighting) as totallighting from campaign where `year` >= 2011 group by siteref, panelno order by siteref asc;
//please take note this sort is before the grouping
// if you want after grouping result, query the result from output table, and sort it there

db.campaign.runCommand({
  mapreduce: "campaign",
  sort: { "siteref": 1 },
  map: function() {
    //month starts on 0
    day = new Date(this.year, this.mon-1, 1, 0, 0, 0);
    oSite = db.site.findOne({siteref: this.siteref, panelno: this.panelno});
    emit({siteref: this.siteref, panelno: this.panelno, advertiser: this.advertiser},
      { rental: this.rental, lighting: this.lighting });
  },
  reduce: "function(key, values) {\
    var output = { cnt: 0, totalrental: 0, totallighting: 0, aa: 1};\
    values.forEach(function(v) {\
      output['cnt']++;\
      output['totalrental'] += v['rental'];\
      output['totallighting'] += v['lighting'];\
    });\
    return output;\
  }",
  out: {
    "replace": "campaign_report"
  },
  query: {
    year: { $gte: 2011}
  }
});