Dougy Mak's Blog

MY BLOG!

setuid/sgid

How Unix works is, when a user creates a file, the file’s group is the user’s, which means other users could not edit it. So my developers and I always had this problem, and I always had to use “chown -R www-data:www-data . ” to change all the groups of the files in the current directory, but there’s a better way. You can set up setuid.

$ chgrp ftpusers /path/to/the/ftp/directory
$ chmod g+s $_

More information: http://www.cyberciti.biz/faq/unix-bsd-linux-setuid-file/

No comments

Unix $_

$_ is a variable that holds the first argument in the last command. For example,

$ chgrp ftpusers /path/
$ chmod g+s $_

$_ would equal ftpusers. You can also echo $_ and experiment around.

No comments

Getting control over authentication results

So, to get control over the authentication results for various errors such as no such username, wrong password, etc..  You can use this:

$result = $this->_auth->authenticate($adapter);
switch ($result->getCode()) {
case Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND:
/** do stuff for nonexistent identity **/
break;
case Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID:
/** do stuff for invalid credential **/
break;
case Zend_Auth_Result::SUCCESS:
/** do stuff for successful authentication **/
break;
default:
/** do stuff for other failure **/
break;
}

$result = $this->_auth->authenticate($adapter);

switch ($result->getCode()) {

case Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND:

/** do stuff for nonexistent identity **/

break;

case Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID:

/** do stuff for invalid credential **/

break;

case Zend_Auth_Result::SUCCESS:

/** do stuff for successful authentication **/

break;

default:

/** do stuff for other failure **/

break;

}

http://framework.zend.com/manual/en/zend.auth.introduction.html#zend.auth.introduction.results

No comments

Zend_Auth returns results and identity

This actually help me realized that my login wasn’t logging in properly to begin with. I needed to check if a person was logged on or not, and I found out you can see if the visitor has an identity and you can even get it with the following commands:

Zend_Auth::getInstance()->getIdentity()

Zend_Auth::getInstance()->hasIdentity()

More information here:
http://framework.zend.com/manual/en/zend.auth.introduction.html

No comments

Show your stack trace

I kept getting the following error:

An error occurred
Application error

And that means nothing to me. I don’t know what is going on, so I found out you can set the following in your .htaccess under your public folder and then you will be able to see the stack trace which gives you a better idea of what is wrong.

SetEnv APPLICATION_ENV “development”

No comments

Completed my first milestone

Taking baby steps towards my goal! I just took my first step and completed the first milestone, taking action.

No comments

I love you DD-WRT

Recently, my one of my tenants has been hogging the internet bandwidth, so I slapped on a p2p filter the tenants MAC address and viola! my internet is fast again!

No comments

Want to try a little harder…

Not in school, but in everything else. School’s not making me happy, it isn’t bringing me self satisfaction and I don’t feel like I am working for anything. I just feel like a drone, a drone waiting to be free on the day I graduate, the day I set off and sail towards the sunset to start my new adventure.. Maybe I’ll take less classes, and get a job. Maybe I’ll stop wasting my money, and save. Maybe I’ll save up more, and buy my own car. Maybe I’ll continue to save up, so I have a house to put my car in. Maybe I should try a little harder in life…

No comments

Most just stumble on to it…?

I’m laying here on my bed at my girl friend’s house at 2:14 am on a Sunday and I have Physics in 6 hours. I just finished watching Pirates of the Sillicone Valley, and reading tons of articles about Steve Jobs and startup related things. I realized it is very hard to come up with an idea that would forever change the world, but when looking back on it, it’s just so obvious and leaves me wondering why didn’t I come up with that idea. Apple created many products, and forever changed the world. It continued to push industries and it was because of them that competitors developed products that you love.  Facebook changed the way we socialize. YouTube forever changed the way we consume video media. When you think about it… IT IS SO OBVIOUS! WHY DID I NOT THINK OF THIS?  I still remember downloading videos back then and watching videos like numa numa and that was how videos were shared before then came YouTube. I consider myself pretty tech savvy, and that is my Achilles heel. When you know how to do everything that you need to, you get accustomed to it and do not really think about redefining how it works to improve it. So now I am sitting here trying to come up with an idea to change the world, and I keep arriving at the same questions: Why would someone even use this? There is already a way to do this, you do it X way. If I redefined this to do it with X way, then that could work, but how much better is this? Do people just stumble on to these ideas? They probably are experiencing the problem and decided to build X to help improve their lives…. And I continue to sit here… putting myself in the future trying to experience what technology would be like and asking myself “why didn’t I think of that?”


No comments

Late night inspirations

I always get these moments of inspiration at the most oddest hours. Usually during 1-5AM, if I am awake. I want to act on it and start programming or do something, but I know I would be dead tired next day when I am in class. It’s not like I listen in class anyways, but I want to complete my degree just so I can say I have a degree in Computer Science and also to satisfy my parents wants. I always feel like I am trying to juggle my passions with school and I always end up fucking up both. I want to just cut one of them (school) and focus on the other, but I don’t have the balls to… What should I do?  Persevere for 3 more semesters…

No comments

Next Page »