Posts

Showing posts from April, 2011

Changing Disk Drive Icon at Windows XP

Image
The classic local disk drive icon or any other plug&play disk icon can be changed with a little touch of one " autorun.inf " file and the icon available from local machine. Users might be get used to with autorun.inf files. Since, they are the root cause of trojans, viruses and other vulnerables comes from usb stick and plug&play hard disks. Make a new txt file and rename it to "autorun.inf" at the root directory of disk drive whose icon is intended to be changed. Then insert the below lines into it, and save the file. Change the property of this file to hidden (optional). [autorun] icon = .\myicon.ico "icon = " must be followed by any file with full path on your local machine. e.g. "icon = C:\Program Files\NetBeans 6.8\bin\netbeans.exe " then the result is as follows.

Marshalling JAXB Elements with Less Amount of Code

Marshalling java objects which must be conveniently annotated according to JAXB 2.X specification, has become simpler than before. An entity has XmlRootElement annotation can be marshalled with JAXB as follows: TruckType truck = new TruckType(); truck.setBrand("BMC"); truck.setModel("PRO 940 (8x2)"); // create an instance of JAXBContext for TruckType class JAXBContext context = JAXBContext.newInstance(TruckType.class); // create marshaller for JAXB context Marshaller m = context.createMarshaller(); // OPTIONAL: just for presentation m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); // finally marshalling instance of TruckType to System.out m.marshal(truck, System.out); Another case for marshalling with JAXB is JAXBElement<T> classes where T is any class has valid annotations. Sample code demonstrates how to marshal JAXBElements: CarType carType = new CarType(); carType.setBrand("BMW"); carType.setModel("3.20D"); ObjectFactory facto