I have been using Mac terminal to get a MAMP setup done lately and I kept running back in to and error I spent a lot of time trying to fix a while ago…sigh. This comes up when you try to install or update with brew.
Irshads-MBP:~ Ishy$ brew upgrade
Error: Cannot write to /usr/local/Cellar
Fix it this way:
sudo chown -R $USER /usr/local
Note: You can replace $USER to root as homebrew is better set with root.
Okay, since getting a 50″ Samsung Smart TV, I wanted to be able to stream existing videos from my Mac on the TV. Where do I start? Search for apps? Not helpful. Chromecast is the easiest and cheapest solution but its £35 and as a bit of an IT nerd, I would not go for that option. So, instead I came up with serving files via apache and php to stream. This is not the most convenient way as we will need to be editing file names every time we need a new movie added (which isn’t too bad) but I think would help many like me.
I assume the readers here are somewhat capable of editing configs, Apache and virtual hosts, terminal etc. Pop in any questions below if something is missing or still doesn’t work after these steps.
A Mac/ Linux system with Apache/ PHP (This is already built in on Macs)
Check if Apache works
sudo apachectl start
and in your browser, paste the below. This should display the page below.
If you don’t see this, that means we’ll need to fix Apache with some help from the section further down. But if it works, follow these next steps to continue.
1.Make a directory for our new files via terminal
sudo mkdir ~/Sites
2.Create a new user config (You can use the Mac user account short name)
sudo vi /etc/apache2/users/username.conf
3.Paste the following lines into the file and save + quit
Options Indexes MultiViews FollowSymLinks AllowOverride All
Require all granted
4.Now enable this user directory to serve files
Note: Take a backup of the httpd.conf file before editing.
cp /etc/apache2/httpd.conf /etc/apache2/httpd.conf.bak
sudo vi /etc/apache2/httpd.conf
5.Uncomment the lines below if they aren’t (Find the block by searching for “userdir”)
LoadModule userdir_module libexec/apache2/mod_userdir.so
LoadModule alias_module libexec/apache2/mod_alias.so
LoadModule rewrite_module libexec/apache2/mod_rewrite.so
LoadModule php5_module libexec/apache2/libphp5.so
6.Final change to be made
sudo vi /etc/apache2/extra/httpd-userdir.conf
Uncomment the following line in this file, save and quit.
Embed HTML5 Video
Now that our servers are working fine and the new directory from step 1 is being served, we need to put some html files in here to access the video we will be embedding. Smart TV’s do not usually support streaming video on their inbuilt ‘browsers’ but can ‘play’ html5 content.
Video file you will be serving:
Video and HTML File location:
HTML file name:
1.Create html file in the ~/Sites directory and paste this code in and save.
<p3 style ="color:Black;font-family:papyrus"><center><b>Daredevil HD</b></center></p3>
<video width="640" controls> <source src="/Users/username/Sites/Daredevil.mp4" type="video/mp4"> </video> </center>
2.Check on browser (This is what you should see on the Smart TV)
Type in the following address and you should see a page as below
Unless you’ve broken the configs. If you have, follow steps here to fix your Apache configs and start over from Step1 above. This site also provides a default copy of the httpd.conf file which can be used to start clean.
Note: Create backups of all files that you will be editing/ replacing.
So I managed to squeeze a week off work (effectively giving me 9 days off work) to fly to Sri Lanka (home!), see family and friends and make use of my SLR a little more. Flew out on the 27th Nov Friday morning for the whole day via Qatar and arrived on Saturday. It was great to see family and then met up with friends by the beach in Wellawatte where we used to hang out in the old days (you can actually skip to the gallery below!).
As this was such a short visit, I had to make myself feel like I’ve done loads for the week. So I plan this whale watching trip in Mirissa (Down south) which is a well equipped boat tour leaving at 7 in the morning from Mirissa Naval Quarters/ Harbour. We got to see some dolphins, flying fish and a whale. If you’re lucky, you’ll see more whales. We couldn’t spot many and therefore I did not spend time clicking away and wasting my opportunity to get glimpses of this majestic creature. Everyone apart from the crew and my group of 5 were tourists from abroad and it was great to see so much diversity in Sri Lanka 🙂
Next up was Yala National Park. I called my old safari operator who also happens to have his own guest house (JC Guest) close to Yala. This also includes a Cabana. Very nice personality he is. I would recommend anyone. The prices are cheap too. At the end of the safari, he even served us Tea in a nice warm pot with tea-cake at the Cabana, with dimmed lights. The ambience was soothing to end the tiring day.
(The photo sets may need to be viewed separately if viewing using next keys)
Below is a command example on how to easily Zip compress files in Linux via command line.
If you cannot find the zip package, install it using your Linux package manager
(e.g. apt-get install..)
ishy@server:~/home$ zip filename.zip filename1.txt filename2.jpg filename3.txt
Ask any photography enthusiast, professional; ‘Autumn’ would be the most likely answer to the question ‘What’s the best time to take photographs?’
Today, I had some time to walk around Wakehurst Place, a branch of Kew Gardens in the UK to snap some shots. It’s been a very long time since I used my SLR as I was held up with my MSc and other mental commitments!
All rights reserved.