Tuesday, 10 October 2017

Command line instructions Pertama ketika Membuat Repository pada GITHUB/GITLAB

No comments:
Git global setup
git config --global user.name "Jhon Doe"
git config --global user.email "xxx@gmail.com"
Create a new repository
git clone git@gitlab.xxx/xxx.git
cd xxx-folder
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master
Existing folder
cd existing_folder
git init
git remote add origin git@gitlab.com:xxx/xxx.git
git add .
git commit -m "Initial commit"
git push -u origin master
Existing Git repository
cd existing_repo
git remote add origin git@gitlab.com:xxx/xxx.git
git push -u origin --all
git push -u origin --tags
Read More

FIX 'Permission Denied (publickey)' on GITLAB/GITHUB

No comments:
This means, on your local machine, you haven't made any SSH keys. Not to worry. Here's how to fix:
  1. Open git bash (Use the Windows search. To find it, type "git bash") or the Mac Terminal. Pro Tip: You can use any *nixbased command prompt (but not the default Windows Command Prompt!)
  2. Type cd ~/.ssh. This will take you to the root directory for Git (Likely C:\Users\[YOUR-USER-NAME]\.ssh\ on Windows)
  3. Within the .ssh folder, there should be these two files: id_rsa and id_rsa.pub. These are the files that tell your computer how to communicate with GitHub, BitBucket, or any other Git based service. Type ls to see a directory listing. If those two files don't show up, proceed to the next step. NOTE: Your SSH keys must be named id_rsa and id_rsa.pubin order for Git, GitHub, and BitBucket to recognize them by default.
  4. To create the SSH keys, type ssh-keygen -t rsa -C "your_email@example.com". This will create both id_rsa and id_rsa.pub files.
  5. Now, go and open id_rsa.pub in your favorite text editor (you can do this via Windows Explorer or the OSX Finder if you like, tpying open . will open the folder).
  6. Copy the contents--exactly as it appears, with no extra spaces or lines--of id_rsa.pub and paste it into GitHub and/or BitBucket under the Account Settings > SSH Keys. NOTE: I like to give the SSH key a descriptive name, usually with the name of the workstation I'm on along with the date.
  7. Now that you've added your public key to Github and/or BitBucket, try to git push again and see if it works. It should!
More help available from GitHub on creating SSH Keys and BitBucket Help.

reference : https://gist.github.com/adamjohnson/5682757
Read More

Monday, 29 September 2014

Understanding About Server-Side and Client-Side Programming

No comments:
Background

Web development is all about communication. In this case, communication between 2 parties, over the HTTP protocol:

  • The Server - This party is responsible for serving pages.
  • The Client - This party requests pages from the Server, and displays them to the user. On most cases, the client is a web browser.
  • The User - The user uses the Client in order to surf the web, fill in forms, watch videos online, etc.

Each side's programming, refers to code which runs at the specific machine, the server's or the client's.

Basic Example

  • The User opens his web browser (the Client).
  • The User browses to http://google.com.
  • The Client (on the behalf of the User), sends a request to http://google.com (the Server), for their home page
  • The Server then acknowledges the request, and replies the client with some meta-data (called headers), followed by the page's source.
  • The Client then receives the page's source, and renders it into a human viewable website.
  • The User types Stack Overflow into the search bar, and presses Enter
  • The Client submits that data to the Server.
  • The Server processes that data, and replies with a page matching the search results.
  • The Client, once again, renders that page for the User to view.

Programming
Server-side Programming

Server-side programming, is the general name for the kinds of programs which are run on the Server.

Uses

  • Process user input.
  • Display pages.
  • Structure web applications.
  • Interact with permanent storage (SQL, files).

Example Languages

  • PHP
  • ASP.Net in C#, C++, or Visual Basic.
  • Nearly any language (C++, C#, Java). These were not designed specifically for the task, but are now often used for application-level web services.

Client-side programming

Much like the server-side, Client-side programming is the name for all of the programs which are run on the Client.

Uses

  • Make interactive webpages.
  • Make stuff happen dynamically on the web page.
  • Interact with temporary storage, and local storage (Cookies, localStorage).
  • Send requests to the server, and retrieve data from it.
  • Provide a remote service for client-side applications, such as software registration, content delivery, or remote multi-player gaming.

Example languages

  • JavaScript (primarily)
  • HTML*
  • CSS*
  • Any language running on a client device that interacts with a remote service is a client-side language.
Reference : http://programmers.stackexchange.com/questions/171203/what-are-the-difference-between-server-side-and-client-side-programming
Read More

Saturday, 28 June 2014

Integrasi PHPexcel dengan Codeigniter

No comments:
Pertama yang anda butuhkan ialah :

1. PHPExcel, Download
2. Codeigniter

Langkahnya :

1. Extrak hasil downloadan PHPExcel, lalu ke direktori C:/download/PHPExcel/Classes.
2. Copy semuanya yaitu folder PHPExcel dan phpexcel.php ke folder codeigniter /application/third_party/ (pastekan disni)
3. Lalu membuat liblary pada direktori codeigniter /application/liblaries/, buat file excel.php dan copy code dibawah ini :



Contoh untuk membaca file excel dan konversi kedalam array

$file = './files/test.xlsx';
 
//load the excel library
$this->load->library('excel');
 
//read file from path
$objPHPExcel = PHPExcel_IOFactory::load($file);
 
//get only the Cell Collection
$cell_collection = $objPHPExcel->getActiveSheet()->getCellCollection();
 
//extract to a PHP readable array format
foreach ($cell_collection as $cell) {
    $column = $objPHPExcel->getActiveSheet()->getCell($cell)->getColumn();
    $row = $objPHPExcel->getActiveSheet()->getCell($cell)->getRow();
    $data_value = $objPHPExcel->getActiveSheet()->getCell($cell)->getValue();
 
    //header will/should be in row 1 only. of course this can be modified to suit your need.
    if ($row == 1) {
        $header[$row][$columns] = $data_value;
    } else {
        $arr_data[$row][$col] = $data_value;
    }
}
 
//send the data in an array format
$data['header'] = $header;
$data['values'] = $arr_data;

Contoh untuk membuat file excel

//load PHPExcel library
$this->load->library('Excel');
 
// Create new PHPExcel object
$objPHPExcel = new PHPExcel();
 
// Set document properties
$objPHPExcel->getProperties()->setCreator("mohamadikhwan.com")
        ->setLastModifiedBy("mohamadikhwan.com")
        ->setTitle("Office 2007 XLSX Test Document")
        ->setSubject("Office 2007 XLSX Test Document")
        ->setDescription("Test document for Office 2007 XLSX, generated by PHP classes.")
        ->setKeywords("office 2007 openxml php")
        ->setCategory("Test result file");
 
 
// Add some data
$objPHPExcel->setActiveSheetIndex(0)
            ->setCellValue('A1', 'Hello')
            ->setCellValue('B2', 'world!')
            ->setCellValue('C1', 'bonjour')
            ->setCellValue('C2', 'monde')
            ->setCellValue('A4', 'tutorial from: mohamadikhwan.com');
 
// Rename worksheet (worksheet, not filename)
$objPHPExcel->getActiveSheet()->setTitle('createdUsingPHPExcel');
 
 
// Set active sheet index to the first sheet, so Excel opens this as the first sheet
$objPHPExcel->setActiveSheetIndex(0);
 
// Redirect output to a client’s web browser (Excel2007)
//clean the output buffer
ob_end_clean();
 
//this is the header given from PHPExcel examples. 
//but the output seems somewhat corrupted in some cases.
//header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
//so, we use this header instead.
header('Content-type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="mohamadikhwan_dot_com_phpexcel_tut.xlsx"');
header('Cache-Control: max-age=0');
 
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save('php://output');

Terimakasih dan tinggalkan komentarnya jika ada yang kurang dimengerti atau merasa terbantu

Artikel ini referensi dan ditulis ulang kebahasa sendiri dari http://blog.mohamadikhwan.com/

Read More

Memperbaiki Tampilan Debug Array pada XAMPP

No comments:
Pertama download xdebug.dll yang terbaru

Download

Kemudian copy file tersebut ke direktori C:\xampp\php\ext dan rename manjadi xdebug.dll

Lalu buka file php.ini pada direktori C:\xampp\php.

Scroll paling bawah, maka akan menemukan ini dan ubahlah codenya (hilang tanda #) seperti dibawah ini:

[XDebug]
zend_extension = "C:\xampp\php\ext\php_xdebug.dll"
xdebug.profiler_append = 0
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_dir = "C:\xampp\tmp"
xdebug.profiler_output_name = "cachegrind.out.%t-%s"
xdebug.remote_enable = 0
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "127.0.0.1"
xdebug.trace_output_dir = "C:\xampp\tmp"




Read More

Saturday, 24 May 2014

Loading a controller from another module in CodeIgniter HMVC Wiredesign

No comments:
It seems that the module can be loaded without specifying the controller name only if the controller name matches the module name :

Controllers can be loaded as class variables of other controllers using $this->load->module('module/controller'); or simply $this->load->module('module'); if the controller name matches the module name

Try to load the module like that :

//if controller name matches the module name
$this->load->module('name_module'); 
$this->name_module->name_method();
//if controller name not matches the module name
$this->load->module('name_module'/'name_controller');
$this->name_controller->name_method();
Read More