Asus has launched a wide variety of notebooks with high features and gaming support.Asus launched its first Nvidia GeForce 3D Vision Asus G51J 3D Notebook.NVIDIA 3D Vision technology to those high-definition notebook platforms that integrate advanced 120Hz 3D Vision-capable displays directly into the chassis, practically laying the foundation for enjoying an immersive 3D experience while being on the go.Notebooks will include the 120Hz 3D Vision-capable panel and bundle 3D Vision active-shutter glasses. ASUS is readying the first ever NVIDIA 3D Vision notebook - the ASUS G51J 3D.
Features:
Powered by 1.6GHz Core i7 Inteprocessor
GeForce GTX 260M Graphics Card
1Gb of Video RAM
15.6-inch 120Hz LCD screen that boasts 1366×768 pixel resolutions
NVIDIA’s special 3D glasses.
NVIDIA GeForce GTX 260M 1GB DDR3 graphics.
Tags:-Asus,notebooks,Nvidia,3d,3D notebooks,Nvidia GeForce 3D,Asus G51J 3D Notebook,Asus G51J 3D Notebook features,Asus G51J 3D Notebook specifications,ASUS G51J 3D,Asus latest releases,Asus notebooks,Asus new notebooks
The Nokia E72 enters into the UK Markets via Vodaphone. The black version of the Nokia E72 is exclusive to the network carrier.This new Nokia E72 sports a stulish QWERTY Keyboard with 3G enablead support and boasts of a 5 megapixel camera with . The handset incorporates a built-in GPS navigation system and allows users to browse internet and download content. The onscreen widgets enable users to email and instant message straight from the handset’s screen.
The Nokia E72 delivers a talktime of up to 12 hours and standby time of about 20 days. The device measures 114mm x 58.3mm x 10.1mm and it weighs about 128 grams. FM radio and MP3 player are also incorporated. It offers Wi-Fi as well as microSD support. Apart from the quad-band handset, the package includes a charger and a handsfree headset.
The Nokia handset is available for free on selected contracts or for £300 (approx. Rs. 23,299) on Pay As You Go.
Tags:-vodaphone,Nokia,E72,Mobiles,QWERTY,3G,WIFI,Nokia E Series,smartphone,Nokia E72 UK releases,GPS,Nokia E72 Features
Google awaiting Chrome OS be on Download from Next week.When first announcing the project back in July, Google had pledged to make its source code available before the end of the year. This rumor seems to be in line with those promises. However, without proper driver support the operating system will be useless to the average user. By the sound of it next week's release will most likely be just a collection of code meant for software developers to tinker with.
As earlier reported, Google's operating system is built on a Linux foundation and should be very Web-centric. Chrome OS applications will run right in the browser, and they'll be cross-compatible with other standards-compliant browsers on other platforms. Companies like Acer, Asus and HP are reportedly backing the project and may have netbooks running Chrome OS ready for customers in the second half of 2010.
Tags:-Chrome OS,Google OS,Chrome OS releases,Chrome OS features,source code
AMD has introduced new X86 Architectures , AMD Bulldozer and Bobcat Architectures Out.Bobcat is AMD's new mobile platform and Bulldozer is focused on servers, each branch away from traditional designs to cater to their specific markets. Bobcat, for instance, will feature extremely low power requirements, with thermal envelopes under a single watt.
Initially based on a 32nm process, the new Bulldozer chips will feature multiple sets of pipelines that share a single 128bit FPU, as well as L2 and L3 cache. It's speculated the CPU will be capable of executing a minimum of four instructions per cycle, and quite possibly double that. Unfortunately AMD has been very light on specific details, and were more interested in announcing timeframes than design specifics.
In 2011, Brazos platform will be introduced with dual-core Bobcat architecture based chips and "Ontario" APU (accelerated processing unit). This in true sense would Intel Atom competitor and it would be interesting to see whether AMD introduces at lower price points
Tags:-AMD,Processor,X86,X86 Architecture,Latest Processor,AMD Latest Processor,AMD Latest Launch,AMD Bulldozer and Bobcat Architectures,AMD Bulldozer and Bobcat Architectures features
JVC announced the SR-HD1500 and SR-HD1250 Blu-ray / Hard Drive combo recorder decks at the CEDIA 2009. These are high performance professional combo decks with a built-in Blu-ray recorder and an internal hard disk drive for easy duplication and disc authoring without a PC.
These devices are not designed to record TV programs to hard drive or Blu-ray discs. Instead, JVC’s new recorders are used to record video from camcorder or other devices via USB, i.Link IEEE1394 or from SD/SDHC memoru cards. Composite and S-Video inputs provide interfaces for legacy analog devices as well. Unprotected DVD and Blu-ray discs can also be duplicate easily.
Using the SR-HD1500 and SR-HD1250, users can record and author professional BDMV (with menu) or BDAV discs. Advanced MPEG-2 and MPEG-4 (H.264) encoding provides support for HD and SD sources, and a built-in format converter can downconvert HD content for recording to a standard DVD.The units support BD-R or BD-RE (erasable) Blu-ray discs.
The JVC SR-HD1500 has 500GB drive, RS-232C terminal and support for .MOV files while SR-HD1250 has a 250GB hard drive and comes without the RS-232C and .MOV support. They are priced at $2550 and $1995 respectively and will be available in October 2009
import java.util.*; import java.text.*; public class StringToDate { public static void main(String[] args) { try { String str_date="10-Sep-2009"; DateFormat formatter,formatter2 ; Date date ; formatter = new SimpleDateFormat("dd-MMM-yyyy"); date = (Date)formatter.parse(str_date);
String formattedDate = formatter.format(date); System.out.println("dd-MMM-yyyy date is ==>"+formattedDate); Date date1 = formatter.parse(formattedDate);
formatter = new SimpleDateFormat("yyyy-MM-dd"); formattedDate = formatter.format(date1); System.out.println("yyyy-mm-dd date is ==>"+formattedDate); } catch(Exception e)
Zii EGG is not yet ready for public consumption but Creative has started sending units plus SDK to developers. Dapreview’s staffer was amongst the first ones to get it and he has posted his first impression about the device. He reckons even though the dev units are not as brushed up as the final product will be, the Zii is the best sounding Creative player, even without the EQ. He also felt the player is “rough around the edges” and the colors are “shockingly bright” and “alive”.
Normally, we'd take a look at something like this and say, "yeah, could be real, could be fake." Goodness knows there are enough mega-talented graphic designers in the world with the free time to craft this. Here's the thing, though: this phone / MID hybrid -- the latest in Nokia's Internet Tablet series -- has already been outedenough times so that we know this has to be a genuine press shot. If we had to guess, Espoo fashioned it in preparation for its Nokia World event in Germany early next month where theN900 will presumably be announced into officialdom; there's no sign on when or how the T-Mobile USA version will be unveiled, but we're getting pretty amped for it.
We trust you're reading this on your R2-D2 case mod PC with matching Star Wars-themed Skype webcam, all of which you acquired using your awesome mind control powers (learned with the assistance of your Force Trainer). And as all this goes down, you are undoubtedly surrounded by a full compliment of Star Wars Mimobot flash drives. But wait! What if we told you the company has extended the line, now offering C-3PO, Wicket, and an all new Darth Vader (complete with creepy old Anakin Skywalker face when the helmet's removed)? These guys are $39.95 each and come complete with audio clips, wallpaper, a keychain attachment, and more. HIt that read link to see for yourself. What more could you possibly ask for? Wedge Antilles?
Not that we thought it was a fabrication this morning, but Reuters has managed to snap a few pictures of the Nokia Booklet 3G "mini laptop" to assure us that there is indeed at least one physical unit in existence, located at the company's Helsinki headquarters. As seen in another photo, the model sports the blue lid, and just so you're absolutely clear how a 10.1-inch netbook sizes up to an actual phone, we've got a side-by-side with an E71. Looks like we'll have to wait until Nokia World to figure out what Intel Atom processor they've got inside that makes sense to pair with a HDMI output, however.
Update: Nokia might be mum on the issue, but Intel tells Pocket-lint that it's got the 1.6GHz Intel Atom Z530 chipset, which isn't exactly known for its HD video prowess but can technically do up to 720p. No word on any other technology that make the HDMI port more logical, but if there is was, it's probably not coming fromBroadcom -- both companies have denied involvement with the Booklet.
Wildfire fighting is one of the most physically challenging task that human being faces today. Autonomous machines can operate faster and more efficiently while keeping people away from the hard, dirty and dangerous jobs. Designed by Aydin Mert, the Autonomous Fire Guard comes equipped with laser scanners, IR cameras and radar to cut through the smoke during fire. The robot is a perfect assistant for firefighters. Sadly, there is no further info on when it will go into mass production.
Here is the latest addition to the Casio digital camera series. The Casio EX-Z33 is an entry-level camera that boasts a 10.1MP CMOS sensor with a 3x optical zoom lens, a highly visible 2.5 inch widescreen display, Automatic face recognition, Best Shot function, and Auto Shutter mode. The camera provides YouTube Capture Mode, which records and saves movies at the ideal settings for YouTube. Recorded video can be easily uploaded to site using the special included computer software.
AOC has rolled out another affordable eco-friendly LCD monitor that meets EPEAT Gold standards. Dubbed as the AOC 2436Vw, this new 24-inch LCD monitor supports a native resolution of 1920 x 1080 pixels and features 30,000:1 dynamic contrast ratio, 5ms response time, 300 cd/m2 brightness and consumes no more than 49W of power. It also comes with several connectivity ports including VGA, DVI and USB. The AOC 2436Vw is priced at $220.
Logitech is back with another breath-taking technology. This time the company has introduced two mice called the Logitech Performance Mouse MX and the Logitech Anywhere Mouse MX. Both these mice can be used virtually any where including clear glass that is 4mm thick.
These mice include Logitech’s Darkfield Laser Tracking Technology that allows users to use these mice almost anywhere. These mice offer users complete control of their digital world. The hyper-fast scrolling feature makes navigating through long documents quick and easy. The click-to-click mode of these mice offers more precision while navigating lists, photos and slide shows.
The Logitech Performance Mouse MX is a full-sized mouse that features a flexible micro-USB charging system. This system allows users to charge their mouse through the computer or a wall outlet. The mouse features four customizable thumb buttons that allow users to easily switch applications and zoom in and out of web pages.
“Laptops have gained popularity in the last several years because of the freedom they afford – people today want to be able to connect to their digital world anytime, anywhere. However, until now, no mouse has been able to match that flexibility,” said Rory Dooley, Logitech’s senior vice president and general manager of the Control Devices business unit. “Thanks to Logitech Darkfield, whether you’re checking the morning news from the granite counter top in your kitchen or at work manipulating a spreadsheet from your glass desk, you can be confident that your Logitech mouse will be up to the task.”
The Logitech Anywhere Mouse MX is a small portable laptop mouse that works virtually anywhere. Along with being easily portable, this mouse is designed to comfortably fit into the contours of the user’s hand. The mouse also features back and forward buttons within the reach of the thumb. Both these mice include the Logitech Unifying receiver that allows users to plug up to five other compatible Logitech devices.
Logitech will offer these mice in the US and Europe starting this month. The Logitech Performance Mouse MX is expected to be priced at $99.99 (approx. Rs. 4,870) while the Anywhere Mouse MX is expected to retails at $79.99 (approx. Rs. 3,895).
That's the all-new, not-yet-on-salePlayStation 3 Slim's stand. It works by laying flat on whatever surface you deem fit, and then it holds your new gaming console upright. We get the impression that it'll do its job fairly well, but the $24 retail price is borderline insulting. Or, it's just the motivation you needed to craft one on your own and prove that you were indeed born with a few DIY genes -- it's all about perspective, folks.
According to the number crunchers at NPD Group, the trend that came to a head last year when Apple beat out Wal-Mart for the title of largest Stateside music retailer is continuing apace. That's right -- one in four songs sold in America is sold on iTunes, while Wal-Mart (including CD sales through retail stores, sales through their website, and Wal-Mart Music Downloads) holds the number two position at 14 percent. And number three, if you're morbidly curious, is Best Buy. In addition, 69% of all digital music sold in the US comes from the iTunes store, with Amazon ranking second at 8 percent. When talking formats, the CD remains the most popular at 65 percent, but as some dude named Russ Crupnick (NPD's vice president of entertainment industry analysis) notes, "with digital music sales growing at 15 to 20 percent, and CDs falling by an equal proportion, digital music sales will nearly equal CD sales by the end of 2010." Which can only be a good thing, if it means that we'll never have to step into a Wal-Mart again. Sales of ringtones and sales to consumers under 13 were not tabulated, which means the data may incorrectly skew away from purchases of The Wiggles' Go Bananas! and that Crazy Frog song.
Smartphone sales may be growing at a steady rate these days but, if NPD's latest numbers are any indication, it looks like they still have quite a ways to go before they become the norm among cellphone users. As the market research group found during its latest survey, less expensive featurephones accounted for an impressive 72% of all new handset sales in the US during the second quarter of the year, which is only a 5% drop even in the face of a 47% jump in smartphone sales (to 28% market share) over the same quarter last year -- a 14% jump in overall handset sales accounts for some of that discrepancy. According to NPD's numbers, theLG enV2 (pictured above) and Samsung Rant were among the best selling featurephones during the quarter, while the iPhone 3G and Blackberry Curve were the best selling smartphones. Other interesting tidbits include the fact that the average selling price for a phone rose 4% over the year to $87, and that WiFi capability is now found on 20% of new handsets, while 26% of new phones have touchscreens (compared to 35% with QWERTY keyboards).
protected SimpleDateFormat dateFormat = new SimpleDateFormat("MMM d, yyyy"); public void setDateFormat(SimpleDateFormat dateFormat) { this.dateFormat = dateFormat; } public void setSelectedItem(Object item) { // Could put extra logic here or in renderer when item is instanceof Date, Calendar, or String // Dont keep a list ... just the currently selected item removeAllItems(); // hides the popup if visible addItem(item); super.setSelectedItem(item); }
public void updateUI() { ComboBoxUI cui = (ComboBoxUI) UIManager.getUI(this); if (cui instanceof MetalComboBoxUI) { cui = new MetalDateComboBoxUI(); } else if (cui instanceof MotifComboBoxUI) { cui = new MotifDateComboBoxUI(); } else if (cui instanceof WindowsComboBoxUI) { cui = new WindowsDateComboBoxUI(); } setUI(cui); }
class MetalDateComboBoxUI extends MetalComboBoxUI { protected ComboPopup createPopup() { return new DatePopup( comboBox ); } }
class WindowsDateComboBoxUI extends WindowsComboBoxUI { protected ComboPopup createPopup() { return new DatePopup( comboBox ); } }
class MotifDateComboBoxUI extends MotifComboBoxUI { protected ComboPopup createPopup() { return new DatePopup( comboBox ); } }
class DatePopup implements ComboPopup, MouseMotionListener, MouseListener, KeyListener, PopupMenuListener {
protected Color selectedBackground; protected Color selectedForeground; protected Color background; protected Color foreground;
public DatePopup(JComboBox comboBox) { this.comboBox = comboBox; calendar = Calendar.getInstance(); //String[] dts = {dt}; int yr = calendar.get(Calendar.YEAR); int mn = calendar.get(Calendar.MONTH); int dts = calendar.get(Calendar.DATE); String dt = dts+"/"+mn+"/"+yr; comboBox.addItem(dt); // check Look and Feel background = UIManager.getColor("ComboBox.background"); foreground = UIManager.getColor("ComboBox.foreground"); selectedBackground = UIManager.getColor("ComboBox.selectionBackground"); selectedForeground = UIManager.getColor("ComboBox.selectionForeground");
initializePopup(); }
public void show() { try { // if setSelectedItem() was called with a valid date, adjust the calendar calendar.setTime( dateFormat.parse( comboBox.getSelectedItem().toString() ) ); } catch (Exception e) {} updatePopup(); popup.show(comboBox, 0, comboBox.getHeight()); }
public void hide() { popup.setVisible(false); }
protected JList list = new JList(); public JList getList() { return list; }
public MouseListener getMouseListener() { return this; }
public MouseMotionListener getMouseMotionListener() { return this; }
public KeyListener getKeyListener() { return this; }
public boolean isVisible() { return popup.isVisible(); }
public void uninstallingUI() { popup.removePopupMenuListener(this); }
public void mousePressed( MouseEvent e ) {} public void mouseReleased( MouseEvent e ) {} // something else registered for MousePressed public void mouseClicked(MouseEvent e) { if ( !SwingUtilities.isLeftMouseButton(e) ) return; if ( !comboBox.isEnabled() ) return; if ( comboBox.isEditable() ) { comboBox.getEditor().getEditorComponent().requestFocus(); } else { comboBox.requestFocus(); } togglePopup(); }
// Note *** did not use JButton because Popup closes when pressed protected JLabel createUpdateButton(final int field, final int amount) { final JLabel label = new JLabel(); final Border selectedBorder = new EtchedBorder(); final Border unselectedBorder = new EmptyBorder(selectedBorder.getBorderInsets(new JLabel())); label.setBorder(unselectedBorder); label.setForeground(foreground); label.addMouseListener(new MouseAdapter() { public void mouseReleased(MouseEvent e) { calendar.add(field, amount); updatePopup(); } public void mouseEntered(MouseEvent e) { label.setBorder(selectedBorder); } public void mouseExited(MouseEvent e) { label.setBorder(unselectedBorder); } }); return label; }
protected void initializePopup() { JPanel header = new JPanel(); // used Box, but it wasn't Opaque header.setLayout(new BoxLayout(header, BoxLayout.X_AXIS)); header.setBackground(background); header.setOpaque(true);
// update the Popup when either the month or the year of the calendar has been changed protected void updatePopup() { monthLabel.setText( monthFormat.format(calendar.getTime()) ); if (days != null) { popup.remove(days); } days = new JPanel(new GridLayout(0, 7)); days.setBackground(background); days.setOpaque(true);
Calendar setupCalendar = (Calendar) calendar.clone(); setupCalendar.set(Calendar.DAY_OF_WEEK, setupCalendar.getFirstDayOfWeek()); for (int i = 0; i < 7; i++) { int dayInt = setupCalendar.get(Calendar.DAY_OF_WEEK); JLabel label = new JLabel(); label.setHorizontalAlignment(JLabel.CENTER); label.setForeground(foreground); if (dayInt == Calendar.SUNDAY) { label.setText("Sun"); } else if (dayInt == Calendar.MONDAY) { label.setText("Mon"); } else if (dayInt == Calendar.TUESDAY) { label.setText("Tue"); } else if (dayInt == Calendar.WEDNESDAY) { label.setText("Wed"); } else if (dayInt == Calendar.THURSDAY) { label.setText("Thu"); } else if (dayInt == Calendar.FRIDAY) { label.setText("Fri"); } else if (dayInt == Calendar.SATURDAY){ label.setText("Sat"); } days.add(label); setupCalendar.roll(Calendar.DAY_OF_WEEK, true); }
setupCalendar = (Calendar) calendar.clone(); setupCalendar.set(Calendar.DAY_OF_MONTH, 1); int first = setupCalendar.get(Calendar.DAY_OF_WEEK); for (int i = 0; i < (first - 1); i++) { days.add(new JLabel("")); } for (int i = 1; i <= setupCalendar.getActualMaximum(Calendar.DAY_OF_MONTH); i++) { final int day = i; final JLabel label = new JLabel(String.valueOf(day)); label.setHorizontalAlignment(JLabel.CENTER); label.setForeground(foreground); label.addMouseListener(new MouseListener() { public void mousePressed(MouseEvent e) {} public void mouseClicked(MouseEvent e) {} public void mouseReleased(MouseEvent e) { label.setOpaque(false); label.setBackground(background); label.setForeground(foreground); calendar.set(Calendar.DAY_OF_MONTH, day); comboBox.setSelectedItem(dateFormat.format(calendar.getTime())); hide(); comboBox.requestFocus(); } public void mouseEntered(MouseEvent e) { label.setOpaque(true); label.setBackground(selectedBackground); label.setForeground(selectedForeground); } public void mouseExited(MouseEvent e) { label.setOpaque(false); label.setBackground(background); label.setForeground(foreground); } });
Another company producing yet more products that take advantage of Windows 7's much-vaunted touch cappabilities? Amazing but true, at least according to DigiTimes, which is reporting that Acer is set to launch no less than three "touch-enabled products" loaded with Windows 7. That word apparently comes straight from a product manager in the company's mobile computer department, who also went on to say that touch-enabled netbooks might see "good market acceptance" if they're marketed as cheaper alternatives to tablet PCs, although it's not clear if the products in question are actually touch-enabled netbooks. In other touch-related news, Acer is also reportedly looking at using in-cell touch panel technology when it becomes widely available, which should be cheaper to produce than conventional touch panels that don't have all the necessary touch components built right in at the LCD panel level.
We certainly can't knock the 4GB Atree J100 when it comes to its well stocked arsenal of goodies: it has a three-inch touchscreen, an e-dictionary, DMB digital TV tuner, video playback, and microSD expansion -- and it plays music too. Audio formats are also plentiful, with MP3, WMA and OGG for the commoners, and FLAC and APE for the lossless fanatics. Too bad it's held back by the chunky casing, which looks big enough to have fit a five-inch screen if the designers were so inclined. With slicker-looking competition from the likes of Cowon and Samsung, the otherwise entirely useful J100 might struggle to stand out, but if you're willing to look beyond its superficial shortcomings, it's available now for 198,000 KRW ($158).
We're not sure why we didn't hear more about this way back at RIM's WES conference way back in May, but it was apparently mentioned by VP Antoine Boucher at the time that they're working on a Bluetooth-enabled watch. Furthermore, it's said to be more advanced than the models Sony Ericsson has put forth so far, featuring streaming audio (3.5mm jack on the watch, perhaps?) and Twitter / Facebook updates in addition to the usual things like caller ID and text messages. Note that the image floating around today of this thing isn't real -- it's just a ony Ericsson MBW-100 with a swapped logo -- so it remains to be seen what this magical wrist accessory will look like, assuming it's real and coming to retail. It seems Boucher also mentioned a high-end Bluetooth headset codenamed "Alpha 1" that'll allow you to stream music and get navigation directions through some sort of totally awesome silicone earpiece boasted to possibly be "the best solution on the market." It's pretty hard to pique a lot of interest these days with something as vanilla and ubiquitous as a headset, but at any rate, it's interesting to see the depth of RIM's apparent commitment to the accessory market right now.
And so it continues. It seems like just when rumorland is ready to claim this month or this season as the absolute certain suretime of the Apple tablet, those pesky "sources" get cold feed and bump the imaginary release date back a year or so. At least that's what the folks at The Loop are saying. They claim "very reliable sources" have called the September rumor "flat out wrong," and state that we won't see the tablet until the first half of next year sometime. Sigh. Don't give up internet, if we just wish hard enough we know that anything is possible.
Consider we created a folder contains java classes. To compile this programme yourself, make sure; all the source code is in the same folder all the images are in a folder called images
type in a DOS window, javac *.java to compile all the source code type jar -cvfm chess.jar manifest.txt *.class images/*.gif
that will put all the files in an executable jar file
First save the jar inside A folder.Let us consider a jar file named sample.jar is saved inside a folder e:/syam. To get it we have to give the following in command prompt
Java provides the StringBuffer and String classes, and the String class is used to manipulate character strings that cannot be changed. Simply stated, objects of type String are read only and immutable. The StringBuffer class is used to represent characters that can be modified.
The significant performance difference between these two classes is that StringBuffer is faster than String when performing simple concatenations. In String manipulation code, character strings are routinely concatenated. Using the String class, concatenations are typically performed as follows:
String str = new String ("Stanford "); str += "Lost!!";
If you were to use StringBuffer to perform the same concatenation, you would need code that looks like this:
StringBuffer str = new StringBuffer ("Stanford "); str.append("Lost!!");
Developers usually assume that the first example above is more efficient because they think that the second example, which uses the append method for concatenation, is more costly than the first example, which uses the + operator to concatenate two String objects.
The + operator appears innocent, but the code generated produces some surprises. Using a StringBuffer for concatenation can in fact produce code that is significantly faster than using a String. To discover why this is the case, we must examine the generated bytecode from our two examples. The bytecode for the example using String looks like this:
The bytecode at locations 0 through 9 is executed for the first line of code, namely:
String str = new String("Stanford ");
Then, the bytecode at location 10 through 29 is executed for the concatenation:
str += "Lost!!";
Things get interesting here. The bytecode generated for the concatenation creates a StringBuffer object, then invokes its append method: the temporary StringBuffer object is created at location 10, and its append method is called at location 23. Because the String class is immutable, a StringBuffer must be used for concatenation.
After the concatenation is performed on the StringBuffer object, it must be converted back into a String. This is done with the call to the toString method at location 26. This method creates a new String object from the temporary StringBuffer object. The creation of this temporary StringBuffer object and its subsequent conversion back into a String object are very expensive.
In summary, the two lines of code above result in the creation of three objects:
A String object at location 0 A StringBuffer object at location 10 A String object at location 26
Now, let's look at the bytecode generated for the example using StringBuffer:
The bytecode at locations 0 to 9 is executed for the first line of code:
StringBuffer str = new StringBuffer("Stanford ");
The bytecode at location 10 to 16 is then executed for the concatenation:
str.append("Lost!!");
Notice that, as is the case in the first example, this code invokes the append method of a StringBuffer object. Unlike the first example, however, there is no need to create a temporary StringBuffer and then convert it into a String object. This code creates only one object, the StringBuffer, at location 0.
In conclusion, StringBuffer concatenation is significantly faster than String concatenation. Obviously, StringBuffers should be used in this type of operation when possible. If the functionality of the String class is desired, consider using a StringBuffer for concatenation and then performing one conversion to String.
import java.awt.*; import java.io.*; import java.awt.image.*; import com.sun.image.codec.jpeg.*; public class ScreenImage { public ScreenImage() { OutputStream out = null; try { BufferedImage shot = (new
public class Palindrome { public static void main(String [] args){ try{ BufferedReader object = new BufferedReader( new InputStreamReader(System.in)); System.out.println("Enter number"); int num= Integer.parseInt(object.readLine()); int n = num; int rev=0; System.out.println("Number: "); System.out.println(" "+ num); for (int i=0; i<=num; i++){ int r=num%10; num=num/10; rev=rev*10+r; i=0; } System.out.println("After reversing the number: "+ " "); System.out.println(" "+ rev); if(n == rev){ System.out.print("Number is palindrome!"); } else{ System.out.println("Number is not palindrome!"); } } catch(Exception e){ System.out.println("Out of range!"); } } }
Difference Between Two Days import java.io.*; import java.util.*; import java.util.Date.*; import java.util.Calendar; import java.lang.Math.*; import java.util.StringTokenizer; public class DateDemo { String s,s1; int i; int d,d1,m,m1,y,y1; public void add(String a,String b) { s=a; s1=b; StringTokenizer ss=new StringTokenizer(s,"/"); while(ss.hasMoreTokens()) { d=Integer.parseInt(ss.nextToken()); m=Integer.parseInt(ss.nextToken()); y=Integer.parseInt(ss.nextToken()); } StringTokenizer st=new StringTokenizer(s1,"/"); while(st.hasMoreTokens()) { d1=Integer.parseInt(st.nextToken()); m1=Integer.parseInt(st.nextToken()); y1=Integer.parseInt(st.nextToken()); } Calendar c1=Calendar.getInstance(); Calendar c2=Calendar.getInstance(); c1.set(y,m,d); c2.set(y1,m1,d1);
long t1=c1.getTimeInMillis(); long t2=c2.getTimeInMillis(); long t3=Math.abs(t1-t2); i=60*1000*60*24; System.out.println(t3); long diff= t3/i; System.out.println("Difference btn"+ s+" and"+s1+" is"+diff+"days"); } public static void main(String args[])throws Exception { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); DateDemo dd=new DateDemo(); System.out.println("Enter the date as dd/mm/yyyy"); String d1=br.readLine(); System.out.println("Enter second date as dd/mm/yy"); String d2=br.readLine(); dd.add(d1,d2); } }
JavaScript can be used to validate forms, provide interactive calendars, post the current day's headlines, produce background effects on a Web page, and play games, among many other things.
Netscape created JavaScript in 1995. It was originally called "LiveScript”.
An Introduction
JavaScript is not Java
JavaScript can either be client-side or server-side
JavaScript is an object-based scripting language
JavaScript is cross-platform
JavaScript comes in different 'flavors'
JavaScript: This was the name given by Netscape, who invented it.
JScript: This is the scripting language invented by Microsoft to compete with JavaScript.
ECMAScript: The de facto international standard for JavaScript. This standard covers the core of the language.
Comments
// This whole line will be ignored by the JS interpreter
var myOldCar = Ford// The first part will be interpreted; this part will be ignored.
If you need to comment out several lines, you would begin with a forward slash and an asterisk, "/*", and end with an asterisk and a forward slash, "*/". For example,
/* All of this, all three lines,
will be ignored in their entirety
by the JavaScript interpreter */
Remember that JavaScript is case-sensitive.
Remember that the semicolon at the end of a statement is optional in JavaScript. But it is a good programming practice to include one.
Where Does the Script Go?
There are three places where a script can be located:
In the top section of the page ("head"), between the and tags;
In the middle section of the page ("body"), between the and tags; or
In a separate file.
Placing the Script on the Page
When the script is placed on the page, it is located between a set of container tags that look like:
Data Types
JavaScript is a "loosely typed" language, meaning you don't need to specify the type of data being declared in a variable.
There are four basic data types used in JavaScript: strings, numbers, booleans, and nulls.
1. Strings
The following are examples of a string:
"cheeseburger"
"123 Main Street, Anytown, FL32714"
var favfood="a big juicy hamburger";// Correct
var favfood='a big juicy hamburger';// Correct
var favfood="a big juicy hamburger';// Incorrect
HTML elements can also be used inside of strings. Doing so will help you to create more dynamic pages.
document.write("This is really fantastic!");
2. Numbers
·JavaScripts recognizes two types of numbers: integers and floating point numbers.
·Integers are whole numbers (e.g., 1, 20, 546).
·Floating point numbers are numbers that have a decimal point (e.g., 23.8, 23.890).
·Default is floating point number.
3. Boolean
A Boolean data type is used for true or false statements. It's mostly used in if() statements:
var myCar=Chevy;
if (myCar==Chevy)
...
4. Null
A null variable has no value. A null variable is useful for testing input in scripts. Since it's a keyword, it doesn't need to be enclosed in quotation marks:
var nothingNow=null;
Variables
A variable is declared using the var reserved word. A variable can be declared and initialized using one of two methods.
var myName;
myName="Lee";
var myName="Lee";
Our First Script
Let's take a break and write our first script. First, open a new document in your text editor and insert the following HTML elements:
Top of Form
Just a Demo
This will give an alertbox.
The JavaScript Diaries: Part 2
This time, we use a prompt box.
Just a Demo
A prompt is the result of this program.
Special Operators
Operator
Name
Description
?:
Conditional
A type of if...else statement. A condition is placed before the (?) and a value is placed on each side of the (:)
,
Comma
Used to process a series of expressions
delete
Delete
Deletes an object, property, or element from an array
in
In
Used to inspect the contents of a specified object
instanceof
Instanceof
Tests an object to see if it is of a specified object.
new
New
Creates an instance of an object
this
This
Refers to the current object
typeof
Typeof
Identifies the type of value being evaluated
void
Void
Evaluates an expression without returning a value
Writing Functions
function giveName()
{
code goes here;
code goes here;
}
Calling a Function
giveName();.
Example:
Place this in the portion:
Then, put this in the portion:
Window Object Event Handlers
An event handler is a JavaScript
keyword that allows a script to perform certain functions based on events on a Web page. Anytime something happens — a page loads, a link is clicked, the mouse moves — an event happens. Many times it's desirable to control these events. This can be done by using event handlers.
onLoad
Thisevent handler is used to execute a script after a page has fully loaded. That
includes loading all scripts, graphics, plugins and Java applets.
onUnload
This event handler is used toexecute a script before the page in the browser is exited. It's executed in the same manner as the onLoadevent handler. An example would be:
onFocus
This eventhandler executes whenever a window or form element is selected by the visitor
by clicking on the item, using the keyboard, or through manipulation by a script. An example is shown below:
function errpage() {
document.write(“Error”);
}
The history Object
Browsers store a list of URLs that the user has previously visited. This list enables the user to navigate to previously visited Web pages using the back and forward buttons in the browser. This list of URL's is called the browser's history. It's stored in the form of a list (a portion is pictured at right) that can be accessed by JavaScript. For security reasons, a JavaScript function can't read the URL's that are stored in the history object, so you can't use the list to figure out where your visitors have been.
Methods
back() forward()
The back() and forward() methods do exactly what they say. They reload the previous page or go to the next page in the browser's history. They act exactly like the browser's Back and Forward buttons. The methods can be written as follows:
onClick="history.back()"> // combine with line above
onClick="history.forward()"> // combine with line above
go()
The go() method is used to move forward or back more than one page at a time in the history list. This is done by placing the number of pages you want to go in the parentheses. Positive numbers move the browser forward; negative numbers move the browser backward. It's like moving in steps. If you want to go forward one page (one step), use this:
history.go(1)
To go back two pages (two steps), you would use this:
history.go(-2)
The problem with this method is that you need to make sure that the browser's history contains that many URLs.
The Date Object
JavaScript uses the Date() constructor to obtain and manipulate the day and time in a script. The information is taken from the user's computer and is only as accurate as the user's system.
Creating Dates
var d=new Date();
document.write("The date is "+ d.toLocaleDateString()+" ");
document.write("and the time is "+ d.toLocaleTimeString());
which would print as follows:
The date is Friday, September 22, 2006 and the time is 2:29:28 PM