Saturday, December 31, 2011

MODx page not found on manager

This was a real trouble for me in the first place.
How am i suppose to fix this...
First, i did the throw exception as stated in my last post.

then next thing i know, i realize the $modx->config["modRequest.class"] wasn't declared...
so it uses modRequest instead of modManagerRequest class.

after digging for hours, ive finally noticed that the $modx->context->prepare() doesnt seems to return
proper config in $modx->context->config;

to fix it, add in true  into the parameter:
$modx->context->prepare(true);
then, load the manager page. you should be able to see the manager page now.
next, remove the true (restore the code to its previous state).
then login into the manager.
and Site > Clear cache.
Now all your site should have the proper config loaded based on the respective context.


MODx page not found...

Stumble upon modx page not found?
MODx by default, will send an error page if any error found during the loading of the page.
its in modx/core/model/modx.class.php

want to see the actual error?
go to the line declaration of
public function sendError($type = '', $options = array()) {
throw new Exception($errorMessage); //after $errorMessage is defined

Tuesday, December 27, 2011

more google Sucks?

Here lies the support forum:
http://www.google.com/support/forum/p/Google+Apps?hl=en

and no way to post any topic.. yay!

updates: if you are a google app user, no way,
unless u r a gmail user...

mysql select condition and sum select

When one select some records from a table, if the condition didnt meet, there will be 0 records returned..
But for a sum record, there will be min 1 record return, even if the record is not found.

SELECT * FROM `table` WHERE 1=2
#return 0 records;

SELECT id, sum(field1) FROM `table` WHERE 1=2
#return min 1 record, even if id is null

Friday, December 16, 2011

GMail sucks?

I've been a long time users of gmail.
I've my email hosted on google apps, and find their anti-spam protection rocks.
But lately, i found their flaws. This flaws is so extreme that i almost want to move out of their app server.

Their spam protection have moved to another level, TOTALLY BLOCKING IP.
Even after several attempt to request them to white list my ip, They FAILED to response on time or response any emails to my request.
I've my RDNS setup, SPF and DKIM, but they just block my ip.
And its a new vps ive just gotten, so im not sharing the ip with anyone else.
Probably someone have miss-used it in the past, but they should response on time to legitimate ip users. This is very unacceptable attitude from Google Team!
My IP is perfectly clean from any black list servers, and why the heck google need to BLOCK IP????

Thursday, December 15, 2011

white listing your mail server

Its so often that our email got miss-tagged as spam and thrown into the recipient junk mail.
It has and will be an on going research on how to white list our mail server to have those emails going into the proper inbox of the recipient.
Even with perfect configuration of white-listing, SPF and SNDS and RDNS, we need to take important consideration into spam filtering on all your outgoing emails. This is extremely important, as we need to protect our good users from bad users. Also to prevent virus infected pc from sending out spams or viruses.
(This article is a work in progress)

Several options availble:

  • SPF (Sender Policy Framework) Record
    Setting up custom TXT record to domain to whitelist your mail server for each domain
    http://www.openspf.net/
    Used by: Gmail, yahoo mail
  • SNDS (Smart Network Data Services)
    Join the White list channel.
    This will requires a RDNS to point to your domain, and have postmaster or abuse@yourdomain.com to handle the add to white list
    https://postmaster.live.com/snds/FAQ.aspx#WhatIsSNDS
    Used by: hotmail and more..
  • AuthKey
    Used by hotmail
  • DomainKey
    Used by hotmail and yahoo mail
  • RDNS (Reverse DNS)
    Need data center or IP owner to point the ip lookup to domain
Suggestion:
  1. Setup RDNS
  2. Setup SNDS
  3. Setup SPF Record for every domain
  4. Dmainkey and Authkey

Useful resources:

Wednesday, December 14, 2011

I was doing my coding in netbean as usual, and was shock to find my changes been replaced and deleted by git. im not sure where went wrong, is it netbean commit that didnt register, or is it git messed up by replacing my commit with its old version.

Wondering how to revert a pull which messed up your code?
run:
git reflog
#example return:

d5ca5a5 HEAD@{0}: pull : Merge made by recursive.
772321b HEAD@{1}: commit: ....
585e66b HEAD@{2}: commit: ....
5a61fe4 HEAD@{3}: commit: ....

run:
git reset 772321b
#reset to a version before the merge was made

then go to netbean and revert all modification done.
This modification basically meants changes that reverse your commit to the older version


then make a copy of the version you have else where.
then run:
git pull
#redo the merge again , which messed up.

#then run meld and compare both directory and put back your latest files and updates into the working directory.
#then recommit your changes.
#then run:
git push
#again.


Saturday, December 10, 2011

smtp relay and spam?

If you are using an external email server to relay your emails,
makesure to add spf record to your dns:

Example:
#Create a TXT record containing this text:
v=spf1 a:mail.yourdomain.com -all
#above meants only allow email to be sent directly from mail.yourdomain.com

if you want to use google:
v=spf1 include:aspmx.googlemail.com -all

for multiple mail server:
v=spf1 a:mail.yourdomain.com a:mail2.yourdomain.com -all

-all = exclude all others..


-----
How to setup qmail to forward emails to another smtp server?
sudo vi /var/qmail/control/smtproutes

:yourexternalserver.com:port# username password
#port, username and password are optional

if you want to set for specific domain:
mydomain.com:yourexternalserver.com:port# username password
:otherexternalserver.com:port# username password

Other useful commands for kloxo qmail:
List queue:
/var/qmail/bin/qmail-qread
To test send email:
echo to: your@email.com | /var/qmail/bin/qmail-inject

Kloxo logs -
tail /var/log/kloxo/smtp.log

To force qmail to send queue:
#grap id from qmail-send pid
ps -Af | grep qmail-send
kill -9 #id

sudo /etc/init.d/qmail restart




Thursday, December 1, 2011

htmlentities and utf8

Ever wonder why your utf8 charactors doesn't work with htmlentities?
try htmlspecialchars
Example:
$sResult = htmlspecialchars($sText, ENT_COMPAT, "UTF-8");