Accessing Private Methods in Java

February 18, 2008 – 12:16 am

In every introductory Java programming class (and probably every tutorial or book), students are taught that private fields and methods can only be accessed by methods of the same class. Though this would seem to be a security control, using private visibility can be easily overridden, as shown below:


import java.lang.reflect.*;
class A {
  private void f() {
    System.out.println("Running A.f()");
  }
}

public class Main {
  public static void main(String[] args) throws Exception {
    Class a = new A().getClass();
    Method m = a.getDeclaredMethod("f", null);
    m.setAccessible(true);
    m.invoke(new A(), null);
  }
}

Web 2.0 Roundup

February 17, 2008 – 7:35 pm

E-Mail

G-Mail: Google as started offering its popular e-mail client for use on hosted networks.

Webmail.us:

Sproutit:

Word Processing

Writely: Probably the best online word processor available.

Writeboard: Another quite good online word processor.

Ralleypoint:

Jotspot Live:

Zoho Writer:

Spreadsheet

Numsum: The best online spreadsheet.

EditGrid: Nice-looking spreadsheet — check it out!

iRows: Another excellent online spreadsheet.

Jotspot Tracker: Combines a spreadsheet with a Wiki.

Online Spreadsheet: Ugly, but works

Trim Spreadsheet: All Javascript spreadsheet engine.

Calendar

30 Boxes: Best online calendar software

CalendarHub:

Airset:

Hula:

Joyent:

Kiko:

Planzo:

Spongecell:

Trumba:

Presentation

S5:

SlideML:

Project Management

Basecamp: online project management

SidejobTrack: keep track of your side jobs

Mini-Suites

Zimbra:

gOffice:

Thinkfree:

Groowy:

Online Desktop

Protopage: Simple online desktop

YouOS: Web-based Operating System

eyeOS: Web-based Operating System

Homeportals: Web-based desktop

Miscellaneous

Google Maps: Maps, Directions

gModeler: online UML diagrammer

Painter: online paintbrush

WebNote: Post-It Notes

GChart: Integrated with Google Maps, gives local times, dialing codes, and other information

Flickr: Online photo management

Del.icio.us: Social bookmarking

TagCloud: Social bookmarking

Odeo: Online (”clientless”) Podcasting

Travbuddy: Interesting travel site — reviews and recommendations

Digg: news aggregation

Mooflex: online content management suite (currently pre-beta)

Meebo: online instant messaging (AIM, Yahoo, ICQ, etc)

Rollyo: create a “custom” search engine