Friday, November 26, 2010

What is Pentaho


Pentaho is the open source business intelligence leader. Thousands of organizations globally depend on Pentaho to make faster and better business decisions that positively impact their bottom lines. Download the Pentaho here.

I already using this software for database migration, this is very usefull, easy to understand, simple navigation.
But, for first time i confuse to using it :D

thanks to pentaho.

Tuesday, May 18, 2010

displays the updated blog in the sidebar on WPMU

lets try this new trict, How to displays the updated blog on WPMU, place this code in the sidebar.php or anything you want  to place it.

<!--added by myDeveLover--><div class="sidebarbox">
  <h4><span>Blog Terupdate</span></h4>
  <?php $blogs = get_last_updated();
  if( is_array( $blogs ) ) { ?>
  <ul>
    <?php foreach( $blogs as $details ) {
    ?><li>
    <a href="http://<?php echo $details[ 'domain' ] . $details[ 'path' ] ?>" title="<?php echo get_blog_option( $details[ 'blog_id' ], 'blogdescription' )?>">
    <?php echo get_blog_option( $details[ 'blog_id' ], 'blogname' ) ?></a>
    </li><?php
    } ?>
  </ul>
  <?php } ?>
</div><!--//end by myDeveLover-->


comment is welcome...

Friday, May 14, 2010

OOP In PHP

PHP supports OOP starting version 5, which had a new form object modeling to overcome the complexity problem that can not be done on the previous version. PHP 5 provides better performance and new features compared to previous versions.

1. Class
Each pendefinisain / declaration of a class in PHP using a class that followed the class name, then followed the '{' and ends with the sign '}' we can give any name of a class, while not the same as PHP functions owned. example, print class. print class name can not we use it, because the print is owned by a PHP function. We can load / define the property class and the method of the class among the "braces". variable $ this is a fictitious variable that is used to summon the properties or method of a class. The following examples will further clarify about the class in php
//kelas orang
class orang{
//Properties Class
var $nama;
var $umur;
var $tinggi;
var $berat;

function orang (){//Constructor
echo "Initialisation Object";
}

function get_nama(){
return $this->nama;
}
}//end class


Saturday, March 20, 2010

ReBuild Pagination for Controller on CodeIgniter

this function is using for easily using pagination library in one line.
just insert this function in your controller, and the other function call it:

/**
 * set paging for easy use :)
 * @access private
 * @param string $url
 * @param int $total
 * @param int $perpage
 * @param int $numlink
 * @return void
 */
function setPaging($url='', $total=0, $perpage=20, $numlink=3){
 if(!is_numeric($total)){
  $total=0;
 }
 if(!is_numeric($perpage)){
  $perpage=20;
 }
 if(!is_numeric($numlink)){
  $numlink=3;
 }
 $this->load->library('pagination');
 $segment=explode('/',$url);

Wednesday, March 10, 2010

8 basics of regular expression that can make you expert

Well, regular expressions have been something that I was scared of when I started coding as a serious stuff. The string literals puzzled me like anything. preg_match, preg_grep, preg_split, preg_replace etc have been something I always wanted to avoid. But thanks to phpbuilder and php that I can now handle them with some ease. And this is for you guys who find regular expressions tacky.


VERY BASICS:
1. "^tech" : Searches a string that starts with tech.
2. "logy$" : Searches for strings that ends up in logy.
3. "a*b" : Looks for a string that has either zero or more a’s but exactly one b following a. (eg. b, ab, aab, aaab, aaaaaaaaaaaaaaaaab etc.).
4. "a+b" : Same as a*b but only difference is that atleast one a should be there in the string unlike a*b which can overlook a. (eg. ab, aab,aaaaaaaaab etc).

Sunday, March 7, 2010

How to Disabling "My Aptana" "Startup Page"

open menu:
Window -> Preferences

select tab:
Aptana -> My Aptana

select option:
Never display after startup

click [Apply] than click [OK]

thats all.

Saturday, February 13, 2010

FCKeditor-Javascript and Codeigniter integration

here is the script for your view:
<script src="<?php echo base_url()?>javascripts/fck/fckeditor.js" type="text/javascript">
</script>
<script type="text/javascript">
  window.onload = function(){
    var oFCKeditor = new FCKeditor('isi','100%','300','noUpload');
    oFCKeditor.BasePath = 'javascripts/fck/';
    oFCKeditor.Config['CustomConfigurationsPath'] = oFCKeditor.BasePath+'fckconfig.js?';
    oFCKeditor.Config['SkinPath'] = oFCKeditor.BasePath+'editor/skins/silver/';
    oFCKeditor.ReplaceTextarea();
  }
</script>
........
<form action="<?php echo site_url('admin/post/');?>" method="post">
  <table border="0" cellpadding="0" cellspacing="0">
    <tr><td>
      <textarea cols="70" name="content" rows="15"><?php echo $content;?></textarea>
    </td></tr>
    <tr><th><input type="submit" value="Simpan" /></th></tr>
  </tbody></table>
</form>

thats only simple way

Thursday, February 4, 2010

Javascript Countdown Timer

<div style="float: right;">
   Time Remaining 
   <b id="min">0</b> minute(s) 
   <b id="sec">0</b> second(s)
</div>
<script>
dm=0;dd=5;

function remaining(){
   if(dd>=0){

      if(dm<0){
         alert('time is out');
      }else{
         document.getElementById('min').innerHTML=dm;
         document.getElementById('sec').innerHTML=dd;
         if(dd<=0){
            dd=60;
            dm--;
         }
         dd--;
         setTimeout('remaining()',1000);
      }
   }
}
remaining(); </script>

Friday, January 29, 2010

Date and Time validation using Regular Expression

This function is used for date validation on a string
Return of this function is boolean.
function is_date($str){
   $return = (bool) preg_match("(\b([1-9]([0-9]{3}))\-(1[0-2]|0[1-9])\-(3[01]|[12][0-9]|0[1-9])\b)",$str);
   if(strlen($str)==10){
      return $this->is_date_time($str);
   }
   if($return){
     $return = (bool) (strlen($str)==10);
   }
   return $return;
}


This function is used for time validation on a string
Return of this function is boolean.
function is_time($str){
   $return = (bool) preg_match("(\b(2[0-3]|[01][0-9])\:([0-5][0-9])\:([0-5][0-9])\b)",$str);
   if($return){
      $return = (bool) (strlen($str)==8);
   }
   return $return;
}



And This function is used for date_time validation on a string
Return of this function is boolean.
function is_date_time($str){
   $return = (bool) preg_match("(\b([1-9]([0-9]{3}))\-(1[0-2]|0[1-9])\-(3[01]|[12][0-9]|0[1-9]) (2[0-3]|[01][0-9])\:([0-5][0-9])\:([0-5][0-9])\b)",$str);
   if($return){
      $return = (bool) (strlen($str)==19);
   }
   return $return;
}

Friday, January 15, 2010

Reset Password on Mysql

1. we first used to turn off the server, the server did not mean a whole but only mysql service. hehehe …
of course, is how to turn them off from the root linux via the command:
# /etc/init.d/mysql stop

2. then create a sql script to change the password with the command
# vi /root/mysql.reset.sql
or with other commands you like such as pico or nano .
write or fill in the following script:
mysql.user UPDATE SET Password = PASSWORD ( 'my_password') WHERE User = 'root';
GRANT ALL ON *.* TO 'root';
FLUSH PRIVILEGES;

and then save it.

3. sql script is run with the command:
# mysqld_safe --init-file=/root/mysql.reset.sql &
do not forget the “&” in the script terserbut. ok?
then there will be output:
#nohup: ignoring input and redirecting stderr to stdout
Starting mysqld daemon with databases from /var/lib/mysql
mysqld_safe[20970]: started

or:
100116 11:00:28 mysqld_safe Logging to '/var/log/mysql/mysqld.log'.
100116 11:00:28 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
100116 11:00:30 mysqld_safe mysqld from pid file /var/lib/mysql/linux-vb3s.site.pid ended

press enter.

4. restart mysql server
# /etc/init.d/mysql start

URI Validation Using Regular Expression

who know about regular expression?
i need to validate a uri.
so create a validation script using preg_match() on PHP.
but, i get something wrong with my script. can you help me?

this is my uri validation function:
function valid_uri($str){
$patern = "/^((ht|f)tp(s?)\:\/\/|)([a-z0-9]([-.]*[a-z0-9])*(:(0-9)*)*([\/][a-zA-Z0-9\-\.\?\,\/\\\+&%\$#_=]*))?+$/i";
return preg_match($patern,$str);
}

and I have been tested:
$tes=array( "http://www.amikom.ac.id", "amikom.ac.id", "amikom.ac.id.", "ihi amikom.ac.id aha", "https://email.amikom.ac.id","www..com", "http://e-learning.com/", "e-learning.com/index.php", "e-learning.com/index.php?x=1234&a=897", "bukan uri","anang.",".anang.",".com", "http://.com","saya.#@%\$#ini.com");
foreach($tes as $item){
echo "\n".(($this->validasi->valid_uri($item))?"yes":"no")." ".$item;
}


and this is the result:
yes http://www.amikom.ac.id
no amikom.ac.id
no amikom.ac.id.
no ihi amikom.ac.id aha
yes https://email.amikom.ac.id
no www..com
yes http://e-learning.com/
yes e-learning.com/index.php
yes e-learning.com/index.php?x=1234&a=897
no bukan uri
no anang.
no .anang.
no .com
yes http://.com
no saya.#@%$#ini.com


".com" is not valid url, but why "http://.com" is valid?
i just stuck here.
anyone can help me?

Tuesday, January 12, 2010

GO! DEVELOVER GO!

Let's go!
You can do it!
You can do it!
You can do it!
We can do it!
Go! Go! Go!