Yeah… I know…. my last post was 2 months ago. I´m so busy, working a lot.
But, I will start some posts with hints about streaming contents.
Using Shoutcast to provide streaming services
The basic concepts of Shoutcast is a encoder to send content to a server and a server which receives the encoder signal.
Download this files:
Encoder Linux: http://yp.shoutcast.com/downloads/sc_trans_posix_040.tgz
Server Linux: http://yp.shoutcast.com/downloads/sc1-9-8/sc_serv_1.9.8_Linux.tar.gz
And after the download, decompress(tar zxvf package.tar.gz) on a directory, like /usr/local/radio.
On Encoder, you will need configure the password which the encoder talk with the server and the source of media, like a playlist. A very basic setup, you can improve more the basic functionality of shoutcast encoder. See the lines to change below(sc_trans.conf):
; PlaylistFile (required EVEN IF RELAYING) - playlist file (to create, use
; find /path/to/mp3/directory -type f -name “*.mp3″ > playlist_filename.lst
PlaylistFile=example.lst
; ServerIP/ServerPort are the target server to send to
ServerIP=myserver.com(you can put a IP)
ServerPort=8000
; Password is the password on the sc_serv you’re sending to.
Password=yourpassword
; StreamTitle/URL/Genre define the data that appears on the directory and in the
; stream info.
StreamTitle=Name of Streaming
StreamURL=http://urlofyoursite.com
Genre=genre of your radio.
; Logfile optionally denotes a text file to log sc_trans to. a kill -HUP
; will force a close and re-open of this file (but will also cease logging to
; the console)
LogFile=sc_trans.log
; Shuffle the playlist
Shuffle=1
; Bitrate/SampleRate/Channels recommended values:
; 8kbps 8000/11025/1
; 16kbps 16000/11025/1
; 24kbps 24000/22050/1
; 32kbps 32000/22050/1
; 64kbps mono 64000/44100/1
; 64kbps stereo 64000/22050/2
; 96kbps stereo 96000/44100/2
; 128kbps stere0 128000/44100/2
Bitrate=80000
SampleRate=44100
Channels=1
; Quality is from 1-10. 1 is best, 10 is fastest.
Quality=1
And now, create the playlist with your mp3 files:
find /path/to/mp3/directory -type f -name “*.mp3″ > playlist_filename.lst
Time to configure the server(sc_serv.conf). Just put the same port of encoder and the same password.
Password=changeme
PortBase=8000
Save and close the file.
Now, start the server: ./sc_serv &
And finally, start the encoder: ./sc_trans_linux &
Maybe you will need change NAT configuration of your modem to redirect port 8000 connections to your computer.
All the best.
November 14 2008 | Tutorials and Uncategorized | No Comments »
Edit the file:
/etc/php5/apache2/php.ini
And look the line:
short_open_tags = Off
Turn it ON, and PHP will work with “<?” short tags too.
September 18 2008 | Hints | 1 Comment »
Wow…. weeks without posts.
Just some hints to work with linux.
Edit main.cf and put the line below:
smtp_generic_maps = hash:/etc/postfix/generic
Create and edit a file called generic on postfix directory:
Put the line below:
linuxuser user@validdomain.com
After, create a hash of generic file:
postmap /etc/postfix/generic
And finally… restart postfix.
ENJOY!!
September 18 2008 | Hints | No Comments »
In this tutorial, I will use a reference site.
Sometimes when you have a website with a lot of data on a MySQL database, is needed a backup, or a migration to another server using another DBMS.
I will use the ‘Products’ Example. There´s Products with Name and Prices.
<?php
/* Making the SQL query */
$query = “select * from products ORDER BY id_products”;
$results = mysql_query($query) or die ( mysql_error() );
echo “<products>”; /* Creating an element called ‘products’ */
/* Using while to return the query results */
while ($line = mysql_fetch_assoc($results) ) {
/* Creating a XML file with Elements Product, Name and Price */
echo “<product>”;
echo “<name>” . $line['name'] . “</name>”;
echo “<price>” . $line['price'] . “</price>”;
echo “</product>”;
}
/* Ending startup element called ‘products’
echo “</products>”;
?>
On this example, we can make a very simple XML file through MySQL database. We can improve a lot this example, using attributes and another nested XML. Another example, we can use a class - MySQL to XML - XML to MySQL developed by a brazilian, called Ricardo Costa. On linked website there´s examples how to use a PHP class to make this work.
Well… that´s the end! See you on the next post of ‘XML Series’
August 28 2008 | Tutorials | No Comments »
Howto: Using XQuery(with Nodes Method) to generate a XML file and after query the XML file on SQL Server 2005.
– USING ADVENTUREWORKS SAMPLE DATABASE
– DECLARE A VARIABLE WITH XML DATA-TYPE
DECLARE @xmlOrder xml
– SET THE VALUE OF DECLARED @xmlOrder VARIABLE USING A SELECT WITH STATEMENT ‘FOR XML AUTO’
SET @xmlOrder = (SELECT Cust.CustomerID CustID, CustomerType, SalesOrderID
FROM Sales.Customer Cust JOIN Sales.SalesOrderHeader [Order]
ON Cust.CustomerID = [Order].CustomerID
ORDER BY Cust.CustomerID
FOR XML AUTO)
– SELECT THE DATA OF XML GENERATED ON @xmlOrder VARIABLE
SELECT nCol.value(’@SalesOrderID’, ‘integer’) SalesOrderID
FROM @xmlOrder.nodes(’/Cust/Order’) AS nTable(nCol)
– THE RESULT WILL BE AN COLUMN CALLED SALESORDERID WITH VALUES OF SALESORDERID FROM THE @xmlOrder VARIABLE.
August 28 2008 | Tutorials | No Comments »
XML, the Extensible Markup Language, is a W3C-endorsed standard for document markup. It defines a generic syntax used to mark up data with simple, human-readable tags. It provides a standard format for computer documents that is flexible enough to be customized for domains as diverse as web sites, electronic data interchange, vector graphics, genealogy, real estate listings, object serialization, remote procedure calls, voice mail systems, and more.
You can write your own programs that interact with, massage, and manipulate the data in XML documents. If you do, you’ll have access to a wide range of free libraries in a variety of languages that can read and write XML so that you can focus on the unique needs of your program. Or you can use off-the-shelf software, such as web browsers and text editors, to work with XML documents. Some tools are able to work with any XML document. Others are customized to support a particular XML application in a particular domain, such as vector graphics, and may not be of much use outside that domain. But the same underlying syntax is used in all cases, even if it’s deliberately hidden by the more user-friendly tools or restricted to a single application.
The first concept to understand XML files is understand Elements, Attributes and Character Data.
For example, if you have a table ‘person’ in a database with columns Id,Name, Age and Address, we can export this information using XML:
<person Id=”555″>
<Name> Gabriel </Name>
<Age> 28 </Age>
<Address> Street XYZ </Address>
</person>
In the first line, we have the element called ‘person’ with an attribute Id with a value ‘555′. In the second, third and fourth line we have elements which receives the contents ‘Gabriel’, ‘28′ and ‘Street XYZ’.
An element is delimited by the start-tag and the end-tag. Everything between the start-tag and the end-tag of the element (exclusive) is called the element’s content.
Example:
<Name> Gabriel </Name>
XML elements can have attributes. An attribute is a name-value pair attached to the element’s start-tag. Names are separated from values by an equals sign and optional whitespace. Values are enclosed in single or double quotation marks.
Example:
<person Id=”555″>
But… why use XML? For the basics, we can export database data, like table contents to our suppliers, partners and websites.
And more: there´s a lot of DBMS in the world. MySQL, Postgres, SQL, Oracle, DB2…
For now, you understood the basics of XML files, but we have a lot of things to learn, how make any DBMS export data to XML, how manipulate data on XML files…
But… stay calm… we will discuse this topics on anothers posts.
Well.. see you on another post!
*DBMS - Database management system
August 27 2008 | Tutorials | No Comments »
I received an answer from Kenia, about Business Intelligence and Free Software. Honestly, I don´t know BizGres, a BI software to work with PostGreSQL. But I will make a test and a review about BiGres soon. Thanks by the answer, I still waiting answers for that question.
Links:
BizGres
Business Intelligence - Wikipedia
August 07 2008 | Review | No Comments »
http://jordimassaguerpla.blogspot.com/2008/08/installing-local-build-service-on.html
August 07 2008 | Hints | No Comments »
Gostaria de parabenizar por uma invenção tão significativa para a pomunidade brasileira. Como vamos *acabar com o desemprego* no país sem iniciativas brilhantes com essas?
Parabéns!
É sério. Aproveito para roubar ainda a frase do dia: Pequenos estados, grandes negócios!
August 07 2008 | News | No Comments »
Sorry, only PT_BR: “Adoro palestras onde os ditos “palestrantes” falam frases de efeito e mostram coisas impressionantes… é a melhor hora de fazer uma pergunta tosca e diferenciar um vendedor de um técnico.”
August 06 2008 | Review | No Comments »
Next »