Wednesday, December 10, 2008

How to print over the internet in windows XP?

Depends on the DSL router
The answer is maybe.

The router may be configured by the manufacturer to only accept print jobs from the inside. You may or may not be able to reconfigure that.

If you cannot, Try forwarding a TCP port from the outside to the TCP port for the inside print server. Here are the basics of that idea...

Do you already have it set up to print from the PCs in office B (from the inside of the DSL router)? If so, you may be able to set up a port forwarding rule.

Lets say, for example, that the DSL router's internal ip addy is 192.168.1.1 and that to print from the inside (office b) you set up a printer on each computer to print to 192.168.1.1 port 9100.

So set up a port forwarding rule on the DSL router so that incoming traffic to port (pick an unused port) gets redirected to 192.168.1.1 port 9100 (TCP)

Then set up the computer in office A to print to the static ip addy of dsl router (specify the port you chose on your port fwd rule).

I would not choose 9100 on the outside side because then anyone can print to your printer. pick something high that isnt used.

9100 is a guess at what port it uses, another likely candidate is 515.

Tuesday, December 2, 2008

Faces (EQ Test)


How many faces can you find?
To test your intelligence:

If can find 0 – 5 faces – idiot

If can find 6 – 7 faces – stupid

If can find 8 – 9 faces – normal

If can find 10 – 11 – very normal

If can find 12 – 13 faces –genius

cid:1.2505439584@web65614..mail.ac4.yahoo.com

Java String Comparison

String Comparison

Strings can not be compared with the usual <, <=, >, or >= operators, and the == and != operators don't compare the characters in the strings.

Comparing objects vs. primitive types

[to be supplied]

Comparing Strings: ==, .equals(), .compareTo(), ...

To compare Strings for equality, don't use ==. The == operator checks to see if two objects are exactly the same object. Two strings may be different objects, but have the same value (have exactly the same characters in them). Use the .equals() method to compare strings for equality. Similarly, use the .compareTo() method to test for unequal comparisons. For example,
    String s = "something", t = "maybe something else";
if (s == t) // Legal, but usually WRONG.
if (s.equals(t)) // RIGHT
if (s > t) // ILLEGAL
if (s.compareTo(t) > 0) // CORRECT>

Java get MAC ADDRESS

import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.net.UnknownHostException;
 
public class mac_address {
    
    public static void main(String[] args) {
        try {        
            InetAddress address = InetAddress.getLocalHost();
            
            /*
             * Get NetworkInterface for the current host and then read the
             * hardware address.
             */
            NetworkInterface ni = NetworkInterface.getByInetAddress(address);
            byte[] mac = ni.getHardwareAddress();
            System.out.println(Array.join(mac,""));
            /*
             * Extract each array of mac address and convert it to hexa with the
             * following format 08-00-27-DC-4A-9E.
             */
            for (int i = 0; i < mac.length; i++) {            
                System.out.format("%02X%s", mac[i], (i < mac.length - 1) ? "-" : "");
            }
            
        } catch (UnknownHostException e) {
            e.printStackTrace();    
        } catch (SocketException e) {
            e.printStackTrace();
        }
    }    
}

Centos 7 reset root/ any user lost password / lockout due to cant remember password

1. Need to be in front of the terminal. (Physically if not vm). 2. Reboot the server 3. Press 'e' in the GRUB2 boot screen. 3. bunch...