Monday, September 17, 2012

Setting Git

Just in case if forget to setting proxy for your GIT if you want to use GIT with proxy then type command below
git config --global http.proxy 
but if you want to delete your proxy setting for your GIT app, then type command below
git config --global --unset http.proxy

Wednesday, September 12, 2012

Setting Proxy for Maven

Just write down when need proxy to grab maven repo go to maven directory and find setting.xml. and find sub proxies


Tuesday, May 29, 2012

Execute Bash script via Java GUI

Couple days ago I got question from My Friend, is there any possibilities to execute bash script with some input from Swing? I didn't answer that question but let me think about it later after got free time.
Today I write answer,
Scenario --> I need to execute bash script with input SUBJECT and EMAIL ADRESS, got 2 input here.

Shell script

just create bash/shell script in your linux/unix machine as per below
#! /bin/sh 

echo "This is content of Email" | /usr/bin/mutt -s "Request by ${1}" ${2}  -a just_test.txt

Tag of ${1} is first input of bash script and ${2} is second input.
I need jSch library to execute bash script, so go to here and download library, then you just include jsch library into your project
This is Swing Gui for execute Bash Script

What I did was , create class with execute bash/shell script with help from jSch library. here my simple code

private void SendEmail(String ntuser, String email) throws Exception {                
        String host = "";
        String user = "test";
        String pass = "test";
        String command = "/bin/sh /home/cmsuser/ "+ntuser+" "+email;
        try {
            JSch jsch=new JSch(); 
            Session session = jsch.getSession(user, host);  
            java.util.Properties config=new java.util.Properties();
            config.put("StrictHostKeyChecking", "no");
            ChannelExec channel = (ChannelExec) session.openChannel("exec"); 
            channel.setCommand(command);  // Pull Report            
            BufferedReader reader = new BufferedReader(new InputStreamReader(channel.getInputStream()));
            String output = reader.readLine();
            while (output != null) {
                output = reader.readLine();
        } catch (Exception t) {

You must change your host name, user & password before you save and execute your java project. And the next step go to my Github page for more details

Sunday, May 20, 2012

Create Ascii Checker tools with Java Swing

Question : Need ascii check before paste word into CMS Template
Answer : Need fast checker rather than re-type offer one by one.

Create swing project with Netbeans for that purpose.

What important thing is you must decide what ascii encoder you need to use in your checking. my one only use this

static CharsetEncoder asciiEncoder = Charset.forName("US-ASCII").newEncoder(); // or "ISO-8859-1" for ISO Latin 1

  public static boolean isPureAscii(String v) {  
      return asciiEncoder.canEncode(v);

and this is what I build for Ascii Checker

and code for Check button was

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         
        // TODO add your handling code here:
        int koral =0;
        for (int j = jTextArea1.getText().length(); j>= koral; j--) {
            String s = jTextArea1.getText().substring(j);//substring(koral, j);            
            if (isPureAscii(s) == false ) {
                jLabel1.setText("isPureAscii() --> "+isPureAscii(jTextArea1.getText())+"  Failed at position : "+ j);
                //System.out.println("Char at position: "+ j);                            
                jLabel1.setText("isPureAscii() --> " +isPureAscii(jTextArea1.getText()));

the next step go to my Github page for more details

Monday, January 19, 2009

Blogging melalui firefox dengan add on [ScribeFire]

This add on make us easir to blogging, if there something to write just open your firefox and choose ScribeFire and start to wirte. Technology made us easier...
thanks God...

Saturday, January 17, 2009

Mempercepat access loading FireFox

1. buka firefox
2. klik pada addressbar : ketik 'about:config'

a. network.http.max-connections = set ke 30
b. network.http.pipelining = set ke TRUE
c. network.http.pipelining.maxrequests = 8
d. network.http.proxy.pipelining = true

3. buat key baru caranya : kilk kanan pilih new integer
4 . ketik : 'nglayout.initial.delay' set ke 0 (KOSONG alias NOL)

Sumber au ah gelap...

Friday, January 16, 2009

Update ah...

Lama nih kagak update blog gue, secara gue kesasar pada kerjaan yang
bussyyyeetttt.... tujuh ribu, sama sekali berhubung dengan ini & itu IT,
but life must be go on ..

Kalau bisa sih nyari sesuatu/share sesuatu yang bener2 berguna buat diri
sendiri dulu, kagak perduli orang mau baca atau tidak yang penting bisa
dipakai kalau butuh...Nyambung kagak sih... au ah gelap...

Will see u soon...