Skip to content

How to disable in app browsing in recent twitter app.

May 30, 2016

Recent updates of the twitter app forces one to browse links in an embeded app.

This messes with my flow as i want to open the links in chrome keep reading my time line, then read the webpages from the links.

If this is also you then maybe you want to disable the in app browsing feature. Its quite simple.

On my android device, its Settings-> General-> Display and sound -> uncheck use in app browser.

Hope that helps.
Cheers!

Using CakePHP 3 with php7

May 14, 2016

The new php7 release seems to be the buzz in the php community at the moment, not with all the speed gains being touted and what not.

Any ways for CakePHP3 users looking to make the jump from php 5 to php 7, this one is for you.

To setup php7 on ubuntu do the following

sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.0
sudo apt-get install php7.0-mysql

To get your cakephp3 setup working you need the intl and mbstring module as per the official installation requirements

Install them like so

sudo apt-get install php7.0-intl
sudo apt-get install php7.0-mbstring

That should get your cakephp3 working!

Confirm use of php7 by viewing the output of phpinfo();

Cheers!

Using your digitalocean droplet to host multiple domains (php websites)

November 15, 2015

Now you have your own brand new VPS with 20GB of disk space. But that app you were making to test your new idea only uses 2GB.

My what a waste you might think.

Well…not really. You might just want to consider using that droplet to host 1, 2 or 3 more ‘small’ apps instead of spawning a new VPS any time you have a brain wave.

You can achieve this using Virtual Host feature in apache

Before you start

  1. I assume your VPS has been created and running Ubuntu (my instance is 14.04)
  2. You should set up apache and mysql and php as per your usual practice

Now that we have those out of the way, we will create a virtual host to host domain example.com here goes nothing:

  1. Create directories to host each ‘site’: At the time of this writing, Apache installed via apt-get on ubuntu 14.04 is such that your web files are located at /var/www/html/. We will use sub directories of this path to host our ‘sub sites’. So our example.com domain will be hosted at /var/www/html/example.com/public_html/. Go ahead and create that directory like so:
    mkdir /var/www/html/example.com/
  2. Grant permission to the directory: We need to define permissions for this directory such that our ubuntu user will ‘own’ the directory. You can do that by running
    chown -R $USER:$USER /var/www/html/example.com/public_html/
  3. Create a demo index.php file and drop in the public_html directory above.
  4. Create a virtual host file called example.com.conf at /etc/apache2/sites-available/example.com.conf. The content of the file will be:
<VirtualHost *:80>
    ServerName example.com
    ServerAlias www.example.com
    ServerAdmin admin@example.com
    DocumentRoot /var/www/html/example.com/public_html/

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<Directory "/var/www/html/example.com/public_html/">
    AllowOverride All
</Directory>

5. Enable the virtual host file like so:

a2ensite example.com.conf

6. Reload apache server by running

service apache2 reload

 

Once this is done, you will need to point your domain to the ip of your digitalocean droplet.

You need to wait a while for the DNS information to propagate (it may be a good idea to do this first before configuring the virtual host so that your waiting time is not so long)

Test your setup by pointing your browser to example.com and see your virtual host in action.

You may repeat these steps as many times as you want (or as many time as your VPS can tolerate) to create more sites on he droplet.

PS: To automate the above steps, i have written a python script called makevhost.py

Just run it like so

sudo python makevhost.py

Enter the name of the domain you want to create a virtual host for and viola!

Download makevhost.py from my github by clicking here

I want to test my php web application but mail() function isn’t working on my localhost

January 5, 2014
tags:

Ah!

It happened to you too?😀

Apparently you need to set up an emailing software to handle the actual heavy lifting failing this, no emails would get sent.

postfix is the grand dad freeman in this case but it is quite involving to configure correctly

ssmtp is the lightweight alternative

Install it like so

sudo apt-get install ssmtp

edit /etc/ssmtp/ssmtp.conf

look for ;mailhub, remove the ; and edit it to look like the following

mailhub=smtp.gmail.com:587

 

Add the following lines under the line above
UseSTARTTLS=YES
AuthUser=your_google_username@gmail.com
AuthPass=your_google_password

 

edit your php.ini

look for sendmail_path

‘uncomment’ it and edit the line to look like so

sendmail_path = /usr/sbin/sendmail -t

Restart your apache server.

Your mail function should now be working!

Your website is on digitalocean. It loads OK without www, but once you add www it doesnt work.

December 11, 2013

This one is actually very frustrating if you dont know what to do

Well here goes.

Log into your digital ocean control panel

Go to DNS

Under domains

Click the view button after your_domain_name

Add a new Record

Select CNAME

Name: www

Hostname: @

Save it and give about 1 hour for the new information to propagate via DNS

N.B

If you use * as name instead of www. You have essentially created a wildcard. So www and pretty much any thing can be appended to your domain and it will still work. It’s actually useful in case a user types ww or wwww. They wont get an error, your page will load quietly and forgive the mistake.😀

Your SSL Certificate is trusted on desktop but not on mobile (especially android)

December 11, 2013

I had this problem show up while setting up a VPS for one of my projects.

This project is APACHE based!

Researching the web showed up several clues, but sometimes you have to be a detective to piece it all together. It took me like a week!

As it turns out, the problem i had was a chain issue.

And fixing it was simple

Check here to make sure your issuer is recognized by android: http://www.andreabaccega.com/blog/2010/09/23/android-root-certification-authorities-list/

To know what ssl issues exist with your certificate, you can use this free tool to analyse it:  https://www.ssllabs.com/ssltest/analyze.html

If your challenge is chain issue then you need to find your host configuration file

Check the part where SSL instructions go

You are specifically looking for

SSLCertificateFile /path/to/certificate/file
SSLCertificateKeyFile /path/to/certificate/key/file
SSLCertificateChainFile /path/to/certificate/chain/file
SSLCACertificateFile /path/to/ca/certificate/file

For desktops, the abscence of the SSLCertificateChainFile does not cause a problem.

IT DOES CAUSE A BIG PROBLEM ON MOBILE.

So make sure you get a certificate chain file for your server from your issuer and  upload it.

Once you do add the instruction to your configuration

Restart apache…cheezeballs!

At least this was what solved my issue.😀

Is a loud ring tone a bad thing?

August 4, 2011

My phone by default came with the classic “greeeen greeeen” ring tone with is loud enuff for me to hear anywhere in the house, such that I almost never miss any calls. My ears are so sensitive to the sound, I sometimes hear my phone ring when it actually isn’t! This last sunday, I was looking for a new theme so I downloaded this “earth theme” in the spirit of “eco-friendliness”. I didn’t like it so I removed it almost immediately. While my theme setting was reverted to the old, my ring tone remained a relatively muted play of MJ’s earth song. So along came yesterday. I picked up my computer, started an application I was working on and I spent 8 quality hours working on it without remembering my phone. I concentrated on it fully, solving problems as they arose…
Compared to “pre-ecofriendly ring tone” days, one loud chime or the other would have interrupted by thoughts. I woulda answered a few calls, checked my email every now and then, an email may lead me to follow up on an “interesting” article, breaking my concentration into shreds, leaving me to pickup the bits and pieces over and over and never getting meaningful work done! Sure I missed a few calls, did not hear some “breaking news” till much later but…
Mobile phones are a necessary part of our lives, but they come with risks. The biggest of which, at least in my opinion, is their ability to “use you while using them” thus distracting you perpetually.
So while the earth song is the only MJ song I know that I don’t like (really!), I’m so keeping this ring tone, until my ears get hypersensitive to it!