I you have website and want to download or upload all files from your website, then you need something like Filezilla or WinSCP to download them. Actually what i write in here is in hosting help too.

This is how i did when i use Filezilla and hosting in Yahoo Small Business. Open the filezila, then click File -> Site Manager. It will show pop up window to fill the detail login to your website. Fill the
Host : ftp.yourwebsite.com
Protocol : FTP - File Transfer Protocol
Encryption : Require explisit FTP over TLS
Logon Type : Normal but you can choose other
User : user FTP that you have already created in your Yahoo Cpanel (i call it Cpanel) - make sure that u have already created it.
Password : ***
Then Connect. After that you can see right side and left side. Left side is our files or folders that we want to upload and the right side is files and folders in your website. If you want to upload or download, just make right click then you have options what will you do.

If you use  WinSCP, i don't know the explanation of what i fill to connect website, but here it is the detail to connect :
File Protocol : SFTP
Host Name : www.yourwensite.com
Port Number : 22
User name and password. Then click connect.





In my previous post, i have connection Yii with Oracle, then, when i move to my new office, they use sql server for database. It is almost the same as connection with oracle. Here we go,

  1. you must install sql client server, i use windows 7 and it need sql client server 2012. 
  2. download php_pdo_sqlsrv_54_nts.dll, php_pdo_sqlsrv_54_ts.dll, php_pdo_sqlsrv_53_nts.dll, php_pdo_sqlsrv_53_ts.dll. if u use php 5.4 then paste 54 or php 5.3 then paste 53 file. Then paste all the files into xampp\php\ext\, 
  3. then edit php.ini, like this : 
      extension=php_sqlsrv_54_ts.dll
      extension=php_pdo_sqlsrv_54_ts.dll


    4. restart apache..
    5. configure the yii files : protected\config\main.php like this :

             db'=>array(
            'connectionString' => 'sqlsrv:Server=LOCALHOST;Database=CPPermata',
            'username' => 'sa',
            'password' => 'sa1234',
            'charset' => 'GB2312',
        ),


then you can generate model by gii.. :D


I have a task to create company profile of company where i work. Then i decide using Yii framework to develop that. One of the fitur is news and it needs upload image to complete the news. I write in here just because i can open it again in the future. i realize that this way to upload is simpler than php non framework. here we go :

in view -> form, we have :

    $form = $this->beginWidget('CActiveForm', array(
        'id' => 'news-form',
        'enableAjaxValidation' => false,

        'htmlOptions' => array('enctype' => 'multipart/form-data')
            ));
    ?>



        labelEx($model, 'newsImage'); ?>
       
        error($model, 'newsImage'); ?>
   

endWidget(); ?>

in models, we have :

class News extends CActiveRecord
{
    public $newsImage;


    //other function

    public function rules()
    {       
        return array(          
            array('newsId', 'numerical', 'integerOnly'=>true),
            array('newsTitle,  newsAuthor', 'length', 'max'=>200),
            array('newsImage', 'file', 'types'=>'jpg, gif, png'),
            array('user_in, user_up', 'length', 'max'=>8),
            array('newsDate, newsContent, date_in, date_up', 'safe'),
            array('newsId, newsTitle, newsDate, newsContent, newsImage, newsAuthor, user_in, date_in, user_up, date_up', 'safe', 'on'=>'search'),
        );
    }

    
    //other function
}

in controller we have save create example :

public function actionCreate() {
        $model = new News;
        if (isset($_POST['News'])) {
            $model->attributes = $_POST['News'];
            $model->newsImage = CUploadedFile::getInstance($model, 'newsImage');
            if ($model->save()) {
                $model->newsImage->saveAs(Yii::app()->basePath.'/../images/news/'.$model->newsImage);
                $this->redirect(array('view', 'id' => $model->newsId));
            }
        }

        $this->render('create', array(
            'model' => $model,
        ));
    }


I hope this help. I get reference from here :
http://www.yiiframework.com/wiki/2/how-to-upload-a-file-using-a-model/


Sometimes when u have many filters in your searching data, then u need query in string format. It's avoid many 'if else' of field that u use to filter. I have a senior programmer who tell me how to write the sp. Here we go the example :

BEGINSET NOCOUNT ON;
declare @str NVarchar(4000) , @where varchar(2000), @UserId char(8)
select @UserId = 'U0000000', @where = '(m.DocumentKeywords like ''%og%'' or m.DocumentKeywords like ''%og%'') AND convert(datetime,m.DocumentCreatedDate,106) between ''01 Mar 2013'' and DATEADD(DAY, +1,''31 Mar 2013'')'
set @str=N'SELECT distinct m.DocumentId, m.DocumentName
FROM dbo.DocumentsAccess a inner join dbo.Documents m on a.DocumentId=m.DocumentId and m.stsrc <> ''D''
inner join Users u on m.DocumentCreatedById = u.UserId
left join Users um on m.DocumentModifiedById = um.UserId and u.stsrc <> ''D''
WHERE (a.Stsrc <> ''D'' and a.canAccess=''1'' and a.UserId = '''
+ @UserId + ''') and '

set @str=@str+'('+@where +')'
+ 'ORDER BY m.DocumentName '

exec sp_executesql @str
print @str

END Then the result will be :

SELECT distinct m.DocumentId, m.DocumentName
FROM dbo.DocumentsAccess a inner join dbo.Documents m on a.DocumentId=m.DocumentId and m.stsrc <> 'D'
inner join Users u on m.DocumentCreatedById = u.UserId
left join Users um on m.DocumentModifiedById = um.UserId and u.stsrc <> 'D'
WHERE (a.Stsrc <> 'D' and a.canAccess='1' and a.UserId = 'U0000000') and ((m.DocumentKeywords like '%og%' or m.DocumentKeywords like '%og%') AND convert(datetime,m.DocumentCreatedDate,106) between '01 Mar 2013' and DATEADD(DAY, +1,'31 Mar 2013'))ORDER BY m.DocumentName
 


Install Yii sebenarnya mudah, aku menuliskannya disini karena takut lupa. heheheh... :)
spesifikasi yang aku pakai : xampp 1.7.7

1. download source yii...
2. extract file source, bisa ditaro dimana saja, tp ak taro di htdocs jg.
3. buka cmd, dan mengetikkan perintah seperti dalam gambar.
dan selesai instalasi yii nya. hehehe..




When i use Yii framework and oracle for my web application, i found this error : CDbConnection failed to open the DB connection: could not find driver. For my problem, the solution is :

  1. I use xampp with PHP version 5.3 (up)
  2. setting php.ini with uncomment this line : 
    • extension=php_pdo_oci.dll
I found the solution from here : 
http://www.yiiframework.com/forum/index.php/topic/7390-mhon-bimbingan-gagal-koneksi-ke-oracle/page__p__37908__hl__failed+to+open+the+DB+connection#entry37908
http://id.php.net/manual/en/ref.pdo-oci.connection.php#70329


It's a long time ago when i wrote this blog last time, even, you can say that this is my first posting. Hehehe... Actually I am still don't know what should i write in this blog. Hahaha... So, to know me closer, I write about my self. Yup, my friends usually call me arum. That is a good name, I think. But, my parents never call me with that name, and until now, I don't know why. They have weird name for call me. I don't wanna mention in here... too embarrassing. Hahaha... But if you want to hear that, just go to my home. :D
Anyway, I am an ordinary person, though I just only one in this world. Very straight, always obey the regulation, always avoid conflicts too. Sometimes, I wanna be extraordinary, so powerful and genius, just like hero. Hahaha... So, I could invent something new that can help people to have better life. I hope I can give good contribution for this world, for example : save the world, earth, people, find new medicine for some serious disease. My imposible dream is I wish I can fly, without plane of course, just by myself. :D
I have so many good friends. They always support me and give me good advice of whatever I did or will do. I do very appreciate them. Hehehe... They just give me strength to face this world which is rarely not friendly. They always have a way to rise me up, to cheer me up. I hope I never lose my friends.
Right now, I don't have a boyfriend, but if i have, i think we will go to cinema, watching movies in weekend. We will go to the beach or hill or mountain, sit under the trees, reading books together, or just talk each other, even we don't need talk, just enjoy the silence together. Yah, just very simple plan for that. :)
About my work, I have been working for 2 years, and still feel that what i knew is just very little. I don't like routine, but I have to. I am working for a company, so, I have to obey the company rules. For now, I just can enjoy my job.
Hmm... That's about me. Thank you for reading... :)