Method 1:
Step 1 : run this command on the terminal
linus@UbuntuLinux$ sudo gedit /etc/apt/apt.conf
//// press enter and then enter password, then gedit will open
Step 2 : write this code into the open gedit file : apt.conf
Acquire::http::proxy "http://username:password@ipaddress:port";
Acquire::https::proxy "https://username:password@ipaddress:port";
Acquire::ftp::proxy "ftp://username:password@ipaddress:port";
Acquire::socks::proxy "socks://username:password@ipaddress:port";
Monday, 28 January 2013
TCP Client & Server Program in Java
// --------------TCPServer.java
import java.io.*;
import java.net.*;
class TCPServer
{
import java.io.*;
import java.net.*;
class TCPServer
{
Get own ip address and subnet mask in java
import java.net.*;
InetAddress localHost = Inet4Address.getLocalHost();
NetworkInterface networkInterface = NetworkInterface.getByInetAddress(localHost);
String ipAddress = localHost.getHostAddress();
String subnetMask = "/"+networkInterface.getInterfaceAddresses().get(0).getNetworkPrefixLength();
System.out.println(ipAddress + subnetMask);
--------
output like :
192.168.65.161/23
Saturday, 19 January 2013
Introduction to Version Control System & SVN
http://www.makebetterthings.com/page/7/
Version Control (aka Revision Control aka Source Control) lets you track your files over time. Why do you care? So when you mess up you can easily get back to a previous working version.
Version Control (aka Revision Control aka Source Control) lets you track your files over time. Why do you care? So when you mess up you can easily get back to a previous working version.
So Why Do We Need A Version Control System (VCS)?
Large, fast-changing projects with many authors need a Version Control System (geekspeak for “file database”) to track changes and avoid general chaos. A good VCS does the following:What is the difference among nil, NULL, Nil in Objective-C?
http://www.makebetterthings.com/#
They are all zeros, the difference lies in their types
-> NULL is a generic pointer value ((void*)0, to be specific). It points to 0×0.
-> nil is an id. So its points to a non-existent objective-c object
-> Nil is a non-existent objective-c class
-> [NSNull null] is an object that’s meant to stand in for nil in situations where nil isn’t allowed. For example, you can’t have a nil value in an NSArray. So if you need to represent a “nil”, you can use [NSNull null]
Also there is no ‘null’ in the objective c its ‘NULL’ not ‘null’. ‘null’ exist in Java or in C# not in Objective-C
-> NULL is a generic pointer value ((void*)0, to be specific). It points to 0×0.
-> nil is an id. So its points to a non-existent objective-c object
-> Nil is a non-existent objective-c class
-> [NSNull null] is an object that’s meant to stand in for nil in situations where nil isn’t allowed. For example, you can’t have a nil value in an NSArray. So if you need to represent a “nil”, you can use [NSNull null]
Also there is no ‘null’ in the objective c its ‘NULL’ not ‘null’. ‘null’ exist in Java or in C# not in Objective-C
How to install VNC server on Ubuntu Server
http://rbgeek.wordpress.com/2012/06/25/how-to-install-vnc-server-on-ubuntu-server-12-04/
VNC is a protocol that is used to
share the desktop with other users/computers over the
network/Internet.In order to share a desktop, VNC server must be install
and configure on the computer and VNC client must be run on the
computer that will access the shared desktop.
Wednesday, 2 January 2013
Proxy support Java Browser
// WebBrowser.java
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.net.*;
import java.io.*;
import javax.swing.*;
import javax.swing.event.*;
public class WebBrowser
{
public static void main(String [] args)
{
JFrame frame = new EditorPaneFrame();
frame.show();
}
}
class ProxyAuthenticator extends Authenticator {
private String user, password;
public ProxyAuthenticator(String user, String password) {
this.user = user;
this.password = password;
}
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.net.*;
import java.io.*;
import javax.swing.*;
import javax.swing.event.*;
public class WebBrowser
{
public static void main(String [] args)
{
JFrame frame = new EditorPaneFrame();
frame.show();
}
}
class ProxyAuthenticator extends Authenticator {
private String user, password;
public ProxyAuthenticator(String user, String password) {
this.user = user;
this.password = password;
}
Proxy authentication in Java code (manual proxy)
Proxy authentication in Java
The usual corporate networks provide internet access via proxy servers and at times they require authentication as well. May applications do open the connections to servers which are external to the corporate intranet. So one has to do proxy authentication programmatically. Fortunately Java provides a transparent mechanism to do proxy authentications.
Create a simple class like below-
Now all calls will successfully pass through the proxy authentication.
see the full browser support code here
Create a simple class like below-
import java.net.Authenticator; class ProxyAuthenticator extends Authenticator { private String user, password; public ProxyAuthenticator(String user, String password) { this.user = user; this.password = password; } protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(user, password.toCharArray()); } }and put these lines of code before your code opens an URLConnection-
Authenticator.setDefault(new ProxyAuthenticator("user_iiitm", "password123")); System.setProperty("http.proxyHost", "proxy host"); System.setProperty("http.proxyPort", "port");
Now all calls will successfully pass through the proxy authentication.
see the full browser support code here
Subscribe to:
Posts (Atom)