Categories
programming Useful

Bash Infinite Loop raspberry pi

We are using a raspberry pi (with raspbian) to run a video file in a loop at www.dokodemoterebi.com, but this should work with any linux version.

Creating an infinite loop is very simple the following code will do the trick:

while true; do omxplayer /home/pi/myvideo.mp4; done

If you want it to run at start up, edit /etc/init.d/rc.local and copy the code above at the end of rc.local

Now you only need to power the pi and the video will run in an endless loop, log in or any input from the user is not necessary. Be careful as you will be locked out if you do this. If you need to change something in the future you can plug the disk into another linux machine or use ssh.

Categories
programming

How to search and replace all wordpress posts using phpmyadmin

Today I had to replace an specific text that was repeated on many of our blog posts. Fortunately there is an easy way to search and replace everything automatically.

First open your blog database on phpmyadmin and select SQL tab

 

Copy the code bellow and replace the text between the quotes with the desired text to be searched and replaced.

UPDATE wp_posts SET post_content = REPLACE (post_content, "text to replace here", "new text here");

Press go and the task will be done automatically.

Categories
programming

UTF 8 error on php

Warning:?Cannot modify header information -?headers already sent by (output started at …

If you get this?error on a php file that uses UTF-8 encoding it is because your editor creates a signature at the beginning of the file to mark it as a UTF-8 file. Most UTF-8 compatible editors will create and hide this signature (windows notepad too) and you will not be able to see and delete it.?Fortunately?the solution is very simple, if you use Windows run cmd, and use the old DOS editor to edit your file. You will see a few strange characters at the beginning of the file that are creating all the troubles. Just delete those characters and save the file. Remember that if you edit the file again with notepad or other editor that generates the signature, you will have to delete it again.

For more information about programming services please visit?/e/webservices.html