An array is a collection of elements stored in a contiguous block of memory.
Each element in an array must be the same data type, and they are distinguished
by an index. The first element in the array is at index 0.
Creating an array involves two steps, as follows:
1. Declaring a reference for the array.
2. Instantiating the array using the new keyword and specifying the size
of the array.
In Java, data is either a primitive data type or an object. Because arrays are not one of the eight primitive data types, they must be objects. Therefore, an array requires a reference to access it and the new keyword to instantiate it.
Use square brackets to declare an array reference. For example, the following
statement declares a reference to an array of ints:
int [] sums;
In Java, you can also declare an array with the square brackets following the variable name, instead of preceding it. For example, sums can be declared as follows:
int sums [];
This is for compatibility with C and C++. My preference is to place the square brackets before the variable name, because it makes the reference declaration clearer.
The sums reference can refer to any array of ints, no matter how many elements are in the array. Because sums is a reference, it can also be assigned to null.
The size of the array is determined when the array is instantiated. An int is placed in square brackets to specify the size. For example, the following statement assigns sums to a new array of 20 ints:
sums = new int[20];
Because an array must be in contiguous memory, its size cannot be changed after the memory is initially allocated. If the array of size 20 is deemed too small, a new larger array is instantiated and the old array is garbage collected. For example, the following statement assigns sums to a larger array of 30 ints:
sums = new int[30];
The array of 20 ints is garbage collected, assuming that it is no longer being referenced in your program. Assigning sums to an array of 20 ints and then to an array of 30 ints demonstrates how sums can refer to any size array of ints.
An array reference can be declared and the array object can be instantiated in the same statement. The following statement declares temps a reference to an array of doubles, and temps is assigned to a new array of 31 doubles in the same statement:
double [] temps = new double[31];
As with sums, temps can refer to any size array of doubles. Right now, it refers to an array of 31 doubles.
Because an array object is instantiated using the new keyword, the memory is zeroed after it is allocated. Therefore, the initial values of the elements in the array will be their zero value (these values were found in Table 4.5). For example, the 31 doubles in the temps array are initially 0.0, and the 30 ints in the sums array are initially 0.
Thursday, May 7, 2009
407 – Proxy Authentication Required
Error Message: “407 – Proxy Authentication Required”
Translation: A proxy server is a server that sits between a Web browser and an actual Web server. The proxy server reads all requests to the actual server and attempts to service each request itself—if not, the request is forwarded to the actual server. Proxy servers improve performance by caching popular pages for certain groups of users and are often used to enhance the security of a Web site.
When you get a 407 error, the URL resource is available, but a connection requires the use of a proxy server that also needs authentication cre dentials. This error indicates that access has been denied because you have not logged onto the proxy server first or have logged on incorrectly.
Solution: You’ll need to log into the appropriate proxy server first and provide the proper credentials (password and/or username) before you’re able to proceed to the desired URL. This generally means you’ll need a URL for the proxy server, along with authentication credentials. Once you’re successfully logged onto the proxy server, you can usually navigate to the desired Web site successfully. If you have trouble obtaining proxy server information, contact the Webmaster for detailed user instructions.
Translation: A proxy server is a server that sits between a Web browser and an actual Web server. The proxy server reads all requests to the actual server and attempts to service each request itself—if not, the request is forwarded to the actual server. Proxy servers improve performance by caching popular pages for certain groups of users and are often used to enhance the security of a Web site.
When you get a 407 error, the URL resource is available, but a connection requires the use of a proxy server that also needs authentication cre dentials. This error indicates that access has been denied because you have not logged onto the proxy server first or have logged on incorrectly.
Solution: You’ll need to log into the appropriate proxy server first and provide the proper credentials (password and/or username) before you’re able to proceed to the desired URL. This generally means you’ll need a URL for the proxy server, along with authentication credentials. Once you’re successfully logged onto the proxy server, you can usually navigate to the desired Web site successfully. If you have trouble obtaining proxy server information, contact the Webmaster for detailed user instructions.
Windows cannot print due to a problem with the current printer setup
Error Message: “Windows cannot print due to a problem with the current printer setup.”
Solution: Sometimes pictures and graphics embedded within a PowerPoint file are too large and must be reduced in size before the printer can handle the file. Microsoft recommends opening the file in PowerPoint 2003 and compressing pictures to reduce their file sizes. Find the Picture toolbar and click Compress Pictures. If the toolbar isn’t visible, expand the View menu, expand Toolbars, and click the Picture entry.
When the Compress Pictures dialog box appears, make sure the All Pictures In Document radio button is selected, select the Print radio button in the Change Resolution section, and select the checkboxes next to Compress Pictures and Delete Cropped Areas Of Pictures. Click OK, click Apply, let the utility do its work, and try printing the file again.
Translation: This error message appears along with a list of potential solutions that usually work, unless you are trying to print a
very large (in terms of file size) PowerPoint file. When that is the case, there usually is nothing wrong with the printer, despite what the error message says.Solution: Sometimes pictures and graphics embedded within a PowerPoint file are too large and must be reduced in size before the printer can handle the file. Microsoft recommends opening the file in PowerPoint 2003 and compressing pictures to reduce their file sizes. Find the Picture toolbar and click Compress Pictures. If the toolbar isn’t visible, expand the View menu, expand Toolbars, and click the Picture entry.
When the Compress Pictures dialog box appears, make sure the All Pictures In Document radio button is selected, select the Print radio button in the Change Resolution section, and select the checkboxes next to Compress Pictures and Delete Cropped Areas Of Pictures. Click OK, click Apply, let the utility do its work, and try printing the file again.
Friday, May 1, 2009
This program has performed an illegal operation and will be shut down. If the problem persists, contact the program vendor.
Error Message: “This program has performedan illegal operation and will be shut down. If the problem persists, contact the program vendor.”
Translation: Clicking Details on this error message will show a possible explanation, such as “X caused an invalid page fault in module Y at Z,” where X is the name of the program; Y is the name of the module and Z is the address within the memory. After you click OK, the program shuts down.
Solution: Identify when the error message first occurred. Also, determine if you recently made changes to the computer; for example, you installed software or changed the hardware configuration. Clean booting your computer can help you identify the cause of the message. To Clean Boot, followthese steps:
• Restart your computer. When the Starting Windows dialog box is displayed, press the F8 key and choose Step-By-Step Confirmation from the Startup menu.
• When you are prompted, load the following items (if you are prompted to load any other items, type n) :
- Dblspace driver
- Himem.sys
- Ifshlp.sys
- Dblbuff.sys
• Load the Windows GUI (graphical user interface), and choose to load all Windows drivers.
Translation: Clicking Details on this error message will show a possible explanation, such as “X caused an invalid page fault in module Y at Z,” where X is the name of the program; Y is the name of the module and Z is the address within the memory. After you click OK, the program shuts down.
Solution: Identify when the error message first occurred. Also, determine if you recently made changes to the computer; for example, you installed software or changed the hardware configuration. Clean booting your computer can help you identify the cause of the message. To Clean Boot, followthese steps:
• Restart your computer. When the Starting Windows dialog box is displayed, press the F8 key and choose Step-By-Step Confirmation from the Startup menu.
• When you are prompted, load the following items (if you are prompted to load any other items, type n) :
- Dblspace driver
- Himem.sys
- Ifshlp.sys
- Dblbuff.sys
• Load the Windows GUI (graphical user interface), and choose to load all Windows drivers.
Error Deleting File. Cannot delete XX. Access is denied. Make sure the disk is not full or write-protected and that the file is not currently in us
Error Message: “Error Deleting File. Cannot delete XX. Access is denied. Make sure the disk is not full or write-protected and that the file is not currently in use.”
Translation: When you attempt to delete a file (XX) that another program is using (for example, if you have an Excel document open and you try to delete that file using Windows Explorer) this error will occur. Attempting to delete a temporary file in Windows Explorer while Windows is using it will also cause this error.
Solution: Close the file that is causing the error. If Windows is using a system file, rebooting
your system will release the file and allow you to delete it.
Translation: When you attempt to delete a file (XX) that another program is using (for example, if you have an Excel document open and you try to delete that file using Windows Explorer) this error will occur. Attempting to delete a temporary file in Windows Explorer while Windows is using it will also cause this error.
Solution: Close the file that is causing the error. If Windows is using a system file, rebooting
your system will release the file and allow you to delete it.
Cannot delete: Cannot find the specified file. Make sure you specify the correct path and filename
Error Message: “Cannot delete: Cannot find the specified file. Make sure you specify the correct path and filename.”
Translation: Variations of this message can occur when you click a file in Windows Explorer to open, delete, or drag it to the Recycle Bin. The file or folder may contain invalid characters, even though they may not appear in the filename.
Solution: Create a temporary folder, copy the file or folder’s contents to it and delete the old folder’s contents by pressing CTRL-A and pressing DELETE. Restore all the files except the improperly named one to the old folder. Use a single-character wildcard question mark to replace the invalid character (i.e. to rename a file named *eadme.txt, type ren?eadme.txt readme.txt).
AMD Launches Phenom II CPU, Its Fastest Yet
TWO DAYS SHY of a year since Intel launched Penryn, its fi rst 45nm processor, AMD fi nally countered witha few 45nm CPUs of its own, releasing the Phenom II in January. But based on our
hands-on testing of two Phenom II–based desktops—the Dell XPS 625 and the Maingear
Dash—the chip isn’t quite as dominating as AMD would have you believe.
Phenom II Explained
AMD is positioning its Phenom II products between Intel’s Core 2 Quad and Core i7 off erings. Phenom II chips are available in two versions: the X4 920 and the X4 940 Black Edition, which compete tit-for-tat against Intel’s highest Core 2 Quad CPU frequencies at 2.8 and 3.0 GHz, respectively. AMD bumped the amount of shared L3 cache of the Phenom II processors from 2MB up to 6MB, giving each CPU a to tal cache of 8MB. Th e move puts Phenom II processors right in the middle of Intel’s Core 2 Quad lineup for cache size, but the result is still short of the 12MB caches provided on higher-end Core i7 chips. Th ough limited overclocking of the 920 edition processors is available through AMD’s OverDrive soft ware, the company is tipping its hat toward the extremeperformance crowd with its Black Edition processors. These CPUs run multiplierunlocked, which liquidnitrogen- armed enthusiasts have been able to push to frequencies above 6 GHz, surpassing the record for Intel Core i7 processors, which stands at 5.5 GHz.
Peppy Performance
Th e Phenom II’s integrated memory controller and HyperTransport interface give it a technical edge over Core 2 Quad chips, which lack those features. Intel moved to an integrated memory controller and be - gan incorporating its version of HyperTransport, dubbed QuickPath Interconnect, only with Core i7.
In comprehensive PC World lab testing of Dell’s XPS 625 (fi nd.pcworld.com/ 62316) and Maingear’s Dash (fi nd.pcworld.com/62326), the brand-new chips failed to blow Intel’s Core 2 Quad and Core i7 out of the water. Th e XPS 625 earned a World- Bench 6 score of 108, and the
Dash posted a score of 117. Th e Dash’s score tied for the fastest mark among value PCs we’ve tested, but it’s far below the scores received by systems competing for our power desktop PCs chart.
Upgraders’ andOverclockers’ Dream?
However, AMD is waging its war against the speedier Core i7 chips on price, not performance especially for potential upgraders. Moving from a Core 2 Quad CPU to a Core i7 chip requires buying a new motherboard and memory, in addition to the processor. Moving from a Socket AM2+ CPU to a Phenom II requires buying only the new processor. And ifn you wait to upgrade to an AM3-socket Phenom II, ex - pected to be out early this year, you can still keep your DDR2 memory, and possibly even your motherboard. But from what we’ve seen so far, the price benefi t isn’t substantial if you’re in the market for a new computer: Th e two Phenom II systems we tested each rang up at $1499; three of our higherperforming power PCs (in - cluding both Core i7 and Core 2 Quad models) cost from $1600 to $1800.
AMD’s next-generation platform is launching alongside the Phenom II. Th e new Dragon platform (successor to the Phenom quad-corebased Spider) consists of 790-series motherboard chip sets and 4800-series Radeon HD graphics cards. Th e platform focuses on energy savings, thanks to a combination of AMD’s Cool’n’Quiet 3.0 soft ware and the 45nm architecture. Together, they allow Phenom II processors to reduce their heavy-load power consumption by a
reported 30 to 40 percent versus Phenom processors, with a savings of up to 50 percent at idle.
Judging from our testing, a Phenom II will require a solid system backed by strong overclocking to surpass the prowess of even a midrange or high-end Core 2 Quad processor. If you’re looking to upgrade your rig and you care more about simplicity than you do about high stock clock speeds, AMD’s single-CPU upgrade is a powerful statement. As for performance, perhaps AMD’s new products will seem more appealing as soon as extreme-system manufacturers start pushing their Phenom II chip sets past the 4-GHz barrier.
hands-on testing of two Phenom II–based desktops—the Dell XPS 625 and the Maingear
Dash—the chip isn’t quite as dominating as AMD would have you believe.
Phenom II Explained
AMD is positioning its Phenom II products between Intel’s Core 2 Quad and Core i7 off erings. Phenom II chips are available in two versions: the X4 920 and the X4 940 Black Edition, which compete tit-for-tat against Intel’s highest Core 2 Quad CPU frequencies at 2.8 and 3.0 GHz, respectively. AMD bumped the amount of shared L3 cache of the Phenom II processors from 2MB up to 6MB, giving each CPU a to tal cache of 8MB. Th e move puts Phenom II processors right in the middle of Intel’s Core 2 Quad lineup for cache size, but the result is still short of the 12MB caches provided on higher-end Core i7 chips. Th ough limited overclocking of the 920 edition processors is available through AMD’s OverDrive soft ware, the company is tipping its hat toward the extremeperformance crowd with its Black Edition processors. These CPUs run multiplierunlocked, which liquidnitrogen- armed enthusiasts have been able to push to frequencies above 6 GHz, surpassing the record for Intel Core i7 processors, which stands at 5.5 GHz.
Peppy Performance
Th e Phenom II’s integrated memory controller and HyperTransport interface give it a technical edge over Core 2 Quad chips, which lack those features. Intel moved to an integrated memory controller and be - gan incorporating its version of HyperTransport, dubbed QuickPath Interconnect, only with Core i7.
In comprehensive PC World lab testing of Dell’s XPS 625 (fi nd.pcworld.com/ 62316) and Maingear’s Dash (fi nd.pcworld.com/62326), the brand-new chips failed to blow Intel’s Core 2 Quad and Core i7 out of the water. Th e XPS 625 earned a World- Bench 6 score of 108, and the
Dash posted a score of 117. Th e Dash’s score tied for the fastest mark among value PCs we’ve tested, but it’s far below the scores received by systems competing for our power desktop PCs chart.
Upgraders’ andOverclockers’ Dream?
However, AMD is waging its war against the speedier Core i7 chips on price, not performance especially for potential upgraders. Moving from a Core 2 Quad CPU to a Core i7 chip requires buying a new motherboard and memory, in addition to the processor. Moving from a Socket AM2+ CPU to a Phenom II requires buying only the new processor. And ifn you wait to upgrade to an AM3-socket Phenom II, ex - pected to be out early this year, you can still keep your DDR2 memory, and possibly even your motherboard. But from what we’ve seen so far, the price benefi t isn’t substantial if you’re in the market for a new computer: Th e two Phenom II systems we tested each rang up at $1499; three of our higherperforming power PCs (in - cluding both Core i7 and Core 2 Quad models) cost from $1600 to $1800.
AMD’s next-generation platform is launching alongside the Phenom II. Th e new Dragon platform (successor to the Phenom quad-corebased Spider) consists of 790-series motherboard chip sets and 4800-series Radeon HD graphics cards. Th e platform focuses on energy savings, thanks to a combination of AMD’s Cool’n’Quiet 3.0 soft ware and the 45nm architecture. Together, they allow Phenom II processors to reduce their heavy-load power consumption by a
reported 30 to 40 percent versus Phenom processors, with a savings of up to 50 percent at idle.
Judging from our testing, a Phenom II will require a solid system backed by strong overclocking to surpass the prowess of even a midrange or high-end Core 2 Quad processor. If you’re looking to upgrade your rig and you care more about simplicity than you do about high stock clock speeds, AMD’s single-CPU upgrade is a powerful statement. As for performance, perhaps AMD’s new products will seem more appealing as soon as extreme-system manufacturers start pushing their Phenom II chip sets past the 4-GHz barrier.
Subscribe to:
Posts (Atom)