September 28, 2014

Develop a Regional language translator in java

Java source code to for english to malayalam language translator

     There are many online English to malayalam translator available in internet. If you are searching for a full java source code to convert english to malayalam then please dont go through this post, this only an idea how to start working on a english to malayalam language convertor. The code here is not a complete code. Copy the code paste it in your eclipse/Net bean ide and run it.

     You can download the English to malayalam convertor jar application from the link given below.
Please provide your feedback, you can comment for any post in this blog. Genuine comments will be appreciated !!! 

     Some guys sent me alternate code through face book and gmail (probably better code) after reading the post. thanks to those guys. and i have appended all those code with those posts. so share your knowledge !

Language Translator Image
Language Translator in java

Author : +belazy


/**
* Developing for office use
*/


import javax.swing.SwingUtilities;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;

import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.JButton;
import javax.swing.JTextArea;
import javax.swing.border.Border;
import java.awt.Rectangle;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
/**
* @author True caller java *
*/
public class Translator extends JFrame {

private static final long serialVersionUID = 1L;
private JPanel jContentPane = null;
private JTextArea typeArea = null;
private JTextArea viewArea = null;
private Translator thisClass = null;
private Mozhi mozhiObj = null;
/**
* This method initializes Typing area
*
* @return javax.swing.JButton
*/
private JTextArea getTypingArea() {
if (typeArea == null) {
typeArea = new JTextArea();
//typeArea.setBounds(new Rectangle(50, 50, 600, 600));
typeArea.setBounds(new Rectangle(30, 20, 200, 100));
Border border = BorderFactory.createLineBorder(Color.BLACK);
typeArea.setBorder(BorderFactory.createCompoundBorder(border,
BorderFactory.createEmptyBorder(10, 10, 10, 10)));
typeArea.addKeyListener(new KeyAdapter() {
public void keyReleased(KeyEvent e) {
//System.out.println(" Vipin C P");

}

public void keyTyped(KeyEvent e) {
//System.out.println(" Developing language Translator ");
//String engWord = typeArea.getText();
//viewArea.setText(mozhiObj.getMalayalam(engWord));
viewArea.setText(convertToMalayalam(typeArea.getText()));
}
public void keyPressed(KeyEvent e) {
//System.out.println(" English to south indian language translation ");
}
});
}
return typeArea;
}
protected String convertToMalayalam(String engWord) {
String englishWord = engWord;
String malWord = englishWord.replaceAll("A", "¦");
malWord = malWord.replaceAll("bi", "Ìß");
malWord = malWord.replaceAll("the", "çÄ");
malWord = malWord.replaceAll("sh", "×í");
return malWord;
}

/**
* This method initializes Typing area
*
* @return javax.swing.JButton
*/
private JTextArea getViewArea() {
if (viewArea == null) {
viewArea = new JTextArea();
Font malFont = new Font("Kerala", Font.PLAIN, 15);
Border border = BorderFactory.createLineBorder(Color.GRAY);
viewArea.setBorder(BorderFactory.createCompoundBorder(border,
BorderFactory.createEmptyBorder(10, 10, 10, 10)));
//viewArea.setBounds(new Rectangle(700, 50, 600, 600));
viewArea.setBounds(new Rectangle(250, 20, 200, 100));
viewArea.setEditable(false);
viewArea.setFont(malFont);
}
return viewArea;
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
SwingUtilities.invokeLater(new Runnable() {
public void run() {
Translator thisClass = new Translator();
thisClass.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
thisClass.setVisible(true);
}
});
}

/**
* This is the default constructor
*/
public Translator() {
super();
initialize();
}

/**
* This method initializes this
*
* @return void
*/
private void initialize() {
//this.setSize(1340, 720);
this.setSize(500, 200);
this.setContentPane(getJContentPane());
this.setTitle("CFED : English To Malayalam Translator");
mozhiObj = new Mozhi();
}

/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
jContentPane = new JPanel();
jContentPane.setLayout(null);
//jContentPane.add(getLoginButton(), null);
jContentPane.add(getTypingArea(), null);
jContentPane.add(getViewArea(), null);
}
return jContentPane;
}

}






function : convertToMalayalam() is that converts english words to malayalam, work on it. you can use a separate class to do the job.


You can download the malayalam font from this link
FileName : Javabelazy72902
Pasword : independenceday

Please try this code and feedback...

here is an online malayalam editor link


Thanks to +deepajayaprakash payyanakkal


http://javabelazy.blogspot.in/

September 12, 2014

Traffic Light demo in visual basic

Demo for Traffic Light application in visual basic







Dim db As Database
Dim rs As Recordset

Private Sub Command1_Click()
Timer1.Enabled = True
Timer5.Enabled = False
Timer3.Enabled = False
Timer2.Enabled = False
Timer4.Enabled = False
End Sub

Private Sub Command2_Click()
End
End Sub

Private Sub Form_Load()
Set db = opendatabase("K:\WorldTradeCenter\Newyork\iphone\Moto.mdb")
Set rs = db.openrecordset("select * from traffic")
End Sub

Private Sub Timer1_Timer()
Shape1.FillStyle = 0
Shape6.FillStyle = 0
Shape2.FillStyle = 1
Shape3.FillStyle = 1
Shape4.FillStyle = 1
Shape5.FillStyle = 1
Timer2.Enabled = True
Timer1.Enabled = False
Timer3.Enabled = False
Timer4.Enabled = False
Timer5.Enabled = True
End Sub

Private Sub Timer2_Timer()
Shape1.FillStyle = 1
Shape6.FillStyle = 1
Shape2.FillStyle = 0
Shape3.FillStyle = 1
Shape4.FillStyle = 1
Shape5.FillStyle = 0
Timer3.Enabled = True
Timer1.Enabled = False
Timer2.Enabled = False
Timer4.Enabled = False
Timer5.Enabled = True
End Sub

Private Sub Timer3_Timer()
Shape1.FillStyle = 1
Shape6.FillStyle = 1
Shape2.FillStyle = 1
Shape3.FillStyle = 0
Shape4.FillStyle = 0
Shape5.FillStyle = 1
Timer3.Enabled = False
Timer1.Enabled = False
Timer2.Enabled = False
Timer4.Enabled = True
Timer5.Enabled = True
End Sub

Private Sub Timer4_Timer()
Shape1.FillStyle = 1
Shape6.FillStyle = 1
Shape2.FillStyle = 0
Shape3.FillStyle = 1
Shape4.FillStyle = 1
Shape5.FillStyle = 0
Timer3.Enabled = False
Timer1.Enabled = True
Timer2.Enabled = False
Timer4.Enabled = False
Timer5.Enabled = True
End Sub

Private Sub Timer5_Timer()
If rs.EOF = False Then
Label2(0).Caption = rs(0)
Label2(1).Caption = rs(0)
rs.MoveNext
Else
rs.MoveFirst
End If
End Sub
 



To download the microsoft access database file click here
filename : Javabelazy32510
password : iphone6


Happy Onam to all visitors

http://javabelazy.blogspot.in/

September 10, 2014

How to block browsing sites in your computer

How to block internet access in your computer



Yes you can block internet access to your computer !!!

you can override the DNS for a domain in your system by modifying the hosts file in system32 folder in windows. Actually these are used for testing purpose, but we used (we can use) to deny access to a particular site by using loop back ip ie 127.0.0.1 thus a big problem disturbing our IT Section ( assigned by +bithesh soubhagya  ) was solved.

We successfully blocked internet access in 100 branches under cfed kozhikode regional office.

The units under our regions are misusing internet for the past years, the old IT staff had blocked denied the access to internet explorer by a password. But it doesnt worked fine while mozilla firefox and google chrome came and peoples starts installing third party browser software. So now its necessity for any thing new that block their access to internet. For past few weeks i was working on it and found a solution.

How to block internet


Browse to  C:\Windows\System32\Drivers\etc\

you can find a hosts file in it, right click and edit and make following changes. Now try to access facebook, the site will redirect to your system itself. Access blocked !!!



consumerfed kozhikode region it section
you can download the hosts file from here

Other methods for blocking internet access to triveni computers link




Thanks to +Consumerfed  +Consumerfed IT Division  for assigning this task through our regional IT




http://javabelazy.blogspot.in/

Facebook comments