Posts with the name or tag of admin;

by admin

SEO friendly URL in PHP

2:29 pm in CMS, Elgg, PHP by admin

You can make SEO Friendly url easily in php.

function friendlyURL($string){
	$string = preg_replace("`\[.*\]`U","",$string);
	$string = preg_replace('`&(amp;)?#?[a-z0-9]+;`i','-',$string);
	$string = htmlentities($string, ENT_COMPAT, 'utf-8');
	$string = preg_replace( "`&([a-z])(acute|uml|circ|grave|ring|cedil|slash|tilde|caron|lig|quot|rsquo);`i","\\1", $string );
	$string = preg_replace( array("`[^a-z0-9]`i","`[-]+`") , "-", $string);
	return strtolower(trim($string, '-'));
}

usage:

$myFriendlyURL = friendlyURL("Barca rejects FIFA statement on Olympics row");
echo $myFriendlyURL; // will echo barca-rejects-fifa-statement-on-olympics-row

by admin

Hide Admin user from recent login in JCow Social script

2:50 pm in Elgg, JCow by admin

you can apply a tricks not to show admin on the recent logins or recent members like this.

Open theme’s page.tpl.php and go to line no 170.

Change with following query.it will not show admin.

$res = sql_query(“SELECT * from `”.tb().”accounts` where roles!=3 order by lastlogin desc limit 20″);

by admin

JCow as Opensource Social Networking script

1:10 pm in Elgg, JCow by admin

Few days back, I was asking to make a website for a alumni association.They need a function as like facebook.After that I had started searching on google.I found have few scripts.Out of them, I liked three scripts i.e. Elgg,  Dolphin and JCow.

I discover that JCow is nicely developed.Although, i was strange to see the name “JCow” as social networking script.It is very easier to extend.It is very lightweight and faster than others. So i decided to work on JCow.JCow has some lack of features but it can be extended easily.I have written some scripts for my website.I will share it soon.

Happy JCowing……!

by admin

IVR Application in Lua for Freeswitch

5:57 pm in FreeSWITCH, Lua by admin

1. Create a New file name 01_Custom.xml and add the following new extension:

<extension name=”Read Back Entered Digits”>
<condition field=”destination_number” expression=”^(9910)$”>
<action application=”lua” data=”test1.lua”/>
</condition>
</extension>

2. Save the file. Launch fs_cli and issue reload_xml, or press F6.

Our Dialplan is now ready to call the Lua script named test1.lua. Create this new script as follows:

1. Using your text editor, create test1.lua in the freeswitch/scripts/ directory and add the following lines:

– test1.lua
– Answer call, play a prompt, hangup

– Set the path separator
pathsep = ‘/’ — Windows users do this instead:
– pathsep = ‘\’

–Answer the call
session:answer()

–Create a string with path and filename of a sound file
prompt = “ivr” .. pathsep .. “ivr-welcome_to_freeswitch.wav”

– Print a log message
freeswitch.consoleLog(“INFO”,”Prompt file is ‘” .. prompt .. “‘\
n”)

–Play the prompt
session:streamFile(prompt)

– Hangup
session:hangup()

2. Save the file.

Now dialer 9910 and you will get IVR.

by admin

Lua Tutorial for Freeswitch

5:52 pm in FreeSWITCH, Lua by admin

Lua is very lightweight programing language.Lua has a simple syntax that is easy both to learn and to read. Following is a
simple script:

— This is a sample Lua script
— Single line comments begin with two dashes

–[[
This is a multi-line comment.
Everything between the double square brackets
is part of the comment block.
]]

— Lua is loosely typed
var = 1 — This is a comment
var = �alpha� — Another comment
var = �A1� — You get the idea…

–[[
When the Lua script is called from the dialplan
you have a few magic objects. A handy one is
the 'freeswitch' object which lets you do things
like this:
freeswitch.consoleLog(�INFO�,�This is a log line\n�)

Another important one is the 'session' object which
Lets you manipulate the call:
session:answer()
session:hangup()
]]

— Lua makes extensive use of tables
— Tables are a hybrid of arrays and associative arrays
my_table = {
key1 = val1,
key2 = val2,
�index 1�,
�index 2�
}
freeswitch.consoleLog(�my_table key1 is ‘� .. my_table[key1] .. �’\n�)
freeswitch.consoleLog(�my_table index 1 is ‘� .. my_table[1] .. �’\n�)

— Access arguments passed in
arg1 = argv[1] — First argument
arg2 = argv[2] — Second argument

— Simple if/then
if ( var == �A1� ) then
freeswitch.consoleLog(�INFO�,�var is ‘A1′\n�)
end

— Simple if/then/else
if ( var == �A1� ) then
freeswitch.consoleLog(�INFO�,�var is ‘A1′\n�)
else
freeswitch.consoleLog(�INFO�,�var is not ‘A1′!\n�)
end

— String concatenation uses ..
var = �This � .. � and � .. �that�
freeswitch.consoleLog(�INFO�,�var contains ‘� .. var .. �’\n�)

— The end

Every Lua script that is executed from the Dialplan receives the session object,
which represents the call leg that is being processed. The session object is the
primary means of manipulating the call, and is used extensively in Lua scripting.

by admin

Getting started with Lua in FreeSWITCH

5:49 pm in FreeSWITCH, Lua by admin

Enabling Lua (via mod_lua) is very easier process.It is done in the
following way:

1. Open modules.conf in the FreeSWITCH source directory and locate the
following line:

#languages/mod_lua

Remove the # and save the file.

2. Open modules.conf.xml in the conf/autoload_configs directory and
locate the following line:

tags and save the file.

3. Build and compile mod_lua from the FreeSWITCH source directory:

make mod_lua-install

4. Wait for the installation to finish, and then restart FreeSWITCH. Launch
fs_cli and type show application. If Lua loaded successfully, then you
will see that lua is now available as a Dialplan application as follows:

lua,Launch LUA ivr,

by admin

Squid Proxy Server Mac Address based filtering

2:44 pm in CentOS, Fedora, FreeBSD by admin

To set up ACL’s based on MAC address:

Open squid.conf:

# vi /etc/squid/squid.conf

Local acl, section and append ACL as follows:

acl macf1 arp mac-address
acl macf2 arp 00:11:22:33:44:55
http_access allow macf1
http_access allow macf2
http_access deny all

Save and close the file. Restart squid server:

# /etc/init.d/squid restart

by admin

Increase Private Memory Size on OpenSIPS

6:59 am in Linux, OpenSIPS by admin

By default the size of private memory chunk used by each OpenSIPS process is 1 MB.

To increase the size of private memory you need to compile OpenSIPS from sources. Once you get the sources from SVN or the opensips.org’s download site, do the following steps:

- edit the file “config.h” and search for the next lines:

/*used only if PKG_MALLOC is defined*/
#define PKG_MEM_POOL_SIZE 1024*1024

- change the value of PKG_MEM_POOL_SIZE to desired size, for example to have 4MB of private memory:

#define PKG_MEM_POOL_SIZE 4*1024*1024

- recompile and reinstall OpenSIPS

make all; make install;

by admin

Increase Share Memory Size on OpenSIPS

6:54 am in Linux, OpenSIPS by admin

To increase the share memory size use ‘-m’ command line parameter of OpenSIPS.

opensips -m 256

# this will run OpenSIPS with 256MB of share memory

by admin

How to make money from Twitter

8:23 pm in CMS, Linux, Others, PHP by admin

If you have a twitter account with many followers or just a few, you still can make money through a Twitter advertising company called Ad.ly.

You set the price and once an advertiser is interested to put an ad in your tweet, you’ll earn money. For how much? It depends on how much price you have set.