Sunday, April 5, 2015

Wordpress and OwnCloud on Android

End Results

I got Wordpress, OwnCloud, ssh, samba, ftp hosted on android device acting as my home server for movies, music (playlists of remote files) from an ext3 portable hard drive all on 9 watts.

What you need

Android device (duh), optionally rooted
Servers Ultimate($4 but worth it)
SambaDroid (Servers ultimate's ssh is broke, and SambaDroid supports users)
BSPlayer (Plays remote files, can create playlists with recursivly listing remote directories)
MXPlayer (best remote player bar none due to codec support)

Wordpress and OwnCloud

Php and MySql

Wordpress requires PHP and MySql. There are only a few contenders for this niche market. I've tried AndroPHP, PAW, Utli server, KSWeb, Bit web server, Palpa Web Server. AndroPHP was the only free functional one, while the rest cost past the 5 day trial. If you're going to spend the dough spend it on something that has the kitchen sink, and boy does Servers Ultimate Pro have every server you could want when you're interested in using android as a linux server.
After installing Servers Ultimate Pro Start up the MySql server (all configuration we care about is handled in phpmyadmin.)
Check the Start on Boot option, and repeat for all the servers below.
Now start the mysql server.
Create a "web" folder somewhere on an SD card or external storage where we'll be putting the wordpress root folder.
Create a php server. Check the "Enable PhpMyAdmin". Set the Document root to the "web" folder you created above. Start both servers up. If you have root enable root forwarding so your web server can take traffic on port 80 (the port all browsers default to when going to www.bla.com. Without root you'll be stuck with something like 8080. This implies that links to your site will need this unusual www.jim.no-ip.com:8080 link. Sites like no-ip.org have mechanisms to redirect sites(:80 -> :8080), but can't overcome this limitation)
In a browser navitate to 127.0.0.1/phpmyadmin
or 127.0.0.1:8080/phpmyadmin if you don't have root
On the login screen use username: root , password: <blank>
Welcome to the dashboard for your MySql server
change the password to whatever you like.
Go to the Users tab and create a new user called "wordpress". 
Under Host put localhost. 
Put in some password for wordpress's database needs that you can remember (best to have it different than the root password).
Be sure to select "Create database with same name and grant all privileges"
Then "Add user"
Do the same as above but for "owncloud"
You're done with phpmyadmin.

Wordpress

Download the wordpress zip and unzip it in the "web" folder.
In a browser navigate to localhost/wordpress
Enter the username and password you created above into the wizard for wordpress and choose localhost for the host that wordpress connects to.
Voila, you have wordpress. I'll walk you through making it pubically accessable later.
If you want to download the wordpress app on your android device for easy editing of your blog posts you'll need to be connected to the internet at least when entering in the hostname of your blog (localhost), but after that you can be offline and make edits to your local wordpress blog.

OwnCloud

Download the owncloud tar file. Unzip it in "web". Owncloud was a bit more tricky because they expect to be on a linux system more than wordpress does. I had to remove two checks in /lib/private/util.php. Because OwnCloud may update this file I'll simply point you to the code I had to delete. It'd be nicer if the code checked if it was running on android and ommitted this check, but eh. I had to delete the if statement around line 622 refering to isSetLocaleWorking. I also had to replace the contents of the function titled checkDataDirectoryPermissions. Simpy replace all the stuff inside the curly braces with  return array(); Android doesn't do that well with these permissions. I with I could do better here.
In a browser navigate to localhost/owncloud
Be sure to open the database section and put in the username and password you created above. It could use sqllite, but we're shooting for the stars here.

Samba network share

For some reason Servers Ultimate Pro's Samba server triggers a null pointer in ES File Explorer. SambaDroid (even the non pro version) I found sufficient. It allows one user username: android password:<blank> which you can change. It restricts you to one root directory to be shared, which I chose to be the /mnt folder. Because it's restricted by credentials I felt it was safe enough.
With this samba server running I was able to stream movies and music from MXPlayer and BSPlayer respectivly.
MXPlayer works great with ES File Explorer because with ES you can easily navigate to the NAS server using the device's IP address and credentials. Clicking on a movie will trigger MXPlayer to take over and stream across the network. MXPlayer has the added benefit of having 200% volume capability which helps with android devices and some movies.
BSPlayer was the best at being able to play an entire folder on a network share and create a playlist from it.

Remote Management

Use Servers Ultimate Pro's ssh server to open ssh access. Be sure to add a user in the ssh server settings before turning it on. Also install BusyBox if you want to make sure that the command line tools you want are there.

In another post I'll talk about how to open your server to the internet, as well as protecting your data.

Monday, September 16, 2013

Static site

Making your own Static Website

Under construction

Intro

You can make a website for free. Want to start a forum, make a website for your startup, showcase your latest creations and get buyers, make a website for your church with a forum.  I'm going to outline my findings for 100% free options for creating your own website.

If all you want is a walkthrough of how to make your own website click here for a tutorial

Free Website options

First check out these polished website making sites. They have easy theming, customer support, active forums, and often allow embedding of HTML widgets for further tweaking.

Blogger

While you may think "I don't want to make a blog" the concept of having  pages, and posts are often enough heirarchtical nesting to suit your needs.  Blogger can give you direct access to the underlying HTML
free sub-domain at  XXXXXX.blogspot.com


Wix

Beautiful and very polished website creator. Drag 'n drop feel with an HTML widget box option.
free sub-domain at XXXX.wix.com, or pricing option to migrate your domain over to them.
  They already have a google calendar integration app and "call me" app, both free.
  Hit up the app store when editing your website and browse their rather rich set of apps available. The dropbox/GDrive app for direct access to a cloud folder was intriguing.


Tumblr

I havent had much experience here.  I expect a fair amount of customization here.


Google Sites

Google has done a great job pulling it all together. You tell it the name of your company, address... and they send your business a postcard to verify it's you. You then get a polished website with full traffic metrics, Google+ integration, bla bla bla.


AppEngine

Sometimes you just need some server side computation either triggered time-wise, or by it getting an HTTP request (website hits a URL). AppEngine takes in your PHP/Python/Go code, which takes in HTTP requests and returns whatever, including HTML. The free account has daily request limits, application emailing limits, and file access is limited to interaction with google datastores (no free MySQL access).  Google's data storage is fast, indexed, and easy to use.  They also handle spinning up multiple instances world wide for low latency.

Wordpress

While you can pay Wordpress.com to host your wordpress pages, you too can host them.  See this post for instructions on going this route.  Sometimes wordpress plugins require you to go this route.

Hosting

Dropbox (Pancake.io)

Pancake.io is needed to make your files directly accessable from the web w/o needing to click on a "Download" button for your .html file.
Files in your pancake.io folder (subfolder in your dropbox) are available online including css, js, html... files.  I recently ran into a problem with very large files, but pancake/dropbox is probably paying per megabyte downloaded.
2 GB is free, and is probably sufficent, with easy free actions to get more storage if you like backup.
While pancake.io has an online text editor, editing code isn't that nice.


GDrive

Where this really shines is apps that allow you to edit your online files.  Sharing a folder publicly is easy, but getting a direct line, w/o some hoop jumping isn't quite there.

Non-profit

If you're making a website for a non-profit organization check out dreamhost. They offer free hosting

Shortened URL: Bitly

bit.ly/polishedWebsite
If you're serving your flat website from some obscure base URL this provides an easy way to get a simple looking URL.  Bitly lets you pick the part that comes after bit.ly/XXXXXX if it isn't already taken. The url redirects to your long website URL.
You can change the redirect URL at a later point if your files are getting served from elsewhere.
bit.ly offers you nice traffic metrics to visitors, which can be duplicated with widgets.


Free domain: NoIp

Sometimes you want a domain for free. noip.com lets you sign up for a sub-domain common.no-ip.org for example, which will point to an IP address.  You can even host your files from your phone and install the no-ip app which can automatically update the IP address whenever the app notices your phone changes IP addresses.  Every month you need to click on a "I'm still alive" email link, but is free.
Note: If your server (either on your computer or phone) doens't have permission to make a customer server on port 80 you'll need to configure no-ip to redirect traffic to a different port. The user's URL in their browser does change to your IP:port which makes bookmarking less than nice.

Widgets

Forum

Nabble gives you an embedable forum with full admin features.  If all you want is a forum nabble provides a domain for your forum for free.  Registered users (registration is free) can post HTML content. You, as the admin, can edit each page and override each type of page's functionality for a highly customized forum.  You can also change the format to model a blog, Gallery, News feed... because they're all based on the same concept.  A forum is just one way of creating a tree.


Comments

Most blogging sites come preinstalled with comments, and may or may not allow you to disable the requirement that commenters be registered somehow (AIM, google, yahoo...). Allowing anonymous comments may be your way of having a low entrance bar. This widget also allows you to either require or not require some form of registration. If you're just doing some low level HTML junk and want a comment section this is easy to set up. There's the variable hbc_user.PAGE that you can set for each page of seperate comment threads

Call Me

With Google voice you can add a widget to allow viewers to call you.  Don't worry about having your phone number plastered all over the web.  The widget has the viewer enter in his/her phone number and google calls both of you in one call.


Chat area

     Here's a flash based chat window http://xat.com/web_gear/chat.php
     I like to disables the smileys (We're in the 21st century) and have a transparent background.
     Here's a javascript chat window http://embedded-chat.com
     You can either have the window come out of a tab on the side of the page, or be in a div somewhere


Polls

  1. Google Docs allow you to make a form and get access to the results in a spreadsheet.  You can view the form and extract the textboxes with their IDs and rearrange them as you see fit.  See the chart option below for more fun.
  2. Nabble forum's allow you to post a new thread with a poll.


Charts

    Google spreadsheets allow you to pull data from an imported file, a table in a web page, CSV file, or text field using some XML class path in a web page.  You can then assemble the results and make a chart from them.  Click on the arrow and "Publish Chart" then embed this in your web page. 


Flixn

Use your webcam to talk with people face to face.


Ebay

With this tool you can show an up-to-date listing of your recent ebay items you're selling


Maps

You can show a map to your store, favorite spot to hike, or the area you grandfather lived. For the adventurous you can call on Google's Maps javascript APIs to do some really fancy things.


Social Network windows / Like buttons

Facebook

Do you have something you'd like people to like?


Google+

My personal favorite.  I may be biased though


Linkedin

Embed your profile right on your site.  No more needing to update your skills in multiple places


RSS feeds

Do you have some RSS feeds that you'd like summarized on your page?


Music

I can't really recommend one, I haven't used one. Providing a link to the mp3 file you saved and made public in a cloud drive is an option, however may be illegal depending on what the mp3 is of.


Tag Cloud

Do you like the jumble of words that give a birds eye view of what a page or blog is about.  Point this tag cloud at your site and get an embed code to slap into your page


YouTube

Embed videos right into your site. Teach lessons with videos. Alternatively you can link to a playlist you created.


Twitter

Do you want your tweets to appear right on your webpage?  I don't have a twitter account so I don't know if their widgets require a server backend.


Flickr

Javascript Toolboxes

CKEditor

HTML wysiwyg editor.  In a nutshell it wraps itself around whatever div/textbox you point it at and it lets you change the contents with html elements.  While it assumes saving by calling some PHP, the full version (also free) has a "Source" button which you can copy and paste out.
Embed this into your page so you can edit the whole page in a textbox online.
You can link directly to their nightly javascript build so you don't have to copy their folder to your public cloud folder

jQuery UI

I haven't had to use these features, but, oh boy, do they look slick.
W/o a php running backend, the user won't be able to save their work, but you may find creative uses of rendering whatever data you have

CSS

css files are used to play with the formatting of your webpage.  With them you can change the font size of all section headers, or make them all centered. This is only skimming the surface of what is possible.  For the newbie it's probably easiest to simply swap out one css file for another till you find one that looks good for your content.  If it's almost right I encourage you to get a basic understanding of how css files work so you can find the section that's tweaking the aspect that's not quite right.

Bootstrap

Here be some beautiful css files.