Import Database ke Web Server Centos 6.5

Kondisi ==> baru saja bikin web server di komputer A dengan OS minimal Centos 6.5 untuk menaruh aplikasi web. Database ada di xampp phpmyadmin di laptop B. Jaringan ok, apache ok.
Permasalahan => Bagaimana melakukan export database dari database yg sudah dibuat di laptop ke server yang baru dibuat ini?

Solusi =>
1. Database dari laptop diexport dulu hingga dapat file extensi .sql
2. File .sql tadi dicopy ke server yang baru (pake ftp). ditaruh dimana aja sih, tapi kudu tau url folder nya.
Kalau belum ada server ftp. install dulu:

yum install vsftpd
yum install ftp

Lalu hidupkan service nya:
service vsftpd start
chkconfig vsftpd on
reference : https://www.digitalocean.com/community/tutorials/how-to-set-up-vsftpd-on-centos-6–2

3. pastikan service mysqld sudah jalan :
service mysqld status

lalu masuk ke mysql dengan cara :
mysql -u root -p

4. Buat sebuah database, nama nya disamakan saja dengan database yang akan diimport, misalnya balabala=>

create database balabala;

5. Untuk melihat seluruh database yang ada di server, gunakan command :

SHOW DATABASES;

6. exit dari mode mysql

7. import database dengan command =>
mysql -u root -p balabala

masuk ke mode mysql =>
mysql
use balabala;
show tables

maka table-table dari database yang diimport akan muncul.

Good luck.

Sup Telur

My bestfriend ask me bad to write my Egg Soup recipe for her. She really want to cook for her boy this weekend. Well, here we goes…

Getting ready :
1. Tentukan toping. Misal wortel, buncis, dan baby corn.
2. Kupas dan cuci topping.
2. Iris toping sesuai selera, misal buncis dipotong miring kecil-kecil, baby corn dipotong miring kecil, wortel dipotong bulat kecil.
3. Iris tipis 6 siung bawang putih.
4. Kocok 1 butir telur ayam.

Cooking :
1. Tumis bawang putih sampai harum
2. Masukkan daun bawang
3. Masukkan irisan wortel, buncis, dan baby corn. aduk rata.
4. Masukkan air matang sedikit demi sedikit hingga topping terendam namun jangan terlalu banyak, secukupnya untuk kuah saja.
5. Saat air mendidih, masukkan garam secukupnya, merica sedikit, dan gula setengah sendok.
5. Aduk seperlunya, hingga topping lunak.
6. Setelah lunak,dengan api kecil, masukkan kocokan telur sedikit demi sedikit. Lalu aduk masakan hingga menghasilkan serat halus pada sup.
7. Cicip masakan dan tambahkan bumbu seperti garam, gula, atau merica jika terasa kurang. Jika terasa berlebih, tambahkan sedikit air, dan sesuaikan bumbu.

Good luck.

Access MySQL on an Android App (Android Studio)

Thanks to Taseen Amin http://twitter.com/taseenAdmin for this tutorial. I post this rashly. I’ll explain this tutorial when I get time, soon.

file app/src/main/res/layout/ activity_main.xml


<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">

<TextView
android:text="@string/hello_world"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/result" />

</RelativeLayout>

file app/src/main/java/MainActivity.java


package com.ditaoktaria.classic;

import android.os.StrictMode;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.json.JSONArray;
import org.json.JSONObject;
import java.lang.String;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;

import static com.ditaoktaria.classic.R.id.result;
public class MainActivity extends ActionBarActivity {

TextView resultView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
StrictMode.enableDefaults();
resultView = (TextView) findViewById(R.id.result);
getData();
}

public void getData(){
String result ="";
InputStream isr = null;
try{
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://10.0.0.61/classic/getAllLectures.php");
HttpResponse response = httpclient.execute(httppost);
HttpEntity entity = response.getEntity();
isr = entity.getContent();
}
catch (Exception e){
Log.e("log_tag","Error in http connection"+e.toString());
resultView.setText("Couldnt connect to database");
}

//convert response to String

try{
BufferedReader reader = new BufferedReader(new InputStreamReader(isr,"iso-8859-1"),8);
StringBuilder sb = new StringBuilder();
String line = null;
while ((line=reader.readLine()) != null) {
sb.append(line + "\n");
}
isr.close();
result=sb.toString();
}
catch(Exception e){
Log.e("log_tag","Error converting result"+e.toString());
}

try {
String s = "";
JSONArray jArray = new JSONArray(result);

for(int i=0; i<jArray.length(); i++){
JSONObject json = jArray.getJSONObject(i);
s = s+
"idLecturer : "+json.getInt("idLecturer")+"\n"+
"username : "+json.getString("username")+"\n"+
"pass : "+json.getString("pass")+"\n"+
"fullName :"+json.getString("fullName")+"\n\n";
}

resultView.setText(s);

}

catch (Exception e){
//to do handle exception
Log.e("Log_tag","Error Parsing Data"+e.toString());
}

}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();

//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}

return super.onOptionsItemSelected(item);
}
}

file app/src/main/AndroidManifest.xml


<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ditaoktaria.classic" >

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>

</manifest>

access mysql on android

access mysql on android

Start XAMPP on Yosemite OSX 10.10 (error example)

1. How to start your XAMPP services?

XAMPP control panel on OSX named manager-osx

xampp control panel

xampp control panel

 

2. Go to tab “manage server” then start the apache and mysql service.

3. If you can’t start the mysql servie, open your terminal and execute this command :

sudo /Applications/XAMPP/xamppfiles/bin/mysql.server start

4. You might see ” starting mysql….. success” but Mysql database on manager-osx is still not running.

Don’t worry, it just takes a while for it to become “running”, you can just open http://localhost/phpmyadmin on your browser and you will see that it actually has been started already.

Good luck !

Taqobalallahu minna wa minkum, taqobbal yaa karim. Mohon maaf lahir dan batin ya teman2 semuanya. Please forgive all of my words and attitude that may hurt you. Maafkan kekhilafan saya. Happy eid mubarak ! Allahu akbar allahu akbar, allahu akbar :) – with Dhinda Maydhita

View on Path