Posts which you will also like.

Monday, September 14, 2015

How to remove Windows 10's Forced updates

How to remove Windows 10's Forced updates


Microsoft launched windows 10 in 190 countries.
windows 10 automatically downloads onto windows 7 and windows 8, windows 10 installation files take 3.5GB to 6GB hidden folder labelled '$Windows.~BT'
go to your C: partition and look for folder- '$Windows.~BT'.




Windows 10 updates


there may be a setup.exe file which means a new operating system are already on your PC. to remove them use Shift+Delete or by safe way

windows10setup.exe




Right click to C:drive -> Properties -> Disk Cleanup -> Clean up System files -> Enables Temporary Windows installation files -> OK

Diskcleanup



How to remove Windows 10's Forced updates from being re-downloaded

Disk cleanup remove windows 10 files but after a reboot the updates may be re- downloaded with windows updates

to control this follow the next step:

go to control panel-> Programs and features-> View installed updates

and at top right side of the screen search for the below updates

for windows 8: KB3035583, KB2976978
and for windows 7: KB3035583, KB2952664, KB3021917
right-click each of them, and hit the uninstall option, but after this process a reboot will required, so do it, and after that follow the below steps:

Control Panel-> Windows Updates-> Check for Updates-> View Uninstalled updates

Look for the updates you just removed, right-click them one by one and hit the Hide update option.
Read More ->>

Saturday, September 12, 2015

Bazel by Google


Bazel by google
Google announce  the Beta release of Bazel, an open source system that automates software that builds and tests android apps.

Bazel supports java, Objective-C and C++ out of box, and can be extended to support arbitrary programming languages.

Bazel is a flavor of the tool that Google uses to build its server software internally. It has expanded to build other software as well, like mobile apps (iOS, Android) that connect to our servers.

Bazel shines at building and testing projects with a large codebase, projects written in compiled languages, projects that deploy on multiple platforms

Bazel can run on different platform, currently, Linux and Mac OS X.

Bazel is similar to other tools like Make, Ant, Gradle, Buck, Pants and Maven.

It also includes support for building Android and iOS apps, as well as Docker images, and lets you use libraries from sources like GitHub and Maven. If you prefer, you can dig into Bazel’s API to add your own build rules.


Read More ->>

iPhone 6S vs iPhone 6S Plus


iPhone 6S vs iPhone 6S Plus:


iPhone 6S and iPhone 6S Plus
1-Design

iPhone 6S: Curved aluminium, gold or light/dark silver, 6.8mm thick, 129g

iPhone 6S Plus: Curved aluminium, gold or light/dark silver 7.1mm thick, 172g

2-Screen

iPhone 6S: 4.7-inch 1334 x 750, “Retina HD” LCD

iPhone 6S Plus: 5.5-inch 1920 x 1080 LCD, optimisation in landscape

3-Camera

iPhone 6S: 8MP camera, 1/3.06-inch sensor, true-tone flash,f/2.2 aperture dual-LED flash, phase detection

iPhone 6S Plus: 8MP camera, 1/3.06-inch sensor, true-tone flash,f/2.2 aperture dual-LED flash, phase detection, OIS

4-Software

iPhone 6S and iPhone 6S Plus: iOS 9

5-Performance

iPhone 6S: Apple A9 64-bit and M9 co-processor

iPhone 6S Plus: Apple A9 64-bit and M9 co-processor

6-Storage and Price

The iPhone 6S will start at £539, while the iPhone 6S Plus starts at £619. Breaking that down further:

iPhone 6S 16GB: £539
iPhone 6S 64GB: £619
iPhone 6S 128GB: £699

iPhone 6S Plus 16GB: £619
iPhone 6S Plus 64GB: £699
iPhone 6S Plus 128GB: £789

7-Battery Life

iPhone 6S: 1,810 mAh battery, 11 hours video, 11 hours browsing

iPhone 6S Plus: 2,915 mAh battery, 14 hours video, 12 hours browsing

8-Colours

iPhone 6S and iPhone 6S Plus: Silver, Gold, Space Gray, Rose Gold

9-Sensors

Compass/ Magnetometer
Proximity sensor
Accelerometer
Ambient light sensor
Gyroscope
Barometer

10- 3D touch

iPhone 6s introduces an entirely new way to interact with your phone. For the first time, iPhone senses how much pressure you apply to the display. In addition to familiar Multi‑Touch gestures like Tap, Swipe, and Pinch, 3D Touch introduces Peek and Pop. This brings a new dimension of functionality to the iPhone experience. And when you use 3D Touch, your iPhone responds with subtle taps. So not only will you see what a press can do — you’ll feel it.
Read More ->>

Tuesday, July 2, 2013

FEATURES OF WINDOWS 8.1

Microsoft released the preview version of windows 8.1 operating system at the build 2013 conference in San Francisco on wed.



The windows 8.1 Operating System is in developing phase.

Windows 8.1 is updation of windows 8 with some of extra features and fully loaded apps.

 The previous version of windows 8.1 iso files available for download from Microsoft website.

Be careful while you installing this previous version of windows 8.1 Operating System as your system may crash.

You can search anything from your PC,your apps and the web. Powered by Bing.
In Windows 8.1 you will notice that Windows store has a new look which makes it easy to find and download apps.

You can also set an slide show on lock screen by picking your favourite pictures.

Windows 8.1 is built in cloud storage,now you can save your data on sky drive and can access your files from anywhere even when you are offline.

Updated version of win 8.1 contains internet explorer 11 thats make your browsing easier and faster,and also has updated version of skype.

In 8.1 Operating system there is an start buttom, through which you can easily shutdown,hibernate,sleep,lock,restart,log off and switch user.

For fully loaded Windows 8.1 Operating System wait for full version of 8.1 operating system - via techcresendo

Read More ->>

Wednesday, May 15, 2013

HOW TO PLAY A GAME BY ESTABLISHING A WI-FI CONNECTION?

HOW TO PLAY A GAME BY ESTABLISHING A WI-FI CONNECTION...?



1)ENABLE THE WI-FI


2)ON THE TASK BAR LOOK FOR THE "OPEN NETWORKS AND SHARING CENTER" CLICK ON IT .A DIALOGUE BOX APPEARS

3)CLICK ON "SET UP A NEW CONNECTION OR NETWORK"


 4)SCROLL DOWN TO CHOOSE SET UP A WIRELESS AND HOC(COMPUTER TO COMPUTER NETWORK) SELECT IT AND CLICK ON NEXT
5)THEN AGAIN CLICK ON NEXT

6)THEN NOW PROVIDE A "NETWORK NAME" AND "SECURITY KEY" OF YOUR CHOICE IT IS OPTIONAL TO SAVE THIS NETWORK CLICK ON NEXT

7)THE WIRELESS NETWORK IS SUCCESSFULLY CREATED

8)TO SHARE FILES OPEN NETWORK AND SHARING CENTER IN CONTROL PANEL AND TURN ON THE FILE SHARING

9)NOW THE PERSON WHO WANTS TO CONNECT TO THAT NETWORK CONNECTION MUST GIVE THE SAME NETWORK NAME/SSID AND SECURITY KEY
  AND THEN GO TO NETWORK AND REFRESH THE PAGE AND YOU WILL SEE THE NAME OF THE DEVICE/SYSTEM THAT YOU ARE CONNECTED WITH

10)NOW YOU ARE READY TO ENJOY THE MULTIPLAYER GAME WITHOUT USING LAN CARD.......
Read More ->>

Tuesday, March 26, 2013


Nexus 7 comes to India


 
                   Finally after a long wait, the Nexus 7 is gonna be launched in India at 16000 bucks; the product is expected to be shipped from 5th April onwards. You can book the same from the google site, find the link at bottom of this article.



               The Indian version although is going to be shipped in 16 GB variant, while there is no announcement about 8 GB version, so far; and it doesn't seem like Google would actually  be willing to release it either, but who is complaining ? :D .. We all obviously want more space.



              The Nexus is basically an Google flagship product, manufactured by Asus, so this would pitch in a lot of support from Google on software side, given that it even runs on Android 4.2 and along with project butter, this should run smooth.



              As far as the specs are concerned the Nexus 7 looks really promising, here is all the aspects in this little monster : 







1. Built and Screen 
 


              The Nexus is pretty solid built, given that ASUS is the manufacturer, There doesn't seem like too many things to be felt cheap about.. Would say very good built for its price range. The tab is 20 cm long and about 12 cm broad with thickness of 10.45 mm, and above all weighs only about 340 gm, so seems good for one hand fit! Oh yeah not to forget 7" inches screen, moreover the screen is protected by a Scratch-resistant Corning® glass.



          The Screen sports a 1200 x 800 resolutions screen, with 216 pixels per inches (ppi), although the resolution is good, the pixel density of 216 is just OK ! .. definitely not the best around. The nexus uses an IPS display. So overall the screen is decent, in fact pretty good for its price factor, but then Screen is not this tablet's biggest assets, so if we had to rate it we would say 8/10. 




2. Processor, RAM and GPU.




       The Nexus 7 runs on NVIDIA® Tegra® 3 quad-core processor, which is currently one of the best mobile cpu in the market, so thats a pretty good hardware, while 1 GB RAM is sure to make a smoother interface for the users.



          Not to forget that Google had put in a whole new research team on project BUTTERS, so as to make the whole experience on its tablet a butter like, so as far as interface is concerned this sure is a silky experience. We would give 9/10 for this segment.





3. BATTERY!!




          The one biggest problems according to me in the recent mobile devices has been the battery, well at least on this device we seem to have a decent battery, with 4325 mAH battery, this device should easily give about 7-8 hours of active uses, like gaming, wifi and stuff, this can easily be a score of 9/10






4. Other Inputs




                   1.2 Mgpx FRONT facing camera 
            (no back camera)
                    Android 4.2
            WiFi 802.11 b/g/n
            Bluetooth
            NFC
            Microphone
            Accelerometer
            GPS
            Magnetometer
            Gyroscope




ALL That we find awesome about NEXUS 7 (pros) : 
 



      1. The processor : 1.2 GHZ NVIDIA® Tegra® 3 quad-core processors along 1 GB RAM are extremely gaming + app friendly, makes for a smooth usage.

    2. The Battery, we really like the 4325 mAH power, good enough to run through all days play and still not trouble you for charge.

        3. Native support from Google.




And the cons : 
 



     1. Seriously we miss the back facing camera, although the front facing 1.2 mgpx camera is good, the back camera would have been just perfect.

       2. 216 ppi screen could have been improved, not that it under performs or anything, but then is could have just been a really cool.


Benchmarks :


The CPU and processor test (geekbench)




 GPU test (vellamo)





Our Verdict 

      The Nexus 7 is a really good tablet, for its price range. The above benchmarks speaks positive about the product as well, overall this is a really good product and is definitely one to be looked at, we would give it 9/10. So if you looking for a tablet in 15k range, do give this a try, Its worth it :-) 


you can order it from here : 



 
 


Read More ->>

Wednesday, March 20, 2013

Features of SAMSUNG GALAXY S4




Samsung I9500 Galaxy S4 Tech spec

 

General             2G Network
    GSM 850 / 900 / 1800 / 1900
        3G Network
    HSDPA 850 / 900 / 1900 / 2100
        SIM
    Micro-SIM
        Announced
    2013, March
        Status
    Coming soon. Exp. release 2013, April 26th
Body                 Dimensions       136.6 x 69.8 x 7.9 mm (5.38 x 2.75 x 0.31 in)


 Weight 130 g (4.59 oz)


Display             Type         Super AMOLED capacitive touchscreen, 16M colors
   Size         1080 x 1920 pixels, 5.0 inches (~441 ppi pixel density)
   Multitouch         Yes
   Protection         Corning Gorilla Glass 3
         -TouchWiz UI
Sound              Alert types  Vibration; MP3, WAV ringtones
             Loudspeaker Yes
             3.5mm jack           Yes
Memory          Card slot                microSD, up to 64 GB
         Internal 16/32/64 GB storage, 2 GB RAM
Data                GPRS                    Yes
               EDGE Yes
               Speed HSDPA, 42.2 Mbps; HSUPA, 5.76 Mbps
               WLAN Wi-Fi 802.11 a/b/g/n/ac, dual-

 

Read More ->>

Friday, March 15, 2013

How to read / write excel files in java ?


In this blog post We will learn how to create/read excel files in java.
For all type of Microsoft Documents we can use an open source lib – Apache POI.
This library can help us to read/writer all Microsoft Document Formats,But we will use it for excels only.
Apache POI provides two type of API for excel manipulation
  • POI-HSSF – excel manipulation in excel –97(2007) file format(xls)
  • POI-XSSF - excel manipulation in excel –2007 file format(xlsx)
Steps to follow to create an excel file:
  • Create a new workbook:  Work book creates the excel files which we can use for read and write.Work Book can be created in two way-
    Workbook wb = new HSSFWorkbook();// For old format

    or

    Workbook wb = new XSSFWorkbook();// For new format

  • Create the sheets inside the workbook: These sheets contains cells in which the actual data resides.

    Sheet sheet1 = wb.createSheet("Result");
    Sheet sheet2 = wb.createSheet("Result2");
  • Create the rows inside sheet to hold the cells:  Row row = sheet.createRow((0);//Note that rows are zero index based i.e. first row starts with 0 index.


  • Create the cells inside the row to hold the data: Cells are also zero index based as rows.

    Cell cell = row.createCell(0);

    cell.setCellValue(1);

  • Writing the excel sheet to a file:

     FileOutputStream fileOut = new FileOutputStream("my_workbook.xlsx");
     wb.write(fileOut);
     fileOut.close();

Steps to follow to read an excel file:        InputStream input = new FileInputStream("my_workbook.xlsx");
    Workbook wBook = WorkbookFactory.create(input);
    Sheet sheet = wBook.getSheetAt(0);
    Row row = sheet.getRow(2);
    Cell cell = row.getCell(3);


Example:


public class ExcelWriter {
    public static void main(String[] args) {
        Workbook wb = new HSSFWorkbook();
        Sheet sheet = wb.createSheet("demo sheet");

        // Create a row and put some cells in it. Rows are 0 based.
        Row row = sheet.createRow((short)0);
        // Create a cell and put a value in it.
        row.createCell(1).setCellValue(999);
        row.createCell(2).setCellValue("Empty Heart");
        row.createCell(3).setCellValue(true);

        // Write the output to a file
        FileOutputStream fileOut = new FileOutputStream("demo.xls");
        wb.write(fileOut);
        fileOut.close();
    }
}
Read More ->>

Monday, January 14, 2013

Using Regular Expressions in Java



In this java tutorial we will learn to use regular expression in java.Regular expression is very powerful tool for text manipulation and searching.It provides the fastest searching in huge amount of available data.So if you know it definitely you will save a lot time while doing these operations.In this tutorial I am going to describe how to use regular expression in java,I will not teach you the regular expression(If you are new to regular expression then please update yourself first via techcresendo.com)
In java we have java.util.regex package for regular expressions.This package basically contains three classes
  • Pattern:  This class represents the pattern in regular expression.Pattern is basically a format of text which needs to be matched in a group of texts.Patterns are constructed using regular expressions. e.g pattern
  • "[tT]rue" matches true or True

  • Matcher:  This class does the matching of the compiled pattern against an input string.

  • PatternSyntaxException: This class represents the exception which are thrown when your regular expression pattern is not correct.(It is unchecked exception)
Steps to create a pattern matching program:
  1. Create a pattern object.This object defines your regular expression.                                                                                                                           Pattern pattern=Pattern.compile(“regex”);

  2. Now with the help of Pattern object we can get Matcher object for a given input text(into which pattern to be  matched).                                                                                                                                                       Matcher matcher=pattern.matcher(INPUT_TEXT); 

  3. Now using this matcher object  we can easily find the pattern in the text as we will see in the example program.

package com.techy.rajeev;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class PatternMatch {
  public static final String INPUT_TEXT = "This is a test for regular expression Testing.";
  public static final String PATTERN = "[tT]est";
  
  public static void main(String[] args) {
    Pattern pattern = Pattern.compile(PATTERN);
    Matcher matcher = pattern.matcher(INPUT_TEXT);
    while (matcher.find()) {
      System.out.print("Start pos: " + matcher.start());
      System.out.print(" End pos: " + matcher.end() + " ");
      System.out.println(matcher.group());
    }
  }
} 



Output:

Start pos: 10 End pos: 14 test
Start pos: 38 End pos: 42 Test
Read More ->>

Tuesday, December 25, 2012

How to create SFTP connection using java ?



In this blog post we will learn how to create a secure FTP connection using java.SFTP is much more secure than its predecessor FTP since SFTP is based on SSH.
Here We will develop a SFTP client.Basically SFTP clients are programs that use SSH to access, manage, and transfer files. SFTP clients are functionally similar to FTP clients, but they use different protocols.
To create a SFTP connection to a server for file transfer or any other FTP operation we will use an open source library called JSCh. You can download this library from http://www.jcraft.com/
Add this library to your class path and start creating the program.
This example shows how to get a file from the server using SFTP.
package com.techy.rajeev;

import com.jcraft.jsch.*;

    /**
     * @param args
     */

    public class SFTPTest {
    public static void main(String args[]) {
        JSch jsch = new JSch();
        Session session = null;
        String username="";//Put your username here
        String password="";//Put your password here
        String host="";//Hostname
        String sourceFile="";//Path of file on the server
        String destFile="";//Path of local file
        try {
            session = jsch.getSession(username,host,22);
            session.setConfig("StrictHostKeyChecking", "no");
            session.setPassword(password);
            session.connect();

            Channel channel = session.openChannel("sftp");
            channel.connect();
            ChannelSftp sftpChannel = (ChannelSftp) channel;

            sftpChannel.get(sourceFile,destFile);
            sftpChannel.exit();
            session.disconnect();
        } catch (JSchException e) {
            e.printStackTrace(); 
        } catch (SftpException e) {
            e.printStackTrace();
        }
    }
Read More ->>

Monday, December 17, 2012

Java program to generate all possible sub string of a string


This simple java program generates all possible sub string of given string.You can replace string with StringBuilder or StringBuffer where performance is issue.
package com.techy.rajeev;

public class GenStr {

    /**
     * @param args
     */
    public static void genAllSubStr(String str){
        for(int i=0;i<str.length();i++){
            for(int j=i;j<str.length();j++){
                System.out.println(str.substring(i, j+1));
            }
        }
    }
    public static void main(String[] args) {
        genAllSubStr("abc");
    }

}


Output:

a
ab
abc
b
bc
c

Read More ->>

Tuesday, December 4, 2012

Java program to generate permutation of a string


This post is about generating permutation of a string using a java program.This program has a static method  genPerm() method which is used for generation of permutation of the string. genPerm() method is recursive and takes two string arguments and prints the permutations of the second string.
Source Code:
public class GeneratePerm {

    /**
     * @param args
     */
    public static void genPerm(String pString,String sb){
        if(pString.length()==3)
            System.out.println(pString);
        for(int i=0;i<sb.length();i++){
            genPerm(pString+sb.charAt(i),sb.replaceFirst(sb.charAt(i)+"",""));
        }
    }
    public static void main(String[] args) {
        String sb=new String("abc");
        genPerm("",sb);
    }

}

Output:
abc
acb
bac
bca
cab
cba

Read More ->>

Tuesday, October 2, 2012

How to create random folder creating virus?



In this blog post I will teach you how to create more than 5000 random folders in a minute but before this I want to warn you that I do not take any responsibility for causing harm to your or any other computer.This tutorial is just for informative purpose only Smile.


Techyrajeev.blogspot.com


For this we will use the help of bat files and simple dos commands.So follow the step by step procedure for creating random folder creating virus if you want to create one.

Step 1: Open the notepad or any other text editor

Step 2: Type the following things

@ECHO OFF
:LABEL
md %RANDOM%
GOTO LABEL

 
Explanation: This is very simple bat file which runs infinitely with the help of recursive(self) calling(GOTO LABEL) and between these calls we are creating empty directory using md(You can write any other command instead of md).


Step 3: Now save it with Computer.bat in your hard disk.


Step 4: Now send it’s shortcut to desktop and change it’s default icon to icon of the computer or anything you like e.g Internet Explorer but do not forget to change the name accordingly.
ComputerBat
Step 5: Now delete or hide the original one from desktop so that user of the system will click on the fake one.Njoy the magic of bat files Thumbs up.AfterComputer
Read More ->>

Saturday, September 29, 2012

BackTrack 5 R3 Unleashed



Great news for our hacker friends a new version of popular penetration testing tool BackTrack 5 R3 is released.
BackTrack 5 R3 will provide latest hacking tools and more stable penetration testing environment than its predecessor.BackTrack 5 R3 is built upon linux kernal 3.2.6 which has updated version of hacking tools and latest securities patches.

bt5-6

BackTrack main website has a nice tutorial on how to upgrade from BackTrack 5 R1 to BackTrack 5 R3.If you want to upgrade your BackTrack to latest one the you can do it from this link.
If you are new to BackTrack then you can download the latest BackTrack from here.
Read More ->>

Monday, September 24, 2012

Apple got $1 billion in 30 trucks full of 5 cents coins by Samsung !



After loosing the legal battle with Apple finally Samsung decided to pay the $ 1 billion fine charged by Apple for the infringement of the patents.Tim Cook(Apple’s CEO) got a call from Samsung CEO explaining that Samsung will pay $1 billion fine and perhaps he must have been eagerly waiting for that huge amount of money.


And finally they got the money with surprise.Money arrived in fully loaded 30 trucks filled with 5 cents coin Smile. When the trucks arrived at Apple’s office security personnel stopped the trucks on the gate assuming that trucks arrived at the wrong place but soon Tim cook got a call from Samsung CEO that this is your money and since the legal suit did not specify a single payment method so Samsung is entitled to pay the fine in this way.

SamsungVs apple
A total of 20 billion coins is a new headache to Apple executives as they will need to put in long hours counting all that huge sum of money, to check if it is really $ 1 billion or not.But problem further continues if suppose it is $ 1 billion then they may face problem in depositing that 20 billion 5 cents coins to a bank.


sam

Lee Kun-hee, Chairman of Samsung Electronics, told the media that Apple can use the coins to buy the refreshments at the little machine for life or melt the coins to make computers, that’s not their problem, Samsung already paid them and it is fulfilled by the law.
But Some sources says that this news is fake and this incident did not happen.People just spread the rumours nothing of this sort has happened.Let’s wait for more Winking smile.
Read More ->>

Saturday, September 22, 2012

Java Tutorial on GridBagLayout Manager


In this java tutorial we are going to discuss about GridBagLayout Manager.
GridBagLayout manager is one of the most powerful but complex layout manager in java.It is somewhat similar to GridLayout in the sense that it also arranged the components in the grid, but here component added can be of varying sizes i.e we can increase or decrease their size to occupy more than one row or column of the grid.
If suppose you are going to use this layout manager in your program then you first decide and draw the outline of GUI you need then proceed further.Life will be much easier(Really).
Most important parts of the GridBagLayout are GridBagConstraints .They specify the size and position, and many more constraints  of the each component. We will discuss about each GridBagConstraints fields.

gridx The column in which the component will be placed
gridy The row in which the component will be placed.
gridwidth The no of column the component occupies.
gridheight The no of rows the component occupies.
weightx The amount of extra space to allocate horizontally. The grid
slot can become wider when extra space is available.
weighty The amount of extra space to allocate vertically. The grid slot
can become taller when extra space is available.
anchor When component added is smaller than its area then we can use anchor to specify its position.Possible positions are NORTH, NORTHEAST, EAST, SOUTHEAST, SOUTH, SOUTHWEST, WEST,
NORTHWEST or CENTER
fill This basically tell how to resize the component when container area is bigger than it’s size.
We can have a single “GridBagConstraints” instance which is used for specifying the constraints of all the components or seperate “GridBagConstraints” for each of them.
But it is recommended to use seperate “GridBagConstraints” for each of the component added to the container using GridBagLayout Manager.
Now we will use the GridBagLayout in our sample program:


package com.techy.rajeev;

import java.awt.EventQueue;

public class GridBagLayoutTest {

    private JFrame frmTechyrajeev;
    private JTextField textField;
    private JTextField textField_1;

    /**
     * Launch the application.
     */
    public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable() {
            public void run() {
                try {
                    GridBagLayoutTest window = new GridBagLayoutTest();
                    window.frmTechyrajeev.setVisible(true);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    }

    /**
     * Create the application.
     */
    public GridBagLayoutTest() {
        initialize();
    }

    /**
     * Initialize the contents of the frame.
     */
    private void initialize() {
        frmTechyrajeev = new JFrame();
        frmTechyrajeev.setTitle("techyrajeev");
        GridBagLayout gridBagLayout = new GridBagLayout();
        gridBagLayout.columnWidths = new int[]{0, 0, 0, 0, 0, 0};
        gridBagLayout.rowHeights = new int[]{0, 0, 0, 0, 0, 0, 0, 0};
        gridBagLayout.columnWeights = new double[]{1.0, 0.0, 1.0, 1.0, 0.0,
 Double.MIN_VALUE};
        gridBagLayout.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0,
 Double.MIN_VALUE};
        frmTechyrajeev.getContentPane().setLayout(gridBagLayout);
        
        JLabel lblLoginForm = new JLabel("Login Form");
        GridBagConstraints gbc_lblLoginForm = new GridBagConstraints();
        gbc_lblLoginForm.insets = new Insets(5, 0, 5, 5);
        gbc_lblLoginForm.gridx = 2;
        gbc_lblLoginForm.gridy = 0;
        frmTechyrajeev.getContentPane().add(lblLoginForm, gbc_lblLoginForm);
        
        JLabel lblEnterUsername = new JLabel("Username:");
        GridBagConstraints gbc_lblEnterUsername = new GridBagConstraints();
        gbc_lblEnterUsername.anchor = GridBagConstraints.EAST;
        gbc_lblEnterUsername.insets = new Insets(0, 0, 5, 5);
        gbc_lblEnterUsername.gridx = 1;
        gbc_lblEnterUsername.gridy = 1;
        frmTechyrajeev.getContentPane().add(lblEnterUsername, gbc_lblEnterUsername);
        
        textField = new JTextField();
        GridBagConstraints gbc_textField = new GridBagConstraints();
        gbc_textField.insets = new Insets(0, 0, 5, 5);
        gbc_textField.fill = GridBagConstraints.HORIZONTAL;
        gbc_textField.gridx = 2;
        gbc_textField.gridy = 1;
        frmTechyrajeev.getContentPane().add(textField, gbc_textField);
        textField.setColumns(10);
        
        JLabel label = new JLabel("");
        GridBagConstraints gbc_label = new GridBagConstraints();
        gbc_label.insets = new Insets(0, 0, 5, 5);
        gbc_label.gridx = 1;
        gbc_label.gridy = 2;
        frmTechyrajeev.getContentPane().add(label, gbc_label);
        
        JLabel lblPassword = new JLabel("Password:");
        GridBagConstraints gbc_lblPassword = new GridBagConstraints();
        gbc_lblPassword.anchor = GridBagConstraints.EAST;
        gbc_lblPassword.insets = new Insets(0, 0, 5, 5);
        gbc_lblPassword.gridx = 1;
        gbc_lblPassword.gridy = 3;
        frmTechyrajeev.getContentPane().add(lblPassword, gbc_lblPassword);
        
        textField_1 = new JTextField();
        GridBagConstraints gbc_textField_1 = new GridBagConstraints();
        gbc_textField_1.insets = new Insets(0, 0, 5, 5);
        gbc_textField_1.fill = GridBagConstraints.HORIZONTAL;
        gbc_textField_1.gridx = 2;
        gbc_textField_1.gridy = 3;
        frmTechyrajeev.getContentPane().add(textField_1, gbc_textField_1);
        textField_1.setColumns(10);
        
        JButton btnLogin = new JButton("Login");
        GridBagConstraints gbc_btnLogin = new GridBagConstraints();
        gbc_btnLogin.insets = new Insets(0, 0, 5, 5);
        gbc_btnLogin.gridx = 2;
        gbc_btnLogin.gridy = 4;
        frmTechyrajeev.getContentPane().add(btnLogin, gbc_btnLogin);
        
        JTextArea txtrThisIsA = new JTextArea();
        txtrThisIsA.setText("This is a text area.");
        GridBagConstraints gbc_txtrThisIsA = new GridBagConstraints();
        gbc_txtrThisIsA.gridwidth = 5;
        gbc_txtrThisIsA.fill = GridBagConstraints.BOTH;
        gbc_txtrThisIsA.gridx = 0;
        gbc_txtrThisIsA.gridy = 6;
        frmTechyrajeev.getContentPane().add(txtrThisIsA, gbc_txtrThisIsA);
    }

}


GridBagLayout2


This is the grid view of rows and columns of the frame.As you can see it is very easy to divide the whole Gui into rows and columns on the paper and then proceed accordingly for the actual designing using GridBagLayout Manager.


Output of this GridBagLayout tutorial program is:


gridBagLayout
Read More ->>

Thursday, September 13, 2012

Java Tutorial on Anonymous Inner Class


An anonymous inner class is a very strange type of inner class.It can be created on the fly when needed and It can also be defined inside method argument!.
We will cover all the details about anonymous inner class in this blog post so continue reading.
As the name suggests anonymous inner classes do not have any name so how would you recognize a inner class? Anonymous inner classes are recognized by their parent’s type.Here parent could be either a class or interface.Basically anonymous inner class can be categorized into two types:
  • As a class providing implementation to a predefined interface.
  • As a class providing implementation to a predefined class or a abstract class
Now we will see both methods
Pointing up
class Test{
            public void doTesting(){
              System.out.println("Testing is on the way!");
             }
            }
public class InnerJ{
    Test t=new Test(){
            public void doTesting(){
                System.out.println("Testing completed!");
            }
        };//watch out for semicolon
}



Here what we are saying basically  is,that create a anonymous class(without any name) which is a subclass of type Test(extends Test) and declare a reference variable of type Test to hold that anonymous class object since at the same time we are instantiating that anonymous inner class(see the new key word in InnerJ).


Fingers crossed



//Now same thing with interface 
interface Test{ 
            void doTesting(); 
            } 
public class InnerJ{

//Beware this not instantiation of interface ! 
    Test t=new Test(){ 
            public void doTesting(){ 
                System.out.println("Testing completed!"); 
            } 
        };//watch out for semicolon 
}


here instead of saying extends we say implements and every thing is same.


Restrictions on anonymous inner class:



  • Anonymous inner classes can implement only one interface


  • Anonymous inner classes can either extends a class or implement an interface at a time

Read More ->>

Thursday, August 30, 2012

Java program to divide an image into multiple equal parts



In this post I am going to demonstrate how to divide an image into equal parts.Here I have used simple Java image api to manipulate the source image via techcresendo.com
In this java program for image dividing ,I have first divided the image into smaller equal size parts and placed them randomly on the buttons on the frame using Grid Layout .
Input Image:
img

This program can be used further to develop sliding game puzzle in java.
package com.techy.rajeev.divideImage;

import java.awt.EventQueue;
import java.awt.Image;

import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import java.awt.GridLayout;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.net.URL;

public class MainWin {

    private JFrame frame;
    private JButton []jb=new JButton[9];
    /**
     * Launch the application.
     */
    public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable() {
            public void run() {
                try {
                    MainWin window = new MainWin();
                    window.frame.setVisible(true);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    }

    /**
     * Create the application.
     */
    public MainWin() {
        try {
            initialize();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    /**
     * Initialize the contents of the frame.
     * @throws IOException 
     */
    private void initialize() throws IOException {
        frame = new JFrame();
        frame.setBounds(100, 100, 612, 519);
        setImage();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.getContentPane().setLayout(new GridLayout(3, 3));
        for(int i=0;i<9;i++){
            frame.add(jb[i]);
        }
    }

    public void setImage() throws IOException{
        URL img=MainWin.class.getResource("/img/img.jpg");
        BufferedImage bimg=ImageIO.read(img);
        int w=bimg.getWidth();
        int h=bimg.getHeight();
        int count=0;
        for(int i=0;i<3;i++){
            for(int j=0;j<3;j++){
                BufferedImage wim=bimg.getSubimage(i*w/3,j*h/3, w/3, h/3);
                Image sc=wim.getScaledInstance(frame.getWidth()/3,


               frame.getHeight()/3, Image.SCALE_AREA_AVERAGING);
                setupImage(count++,sc);
            }
        }
    }

    private void setupImage(int i,Image wim) {
        jb[i]=new JButton(new ImageIcon(wim));
    }

}


Output:


imgdivide

Read More ->>

Tuesday, August 28, 2012

Extracting text from images




In this blog post we are going to discuss about the tools and api for extracting the text from the image.Some of these tools and apis are free and open source but some of them are not free but still you can send request to the company to get developer’s version for free.
Java OCR:
Java OCR is a simple and efficient java based open source library for image processing and optical character recognition.This library can also be used in the development of android based project.
265598
If you want to test it just click here to download it and give it a try.
Tesseract-OCR:
This is the one of the best optical character recognition open source library available .It was originally developed by HP Labs but now supported by Google.It is the one of the most accurate OCR engine. It can read wide variety of image formats and text read can be converted into different languages also.As of now It supports more than 40 languages and new languages are being implemented.
It is developed in c++ and if you are a java developer then don’t worry you may  be able find some JNI wrapper for it.
Tess4j is one of the available java JNI wrapper of tesseract-OCR.
There are some graphical front end already available.If you want  to check the functionality of Tesseract-OCR you can download gImageReader,VietOCR .Other than them there are many more GUI front end are available on the web.
blg
Asprise OCR for Java:  
Asprise Lab provides Asprise OCR SDK for development of OCR in java.It also provides the web based solution for optical character recongition.It enables us to equip our Java applications (Java applets, web applications, standard applications, J2EE enterprise applications) with optical character recognition (OCR) ability.
bc
But this SDK is not free, for commercial usage you need to buy the License.
Via - techcresendo.com
Read More ->>

Saturday, August 18, 2012

Java Tutorial:Sorting list using Comparator


In this java tutorial we are going to understand the sorting of a List with the help of Comparator interface.

So we will use sort(arrayToSort,Comparator) of Collections and Arrays to sort the list.Now we have to create a class which implements the comparator interface but before that we should have the class for which sorting is done.So lets create that first.

package com.techy.rajeev;

public class Employee{
    private String ename;
    private int eid;
    private double salary;

    public String getEname() {
        return ename;
    }

    public Employee(String ename, int eid, double salary) {
        super();
        this.ename = ename;
        this.eid = eid;
        this.salary = salary;
    }

    public void setEname(String ename) {
        this.ename = ename;
    }

    public int getEid() {
        return eid;
    }

    public void setEid(int eid) {
        this.eid = eid;
    }

    public double getSalary() {
        return salary;
    }

    public void setSalary(double salary) {
        this.salary = salary;
    }

    @Override
    public String toString() {
        return "Employee [ename=" + ename + ", eid=" + eid + ", salary="
                + salary + "]";
    }

}


Now lets create the Sorter class.


package com.techy.rajeev;

import java.util.Comparator;

public class SortByName implements Comparator<Employee> {

    @Override
    public int compare(Employee o1, Employee o2) {
        return o1.getEname().compareTo(o2.getEname());
    }

}


Now lets do the sorting


package com.techy.rajeev;

import java.util.*;

public class TestSorting {
    public static void main(String[] args) {
        ArrayList<Employee>al=new ArrayList<Employee>();
        al.add(new Employee("Anonymous",1,12345.00));
        al.add(new Employee("Hacker",2,32423));
        al.add(new Employee("Cba",3,23434));
        System.out.println("Before:"+al);
        SortByName sbn=new SortByName();
        Collections.sort(al,sbn);//passing the sorter to sort
        System.out.println("After:"+al);
        
    }

}

Output:

Before:[Employee [ename=Anonymous, eid=1, salary=12345.0], Employee [ename=Hacker, eid=2, salary=32423.0], Employee [ename=Cba, eid=3, salary=23434.0]]

After:[Employee [ename=Anonymous, eid=1, salary=12345.0], Employee [ename=Cba, eid=3, salary=23434.0], Employee [ename=Hacker, eid=2, salary=32423.0]]

Now I hope you know how to sort the list using comparator.Keep reading.Thumbs up
Read More ->>
DMCA.com Protected by Copyscape Online Plagiarism Tool