Thursday, December 24, 2015 0 comments

Merry Christmas 2015

0 comments

Favourite Quotes

Our body is nothing more than a container. - Digimon Tamer

We can change our fate. - Digimon Tamer

We can't change the past, but we can change our present for our future. - Digimon Tamer
0 comments

Fun (feat. Tove Lo) - Coldplay

I know it's over before she says
I know it falls at the water face
I know it's over, an ocean that waits
For a storm
The sun on snow
Rivers in rain
Crystal ball can foresee a change
And I know it's over, a parting of ways
And it's done

But didn't we have fun?
Don't say it was all a waste
Didn't we have fun?
From the top of the world
The top of the waves
We said forever, forever always
We could have been lost
We would have been saved
Now we're stopping the world, stopping it's spin
Oh come on don't give up
Don't see me give in
Don't say it's over
Don't say we're done
Oh, didn't we have fun?
Oh, didn't we have fun?

I know it's over before she says
Know someone else has taken your place
"I know it's over" Icarus says to the sun
The sword sinks in, lightning strikes
And two force, two forces collide
And fight til it's over, fight til it's done

But didn't we have fun?
Don't say it was all a waste
Didn't we have fun?
From the top of the world
The top of the waves
We said forever, forever always
We could have been lost
We would have been saved
Now we're stopping the world, stopping it's tracks
But nothing's too broken to find a way back
Before it's over, before you run
Ah, didn't we have fun?

Cause you and me
We were always meant to, always meant to
Hey-ey-ey-ey
We were always meant to, always meant to
You and me
We were always meant to, always meant to
Hey-ey-ey-ey

Oh, didn't we have fun?

Oh, didn't we have fun?

But then...
Maybe we could again
0 comments

Psikotes PT AGIT

Waktu 2 jam.

Psikotesnya dimulai dengan:
1. Tes aritmatika(+,-,x,/). 30 soal
2. Tes mencari gabungan gambar. 30 soal
3. Tes mencari sinonim dan antonim. 30 soal
4. Tes mencari 2 pola gambar berikutnya. 30 soal
5. Tes Pauli, kertas A3 bolak-balik.
0 comments

Psikotes PT Daihatsu Motor

Waktu dr pukul 2 siang sampai 5 sore.
Bawa pensil HB, pena hitam dan KTP asli

Psikotesnya dimulai dengan:
1. tes logika matematika(>,<,>=,<=,=,!=)
2. tes gambar balok yg bersentuhan. Ada berapa sisi yg bersentuhan
3. tes logika pengambilan kesimpulan. Jika a maka b. Jika b maka c. Kesimpulan jika a maka c.
4. tes logika gambar mekanik. timbangan, roda gir, katrol
5. tes melengkapi gambar yang hilang
6. tes krapelin
7. tes warteg
8. tes gambar orang
9. tes gambar pohon
0 comments

Download Videos 1.1

Refer to previous version program Download Video 1.0, I made some changes:
1. Add GUI so that it will look nicer
2. Add method for checking internet connectivity
3. Add try catch to all methods
4. No need to set path for Internet Download Manager(IDM), just put the path on the Input Dialog
5. Have the executable program (.exe)


Here is the input:




Here is the process:



And for the output is still the same with previous version: have a text file output and links are queuing to IDM.

Download Executable Program (.exe)

Here is the implementation in Java Programming Language:
 
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.util.List;

import javax.swing.BorderFactory;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.SwingUtilities;

import org.apache.commons.io.FileUtils;
import org.apache.commons.io.LineIterator;
import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.firefox.internal.ProfilesIni;

// create "firefox.exe -p" profile
// and set browser firefox about:config :
// permissions.default.image=2 (disable images)
// media.autoplay.enabled=false
// media.mediasource.enabled=false
// and set never remember history or cache

public class IDMCommandLine {

 public static String seasonURL;
 public static String filePath;
 public static String idmPath;
 public static long waitingTime;
 public static String urlTestInetConn = "www.google.com";
 public static int portTestInetConn = 80;
 public static JLabel label;

 public static void main(String[] args) {
  try {
   if (testInternetConnection(urlTestInetConn, portTestInetConn)) {
    getInputDialogShowProgressBarDoBackgroundProcess();
   }
  } catch (Exception ex) {
   System.out.println("Error from main");
   JOptionPane.showMessageDialog(null, "Error from main");
   ex.printStackTrace();
   System.exit(0);
  }

 }

 public static boolean testInternetConnection(String site, int port) {
  boolean returnValue = false;
  Socket sock = new Socket();
  try {
   InetSocketAddress addr = new InetSocketAddress(site, port);
   sock.connect(addr, 3000);
   returnValue = true;
  } catch (Exception ex) {
   returnValue = false;
   ex.printStackTrace();
   System.out.println("Make sure you have an internet connection.");
   JOptionPane.showMessageDialog(null, "Make sure you have an internet connection.");
  } finally {
   try {
    sock.close();
   } catch (IOException e) {
   }

  }
  return returnValue;
 }

 public static void getInputDialogShowProgressBarDoBackgroundProcess() {
  try {
   // show input dialog for season url, file path,
   // idm path and waiting time
   seasonURL = JOptionPane.showInputDialog(null,
     "Input Season URL =\nExample: http://kisscartoon.me/Cartoon/The-Simpsons-Season-03",
     "http://kisscartoon.me/Cartoon/The-Simpsons-Season-03");
   filePath = JOptionPane.showInputDialog(null,
     "Input file text output destination =\nExample: C:\\Users\\Stars\\Desktop\\TheSimpsonsSeason03.txt",
     "C:\\Users\\Stars\\Desktop\\TheSimpsonsSeason03.txt");
   idmPath = JOptionPane.showInputDialog(null,
     "Input Internet Download Manager's path =\nExample: C:\\Program Files (x86)\\Internet Download Manager\\IDMan.exe",
     "C:\\Program Files (x86)\\Internet Download Manager\\IDMan.exe");
   String time = JOptionPane.showInputDialog(null, "Input waiting time in miliseconds=\nExample: 5000",
     "5000");
   waitingTime = Long.parseLong(time);

   // call frame for progress bar
   final JFrame frame = new JFrame("Download Video");
   final JProgressBar progressBar = new JProgressBar();
   progressBar.setIndeterminate(true);

   progressBar.setPreferredSize(new Dimension(500, 20));
   final JPanel contentPane = new JPanel();
   // top,left,bottom,right
   contentPane.setBorder(BorderFactory.createEmptyBorder(10, 100, 10, 100));
   contentPane.setLayout(new BorderLayout());
   label = new JLabel("Processing...");
   contentPane.add(label, BorderLayout.NORTH);
   contentPane.add(progressBar, BorderLayout.CENTER);
   frame.setContentPane(contentPane);
   frame.pack();
   frame.setLocationRelativeTo(null);
   frame.setVisible(true);
   frame.setResizable(false);
   frame.addWindowListener(new WindowAdapter() {
    @Override
    public void windowClosing(WindowEvent we) {
     // exit process when click close icon
     System.exit(0);
    }
   });

   // start background prosess
   Runnable runnable = new Runnable() {
    public void run() {

     // call main process
     process(seasonURL, filePath, idmPath, waitingTime);

     SwingUtilities.invokeLater(new Runnable() {
      public void run() {
       frame.setVisible(false);
      }
     });

    }
   };

   new Thread(runnable).start();
  } catch (Exception ex) {
   System.out.println("Error from getInputDialogShowProgressBarDoBackgroundProcess");
   JOptionPane.showMessageDialog(null, "Error from getInputDialogShowProgressBarDoBackgroundProcess");
   ex.printStackTrace();
   System.exit(0);
  }
 }

 public static void changeLabel(final String s) {
  try {
   SwingUtilities.invokeLater(new Runnable() {
    public void run() {
     label.setText("<html>" + s + "</html>");

    }
   });
  } catch (Exception ex) {
   System.out.println("Error from changeLabel");
   JOptionPane.showMessageDialog(null, "Error from changeLabel");
   ex.printStackTrace();
   System.exit(0);
  }
 }

 public static void process(String seasonURL, String filePath, String idmPath, long waitingTime) {
  try {
   System.out.println("Start " + seasonURL);
   changeLabel("Start " + seasonURL);
   // get episodes and videos url
   StringBuilder saveVideoURL = new StringBuilder();
   String[] episodesURL = getEpisodesURL().split(";");
   System.out.println("Total episodes = " + episodesURL.length);
   changeLabel("Total episodes = " + episodesURL.length);
   for (int i = episodesURL.length - 1; i >= 0; i--) {
    if (episodesURL[i] != null) {
     String videoURL = getVideoURL(episodesURL[i]);
     String videoTitle = getVideoTitle(episodesURL[i]);
     System.out.println(videoTitle + "\n" + videoURL);
     changeLabel(videoTitle + "<br>" + videoURL);
     saveVideoURL.append(videoTitle);
     saveVideoURL.append(";");
     saveVideoURL.append(videoURL);
     saveVideoURL.append(";");
     saveVideoURL.append(episodesURL[i]);
     saveVideoURL.append("\n");
    }
   }

   // write file to text
   File file = new File(filePath);
   FileUtils.writeStringToFile(file, saveVideoURL.toString().trim());

   // send link to IDM
   File file1 = FileUtils.getFile(filePath);
   LineIterator iter = FileUtils.lineIterator(file1);
   while (iter.hasNext()) {
    String[] lines = iter.next().split(";");
    String title = lines[0];
    String url = lines[1];
    // String referer = lines[2];

    if (!url.equals("null")) {
     sendURLtoIDM(url, title);
    }
   }
   System.out.println("Finish " + seasonURL);
   changeLabel("Finish " + seasonURL);

  } catch (Exception ex) {
   System.out.println("Error from process");
   JOptionPane.showMessageDialog(null, "Error from process");
   ex.printStackTrace();
   System.exit(0);
  }
 }

 public static void sendURLtoIDM(String videoURL, String videoTitle) {
  try {
   ProcessBuilder pb = new ProcessBuilder(idmPath, "/d", videoURL, "/f", videoTitle, "/a");
   Process process = pb.start();
   int returnValue = process.waitFor();
   if (returnValue == 0) {
    process.destroy();
   }
  } catch (Exception ex) {
   System.out.println("Error from sendURLtoIDM");
   JOptionPane.showMessageDialog(null, "Error from sendURLtoIDM");
   ex.printStackTrace();
   System.exit(0);
  }
 }

 public static String getVideoTitle(String url) {
  String titleString = null;
  try {
   if (url != null && !url.equals("")) {
    String[] titles = url.trim().replace("-", "_").replace("?", ",").split(",")[0].split("/");
    titleString = titles[titles.length - 2].concat("_").concat(titles[titles.length - 1]).concat(".mp4");
   }

  } catch (Exception ex) {
   System.out.println("Error from getVideoTitle");
   JOptionPane.showMessageDialog(null, "Error from getVideoTitle");
   ex.printStackTrace();
   System.exit(0);
  }
  return titleString;
 }

 public static String getEpisodesURL() {
  StringBuilder sb = new StringBuilder();

  try {
   // get saved profile
   ProfilesIni profile = new ProfilesIni();
   FirefoxProfile myprofile = profile.getProfile("MyProfile");

   // load the firefox profile
   WebDriver driver = new FirefoxDriver(myprofile);
   // open URL
   driver.get(seasonURL);
   // wait page loading
   Thread.sleep(waitingTime);

   List<WebElement> tables = driver.findElements(By.tagName("table"));
   for (WebElement table : tables) {
    List<WebElement> trs = table.findElements(By.tagName("tr"));
    for (WebElement tr : trs) {
     List<WebElement> tds = tr.findElements(By.tagName("td"));
     for (WebElement td : tds) {
      List<WebElement> as = td.findElements(By.tagName("a"));
      for (int i = 0; i < as.size(); i++) {
       sb.append(as.get(i).getAttribute("href"));
       sb.append(";");
      }
     }
    }
   }
   driver.quit();
   if (sb == null || sb.toString().trim().equals("")) {
    sb = null;
    System.out.println("Could not find any episodes");
    JOptionPane.showMessageDialog(null, "Could not find any episodes");
    System.exit(0);
   }

  } catch (Exception ex) {
   System.out.println("Error from getEpisodesURL");
   JOptionPane.showMessageDialog(null, "Error from getEpisodesURL");
   ex.printStackTrace();
   System.exit(0);
  }
  return sb == null ? null : sb.toString().trim();
 }

 public static String getVideoURL(String urlEpisode) {
  String urlVideo = null;
  try {
   // get saved profile
   ProfilesIni profile = new ProfilesIni();
   FirefoxProfile myprofile = profile.getProfile("MyProfile");

   // load the firefox profile
   WebDriver driver = new FirefoxDriver(myprofile);
   // open URL
   driver.get(urlEpisode);
   // wait page loading
   Thread.sleep(waitingTime);

   List<WebElement> results = driver.findElements(By.tagName("video"));
   for (WebElement we : results) {
    urlVideo = we.getAttribute("src");
   }
   driver.quit();
  } catch (Exception ex) {
   System.out.println("Error from getVideoURL");
   JOptionPane.showMessageDialog(null, "Error from getVideoURL");
   ex.printStackTrace();
   System.exit(0);
  }
  return urlVideo;
 }
}
Saturday, December 19, 2015 0 comments

Download Videos 1.0

Imagine when i open kissanime.to or kisscartoon.me website:


Output: text file contains links of the videos



Internet Download Manager is queuing the videos link



Download Java Project

Here is the implementation in Java Programming Language:
 
import java.io.File;
import java.io.IOException;
import java.util.List;

import org.apache.commons.io.FileUtils;
import org.apache.commons.io.LineIterator;
import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.firefox.internal.ProfilesIni;

// create "firefox.exe -p" profile
// and set browser firefox about:config :
// permissions.default.image=2 (disable images)
// media.autoplay.enabled=false
// media.mediasource.enabled=false
// and set never remember history or cache
// set enviroment variable path to IDM.exe directory

public class IDMCommandLine {
 
 //get video url from kissanime.to or kisscartoon.me
 public static String seasonURL = "http://kisscartoon.me/Cartoon/The-Simpsons-Season-03";
 public static String filePath = "C:\\Users\\Stars\\Desktop\\TheSimpsonsSeason03.txt";
 public static String idmPath = "IDMan.exe";
 public static long waitingTime=5000;

 public static void main(String[] args) throws Exception {

  System.out.println("Start " + seasonURL);

  StringBuilder saveVideoURL = new StringBuilder();
  String[] episodesURL = getEpisodesURL().split(";");
  System.out.println("Total episodes = "+episodesURL.length);
  for (int i = episodesURL.length - 1; i >= 0; i--) {
   if (episodesURL[i] != null) {
    String videoURL = getVideoURL(episodesURL[i]);
    String videoTitle = getVideoTitle(episodesURL[i]);
    System.out.println(videoTitle+"-->"+videoURL);
    saveVideoURL.append(videoTitle);
    saveVideoURL.append(";");
    saveVideoURL.append(videoURL);
    saveVideoURL.append(";");
    saveVideoURL.append(episodesURL[i]);
    saveVideoURL.append("\n");
   }
  }

  File file = new File(filePath);
  FileUtils.writeStringToFile(file, saveVideoURL.toString().trim());

  File file1 = FileUtils.getFile(filePath);
  LineIterator iter = FileUtils.lineIterator(file1);
  while (iter.hasNext()) {
   String[] lines = iter.next().split(";");
   String title = lines[0];
   String url = lines[1];
   // String referer = lines[2];

   if (!url.equals("null")) {
    sendURLtoIDM(url, title);
   }
  }

  System.out.println("Finish " + seasonURL);
 }

 public static void sendURLtoIDM(String videoURL, String videoTitle) throws IOException, InterruptedException {
  // TODO Auto-generated method stub
  ProcessBuilder pb = new ProcessBuilder(idmPath, "/d", videoURL, "/f", videoTitle, "/a");
  Process process = pb.start();
  int returnValue = process.waitFor();
  if (returnValue == 0) {
   process.destroy();
  }
 }

 public static String getVideoTitle(String url) {
  String[] titles = url.trim().replace("-", "_").replace("?", ",").split(",")[0].split("/");
  String titleString = titles[titles.length - 2].concat("_").concat(titles[titles.length - 1]).concat(".mp4");
  return titleString;
 }

 public static String getEpisodesURL() throws InterruptedException {
  // get saved profile
  ProfilesIni profile = new ProfilesIni();
  FirefoxProfile myprofile = profile.getProfile("MyProfile");

  // load the firefox profile
  WebDriver driver = new FirefoxDriver(myprofile);
  // open URL
  driver.get(seasonURL);
  // wait page loading
  Thread.sleep(waitingTime);

  StringBuilder sb = new StringBuilder();
  List<webelement> tables = driver.findElements(By.tagName("table"));
  for (WebElement table : tables) {
   List<webelement> trs = table.findElements(By.tagName("tr"));
   for (WebElement tr : trs) {
    List<webelement> tds = tr.findElements(By.tagName("td"));
    for (WebElement td : tds) {
     List<webelement> as = td.findElements(By.tagName("a"));
     for (int i = 0; i < as.size(); i++) {
      sb.append(as.get(i).getAttribute("href"));
      sb.append(";");
     }
    }
   }
  }
  driver.quit();
  return sb == null ? null : sb.toString().trim();
 }

 public static String getVideoURL(String urlEpisode) throws InterruptedException {
  // get saved profile
  ProfilesIni profile = new ProfilesIni();
  FirefoxProfile myprofile = profile.getProfile("MyProfile");

  // load the firefox profile
  WebDriver driver = new FirefoxDriver(myprofile);
  // open URL
  driver.get(urlEpisode);
  // wait page loading
  Thread.sleep(waitingTime);
  String urlVideo = null;
  List<webelement> results = driver.findElements(By.tagName("video"));
  for (WebElement we : results) {
   urlVideo = we.getAttribute("src");
  }
  driver.quit();
  return urlVideo;
 }
}
go to Download Video 1.1
Friday, December 4, 2015 0 comments

I am so sick

I get a crazy headache. I don't know what causes it. Maybe because I still have no job. Or Maybe because I am brokenhearted. If I can choose I would rather die and don't feel this pain anymore. Pain to not being normal. I am so lonely. Yesterday when came back from the interview, I took a bus going home. Inside this bus, I like one man. I don't know if he is like us too. He looks like an Arabic man with beard. I tried to get beside him. I think our hands were touching and I think we enjoyed it. Actually at that time I felt so sleepy. I wanted to huge him. I know it sounds crazy. But I controlled my will. I wanted to stop when the bus stopped and followed him and talked to him. But because I felt my body was really tired and sick at time time, i didn't do it. Whoever you are, I wish one day we could meet again.
Wednesday, December 2, 2015 0 comments

Pokemon Movie 18 Hoopa and The Clash of Ages Full movie HD

Click Here
0 comments

Android Programming Test PT ESKA LINK

Berlangsung di Jl. Thamrin Boulevard (d/n Jl. Kebon Kacang Raya), Jakarta Pusat. Dekat Grand Indonesia/Plaza Indonesia.

Ada soal tertulis dan praktek.

Soal tertulis:
1. Tuliskan pendapat mu tentang Java, minimal 10.
2. Apa itu Android SDK dan fungsinya
3. Pernakah menggunakan Database SQLite
4. Sudah berapa lama mengenal Android Programming

Soal praktek:
diberikan alamat IP lokal yang merupakan service JSON.
gunakan itu untuk menampilkan dua gambar yg didapat dr url yang ada pada data json service tersebut
-diberi laptop dan eclipse. selebihnya happy coding.
0 comments

Psikotes PT ATI Business Group

Psikotes nya berlangsung di Jalan Batutulis Raya 14, Jakarta Pusat.

Semua soal tesnya dalam bahasa Inggris.
Psikotesnya terdiri atas:
1. Tes grammar bahasa inggris. dikasih wacana. pilih jawaban mengenai wacana yang diceritakan. Kemarin itu ceritanya tentang seseorang dipukul oleh orang lain.
2. Tes logika menghitung, diberikan kalkulator. tes konversi mata uang. tes hitung2an harga jeruk 1gr bila jeruk yg dibeli 5kg berharga berapa dolar. tes harga sewa kamar per malam jika yang nyewa 2 org. tes hitungan bunga dan pajak.
3. Tes kepribadian(soalnya lumayan banyak), diberikan 4 statement, pilih yang mana yang paling mendekati dan bukan diri kamu.
4. Tes krapelin. menjumlahkan dari bawah ke atas.

Soal Programmingnya(khusus IT):
1. ada dua thread yang disynchronized. diminta outputnya apa: kalau tidak salah outputnya diconcat stringbuffernya. A B CA BB
2. sebutkan minimal 3 design pattern
3. desain database perpustakaan

Tesnya dari pukul 9 sampai 3 sore. Tentunya ada waktu istirahat makan 1 jam.
0 comments

Psikotes PT Faber Castell Internasional Indonesia

Psikotes nya berlangsung di Jl. Prof. Dr. Latumenten No. 50 Grogol, Jakarta Barat (belakang sorum Toyota, seberang Mall Season City).

Psikotesnya dimulai dengan:
1. tes kecerdasan/logika(total 4 bagianx15soal). gambar2. melengkapi gambar yang seharusnya lanjutan dr pola yang telah diberikan
2. tes pendengaran(total 15 soal). diberikan instruksi untuk menggaris, mencoret dan menyilang angka/huruf.
3. tes kepribadian(total 225 soal). antara 2 statement, mana yang mendekati kepribadian anda.
4. tes krapelin(total 10 kolom, 23 baris). menjumlahkan dari atas sampai bawah.
5. tes warteg. melanjutkan 8 potongan gambar. urutkan, beri penjelasan yg mana yg mudah dan sulit, disukai dan tidak disukai.
6. tes gambar orang. di atas kertas kosong. beri usia, jenis kelamin dan kegiatan yang sedang dilakukan.
7. tes gambar pohon. di atas kertas kosong. beri keterangan nama/jenis pohon.

Semua proses diberi pengerjaan dr pukul 10 - 2 siang. Tentunya istirahat 1 jam buat makan.
 
;