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");

Friday, November 4, 2011

magento rant

First, their javascript validation for setup Fail big time!
once it failed to validate, no matter what you have change in that field, it will not validate anymore!
need to refresh the page, that sucks big time!

installation, took more than 2minutes!
200+tables, omg, do we need that much?

PHP Memory limit of 256MB ?? omg...

Thursday, October 20, 2011

ubuntu virtualbox alt+click

i find it troublesome that i couldn't alt click in my Virtualbox client.
one way to fix it is by resetting the alt key in the host file to super(windows) key.

Go to windows preferences in setting, and change "movement key" from "alt" to "Super"

Wednesday, October 19, 2011

samba sharing on linux

After several frustration to get sharing working from linux,
finally found the root of the problem.

It is often that ubuntu / linux seems to add invalid charactor to the sharing name.
The solution is to remove them.

Exampke: user-intel (Linux mint)
Change to userintel