Friday, November 25, 2011

Quick install LAMP server on Ubuntu

Here is the site I am going to summarize here: https://help.ubuntu.com/community/ApacheMySQLPHP
I am using Ubuntu 10.10 for this install. It should take 10 minutes or so to follow these steps.
The fastest way to install Appache2, PHP5.3, and MySQL is to use this command:
sudo tasksel install lamp-server
If you are using 11.04 then tasksel might not be installed. Then use this to install it:
sudo apt-get install tasksel
Tasksel will install the Lamp server but won't remove it, but we won't need to remove it.
At this point go to http://localhost and it should say "It works!"
Next use this command to make a new site:
sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/mysite gksudo gedit /etc/apache2/sites-available/mysite
Make a folder in your home folder called webhome or anything you want to put your website in instead of the default var/www because I like to be able to edit the website files from my home so I own them and don't have to use sudo to edit them as root. Edit the DocumentRoot line to point to your new web root: /home/user/webhome/
Change the Directory directive by fixing the path to point to your webhome folder. Instead of <Directory /var/www/> use <Directory /home/user/public_html/>
After saving the file in gedit use these commands to disable the default website and enable the new website.
sudo a2dissite default && sudo a2ensite mysite sudo /etc/init.d/apache2 restart
Next make a index.php file in the webhome folder that says:
<?php phpinfo(); ?> Now go to: http://localhost
You should see the php configuration showing all the php settings.
This was pretty easy. They have streamlined alot of these steps.

Tuesday, November 22, 2011

Idea for making midi or tracker sequencer in html

I would like to make a sequencer in html5. I think its possible and I have been researching how it can be done. The main problem will be making it work in the main browsers and not just 1 or 2. You could make tracker mod music play from firefox by installing vlc and check vlc firefox plug-in when you install it. That works and allows you to add files to the playlist using simple javascript. I made a demo which plays, stops, goes to next track and pauses the music. It works but then the next problem would be how to make the .it or .xm or .mid or .mod file on the fly using the server. Would that be done using a batch command run from php or could it be made using pure php. This would be faster than creating wave or mp3s on the fly and uploading them.
Here is a link to VLC's wiki talking about how to make the embeded object work in firefox and controlling it using js.
http://wiki.videolan.org/Documentation:WebPlugin#Playlist_object

Then I thought this was not really good either since its using old technology and when I refreshed the page it would crash the plugin too. I found a new way to run midi type files in firefox at least and maybe Chrome, Safari or Opera which use webkit.

I found this site:
http://weare.buildingsky.net/processing/audionode.js/examples/index.html
The top example works sort of:
http://weare.buildingsky.net/processing/audionode.js/examples/drum-machine.html
It uses javascript and html5's audio object to create audio from scratch like wave files.
https://wiki.mozilla.org/Audio_Data_API

You tell it what the sample rate is and then feed it all the data in an array. 44100 samples per second is the normal rate. Its the quality of CD's and it seems to work. There is a website I found which converts .midi files to wave channels on the fly in javascript on the client and plays them using firefox.
http://jsspeccy.zxdemo.org

It will take time to learn how to use this to make a cool sequencer program all on the web but it looks like it would be possible. I just need to know how to make sounds either wave files or how to make track files and then convert them to wave files to play in the browser. Its easy to make a simple sine wave but how do you introduce other sounds into the mix?

Sunday, November 6, 2011

Get amazon ASIN using javascript

I was wondering how this can be done and found a couple answers on: http://stackoverflow.com/questions/1764605/scrape-asin-from-amazon-url-using-javascript
url = window.location.href;
url.match("/([a-zA-Z0-9]{10})(?:[/?]|$)");