Shoutcast version 1.9.8 (mp3 straming for free)

T​he shoutcast v2, don’t allow mp3 streaming unless you subscribe to Yepp (cost $5). The shoutcast v1 does not have such restriction. So i went to save cash and moved to v1. If someone is finding hard to get download link of v1, here is it:​

http://dynapub.shoutcast.com/broadcast-tools

​Rest usage is pretty simple:

1) Extract the server, and configure the shoutcast server

vim ./sc_serv.conf

In that you can change port (default to 8000) & broadcast/admin password. Nothing else required to touch, unless you know what you are doing.

2) Run the server (preferred in screen)
./sc_serv sc_serv.conf​

​​

​All for now.​

Posted in Uncategorized. Leave a Comment »

gVim for PHP – windows config

Recently, i tested another editor for PHP (@mwasim, @zshah, @zkhan … which is actually my time wasting hobby). Reason was PDT and Zend was eating up my laptop’s resources and making it too slow. I am fan of notepad++ but it lacks some speedy work which we have in SublimeText. Sublimetext is really nice, but 1) Paid 2) Slow at big files.

The new experiment is not really an innovation. It is the GUI version of linux ‘vim’.

gvim for php

I tweaked some startup config in _vimrc (placed C:\Program Files\Vim).

colorscheme darkblue        " my theme
set guifont=consolas:h11    " my font
set nu!                        " line num

map <C-e> <Esc>dd            " delete line
map <C-d> <Esc>yyp            " duplicate line

let g:netrw_liststyle=3        " tree like explorer
let g:netrw_altv = 1        
let g:netrw_preview = 1

set smartindent                " indenting to 4 space
set tabstop=4                
set shiftwidth=4

Vim comes up with lots of shortcuts, but it gets comfortable only when you used to few tricks. It’s faster than any other so far.

Quick Usage Tips:

- You can open any file in VIM using right click context menu
– Either goto Windows -> File Explorer OR write :Ve command (vertical split explorer)
– Use arrow key to navigate files, and when opening press ‘v’ (for vertical split) or ‘t’ (for new tab)
– Use ‘Ctrl+w+c’ to close any window
– And the key source for file explorer help, try :h netrw

Useful Plugins:

The most wanted sublimetext like Ctrl+P feature in gVim. Install this plugin. Download the archive and place override all the folders inside the vim directory.

screenshot

Posted in Uncategorized. Leave a Comment »

ASP.net gridview in PHP

A good alternate is available on www.phpgrid.org.

The default ASP.net gridview is something like this.

You can see the live working and screenshots from following links.

- Demo Center
Screenshots

Posted in Uncategorized. Leave a Comment »

How to block spambots by user agent using .htaccess

http://healyourchurchwebsite.com/2008/05/27/how-to-block-spambots-by-user-agent-using-htaccess/

# redirect spambots & rogue spiders to the end of the internet
Options +FollowSymlinks
RewriteEngine On
RewriteBase /
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} ^$ [OR]
RewriteCond %{HTTP_USER_AGENT} ^EmailSearch [OR]
RewriteCond %{HTTP_USER_AGENT} ^Microsoft\ URL [OR]
RewriteCond %{HTTP_USER_AGENT} ^Web\ Image\ Collector
RewriteRule .* - [F,L]

Setting up Mp3 Streaming Server (Icecast) on VPS (port 80)

Step 1: Download RPM from following url as per your VPS architecture (e.g. Centos 64bit)

http://pkgs.org/centos-6-rhel-6/centalt-x86_64/icecast-2.3.3-1.el6.x86_64.rpm.html

cd /opt
wget http://pkgs.org/centos-6-rhel-6/centalt-x86_64/icecast-2.3.3-1.el6.x86_64.rpm/download/

Step 2: Install it using yum

yum install icecast-2.3.3-1.el6.x86_64.rpm

Step 3: Set Config

vim /etc/icecast.xml

Change source password, relay password, admin password. Also set mount point to ‘/live

<authentication>
<!-- Sources log in with username 'source' -->
 <source-password>mynewpass</source-password>
<!-- Relays log in username 'relay' -->
 <relay-password>mynewpass</relay-password>
<!-- Admin logs in with the username given below -->
 <admin-user>admin</admin-user>
 <admin-password>mynewpass</admin-password>
 </authentication>
<listen-socket>
 <port>8000</port>
  <shoutcast-mount>/live</shoutcast-mount>
 </listen-socket>

And that’s it. It will start listening on port 8000, when you start service.

Optionally you can also have multiple mount points by adding following config.

<mount>
 <mount-name>/live</mount-name>
 <password>pass-live</password>
 <max-listeners>100</max-listeners>
<dump-file>/tmp/live.mp3</dump-file>
 <fallback-mount>/live-backup</fallback-mount>
 <fallback-override>1</fallback-override>
 <fallback-when-full>1</fallback-when-full>
</mount>

Step 4: Start service + Set for auto start on boot

service icecast start
chkconfig incecast on

Step 5: Run on Port 80

If you want to run it on port 80, due to firewall issue of listeners … you can manage it using mod_proxy module of apache.

For that, check your httpd.conf and see if mod_proxy module is not commented.

LoadModule proxy_module modules/mod_proxy.so

Next, go to your apache public_html, and in .htaccess write following rule.

# streaming on port 80 - icecast
RewriteRule ^live.mp3$ http://domain.com:8000/live [P,L]

This will enable streaming via http. You can now access http://domain.com/live.mp3 to connect to live broadcast.

Step 6: Setting Streaming Server

Icecast is supported many free streaming servers like VLC and Winamp. But i prefer Samcast due to simpler interface but it’s trial and shows popup at random time to buy.

Open Samcast.
Click of Settings link on top -> Capture sound form device
You can select ‘Sound Mapper’ to broadcast speaker out or ‘Mic’

Click Encoder -> Click +
Choose MP3 Lame encoder -> Click OK

On first tab ‘Converter’ select your desired bitrate to stream (16k) and mode (mono/stereo)

On second tab ‘Server details’, select ‘Server Type’ to IceCast
Server IP: your-domain.com

Server Port: 8000 (default)
Password: mynewpass (as set above in tutorial)
Mount: /live (as set in config)
Optionally set, station name, description and website options.

Click OK, and it will add new encoder.

Select newly added encoder and click ‘Play’ button.
If everything goes fine, it’s will update status as ‘Encoding’

Now on main Samcast window, click circle blue button ‘Start’ to start streaming.

Debugging: If you wish to see log, please check

# tail -f /var/log/icecast/error.log

Step 7: Setting up client

We can have desktop clients like winamp or vlc which work smooth. Just open file and give your streamer path.

In our case, it’s http://domain.com/live.mp3
You will hear the playback after little buffering.

If you wish to have web based player, visit following link
http://andy.ehandysoft.com/shoutcast-players.html

JWPlayer is also very stable and work for mp3 streaming. A

In both cases, all we have to do is to give file path:
http://domain.com/live.mp3

That’s It. Phew, long article.

Tool for Twitter Bootstap Color Contrasts Selection

It takes an images, and pick high,low,mid contrast colors to generate theme for bootstrap. You can then customize and replace your bootstrap.css files.

Very resuable tool, saved a lot of time.

http://www.lavishbootstrap.com/

Posted in Uncategorized. Leave a Comment »

Simplest Dovecot Web-based Mailbox Management

I initially had a lot of hard time searching for admin interface to manage dovecot mailbox and user accounts, but finally found a solution. It was the simplest and quickest by my googled research.

Logging it for future reference.

http://www.howtoforge.com/perfect-server-centos-6.3-x86_64-nginx-dovecot-ispconfig-3-p4

11 Install Dovecot

Dovecot can be installed as follows:

yum install dovecot dovecot-mysql

Now create the system startup links and start Dovecot:

chkconfig –levels 235 dovecot on
/etc/init.d/dovecot start

12 Install Postfix

Postfix can be installed as follows:

yum install postfix

Then turn off Sendmail and start Postfix:

chkconfig –levels 235 sendmail off
chkconfig –levels 235 postfix on
/etc/init.d/sendmail stop
/etc/init.d/postfix restart

This will setup the server. And finally the magical tool was ISPConfig.

http://www.howtoforge.com/perfect-server-centos-6.3-x86_64-nginx-dovecot-ispconfig-3-p7

After installation, it was really very simple to add domain, then mailbox and then connect from outlook express, without going in dovecot-mysql detailed configuration. See attached screenshot for more.

Troubleshooting

In this setup, i got stucked at 3 places. Actually i didn’t followed complete walkthrough instead installed postfix, dovecot+dovecot_mysql, ispconfig.

1) Postfix mail  receiving issue, warning: do not list domain domain.org in BOTH mydestination and virtual_mailbox_domains

It started fetching mailbox folders but was receiving any emails. In logs it shows

Nov 24 06:16:34 domain postfix/trivial-rewrite[31898]: warning: do not list domain domain.org in BOTH mydestination and virtual_mailbox_domains
Nov 24 06:16:34 domain dovecot: imap-login: Login: user=<support@domain.org>, method=PLAIN, rip=72.29.80.225, lip=72.29.80.225, mpid=31910, TLS
Nov 24 06:16:34 domain postfix/local[31908]: 93C3F316800D: to=<root@domain.org>, orig_to=<support@domain.org>, relay=local, delay=0.22, delays=0.12/0.05/0/0.06, dsn=2.0.0, status=sent (delivered to mailbox)

Solution: http://www.howtoforge.com/forums/archive/index.php/t-59061.html

Added subdomain in /etc/hosts and /etc/postfix/main.cf

mydestination = mail.domain.org, ……

The hostname defined in main.cf of postfix should not be your domain.org, instead some sub domain e.g. mail.domain.org.

2) Postfix was not sending emails giving error in /var/log/maillog : (delivery temporarily suspended: connect to 127.0.0.1[127.0.0.1]:10024: Connection refused)

Solution: There were many solutions on web, but case was i didn’t installed ‘amavisd’ from walk through and it was preset in ISPConfig postfix config main.cf. Commented it’s filter and Postfix SMTP also worked.

#content_filter = amavis:[127.0.0.1]:10024
content_filter =

http://www.textndata.com/forums/delivery-temporarily-suspended-connect-127-a-49572.html

Another solution could be properly follow walk through and install this anti-spam tool as mentioned here:
http://forum.linode.com/viewtopic.php?p=36880

3) Config issues in “atmail” web client

I also setup “atmail” from sourceforge. It crashed just after installation on first page causing blank modal login window.

I check firebug->ajax response, and it was 500 server error. Debugged code and found it’s PHP new version ‘deprecated’ warning issue, which forcefully terminate script. So i turned on error_reporting in header.php. List the files causing deprecated warning and replace them using vim command.

:%s/=&/=/g
:%s/= &/= /g  <—- this one with space after =

It resolved the deprecated warning issue.

Next issue was with libs/IMAP_Client.php. In new php version ‘namespace’ is a keyword but in this lib, it was named as a class->function. So renamed it and calling and definition places, and finally it worked.

Pretty unique cases, very hard to google. It burnt almost my half night sleep (of 9th muharram, nov 23-24, 2012)

Hope it help.

Posted in Uncategorized. Leave a Comment »
Follow

Get every new post delivered to your Inbox.

Join 30 other followers