TECHiE TALKS

Just another techie stuff

The floating message goes here

Slackware PHP GD Error

In the past months I was able to handle a LAMP server, this is my second time to handle a UNIX based web server but this time its a lot different because I will will be the one to install and configure the web server.  Our System administrator was the one who installed the latest version of slackware which is 13.1 on the machine, so all I need to do is have the web server up and running.

Our system administrator did include the x packages when he installed slackware and this caused me a problem in running PHP because it gave me several errors in GD support.  The error I get was,

PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/lib/php/extensions/gd.so’ – libxcb-xlib.so.0: cannot open shared object file: No such file or directory in Unknown on line 0

I was able to solve the problem with the following steps taken and was based from a linux forum I really loved. Read the rest…

Did find the post very useful? Maybe you want to buy me a glass of beer!

No Comments

Change a String or Character in MySQL

Knowing the right MySQL statement is the most important part in having thousands of data in your database, one false move and you can’t undo things.    If you want to change a string or character in your database and doing it manually in thousands or millions of entries then that should consume all of your time.

One example scenario is when you want to change all the entries containing a character ‘_’ to this character ‘-’ .  All you need to do is have a backup first on that specific table or database so that whatever false move you  will be doing, you can still have the data back.  After having the backup here is the SQL syntax that you should enter:

UPDATE Table SET Column = Replace(Column, ‘find value’, ‘replacement value’) WHERE xxx

Where in my scenario:

UPDATE paging SET pagename = Replace(pagename, ‘_’, ‘-’)

There within less than a minute I was able to change all the data containing ‘_’.  It saved me a lot of time and I can continue coding some other stuff rather than editing the data manually.  Hope this helps and happy coding!

Did find the post very useful? Maybe you want to buy me a glass of beer!

No Comments

Thunderbird To Outlook

I have successfully exported Thunderbird email files on ms outlook 2007 on a Windows XP platform which can also be done in windows vista and windows 7 platform.  There are several steps on how to do it.

1.  First, you need to download and install this software:  IMAPSize
2. Locate your Thunderbird emails, usually it is located in this directory C:\Documents and Settings\user\Application Data\Thunderbird  or  you can copy paste the directory and change the user to your account name.  When you are in the application data folder of Thunderbird navigate to the mail folder of the email account you want to convert.  Make sure you make full backup on the mail folder before doing the conversion. Read the rest…

Did find the post very useful? Maybe you want to buy me a glass of beer!

No Comments

Getting Main Domain

Do you want to extract the main domain of a URL?  Here is a function that works well and can be modified easily.  I found this function while searching for a good Regular Expression to fulfill such result.

<?php
function get_base_domain($url)  {
$debug = 0;
$base_domain = '';
$G_TLD = array(
'biz','com','edu','gov','info','int','mil','name','net','org','aero','asia','cat','coop','jobs','mobi','museum',
'pro','tel','travel','arpa','root','berlin','bzh','cym','gal','geo','kid','kids','lat','mail','nyc','post','sco','web','xxx',
'nato','example','invalid','localhost','test','bitnet','csnet','ip','local','onion','uucp',
'co' );
// country tlds (source: http://en.wikipedia.org/wiki/Country_code_top-level_domain)
$C_TLD = array(
'ac','ad','ae','af','ag','ai','al','am','an','ao','aq','ar','as','at','au','aw','ax','az',
'ba','bb','bd','be','bf','bg','bh','bi','bj','bm','bn','bo','br','bs','bt','bw','by','bz',
'ca','cc','cd','cf','cg','ch','ci','ck','cl','cm','cn','co','cr','cu','cv','cx','cy','cz',
'de','dj','dk','dm','do','dz','ec','ee','eg','er','es','et','eu','fi','fj','fk','fm','fo',
'fr','ga','gd','ge','gf','gg','gh','gi','gl','gm','gn','gp','gq','gr','gs','gt','gu','gw',
'gy','hk','hm','hn','hr','ht','hu','id','ie','il','im','in','io','iq','ir','is','it','je',
'jm','jo','jp','ke','kg','kh','ki','km','kn','kr','kw','ky','kz','la','lb','lc','li','lk',
'lr','ls','lt','lu','lv','ly','ma','mc','md','mg','mh','mk','ml','mm','mn','mo','mp','mq',
'mr','ms','mt','mu','mv','mw','mx','my','mz','na','nc','ne','nf','ng','ni','nl','no','np',
'nr','nu','nz','om','pa','pe','pf','pg','ph','pk','pl','pn','pr','ps','pt','pw','py','qa',
're','ro','ru','rw','sa','sb','sc','sd','se','sg','sh','si','sk','sl','sm','sn','sr','st',
'sv','sy','sz','tc','td','tf','tg','th','tj','tk','tl','tm','tn','to','tr','tt','tv','tw',
'tz','ua','ug','uk','us','uy','uz','va','vc','ve','vg','vi','vn','vu','wf','ws','ye','yu',
'za','zm','zw','eh','kp','me','rs','um','bv','gb','pm','sj','so','yt','su','tp','bu','cs','dd','zr'
);
// get domain
>if ( !$full_domain = get_url_domain($url) ) {

return $base_domain;
}
// now the fun
// break up domain, reverse
$DOMAIN = explode('.', $full_domain);

if ( $debug ) print_r($DOMAIN);
$DOMAIN = array_reverse($DOMAIN);

if ( $debug ) print_r($DOMAIN);
// first check for ip address
>if ( count($DOMAIN) == 4 &amp;&amp; is_numeric($DOMAIN[0]) &amp;&amp; is_numeric($DOMAIN[3]) ) {

return $full_domain;
}
// if only 2 domain parts, that must be our domain
>if ( count($DOMAIN) <= 2 ) return $full_domain;

if ( in_array($DOMAIN[0], $C_TLD) &amp;&amp; in_array($DOMAIN[1], $G_TLD) &amp;&amp; $DOMAIN[2] != 'www' ) {
$full_domain = $DOMAIN[2] . '.' . $DOMAIN[1] . '.' . $DOMAIN[0];
}

else {
$full_domain = $DOMAIN[1] . '.' . $DOMAIN[0];;
}
// did we succeed?
>return $full_domain;
}
function get_url_domain($url)  {
$domain = '';
$_URL = parse_url($url);
// sanity check
>if ( empty($_URL) || empty($_URL['host']) )  {
$domain = '';
}

else {
$domain = $_URL['host'];
}

return $domain;
}
?>

To test the code we can use the function,

$url  = 'http://www.icpep.org';
echo get_base_domain($url) ; // icpep.org

Click here to download.

This code really helped me a lot.  There are a lot of Regular expressions out there but this simple approach can break all those head breaking expressions.  Btw, this function is free of use and is under GNU licensing.   Hope this functions is of big help to you also, happy coding!

Did find the post very useful? Maybe you want to buy me a glass of beer!

3 Comments

PLDT’s Port 25 (SMTP)

Today, a friend and a colleague of mine called me and questioned me why she can’t send emails using her mail client which is Incredimail which is one cool mail client because of the effects and animation.  It really bothered me a lot because I can’t solve the problem without being there in the situation and it is hard to explain things using a phone. So I went over to her place and to find out that PLDT changed their SMTP port to 587 which is not the usual port of SMTP.  But this is not only the solution, outgoing mail server should also be changed to smtpdsl4.pldtdsl.net instead of using your own outgoing mail server(mail.icpep.org).

This has become an issue but still PLDT has no action for this.  This is really one problem especially to those people who are not that techie.  Hope PLDT will change it back to the usual port and find other ways on how to solve the spamming issues.

To summarize it, you can configure your mail clients using the following information:

Outgoing mail server SMTP: smtpdsl4.pldtdsl.net
UNCHECK – My outgoing server (SMTP) requires authentication
USE Port: 587

Hope this helps in solving your problem.

Did find the post very useful? Maybe you want to buy me a glass of beer!

4 Comments

Boost Wireless Signal

If you want to boost the signal of your wireless linksys router all you need is configure the router.  You can type on the browser 192.168.1.1 which is the default IP address assigned on the router.   After logging in you can go to wireless then click advance settings. Most configuration in this area is based on default configuration, change the following value.

  • Beacon Interval – 50
  • Fragmentation Threshold – 2304
  • RTS Threshold – 2304

After setting the values you can save the configuration and turn off the router for several seconds.  Turn it on again to use the changes made on your router.

Did find the post very useful? Maybe you want to buy me a glass of beer!

2 Comments

Slackware Linux E-book

Slackware-Linux

Knowing a Linux distro is one asset of a network administrator, since then I seemed to be a die hard fan of knowing Linux.  The first linux distro I used was Red Hat and from the first time I saw it I was so amazed and at the same time surprised that such operating system exist.  By then I was a great fan of linux but sad to say I seldomly use the operating system because most of the tools used in school and work is windows based, though it can be ran through wine but running it in windows is different.

Lately, my friends and colleagues installed a transparent proxy used for filtering sites accessed within the network.  They explained to me how the proxy functions and it was a very big interest to me especially that linux was involved.

This was also a coincidence that in the previous week I was able to download the latest version of Slackware Linux v13.O.  I tried to install it but facing it in text based is something new to me because the previous flavors of linux I used comes with a graphical user interface making it easy for me to install and configure stuff.  Read the rest…

Did find the post very useful? Maybe you want to buy me a glass of beer!

No Comments

« Previous Entries Next Entries »

Rss Feeds