Sunday, December 2, 2012

#reality_check

Today I watched a play entitled 'heaven's gates and hell's flames'. For a long period of time I had placed my focus on earthly goals: how to get more money, when i will marry, where i will live. All this are great, but the play showed me that the life I am so concerned about can be snatched very fast.
Jesus is my Saviour, He has saved me from my sins, and I no longer have to pay the price for my sins past and future. But most of my workmates are not saved. I have cared little to share the good news of the work of Jesus to them. Life is like a vapour is comes and goes very fast. The lives of my workmates, can be ended at any time and they will face damnation.
But if they turn to Christ then they could be saved. I pray that God would lead me and show me opportunities to share the gospel. I want to be used of God to display and glory of God through Jesus Christ.
I want my workmates to be saved because I love them, and I want them to experience the love of God.
Pray with me.

Monday, October 29, 2012

isPrimeNumber() by Recursion in Python

In the pursuit to optimize some code In was writing I had to write this isPrime() by recursion.

Thursday, October 25, 2012

#shell scripting

So bash scripting in my opinion is cool but annoying
I want to access the file path and file name of a particular file but i don't know the file name. At least i know part of the file name. The files actual name is 'file_name_long.bin' and it is in the directory 'path/path/path/' from my current working directory.

So to get the file path I do something like

`ls path/path/path/file* | grep _name`

This will output : path/path/path/file_name_long.bin

And to get the file name

`ls path/path/path/ | grep _name`

This will output : file_name_long.bin

Hope this helps someone

Wednesday, October 17, 2012

just tried Chromium OS

Just took chromium OS chrome OS  for a whirl and its a pretty good os. Downside is that you have to be connected to the internet to do most of the stuff. I am trying it on a compaq presario c700. The boot is quite fast. My main motivation was the fact that I knew that Google had offered an offline version of docs and i wanted to try it out. Offline Google docs seems to be working well for only documents(text not spreadsheet). That's okay considering it is a beta product.
But my main disappointment is that the touch pad does not work well. Clicking via the buttons and tapping the touch pad works, but moving the mouse does not work. I have tried some of the suggestions on the forum but i still haven't been successful. But I think that the mouse would work with the 'lime' build as they call it.I will give it a try and see how it goes. All in all i am amazed at the power of html and java-script.
With more native looking apps coming up and more offline support Google chrome OS can build and integration of web and desktop that we have not experienced before.

Saturday, October 13, 2012

Hi my name is **** and am a stalker

Sometimes I find myself snooping around peoples profiles on facebook, there photos, there timeline on twitter. Yeah am a stalker. A facebook and twitter stalker. In this day and age, I guess being a stalker is inevitable  But If that is all we do then we are in a mess. Social media has bridged barriers of location and time. But for us to build strong friendships we have to spend time with people not there facebook timeline or tweet feed. So.... note to self by God's grace I will spend time with people and not just there tweets or feeds.

Tuesday, October 2, 2012

Apache Basic Auth through a Reverse Proxy

It took me like a whole day of googling to figure this out.Say you have a web service that doesn't have any form of authentication and you want to open it up to a public ip but still setup some security. If you are this guy then you may want to try basic auth.

Step 1 : Create password file
htpasswd -c /home/user/.passwdFile <username>

Step 2 : Setup the reverse proxy
Setup the reverse proxy

LoadModule proxy_module      modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule headers_module    modules/mod_headers.so
LoadModule ssl_module        modules/mod_ssl.so
LoadModule auth_digest_module modules/mod_auth_digest.so

ProxyRequests Off
ProxyVia Off

ProxyPass / http://127.0.0.1:1234/
ProxyPassReverse / http://127.0.0.1:1234/

127.0.0.1:1234 is the url:port that your webservice is running on. From the above commands your app will be open at 127.0.0.1:80
Remember to include the relevant modules as has been done above the proxy stuff

Step 3 : Setup basic authentication. My mistake was that I was using directory instead of location. Directory refers to to the filesystem while Location refers to webspace..url and stuff
so...

<Location />
    AllowOverride AuthConfig
    Options ExecCGI
    Order allow,deny
    Allow from all
    AuthType Basic
    AuthName "My awesome webservice"
    Require valid-user
    AuthUserFile /home/user/.passwdFile
</Location>


So put this in your httpd.conf file and restart apache.There you have it basic auth on a reverse proxy.
Bigups to http://stackoverflow.com/questions/5011102/apache-reverse-proxy-with-basic-authentication ,
http://httpd.apache.org/docs/2.2/howto/auth.html

Monday, October 1, 2012

Joy, Peace and Contentment

Happiness doesn't come from a well told joke. It is not sustained by money or the possession of a thing or gadget. A person can never make you happy or more peaceful. A peaceful environment doesn't make me anymore peaceful. Having more than enough doesn't make one content.So what do we really need in this life? If all this things and people do not meet our core internal needs.

All I know is that I need Jesus : my God and Saviour. All we think we need come as a result of a relationship with Jesus. Galatians 5:22 But the fruit of the Spirit is love, joy, peace, longsuffering, kindness....
Go to the source to get the product. Don't go to the product. It cannot reproduce itself.

Sunday, September 30, 2012

CodeIgniter Template : Cherry on top of the icing

Just started seriously using CodeIgniter after a long time of just looking at it. I came across an amazing library called Template. It allows you to create yeah...templates for your web page. Yeah one could argue that the same concept can be achieved using views but what amazes me is how good and flexible the template library is. Having come from using grails I needed something that made my coding life a bit easier and that would also bring back the good memories that came from using grails.
So here is the link http://williamsconcepts.com/ci/codeigniter/libraries/template/index.html

Load HTML content of other website via PHP

So what if you wanted to get the html content of another website from within php...easy


$response = file_get_contents("http://www.google.com");

echo $response;

Tuesday, September 25, 2012

Forking a git repo

Forking a git repo allows you to edit someone else's code and implement awesome ideas and in turn share those ideas with the developer community out there.

So basically forking a git repo is like moving a repo from someone elses account to your account but still maintaining links to the other repo if desired. So you can still update your fork so that it is in sync with the main author's code.

To get started
  • Go to git and for the repo you want
  • Clone the repo git clone url
  • Keep track with original code by setting the upstream url git remote add upstream originalRepoUrl. You still have references to your own origin
  • Pulls in changes not present in your local repository, without modifying your files by running git fetch upstream
  • To the merge in the changes to a local branch git checkout master; git merge upstream/master