tag:blogger.com,1999:blog-8659233597353832412024-02-07T21:18:54.559-07:00Ccna final exam - java, php, javascript, ios, cshap all in oneCcna final exam - java, php, javascript, ios, cshap all in one. This is a collaboratively edited question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.Unknownnoreply@blogger.comBlogger3839125tag:blogger.com,1999:blog-865923359735383241.post-33497302773551782332015-03-24T00:11:00.001-06:002015-03-24T00:11:08.178-06:00CCNA 1 Practice Final Exam Answer v5.02 2015 (100%)<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">1. A host is accessing a Web server on a remote network. Which three functions are performed by intermediary network devices during this conversation? (Choose three.)</strong></h4>
<ul style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">regenerating data signals</span></li>
<li style="box-sizing: border-box;">acting as a client or a server</li>
<li style="box-sizing: border-box;">providing a channel over which messages travel</li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">applying security settings to control the flow of data</span></li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">notifying other devices when errors occur</span></li>
<li style="box-sizing: border-box;">serving as the source or destination of the messages</li>
</ul>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">2. For which three reasons was a packet-switched connectionless data communications technology used when developing the Internet? (Choose three.)</strong></h4>
<ul style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">It can rapidly adapt to the loss of data transmission facilities.</span></li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">It efficiently utilizes the network infrastructure to transfer data.</span></li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">Data packets can travel multiple paths through the network simultaneously.</span></li>
<li style="box-sizing: border-box;">It allows for billing of network use by the amount of time a connection is established.</li>
<li style="box-sizing: border-box;">It requires that a data circuit between the source and destination be established before data can be transferred.</li>
</ul>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">3. A medium-sized business is researching available options for connecting to the Internet. The company is looking for a high speed option with dedicated, symmetric access. Which connection type should the company choose?</strong></h4>
<ul style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;">DSL</li>
<li style="box-sizing: border-box;">dialup</li>
<li style="box-sizing: border-box;">satellite</li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">leased line</span></li>
<li style="box-sizing: border-box;">cable modem</li>
</ul>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;"><span style="box-sizing: border-box; color: black;">4. What is an ISP?</span></strong></h4>
<ul style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;">It is a standards body that develops cabling and wiring standards for networking.</li>
<li style="box-sizing: border-box;">It is a protocol that establishes how computers within a local network communicate.</li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">It is an organization that enables individuals and businesses to connect to the Internet.</span></li>
<li style="box-sizing: border-box;">It is a networking device that combines the functionality of several different networking devices in one.</li>
</ul>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">5. An administrator needs to upgrade the IOS in a router to a version that supports new features. Which factor should the administrator consider before performing the upgrade?</strong></h4>
<ul style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;">The old IOS must be removed first.</li>
<li style="box-sizing: border-box;">NVRAM must be erased before the new IOS can be installed.</li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">The new IOS might require more RAM to function properly.</span></li>
<li style="box-sizing: border-box;">The old IOS should be backed up to NVRAM so that it is not lost during a power failure.</li>
</ul>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">6. Refer to the exhibit. A network engineer is attempting to connect to a new router to perform the initial configuration. The engineer connects a rollover cable from the serial port of a PC to the Aux port on the router, then configures HyperTerminal as shown. The engineer cannot get a login prompt in HyperTerminal. What would fix the problem?</strong></h4>
<div class="wp-caption aligncenter" id="attachment_618" style="background-color: white; box-sizing: border-box; clear: both; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; height: auto; line-height: 20px; margin-left: auto; margin-right: auto; max-width: 100%; width: 346px;">
<img alt="CCNA 1 Practice Final Answer 001 (v5.02, 2015)" class="wp-image-618 size-full" height="395" src="http://www.ccna5ccnp.com/wp-content/uploads/2015/02/24653.jpg" style="border: 0px; box-sizing: border-box; height: auto; margin-bottom: 20px; max-width: 100%; vertical-align: middle; width: 346px;" title="CCNA 1 Practice Final Answer 001 (v5.02, 2015)" width="336" /><div class="wp-caption-text" style="box-sizing: border-box; font-size: 11px; line-height: 17px; padding: 0px 4px 5px;">
CCNA 1 Practice Final Answer 001 (v5.02, 2015)</div>
</div>
<ul style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;">Connect to the Ethernet port on the PC.</li>
<li style="box-sizing: border-box;">Change connection settings to even parity.</li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">Move the cable to the router console port.</span></li>
<li style="box-sizing: border-box;">Use a crossover cable instead of a rollover cable.</li>
</ul>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">7. Which connection provides a secure CLI session with encryption to a Cisco router?</strong></h4>
<ul style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;">a console connection</li>
<li style="box-sizing: border-box;">an AUX connection</li>
<li style="box-sizing: border-box;">a Telnet connection</li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">an SSH connection</span></li>
</ul>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">8. Refer to the exhibit. An administrator is trying to view the current configuration on this switch but receives the error message that is displayed. What does this error indicate?</strong></h4>
<div class="wp-caption aligncenter" id="attachment_622" style="background-color: white; box-sizing: border-box; clear: both; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; height: auto; line-height: 20px; margin-left: auto; margin-right: auto; max-width: 100%; width: 262px;">
<a href="http://www.ccna5ccnp.com/wp-content/uploads/2015/02/i208400v1n2_Question-2.png" style="background: transparent; box-sizing: border-box; color: #ff3333; text-decoration: none;"><img alt="CCNA 1 Practice Final Answer 002 (v5.02, 2015)" class="wp-image-622 size-full" height="50" src="http://www.ccna5ccnp.com/wp-content/uploads/2015/02/i208400v1n2_Question-2.png" style="border: 0px; box-sizing: border-box; height: auto; margin-bottom: 20px; max-width: 100%; vertical-align: middle; width: 262px;" title="CCNA 1 Practice Final Answer 002 (v5.02, 2015)" width="252" /></a><div class="wp-caption-text" style="box-sizing: border-box; font-size: 11px; line-height: 17px; padding: 0px 4px 5px;">
CCNA 1 Practice Final Answer 002 (v5.02, 2015)</div>
</div>
<ul style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;">The command does not exist.</li>
<li style="box-sizing: border-box;">One or more required keywords or arguments were omitted.</li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">Not enough characters were entered for the interpreter to recognize the command.</span></li>
<li style="box-sizing: border-box;">The administrator does not have the required level of access to use this command.</li>
</ul>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">9. Refer to the exhibit. From global configuration mode, an administrator is attempting to create a message-of-the-day banner by using the command banner motd V Authorized access only! Violators will be prosecuted! V When users log in using Telnet, the banner does not appear correctly. What is the problem?</strong></h4>
<div class="wp-caption aligncenter" id="attachment_620" style="background-color: white; box-sizing: border-box; clear: both; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; height: auto; line-height: 20px; margin-left: auto; margin-right: auto; max-width: 100%; width: 316px;">
<a href="http://www.ccna5ccnp.com/wp-content/uploads/2015/02/36489.png" style="background: transparent; box-sizing: border-box; color: #ff3333; text-decoration: none;"><img alt="CCNA 1 Practice Final Answer 003 (v5.02, 2015)" class="wp-image-620 size-full" height="140" src="http://www.ccna5ccnp.com/wp-content/uploads/2015/02/36489.png" style="border: 0px; box-sizing: border-box; height: auto; margin-bottom: 20px; max-width: 100%; vertical-align: middle; width: 316px;" title="CCNA 1 Practice Final Answer 003 (v5.02, 2015)" width="306" /></a><div class="wp-caption-text" style="box-sizing: border-box; font-size: 11px; line-height: 17px; padding: 0px 4px 5px;">
CCNA 1 Practice Final Answer 003 (v5.02, 2015)</div>
</div>
<ul style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;">The banner message is too long.</li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">The delimiting character appears in the banner message.</span></li>
<li style="box-sizing: border-box;">The symbol “!” signals the end of a banner message.</li>
<li style="box-sizing: border-box;">Message-of-the-day banners will only appear when a user logs in through the console port.</li>
</ul>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">10. A network administrator enters the service password-encryption command into the configuration mode of a router. What does this command accomplish?</strong></h4>
<ul style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;">This command encrypts passwords as they are transmitted across serial WAN links.</li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">This command prevents someone from viewing the running configuration passwords.</span></li>
<li style="box-sizing: border-box;">This command enables a strong encryption algorithm for the enable secret password command.</li>
<li style="box-sizing: border-box;">This command automatically encrypts passwords in configuration files that are currently stored in NVRAM.</li>
<li style="box-sizing: border-box;">This command provides an exclusive encrypted password for external service personnel who are required to do router</li>
</ul>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">11. Refer to the exhibit. A network administrator is configuring access control to switch SW1. If the administrator uses a console connection to connect to the switch, which password is needed to access user EXEC mode?</strong></h4>
<div class="wp-caption aligncenter" id="attachment_625" style="background-color: white; box-sizing: border-box; clear: both; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; height: auto; line-height: 20px; margin-left: auto; margin-right: auto; max-width: 100%; width: 497px;">
<a href="http://www.ccna5ccnp.com/wp-content/uploads/2015/02/i223579v1n1_208237.gif" style="background: transparent; box-sizing: border-box; color: #ff3333; text-decoration: none;"><img alt="CCNA 1 Practice Final Answer 004 (v5.02, 2015)" class="wp-image-625 size-full" height="235" src="http://www.ccna5ccnp.com/wp-content/uploads/2015/02/i223579v1n1_208237.gif" style="border: 0px; box-sizing: border-box; height: auto; margin-bottom: 20px; max-width: 100%; vertical-align: middle; width: 497px;" title="CCNA 1 Practice Final Answer 004 (v5.02, 2015)" width="487" /></a><div class="wp-caption-text" style="box-sizing: border-box; font-size: 11px; line-height: 17px; padding: 0px 4px 5px;">
CCNA 1 Practice Final Answer 004 (v5.02, 2015)</div>
</div>
<ul style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;">letmein</li>
<li style="box-sizing: border-box;">secretin</li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">lineconin</span></li>
<li style="box-sizing: border-box;">linevtyin</li>
</ul>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">12. What will happen if the default gateway address is incorrectly configured on a host?</strong></h4>
<ul style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;">The host cannot communicate with other hosts in the local network.</li>
<li style="box-sizing: border-box;">The switch will not forward packets initiated by the host.</li>
<li style="box-sizing: border-box;">The host will have to use ARP to determine the correct address of the default gateway.</li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">The host cannot communicate with hosts in other networks.</span></li>
<li style="box-sizing: border-box;">A ping from the host to 127.0.0.1 would not be successful.</li>
</ul>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">13. A network administrator is designing a new network infrastructure that includes both wired and wireless connectivity. Under which situation would a wireless connection be recommended?</strong></h4>
<ul style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;">The end-user device only has an Ethernet NIC.</li>
<li style="box-sizing: border-box;">The end-user device requires a dedicated connection because of performance requirements.</li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">The end-user device needs mobility when connecting to the network.</span></li>
<li style="box-sizing: border-box;">The end-user device area has a high concentration of RFI.</li>
</ul>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">14. A network administrator is troubleshooting connectivity issues on a server. Using a tester, the administrator notices that the signals generated by the server NIC are distorted and not usable. In which layer of the OSI model is the error categorized?</strong></h4>
<ul style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;">presentation layer</li>
<li style="box-sizing: border-box;">network layer</li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">physical layer</span></li>
<li style="box-sizing: border-box;">data link layer</li>
</ul>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">15. Why are the paired wires twisted in a CAT5 cable?</strong></h4>
<ul style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;">to facilitate cable termination in the connector</li>
<li style="box-sizing: border-box;">to extend the signaling length</li>
<li style="box-sizing: border-box;">to improve the mechanical strength</li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">to provide eletromagnetic noise cancellation</span></li>
</ul>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">16. What makes fiber preferable to copper cabling for interconnecting buildings? (Choose three.)</strong></h4>
<ul style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">greater distances per cable run</span></li>
<li style="box-sizing: border-box;">lower installation cost</li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">limited susceptibility to EMI/RFI</span></li>
<li style="box-sizing: border-box;">durable connections</li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">greater bandwidth potential</span></li>
<li style="box-sizing: border-box;">easily terminated</li>
</ul>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">17. Refer to the exhibit. Which layer of the OSI model would format data in this way?</strong></h4>
<div class="wp-caption aligncenter" id="attachment_623" style="background-color: white; box-sizing: border-box; clear: both; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; height: auto; line-height: 20px; margin-left: auto; margin-right: auto; max-width: 100%; width: 662px;">
<a href="http://www.ccna5ccnp.com/wp-content/uploads/2015/02/i208694v1n1_header.jpg" style="background: transparent; box-sizing: border-box; color: #ff3333; text-decoration: none;"><img alt="CCNA 1 Practice Final Answer 005 (v5.02, 2015)" class="wp-image-623 size-full" height="205" src="http://www.ccna5ccnp.com/wp-content/uploads/2015/02/i208694v1n1_header.jpg" style="border: 0px; box-sizing: border-box; height: auto; margin-bottom: 20px; max-width: 100%; vertical-align: middle; width: 662px;" title="CCNA 1 Practice Final Answer 005 (v5.02, 2015)" width="652" /></a><div class="wp-caption-text" style="box-sizing: border-box; font-size: 11px; line-height: 17px; padding: 0px 4px 5px;">
CCNA 1 Practice Final Answer 005 (v5.02, 2015)</div>
</div>
<ul style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;">physical</li>
<li style="box-sizing: border-box;">network</li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">data link</span></li>
<li style="box-sizing: border-box;">transport</li>
<li style="box-sizing: border-box;">application</li>
</ul>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">18. On a point-to-point network, which communication type is used when two devices can both transmit and receive but not at the same time?</strong></h4>
<ul style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;">controlled access</li>
<li style="box-sizing: border-box;">deterministic</li>
<li style="box-sizing: border-box;">full-duplex</li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">half-duplex</span></li>
</ul>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">19. What three statements describe features or functions of media access control? (Choose three.)</strong></h4>
<ul style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;">Controlled media access involves collision handling.</li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">It is responsible for detecting transmission errors in transmitted data.</span></li>
<li style="box-sizing: border-box;">It uses contention-based access also known as deterministic access.</li>
<li style="box-sizing: border-box;">802.11 utilizes CSMA/CD.</li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">Data link layer protocols define the rules for access to different media.</span></li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">Ethernet utilizes CSMA/CD.</span></li>
</ul>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">20. A frame is transmitted from one networking device to another. Why does the receiving device check the FCS field in the frame?</strong></h4>
<ul style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;">to determine the physical address of the sending device</li>
<li style="box-sizing: border-box;">to verify the network layer protocol information</li>
<li style="box-sizing: border-box;">to compare the interface media type between the sending and receiving ends</li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">to check the frame for possible transmission errors</span></li>
<li style="box-sizing: border-box;">to verify that the frame destination matches the MAC address of the receiving device</li>
</ul>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">21. The ARP table in a switch maps which two types of address together?</strong></h4>
<ul style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">Layer 3 address to a Layer 2 address</span></li>
<li style="box-sizing: border-box;">Layer 3 address to a Layer 4 address</li>
<li style="box-sizing: border-box;">Layer 4 address to a Layer 2 address</li>
<li style="box-sizing: border-box;">Layer 2 address to a Layer 4 address</li>
</ul>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">22. What are two actions performed by a Cisco switch? (Choose two.)</strong></h4>
<ul style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;">building a routing table that is based on the first IP address in the frame header</li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">using the source MAC addresses of frames to build and maintain a MAC address table</span></li>
<li style="box-sizing: border-box;">forwarding frames with unknown destination IP addresses to the default gateway</li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">utilizing the MAC address table to forward frames via the destination MAC address</span></li>
<li style="box-sizing: border-box;">examining the destination MAC address to add new entries to the MAC address table</li>
</ul>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">23. Which two functions are primary functions of a router? (Choose two.)</strong></h4>
<ul style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">packet switching</span></li>
<li style="box-sizing: border-box;">microsegmentation</li>
<li style="box-sizing: border-box;">domain name resolution</li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">path selection</span></li>
<li style="box-sizing: border-box;">flow control</li>
</ul>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">24. A router boots and enters setup mode. What is the reason for this?</strong></h4>
<ul style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;">The IOS image is corrupt.</li>
<li style="box-sizing: border-box;">Cisco IOS is missing from flash memory.</li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">The configuration file is missing from NVRAM.</span></li>
<li style="box-sizing: border-box;">The POST process has detected hardware failure.</li>
</ul>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">25. Using default settings, what is the next step in the router boot sequence after the IOS loads from flash?</strong></h4>
<ul style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;">Perform the POST routine.</li>
<li style="box-sizing: border-box;">Search for a backup IOS in ROM.</li>
<li style="box-sizing: border-box;">Load the bootstrap program from ROM.</li>
<li style="box-sizing: border-box;">Load the running-config file from RAM.</li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">Locate and load the startup-config file from NVRAM.</span></li>
</ul>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">26. What are two ways that TCP uses the sequence numbers in a segment? (Choose two.)</strong></h4>
<ul style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">to identify missing segments at the destination</span></li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">to reassemble the segments at the remote location</span></li>
<li style="box-sizing: border-box;">to specify the order in which the segments travel from source to destination</li>
<li style="box-sizing: border-box;">to limit the number of segments that can be sent out of an interface at one time</li>
<li style="box-sizing: border-box;">to determine if the packet changed during transit</li>
</ul>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">27. A high school in New York (school A) is using videoconferencing technology to establish student interactions with another high school (school B) in Russia. The videoconferencing is conducted between two end devices through the Internet. The network administrator of school A configures the end device with the IP address 192.168.25.10. The administrator sends a request for the IP address for the end device in school B and the response is 192.168.25.10. The administrator knows immediately that this IP will not work. Why?</strong></h4>
<ul style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;">This is a loopback address.</li>
<li style="box-sizing: border-box;">This is a link-local address.</li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">This is a private IP address.</span></li>
<li style="box-sizing: border-box;">There is an IP address conflict.</li>
</ul>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">28. Which service will translate private internal IP addresses into Internet routable public IP addresses?</strong></h4>
<ul style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;">ARP</li>
<li style="box-sizing: border-box;">DHCP</li>
<li style="box-sizing: border-box;">DNS</li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">NAT</span></li>
</ul>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">29. Which IPv6 address notation is valid?</strong></h4>
<ul style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;">2001:0DB8::ABCD::1234</li>
<li style="box-sizing: border-box;">ABCD:160D::4GAB:FFAB</li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">2001:DB8:0:1111::200</span></li>
<li style="box-sizing: border-box;">2001::ABCD::</li>
</ul>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">30. Which range of link-local addresses can be assigned to an IPv6-enabled interface??</strong></h4>
<ul style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;">FEC0::/10?</li>
<li style="box-sizing: border-box;">FDEE::/7?</li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">FEBF::/10</span></li>
<li style="box-sizing: border-box;">FF00::/8?</li>
</ul>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">31. What are the three parts of an IPv6 global unicast address? (Choose three.)</strong></h4>
<ul style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;">broadcast address</li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">global routing prefix</span></li>
<li style="box-sizing: border-box;">subnet mask</li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">subnet ID</span></li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">interface ID</span></li>
</ul>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">32. What is the purpose of ICMP messages?</strong></h4>
<ul style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;">to inform routers about network topology changes</li>
<li style="box-sizing: border-box;">to ensure the delivery of an IP packet</li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">to provide feedback of IP packet transmissions</span></li>
<li style="box-sizing: border-box;">to monitor the process of a domain name to IP address resolution</li>
</ul>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">33. Which statement describes a characteristic of the traceroute utility?</strong></h4>
<ul style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;">It sends four Echo Request messages.</li>
<li style="box-sizing: border-box;">It utilizes the ICMP Source Quench messages.</li>
<li style="box-sizing: border-box;">It is primarily used to test connectivity between two hosts.</li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">It identifies the routers in the path from a source host to a destination host.</span></li>
</ul>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">34. Refer to the exhibit. Using VLSM, what is the largest and smallest subnet mask required on this network in order to minimize address waste?</strong></h4>
<div class="wp-caption aligncenter" id="attachment_621" style="background-color: white; box-sizing: border-box; clear: both; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; height: auto; line-height: 20px; margin-left: auto; margin-right: auto; max-width: 100%; width: 623px;">
<a href="http://www.ccna5ccnp.com/wp-content/uploads/2015/02/i207603v1n1_207603.png" style="background: transparent; box-sizing: border-box; color: #ff3333; text-decoration: none;"><img alt="CCNA 1 Practice Final Answer 006 (v5.02, 2015)" class="wp-image-621 size-full" height="435" src="http://www.ccna5ccnp.com/wp-content/uploads/2015/02/i207603v1n1_207603.png" style="border: 0px; box-sizing: border-box; height: auto; margin-bottom: 20px; max-width: 100%; vertical-align: middle; width: 623px;" title="CCNA 1 Practice Final Answer 006 (v5.02, 2015)" width="613" /></a><div class="wp-caption-text" style="box-sizing: border-box; font-size: 11px; line-height: 17px; padding: 0px 4px 5px;">
CCNA 1 Practice Final Answer 006 (v5.02, 2015)</div>
</div>
<ul style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;">255.255.254.0 and 255.255.255.224</li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">255.255.254.0 and 255.255.255.252</span></li>
<li style="box-sizing: border-box;">255.255.255.128 and 255.255.255.224</li>
<li style="box-sizing: border-box;">255.255.255.0 and 255.255.255.252</li>
</ul>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">35. A network administrator has been issued a network address of 192.31.7.64/26. How many subnets of equal size could be created from the assigned /26 network by using a /28 prefix?</strong></h4>
<ul style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;">3</li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">4</span></li>
<li style="box-sizing: border-box;">6</li>
<li style="box-sizing: border-box;">8</li>
<li style="box-sizing: border-box;">14</li>
<li style="box-sizing: border-box;">16</li>
</ul>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">36. A small satellite office has been given the overall network number of 192.168.99.0/24 and the network technician can subdivide the network addresses as needed. The office needs network access for both wired and wireless devices. However, because of the security consideration, these two networks should be separate. The wired network will have 20 devices. The wireless network has a potential connection of 45 devices. Which addressing scheme would be most efficient for these two networks?</strong></h4>
<ul style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">192.168.99.0/26</span><br style="box-sizing: border-box;" /><span style="box-sizing: border-box; color: red;">192.168.99.64/27</span></li>
<li style="box-sizing: border-box;">192.168.99.0/27<br style="box-sizing: border-box;" />192.168.99.32/26</li>
<li style="box-sizing: border-box;">192.168.99.0/27<br style="box-sizing: border-box;" />192.168.99.32/28</li>
<li style="box-sizing: border-box;">192.168.99.0/28<br style="box-sizing: border-box;" />192.168.99.16/28</li>
<li style="box-sizing: border-box;">192.168.99.0/28<br style="box-sizing: border-box;" />192.168.99.64/26</li>
</ul>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">37. The administrator of a branch office receives an IPv6 prefix of 2001:db8:3000::/52 from the corporate network manager. How many subnets can the administrator create?</strong></h4>
<ul style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;">1024</li>
<li style="box-sizing: border-box;">2048</li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">4096</span></li>
<li style="box-sizing: border-box;">8192</li>
<li style="box-sizing: border-box;">65536</li>
</ul>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">38. A user is attempting to do an http://www.cisco.com/ without success. Which two configuration values must be set on the host to allow this access? (Choose two.)</strong></h4>
<ul style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">DNS server</span></li>
<li style="box-sizing: border-box;">WINS server</li>
<li style="box-sizing: border-box;">HTTP server</li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">default gateway</span></li>
<li style="box-sizing: border-box;">Netbios</li>
</ul>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">39. Which devices should be secured to mitigate against MAC address spoofing attacks?</strong></h4>
<ul style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;">Layer 7 devices</li>
<li style="box-sizing: border-box;">Layer 4 devices</li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">Layer 2 devices</span></li>
<li style="box-sizing: border-box;">Layer 3 devices</li>
</ul>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">40. Which router configuration mode would an administrator use to configure the router for SSH or Telnet login access?</strong></h4>
<ul style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">line</span></li>
<li style="box-sizing: border-box;">router</li>
<li style="box-sizing: border-box;">global</li>
<li style="box-sizing: border-box;">interface</li>
<li style="box-sizing: border-box;">privileged EXEC</li>
</ul>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">41. Refer to the exhibit. An administrator is testing connectivity to a remote device with the IP address 10.1.1.1. What does the output of this command indicate?</strong></h4>
<div class="wp-caption aligncenter" id="attachment_626" style="background-color: white; box-sizing: border-box; clear: both; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; height: auto; line-height: 20px; margin-left: auto; margin-right: auto; max-width: 100%; width: 575px;">
<a href="http://www.ccna5ccnp.com/wp-content/uploads/2015/02/i204753v1n2_Question-9.png" style="background: transparent; box-sizing: border-box; color: #ff3333; text-decoration: none;"><img alt="CCNA 1 Practice Final Answer 007 (v5.02, 2015)" class="wp-image-626 size-full" height="112" src="http://www.ccna5ccnp.com/wp-content/uploads/2015/02/i204753v1n2_Question-9.png" style="border: 0px; box-sizing: border-box; height: auto; margin-bottom: 20px; max-width: 100%; vertical-align: middle; width: 575px;" title="CCNA 1 Practice Final Answer 007 (v5.02, 2015)" width="565" /></a><div class="wp-caption-text" style="box-sizing: border-box; font-size: 11px; line-height: 17px; padding: 0px 4px 5px;">
CCNA 1 Practice Final Answer 007 (v5.02, 2015)</div>
</div>
<ul style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;">Connectivity to the remote device was successful.</li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">A router along the path did not have a route to the destination.</span></li>
<li style="box-sizing: border-box;">A ping packet is being blocked by a security device along the path.</li>
<li style="box-sizing: border-box;">The connection timed out while waiting for a reply from the remote device.</li>
</ul>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">42. Which is a function of the show ip route command when used as a tool for troubleshooting network connectivity?</strong></h4>
<ul style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;">indicates the point of failure in the connection</li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">shows the IP address of the next hop router for each route</span></li>
<li style="box-sizing: border-box;">lists the IP addresses of all hops the traffic will pass through to reach the destination network</li>
<li style="box-sizing: border-box;">shows the incoming and outgoing interfaces the traffic will go through in order to reach the destination network</li>
</ul>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">43. A user calls the help desk to report that a Windows XP workstation is unable to connect to the network after startup and that a popup window says “This connection has limited or no connectivity.” The technician asks the user to issue the ipconfig /all command. The user reports the IP address is 169.254.69.196 with subnet mask of 255.255.0.0 and nothing is displayed for the DNS server IP address. What is the cause of the problem?</strong></h4>
<ul style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;">The workstation NIC has malfunctioned.</li>
<li style="box-sizing: border-box;">The subnet mask was configured incorrectly.</li>
<li style="box-sizing: border-box;">The DNS server IP address needs to be configured.</li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">The workstation is unable to obtain an IP address from a DHCP server.</span></li>
</ul>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">44. A particular email site does not appear to be responding on a Windows 7 computer. What command could the technician use to show any cached DNS entries for this web page?</strong></h4>
<ul style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;">ipconfig /all</li>
<li style="box-sizing: border-box;">arp -a</li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">ipconfig /displaydns</span></li>
<li style="box-sizing: border-box;">nslookup</li>
</ul>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">45. To revert to a previous configuration, an administrator issues the command copy tftp startup-config on a router and enters the host address and file name when prompted. After the command is completed, why does the current configuration remain unchanged? </strong></h4>
<ul style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;">The command should have been copy startup-config tftp.</li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">The configuration should have been copied to the running configuration instead.</span></li>
<li style="box-sizing: border-box;">The configuration changes were copied into RAM and require a reboot to take effect.</li>
<li style="box-sizing: border-box;">A TFTP server can only be used to restore the Cisco IOS, not the router configuration.</li>
</ul>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">46. Refer to the graphic. What is the effect of setting the security mode to WEP on the Linksys integrated router?</strong></h4>
<div class="wp-caption aligncenter" id="attachment_624" style="background-color: white; box-sizing: border-box; clear: both; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; height: auto; line-height: 20px; margin-left: auto; margin-right: auto; max-width: 100%; width: 389px;">
<a href="http://www.ccna5ccnp.com/wp-content/uploads/2015/02/i214648v1n1_15832.jpg" style="background: transparent; box-sizing: border-box; color: #ff3333; text-decoration: none;"><img alt="CCNA 1 Practice Final Answer 008 (v5.02, 2015)" class="wp-image-624 size-full" height="127" src="http://www.ccna5ccnp.com/wp-content/uploads/2015/02/i214648v1n1_15832.jpg" style="border: 0px; box-sizing: border-box; height: auto; margin-bottom: 20px; max-width: 100%; vertical-align: middle; width: 389px;" title="CCNA 1 Practice Final Answer 008 (v5.02, 2015)" width="379" /></a><div class="wp-caption-text" style="box-sizing: border-box; font-size: 11px; line-height: 17px; padding: 0px 4px 5px;">
CCNA 1 Practice Final Answer 008 (v5.02, 2015)</div>
</div>
<ul style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;">It identifies the wireless LAN.</li>
<li style="box-sizing: border-box;">It allows the access point to inform clients of its presence.</li>
<li style="box-sizing: border-box;">It translates IP addresses into easy-to-remember domain names.</li>
<li style="box-sizing: border-box;">It encrypts data between the wireless client and the access point.</li>
<li style="box-sizing: border-box;">It translates an internal address or group of addresses into an outside, public address.</li>
</ul>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">47. Which type of wireless security is easily compromised?</strong></h4>
<ul style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;">EAP</li>
<li style="box-sizing: border-box;">PSK</li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">WEP</span></li>
<li style="box-sizing: border-box;">WPA</li>
</ul>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">48. Refer to the exhibit. Which two settings could be changed to improve security on the wireless network? (Choose two.)</strong></h4>
<div class="wp-caption aligncenter" id="attachment_619" style="background-color: white; box-sizing: border-box; clear: both; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; height: auto; line-height: 20px; margin-left: auto; margin-right: auto; max-width: 100%; width: 581px;">
<a href="http://www.ccna5ccnp.com/wp-content/uploads/2015/02/35152.jpg" style="background: transparent; box-sizing: border-box; color: #ff3333; text-decoration: none;"><img alt="CCNA 1 Practice Final Answer 009 (v5.02, 2015)" class="wp-image-619 size-full" height="306" src="http://www.ccna5ccnp.com/wp-content/uploads/2015/02/35152.jpg" style="border: 0px; box-sizing: border-box; height: auto; margin-bottom: 20px; max-width: 100%; vertical-align: middle; width: 581px;" title="CCNA 1 Practice Final Answer 009 (v5.02, 2015)" width="571" /></a><div class="wp-caption-text" style="box-sizing: border-box; font-size: 11px; line-height: 17px; padding: 0px 4px 5px;">
CCNA 1 Practice Final Answer 009 (v5.02, 2015)</div>
</div>
<ul style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;">network mode</li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">SSID</span></li>
<li style="box-sizing: border-box;">radio band</li>
<li style="box-sizing: border-box;">wide channel</li>
<li style="box-sizing: border-box;">standard channel</li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">SSID broadcast</span></li>
</ul>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">49. Fill in the blank. Do not abbreviate. Use lower case.</strong><br style="box-sizing: border-box;" /><strong style="box-sizing: border-box;">Which interface configuration mode command puts a Layer 3 switch interface into Layer 3 mode? <span style="box-sizing: border-box; color: red;">no switchport </span></strong></h4>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">50. Fill in the blank.</strong></h4>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">A nibble consists of <span style="box-sizing: border-box; color: red;">4</span> bits.</strong></h4>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">51. Match each item to the type of topology diagram on which it is typically identified. (Not all options are used.)</strong></h4>
<div class="wp-caption aligncenter" id="attachment_627" style="background-color: white; box-sizing: border-box; clear: both; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; height: auto; line-height: 20px; margin-left: auto; margin-right: auto; max-width: 100%; width: 426px;">
<a href="http://www.ccna5ccnp.com/wp-content/uploads/2015/02/CCNA1_Practice_Final_01.jpg" style="background: transparent; box-sizing: border-box; color: #ff3333; text-decoration: none;"><img alt="CCNA 1 Practice Final Answer 010 (v5.02, 2015)" class="wp-image-627 size-full" height="265" src="http://www.ccna5ccnp.com/wp-content/uploads/2015/02/CCNA1_Practice_Final_01.jpg" style="border: 0px; box-sizing: border-box; height: auto; margin-bottom: 20px; max-width: 100%; vertical-align: middle; width: 426px;" title="CCNA 1 Practice Final Answer 010 (v5.02, 2015)" width="416" /></a><div class="wp-caption-text" style="box-sizing: border-box; font-size: 11px; line-height: 17px; padding: 0px 4px 5px;">
CCNA 1 Practice Final Answer 010 (v5.02, 2015)</div>
</div>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">52. Match the situation with the appropriate use of network media.</strong></h4>
<div class="wp-caption aligncenter" id="attachment_628" style="background-color: white; box-sizing: border-box; clear: both; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; height: auto; line-height: 20px; margin-left: auto; margin-right: auto; max-width: 100%; width: 431px;">
<img alt="CCNA 1 Practice Final Answer 011 (v5.02, 2015)" class="wp-image-628 size-full" height="398" src="http://www.ccna5ccnp.com/wp-content/uploads/2015/02/CCNA1_Practice_Final_02.jpg" style="border: 0px; box-sizing: border-box; height: auto; margin-bottom: 20px; max-width: 100%; vertical-align: middle; width: 431px;" title="CCNA 1 Practice Final Answer 011 (v5.02, 2015)" width="421" /><div class="wp-caption-text" style="box-sizing: border-box; font-size: 11px; line-height: 17px; padding: 0px 4px 5px;">
CCNA 1 Practice Final Answer 011 (v5.02, 2015)</div>
</div>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">53. Match the subnetwork to a host address that would be included within the subnetwork. (Not all options are used.)</strong></h4>
<div class="wp-caption aligncenter" id="attachment_629" style="background-color: white; box-sizing: border-box; clear: both; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; height: auto; line-height: 20px; margin-left: auto; margin-right: auto; max-width: 100%; width: 418px;">
<a href="http://www.ccna5ccnp.com/wp-content/uploads/2015/02/CCNA1_Practice_Final_03.jpg" style="background: transparent; box-sizing: border-box; color: #ff3333; text-decoration: none;"><img alt="CCNA 1 Practice Final Answer 012 (v5.02, 2015)" class="wp-image-629 size-full" height="216" src="http://www.ccna5ccnp.com/wp-content/uploads/2015/02/CCNA1_Practice_Final_03.jpg" style="border: 0px; box-sizing: border-box; height: auto; margin-bottom: 20px; max-width: 100%; vertical-align: middle; width: 418px;" title="CCNA 1 Practice Final Answer 012 (v5.02, 2015)" width="408" /></a><div class="wp-caption-text" style="box-sizing: border-box; font-size: 11px; line-height: 17px; padding: 0px 4px 5px;">
CCNA 1 Practice Final Answer 012 (v5.02, 2015)</div>
</div>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">54. Open the PT Activity. Perform the tasks in the activity instructions and then answer the question.</strong></h4>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">What is the secret keyword that is displayed on the web page?</strong></h4>
<ul style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;">router</li>
<li style="box-sizing: border-box;">switch</li>
<li style="box-sizing: border-box;">frame</li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; color: red;">packet</span></li>
<li style="box-sizing: border-box;">cisco</li>
</ul>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">55. Open the PT activity. Perform the tasks in the activity instructions and then fill in the blank.</strong></h4>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Ubuntu, sans-serif; font-size: 18px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 10px;">
<strong style="box-sizing: border-box;">The Server0 message is <span style="box-sizing: border-box; color: red;">winner </span>.?</strong></h4>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-865923359735383241.post-66015217464530090342012-06-11T22:19:00.003-06:002012-06-11T22:19:52.534-06:00Increasing the performance and usability of Facebook"s FQL<p>
<br /> I try to get some insights from the pages I am administrator on Facebook.
<br /></p>
<a name='more'></a><br/><p>
<br /> <br />
<br /> What my code does, it gets the IDs of the pages I want to work with through mySQL. I did not include that part though.
<br /></p>
<br /><p>
<br /> After this, I get the page_id, name and fan_count of each of those facebook IDs and are saved in <code>fancounts[]</code> .
<br /></p>
<br /><p>
<br /> Using the IDs ( <code>pages[]</code> ) I get two messages max from each page. There may be no messages, there may be 1 or 2 messages max. Possibly I will increase it later. <code>messages[]</code> holds the messages of each page.
<br /></p>
<br /><p>
<br /> I have two problems with it.
<br /></p>
<br /><ol>
<br /> <li>It has a very slow performance
<br /> </li>
<br /> <li>I can't find a way to echo the data like this:
<br /> </li>
<br /></ol>
<br /><p>
<br /> <em>ID - Name of the page - Fan Count</em><br />
<br /> Here goes the first message<br />
<br /> Here goes the second one
<br /></p>
<br /><p>
<br /> <em>//here is a break</em><br />
<br /></p>
<br /><p>
<br /> <em>ID - Name of the page 2 - Fan Count</em><br />
<br /> Here goes the first message of page 2<br />
<br /> Here goes the second one of page 2
<br /></p>
<br /><p>
<br /> My questions are, how can the code be modified to increase performance and show the data as above? I read about fql.multiquery. Can it be used here?
<br /></p>
<br /><p>
<br /> Please provide me with code examples. Thank you
<br /></p>
<br /><pre>
<br /><code>
<br />$pages = array(); // I get the IDs I want to work with
<br /> $pagesIds = implode(',', $pages);
<br />
<br /> // fancounts[] holds the page_id, name and fan_count of the Ids I work with
<br />
<br /> $fancounts = array();
<br /> $pagesFanCounts = $facebook->api("/fql", array(
<br /> "q" => "SELECT page_id, name, fan_count FROM page WHERE page_id IN ({$pagesIds})"
<br /> ));
<br />
<br /> foreach ($pagesFanCounts['data'] as $page){
<br /> $fancounts[] = $page['page_id']."-".$page['name']."-".$page['fan_count'];
<br /> }
<br />
<br />
<br /> //messages[] holds from 0 to 2 messages from each of the above pages
<br />
<br /> $messages = array();
<br /> foreach( $pages as $id) {
<br /> $getMessages = $facebook->api("/fql", array(
<br /> "q" => "SELECT message FROM stream WHERE source_id = '$id' LIMIT 2"
<br /> ));
<br /> $messages[] = $getMessages['data'];
<br /> }
<br />
<br /> // this is how I print them now but it does not give me the best output.
<br /> //( thanks goes to Mark for providing me this code )
<br />
<br /> $count = min(count($fancounts),count($messages));
<br />
<br /> for($i=0; $i<$count; ++$i) {
<br /> echo $fancounts[$i],'<br>';
<br /> foreach($messages[$i] as $msg) {
<br /> echo $msg['message'],'<br>';
<br /> }
<br />}
<br /></code>
<br /></pre>
<br/><a href='http://tips4all.net' title='This is a collaboratively edited question and answer site for professional and enthusiast programmers. It is 100% free, no registration required.'>Source: <strong><em>Tips4all</em></strong></a>Unknownnoreply@blogger.com3tag:blogger.com,1999:blog-865923359735383241.post-65445230433125236422012-06-11T22:19:00.001-06:002012-06-11T22:19:19.816-06:00SVN checkout the contents of a folder, not the folder itself<p>
<br /> I'm fairly new to linux and svn. I'm trying to checkout the trunk folder of a project into my public_html directory using this command (while in public_html):
<br /></p>
<a name='more'></a><br/><pre>
<br /><code>
<br />svn checkout file:///home/landonwinters/svn/waterproject/trunk
<br /></code>
<br /></pre>
<br /><p>
<br /> The waterproject directory contains the files from untarring a base install of drupal.
<br /></p>
<br /><p>
<br /> It checks out fine, except all the files are in <code>public_html/trunk</code> instead of just being in <code>public_html</code> .
<br /></p>
<br /><p>
<br /> I don't know the command to move all the contents of trunk up to public_html and rm trunk, but I think I could figure that out relatively easily. I just want to know if I can just check out the contents of a folder, without the folder itself.
<br /></p>
<br/><a href='http://tips4all.net' title='This is a collaboratively edited question and answer site for professional and enthusiast programmers. It is 100% free, no registration required.'>Source: <strong><em>Tips4all</em></strong></a>Unknownnoreply@blogger.com4tag:blogger.com,1999:blog-865923359735383241.post-41870239561157619152012-06-11T22:18:00.005-06:002012-06-11T22:18:56.716-06:00What is the purpose of a these #define within an enum?<p>
<br /> I found this code in the linux headers, /usr/include/dirent.h:
<br /></p>
<br /><pre>
<br /><code>
<br />enum
<br /> {
<br /> DT_UNKNOWN = 0,
<br /># define DT_UNKNOWN DT_UNKNOWN
<br /> DT_FIFO = 1,
<br /># define DT_FIFO DT_FIFO
<br /> DT_CHR = 2,
<br /># define DT_CHR DT_CHR
<br /> DT_DIR = 4,
<br /># define DT_DIR DT_DIR
<br /> DT_BLK = 6,
<br /># define DT_BLK DT_BLK
<br /> DT_REG = 8,
<br /># define DT_REG DT_REG
<br /> DT_LNK = 10,
<br /># define DT_LNK DT_LNK
<br /> DT_SOCK = 12,
<br /># define DT_SOCK DT_SOCK
<br /> DT_WHT = 14
<br /># define DT_WHT DT_WHT
<br /> };
<br /></code>
<br /></pre>
<a name='more'></a><br/><p>
<br /> What is this construct for? - why define something with an identical string, which will then compile to the int value?
<br /></p>
<br/><a href='http://tips4all.net' title='This is a collaboratively edited question and answer site for professional and enthusiast programmers. It is 100% free, no registration required.'>Source: <strong><em>Tips4all</em></strong></a>Unknownnoreply@blogger.com5tag:blogger.com,1999:blog-865923359735383241.post-3926192798917437322012-06-11T22:18:00.003-06:002012-06-11T22:18:55.593-06:00bash: defining a variable with or without export<p>
<br /> What is export for? What is the difference between:
<br /></p>
<br /><pre>
<br /><code>
<br />export name=value
<br /></code>
<br /></pre>
<a name='more'></a><br/><p>
<br /> and
<br /></p>
<br /><pre>
<br /><code>
<br />name=value
<br /></code>
<br /></pre>
<br/><a href='http://tips4all.net' title='This is a collaboratively edited question and answer site for professional and enthusiast programmers. It is 100% free, no registration required.'>Source: <strong><em>Tips4all</em></strong></a>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-865923359735383241.post-78725651853363893342012-06-11T22:18:00.001-06:002012-06-11T22:18:07.402-06:00generate a core dump in linux<p>
<br /> I have a process in linux that's getting a segmentation fault. How can I tell it to generate a core dump when it fails?
<br /></p>
<a name='more'></a><br/>
<br/><a href='http://tips4all.net' title='This is a collaboratively edited question and answer site for professional and enthusiast programmers. It is 100% free, no registration required.'>Source: <strong><em>Tips4all</em></strong></a>Unknownnoreply@blogger.com5tag:blogger.com,1999:blog-865923359735383241.post-53810219985059454582012-06-11T22:17:00.001-06:002012-06-11T22:17:21.246-06:00What is the simplest way to SSH using Python?<p>
<br /> What is the absolute simplest way to SSH to a remote server from a local Python (3.0) script, supply a login/password, execute a command and print the output to the Python console? I would rather not use any large external library and not install anything on the remote server.
<br /></p>
<a name='more'></a><br/>
<br/><a href='http://tips4all.net' title='This is a collaboratively edited question and answer site for professional and enthusiast programmers. It is 100% free, no registration required.'>Source: <strong><em>Tips4all</em></strong></a>Unknownnoreply@blogger.com6tag:blogger.com,1999:blog-865923359735383241.post-32638021376346712682012-06-11T22:16:00.005-06:002012-06-11T22:16:49.490-06:00jQuery Ajax calls and the Html.AntiForgeryToken()<p>
<br /> I have implemented in my app the mitigation to CSRF attacks following the informations that I have read on some blog post around the internet. In particular these post have been the driver of my implementation
<br /></p>
<a name='more'></a><br/><ul>
<br /> <li>
<br /> <a href="http://blogs.msdn.com/b/aspnetue/archive/2010/09/17/second_2d00_post.aspx" rel="nofollow">Best Practices for ASP.NET MVC</a> from the ASP.NET and Web Tools Developer Content Team
<br /> </li>
<br /> <li>
<br /> <a href="http://haacked.com/archive/2009/04/02/anatomy-of-csrf-attack.aspx" rel="nofollow">Anatomy of a Cross-site Request Forgery Attack</a> from Phil Haack blog
<br /> </li>
<br /> <li>
<br /> <a href="http://davidhayden.com/blog/dave/archive/2009/04/29/AntiForgeryTokenInMVCFramework.aspx" rel="nofollow">AntiForgeryToken in the ASP.NET MVC Framework - Html.AntiForgeryToken and ValidateAntiForgeryToken Attribute</a> from David Hayden blog
<br /> </li>
<br /></ul>
<br /><p>
<br /> Basically those articles and recommendations says that to prevent the CSRF attack anybody should implement the following code:
<br /></p>
<br /><p>
<br /> 1) Add the <code>[ValidateAntiForgeryToken]</code> on every action that accept the POST Http verb
<br /></p>
<br /><pre>
<br /><code>
<br />[HttpPost]
<br />[ValidateAntiForgeryToken]
<br />public ActionResult SomeAction( SomeModel model ) {
<br />}
<br /></code>
<br /></pre>
<br /><p>
<br /> 2) Add the <code><%= Html.AntiForgeryToken() %></code> helper inside forms that submits data to the server
<br /></p>
<br /><pre>
<br /><code>
<br /><div style="text-align:right; padding: 8px;">
<br /> <%= Html.AntiForgeryToken() %>
<br /> <input type="submit" id="btnSave" value="Save" />
<br /></div>
<br /></code>
<br /></pre>
<br /><p>
<br /> Anyway in some parts of my app I am doing Ajax POSTs with jQuery to the server without having any form at all. This happens for example where I am letting the user to click on an image to do a specific action.
<br /></p>
<br /><p>
<br /> Suppose I have a table with a list of activities. I have an image on a column of the table that says "Mark activity as completed" and when the user click on that activity I am doing the Ajax POST as in the following sample:
<br /></p>
<br /><pre>
<br /><code>
<br />$("a.markAsDone").click(function (event) {
<br /> event.preventDefault();
<br /> $.ajax({
<br /> type: "post",
<br /> dataType: "html",
<br /> url: $(this).attr("rel"),
<br /> data: {},
<br /> success: function (response) {
<br /> // ....
<br /> }
<br /> });
<br />});
<br /></code>
<br /></pre>
<br /><p>
<br /> How can I use the <code><%= Html.AntiForgeryToken() %></code> in these cases? Should I include the helper call inside the data parameter of the Ajax call?
<br /></p>
<br /><p>
<br /> Sorry for the long post and thanks very much for helping out
<br /></p>
<br /><p>
<br /> <strong>EDIT</strong> :
<br /></p>
<br /><p>
<br /> As per <a href="http://stackoverflow.com/questions/4074199/jquery-ajax-calls-and-the-html-antiforgerytoken/4074289#4074289">jayrdub</a> answer I have used in the following way
<br /></p>
<br /><pre>
<br /><code>
<br />$("a.markAsDone").click(function (event) {
<br /> event.preventDefault();
<br /> $.ajax({
<br /> type: "post",
<br /> dataType: "html",
<br /> url: $(this).attr("rel"),
<br /> data: {
<br /> AddAntiForgeryToken({}),
<br /> id: parseInt($(this).attr("title"))
<br /> },
<br /> success: function (response) {
<br /> // ....
<br /> }
<br /> });
<br />});
<br /></code>
<br /></pre>
<br/><a href='http://tips4all.net' title='This is a collaboratively edited question and answer site for professional and enthusiast programmers. It is 100% free, no registration required.'>Source: <strong><em>Tips4all</em></strong></a>Unknownnoreply@blogger.com6tag:blogger.com,1999:blog-865923359735383241.post-84837850740682756432012-06-11T22:16:00.003-06:002012-06-11T22:16:27.600-06:00How can I convince IE to simply display application/json rather than offer to download it?<p>
<br /> While debugging jQuery apps that use AJAX, I often have the need to see the json that is being returned by the service to the browser. So I'll drop the URL for the JSON data into the address bar.
<br /></p>
<a name='more'></a><br/><p>
<br /> This is nice with ASPNET because in the event of a coding error, I Can see the ASPNET diagostic in the browser:
<br /></p>
<br /><p>
<br /> <img src="http://i41.tinypic.com/161z6mg.jpg" alt="alt text" />
<br /></p>
<br /><p>
<br /> But when the server-side code works correctly and actually returns JSON, IE prompts me to download it, so I can't see the response.
<br /></p>
<br /><p>
<br /> <img src="http://i40.tinypic.com/wt6a1l.jpg" alt="alt text" />
<br /></p>
<br /><p>
<br /> <strong>Can I get IE to NOT do that, in other words, to just display it as if it were plain text?</strong>
<br /></p>
<br /><p>
<br /> I know I could do this if I set the Content-Type header to be <code>text/plain</code> .
<br /></p>
<br /><p>
<br /> But this is specifically an the context of an ASPNET MVC app, which sets the response automagically when I use JsonResult on one of my action methods. Also I kinda want to keep the appropriate content-type, and not change it just to support debugging efforts.
<br /></p>
<br/><a href='http://tips4all.net' title='This is a collaboratively edited question and answer site for professional and enthusiast programmers. It is 100% free, no registration required.'>Source: <strong><em>Tips4all</em></strong></a>Unknownnoreply@blogger.com5tag:blogger.com,1999:blog-865923359735383241.post-65771984747870087702012-06-11T22:16:00.001-06:002012-06-11T22:16:08.443-06:00How can you make a vote-up-down button like in Stackoverflow?<p>
<br /> <strong>Problems</strong>
<br /></p>
<br /><ol>
<br /> <li>how to make an Ajax buttons (upward and downward arrows) such that the number can increase or decrease
<br /> </li>
<br /> <li>how to save the action af an user to an variable NumberOfVotesOfQuestionID
<br /> </li>
<br /></ol>
<a name='more'></a><br/><p>
<br /> I am not sure whether I should use database or not for the variable. However, I know that there is an easier way too to save the number of votes.
<br /></p>
<br /><p>
<br /> <strong>How can you solve those problems?</strong>
<br /></p>
<br /><p>
<br /> [edit]
<br /></p>
<br /><p>
<br /> The server-side programming language is Python.
<br /></p>
<br/><a href='http://tips4all.net' title='This is a collaboratively edited question and answer site for professional and enthusiast programmers. It is 100% free, no registration required.'>Source: <strong><em>Tips4all</em></strong></a>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-865923359735383241.post-69237955199795209102012-06-11T22:15:00.003-06:002012-06-11T22:15:42.649-06:00Chrome: Disable same origin policy<p>
<br /> Is there a way to disable the same origin policy on Google's Chrome browser? This is strictly for development, not production, use.
<br /></p>
<a name='more'></a><br/>
<br/><a href='http://tips4all.net' title='This is a collaboratively edited question and answer site for professional and enthusiast programmers. It is 100% free, no registration required.'>Source: <strong><em>Tips4all</em></strong></a>Unknownnoreply@blogger.com5tag:blogger.com,1999:blog-865923359735383241.post-41748519135770063262012-06-11T22:15:00.001-06:002012-06-11T22:15:21.480-06:00Do you know of a bleeding-edge HTML5 leveraging, legacy-ignoring JavaScript framework?<p>
<br /> What's the best framework (sort of jquery, extjs, etc like) to use if I'd like to intensively use all the freshest technologies of the HTML5 stack provided by modern browsers (Firefox 7, Safari 5, Chrome 14) and have absolutely no need to support any legacy browsers (incl. no need in IE support at all and no need in Firefox or Chrome prior to the latest stable releases)? I'd like to get all the newest available goodness without having (even abstracted by a library layer) a line of code meant just fore legacy compatibility or keeping any legacy-induced things in mind.
<br /></p>
<a name='more'></a><br/><p>
<br /> To soften the filter, taking very humble hope of such an ideally fresh framework to exist, the least (the maximum level of legacy support) I'd like to agree is not supporting IE versions older than IE8, or better just not supporting IE at all.
<br /></p>
<br/><a href='http://tips4all.net' title='This is a collaboratively edited question and answer site for professional and enthusiast programmers. It is 100% free, no registration required.'>Source: <strong><em>Tips4all</em></strong></a>Unknownnoreply@blogger.com5tag:blogger.com,1999:blog-865923359735383241.post-32678837210293687282012-06-11T22:14:00.003-06:002012-06-11T22:14:57.883-06:00How to sort a NSArray alphabetically?<p>
<br /> How can I sort an array filled with [UIFont familyNames] into alphabetical order?
<br /></p>
<a name='more'></a><br/>
<br/><a href='http://tips4all.net' title='This is a collaboratively edited question and answer site for professional and enthusiast programmers. It is 100% free, no registration required.'>Source: <strong><em>Tips4all</em></strong></a>Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-865923359735383241.post-11687329874705796062012-06-11T22:14:00.001-06:002012-06-11T22:14:44.657-06:00Convert UTF-8 encoded NSData to NSString<p>
<br /> I have UTF-8 encoded nsdata from windows server. I want to convert it to nsstring for iphone. Since data contains characters(like degree symbol) which have different values on both platforms, how do I convert data to string.
<br /></p>
<a name='more'></a><br/>
<br/><a href='http://tips4all.net' title='This is a collaboratively edited question and answer site for professional and enthusiast programmers. It is 100% free, no registration required.'>Source: <strong><em>Tips4all</em></strong></a>Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-865923359735383241.post-7423507904775800272012-06-11T22:13:00.005-06:002012-06-11T22:13:41.728-06:00Are you doing iPhone development? How do you learn?<p>
<br /> I am looking for more iPhone developers who are actively posting to their blog and/or Twitter. I have been learning a lot from books but the online resources beyond Apple's developer site have been hard to find.
<br /></p>
<a name='more'></a><br/><p>
<br /> Please let me know if you are doing iPhone development. You can see my comment on Twitter here...
<br /></p>
<br /><p>
<br /> <a href="http://twitter.com/offwhitemke/statuses/1090551535" rel="nofollow">http://twitter.com/offwhitemke/statuses/1090551535</a>
<br /></p>
<br /><p>
<br /> My secondary question is, where are you going to learn more about iPhone development? Have you found any good sources of video training material? Apple is charging $500 for their iPhone videos but there has to be free content out there. I found content on YouTube but it is so compressed that the text is not readable.
<br /></p>
<br /><p>
<br /> I have found that StackOverflow.com has been a really good place to get answers. I also find that iPhoneKicks.com (links site) has been helpful in finding content.
<br /></p>
<br/><a href='http://tips4all.net' title='This is a collaboratively edited question and answer site for professional and enthusiast programmers. It is 100% free, no registration required.'>Source: <strong><em>Tips4all</em></strong></a>Unknownnoreply@blogger.com30tag:blogger.com,1999:blog-865923359735383241.post-4105553391314956182012-06-11T22:13:00.003-06:002012-06-11T22:13:24.407-06:00How do I draw a shadow under a UIView?<p>
<br /> I'm trying to draw a shadow under the bottom edge of a UIView in Cocoa Touch. I understand that I should use CGContextSetShadow() to draw the shadow, but the Quartz 2D programming guide is a little vague:
<br /></p>
<a name='more'></a><br/><ol>
<br /> <li>Save the graphics state.
<br /> </li>
<br /> <li>Call the function CGContextSetShadow, passing the appropriate values.
<br /> </li>
<br /> <li>Perform all the drawing to which you want to apply shadows.
<br /> </li>
<br /> <li>Restore the graphics state
<br /> </li>
<br /></ol>
<br /><p>
<br /> I've tried the following in a UIView subclass:
<br /></p>
<br /><pre>
<br /><code>
<br />- (void)drawRect:(CGRect)rect {
<br /> CGContextRef currentContext = UIGraphicsGetCurrentContext();
<br /> CGContextSaveGState(currentContext);
<br /> CGContextSetShadow(currentContext, CGSizeMake(-15, 20), 5);
<br /> CGContextRestoreGState(currentContext);
<br /> [super drawRect: rect];
<br />}
<br /></code>
<br /></pre>
<br /><p>
<br /> ..but this doesn't work for me and I'm a bit stuck about (a) where to go next and (b) if there's anything I need to do to my UIView to make this work?
<br /></p>
<br/><a href='http://tips4all.net' title='This is a collaboratively edited question and answer site for professional and enthusiast programmers. It is 100% free, no registration required.'>Source: <strong><em>Tips4all</em></strong></a>Unknownnoreply@blogger.com4tag:blogger.com,1999:blog-865923359735383241.post-46888685328868433242012-06-11T22:13:00.001-06:002012-06-11T22:13:03.906-06:00Programmatically add custom event in the iPhone Calendar<p>
<br /> Is there any way to add iCal event to the iPhone Calendar from the custom App?
<br /></p>
<a name='more'></a><br/>
<br/><a href='http://tips4all.net' title='This is a collaboratively edited question and answer site for professional and enthusiast programmers. It is 100% free, no registration required.'>Source: <strong><em>Tips4all</em></strong></a>Unknownnoreply@blogger.com5tag:blogger.com,1999:blog-865923359735383241.post-56627715836795179392012-06-11T22:12:00.001-06:002012-06-11T22:12:16.918-06:00iPhone or Android?<p>
<br /> According to a recent <a href="http://www.odesk.com/blog/2008/12/android-getting-slaughtered-by-iphone/">article</a> iPhone has gained a better appeal than Android among programmers. I'm quite a newbie to Java and a complete profane to ObjectiveC, in your opinion, in which one of the two could I have a try? which platform is good for me
<br /></p>
<a name='more'></a><br/><p>
<br /> <br />
<br /> because i have knowledge about java but not about objective c.
<br /></p>
<br/><a href='http://tips4all.net' title='This is a collaboratively edited question and answer site for professional and enthusiast programmers. It is 100% free, no registration required.'>Source: <strong><em>Tips4all</em></strong></a>Unknownnoreply@blogger.com25tag:blogger.com,1999:blog-865923359735383241.post-35751620418240174242012-06-11T22:11:00.005-06:002012-06-11T22:11:57.526-06:00How to implement Android Pull-to-Refresh<p>
<br /> In Android applications such as Twitter (official app), when you encounter a ListView, you can pull it down (and it will bounce back when released) to refresh the content.
<br /></p>
<a name='more'></a><br/><p>
<br /> I wonder what is the best way, in your opinion, to implement that?
<br /></p>
<br /><p>
<br /> Some possibilities I could think of:
<br /></p>
<br /><ol>
<br /> <li>An item on top of the ListView - however I don't think scrolling back to item position 1 (0-based) with animation on the ListView is an easy task.
<br /> </li>
<br /> <li>Another view outside the ListView - but I need to take care of moving the ListView position down when it is pulled, and I'm not sure if we can detect if the drag-touches to the ListView still really scroll the items on the ListView.
<br /> </li>
<br /></ol>
<br /><p>
<br /> Any recommendations?
<br /></p>
<br /><p>
<br /> P.S. I wonder when the official Twitter app source code is released. It has been mentioned that it will be released, but 6 months has passed and we haven't heard about it since then.
<br /></p>
<br/><a href='http://tips4all.net' title='This is a collaboratively edited question and answer site for professional and enthusiast programmers. It is 100% free, no registration required.'>Source: <strong><em>Tips4all</em></strong></a>Unknownnoreply@blogger.com7tag:blogger.com,1999:blog-865923359735383241.post-65675139763487466152012-06-11T22:11:00.003-06:002012-06-11T22:11:42.507-06:00How do I make an http request using cookies on Android?<p>
<br /> I'd like to make an http request to a remote server while properly handling cookies (eg. storing cookies sent by the server, and sending those cookies when I make subsequent requests). It'd be nice to preserve any and all cookies, but really the only one I care about is the session cookie.
<br /></p>
<a name='more'></a><br/><p>
<br /> With java.net, it appears that the preferred way to do this is using java.net.CookieHandler (abstract base class) and java.net.CookieManager (concrete implementation). Android has java.net.CookieHandler, but it does not seem to have java.net.CookieManager.
<br /></p>
<br /><p>
<br /> I could code it all by hand by inspecting http headers, but it seems like there must be an easier way.
<br /></p>
<br /><p>
<br /> What is the proper way to make http requests on Android while preserving cookies?
<br /></p>
<br/><a href='http://tips4all.net' title='This is a collaboratively edited question and answer site for professional and enthusiast programmers. It is 100% free, no registration required.'>Source: <strong><em>Tips4all</em></strong></a>Unknownnoreply@blogger.com3tag:blogger.com,1999:blog-865923359735383241.post-27549008056607515182012-06-11T22:11:00.001-06:002012-06-11T22:11:19.885-06:00Restful API service<p>
<br /> I'm looking to make a service which I can use to make calls to a web based rest api. I've spent a couple of days looking through stackoverflow.com, reading books and looking at articles whilst playing about with some code and I can't get anything which I'm happy with.
<br /></p>
<a name='more'></a><br/><p>
<br /> Basically I want to start a service on app init then I want to be able to ask that service to request a url and return the results. In the meantime I want to be able to display a progress window or something similar.
<br /></p>
<br /><p>
<br /> I've created a service currently which uses IDL, I've read somewhere that you only really need this for cross app communication, so think these needs stripping out but unsure how to do callbacks without it. Also when I hit the <code>post(Config.getURL("login"), values)</code> the app seems to pause for a while (seems weird - thought the idea behind a service was that it runs on a different thread!)
<br /></p>
<br /><p>
<br /> Currently I have a service with post and get http methods inside, a couple of AIDL files (for two way communication), a ServiceManager which deals with starting, stopping, binding etc to the service and I'm dynamically creating a Handler with specific code for the callbacks as needed.
<br /></p>
<br /><p>
<br /> I don't want anyone to give me a complete code base to work on, but some pointers would be greatly appreciated; even if it's to say I'm doing it completely wrong. I'm pretty new to Android and Java dev so if there are any blindingly obvious mistakes here - please don't think I'm a rubbish developer, I'm just wet behind the ears and would appreciate being told where I'm going wrong.
<br /></p>
<br /><p>
<br /> Anyway, code in (mostly) full (really didn't want to put this much code here, but I don't know where I'm going wrong - apologies in advance):
<br /></p>
<br /><pre>
<br /><code>
<br />public class RestfulAPIService extends Service {
<br />
<br />final RemoteCallbackList<IRemoteServiceCallback> mCallbacks = new RemoteCallbackList<IRemoteServiceCallback>();
<br />
<br />public void onStart(Intent intent, int startId) {
<br /> super.onStart(intent, startId);
<br />}
<br />public IBinder onBind(Intent intent) {
<br /> return binder;
<br />}
<br />public void onCreate() {
<br /> super.onCreate();
<br />}
<br />public void onDestroy() {
<br /> super.onDestroy();
<br /> mCallbacks.kill();
<br />}
<br />private final IRestfulService.Stub binder = new IRestfulService.Stub() {
<br /> public void doLogin(String username, String password) {
<br />
<br /> Message msg = new Message();
<br /> Bundle data = new Bundle();
<br /> HashMap<String, String> values = new HashMap<String, String>();
<br /> values.put("username", username);
<br /> values.put("password", password);
<br /> String result = post(Config.getURL("login"), values);
<br /> data.putString("response", result);
<br /> msg.setData(data);
<br /> msg.what = Config.ACTION_LOGIN;
<br /> mHandler.sendMessage(msg);
<br /> }
<br />
<br /> public void registerCallback(IRemoteServiceCallback cb) {
<br /> if (cb != null)
<br /> mCallbacks.register(cb);
<br /> }
<br />};
<br />
<br />private final Handler mHandler = new Handler() {
<br /> public void handleMessage(Message msg) {
<br />
<br /> // Broadcast to all clients the new value.
<br /> final int N = mCallbacks.beginBroadcast();
<br /> for (int i = 0; i < N; i++) {
<br /> try {
<br /> switch (msg.what) {
<br /> case Config.ACTION_LOGIN:
<br /> mCallbacks.getBroadcastItem(i).userLogIn( msg.getData().getString("response"));
<br /> break;
<br /> default:
<br /> super.handleMessage(msg);
<br /> return;
<br />
<br /> }
<br /> } catch (RemoteException e) {
<br /> }
<br /> }
<br /> mCallbacks.finishBroadcast();
<br /> }
<br /> public String post(String url, HashMap<String, String> namePairs) {...}
<br /> public String get(String url) {...}
<br />};
<br /></code>
<br /></pre>
<br /><p>
<br /> A couple of AIDL files:
<br /></p>
<br /><pre>
<br /><code>
<br />package com.something.android
<br />
<br />oneway interface IRemoteServiceCallback {
<br /> void userLogIn(String result);
<br />}
<br /></code>
<br /></pre>
<br /><p>
<br /> and
<br /></p>
<br /><pre>
<br /><code>
<br />package com.something.android
<br />import com.something.android.IRemoteServiceCallback;
<br />
<br />interface IRestfulService {
<br /> void doLogin(in String username, in String password);
<br /> void registerCallback(IRemoteServiceCallback cb);
<br />}
<br /></code>
<br /></pre>
<br /><p>
<br /> and the service manager:
<br /></p>
<br /><pre>
<br /><code>
<br />public class ServiceManager {
<br />
<br /> final RemoteCallbackList<IRemoteServiceCallback> mCallbacks = new RemoteCallbackList<IRemoteServiceCallback>();
<br /> public IRestfulService restfulService;
<br /> private RestfulServiceConnection conn;
<br /> private boolean started = false;
<br /> private Context context;
<br />
<br /> public ServiceManager(Context context) {
<br /> this.context = context;
<br /> }
<br />
<br /> public void startService() {
<br /> if (started) {
<br /> Toast.makeText(context, "Service already started", Toast.LENGTH_SHORT).show();
<br /> } else {
<br /> Intent i = new Intent();
<br /> i.setClassName("com.something.android", "com.something.android.RestfulAPIService");
<br /> context.startService(i);
<br /> started = true;
<br /> }
<br /> }
<br />
<br /> public void stopService() {
<br /> if (!started) {
<br /> Toast.makeText(context, "Service not yet started", Toast.LENGTH_SHORT).show();
<br /> } else {
<br /> Intent i = new Intent();
<br /> i.setClassName("com.something.android", "com.something.android.RestfulAPIService");
<br /> context.stopService(i);
<br /> started = false;
<br /> }
<br /> }
<br />
<br /> public void bindService() {
<br /> if (conn == null) {
<br /> conn = new RestfulServiceConnection();
<br /> Intent i = new Intent();
<br /> i.setClassName("com.something.android", "com.something.android.RestfulAPIService");
<br /> context.bindService(i, conn, Context.BIND_AUTO_CREATE);
<br /> } else {
<br /> Toast.makeText(context, "Cannot bind - service already bound", Toast.LENGTH_SHORT).show();
<br /> }
<br /> }
<br />
<br /> protected void destroy() {
<br /> releaseService();
<br /> }
<br />
<br /> private void releaseService() {
<br /> if (conn != null) {
<br /> context.unbindService(conn);
<br /> conn = null;
<br /> Log.d(LOG_TAG, "unbindService()");
<br /> } else {
<br /> Toast.makeText(context, "Cannot unbind - service not bound", Toast.LENGTH_SHORT).show();
<br /> }
<br /> }
<br />
<br /> class RestfulServiceConnection implements ServiceConnection {
<br /> public void onServiceConnected(ComponentName className, IBinder boundService) {
<br /> restfulService = IRestfulService.Stub.asInterface((IBinder) boundService);
<br /> try {
<br /> restfulService.registerCallback(mCallback);
<br /> } catch (RemoteException e) {}
<br /> }
<br />
<br /> public void onServiceDisconnected(ComponentName className) {
<br /> restfulService = null;
<br /> }
<br /> };
<br />
<br /> private IRemoteServiceCallback mCallback = new IRemoteServiceCallback.Stub() {
<br /> public void userLogIn(String result) throws RemoteException {
<br /> mHandler.sendMessage(mHandler.obtainMessage(Config.ACTION_LOGIN, result));
<br />
<br /> }
<br /> };
<br />
<br /> private Handler mHandler;
<br />
<br /> public void setHandler(Handler handler) {
<br /> mHandler = handler;
<br /> }
<br />}
<br /></code>
<br /></pre>
<br /><p>
<br /> Service init and bind:
<br /></p>
<br /><pre>
<br /><code>
<br />// this I'm calling on app onCreate
<br />servicemanager = new ServiceManager(this);
<br />servicemanager.startService();
<br />servicemanager.bindService();
<br />application = (ApplicationState)this.getApplication();
<br />application.setServiceManager(servicemanager);
<br /></code>
<br /></pre>
<br /><p>
<br /> service function call:
<br /></p>
<br /><pre>
<br /><code>
<br />// this lot i'm calling as required - in this example for login
<br />progressDialog = new ProgressDialog(Login.this);
<br />progressDialog.setMessage("Logging you in...");
<br />progressDialog.show();
<br />
<br />application = (ApplicationState) getApplication();
<br />servicemanager = application.getServiceManager();
<br />servicemanager.setHandler(mHandler);
<br />
<br />try {
<br /> servicemanager.restfulService.doLogin(args[0], args[1]);
<br />} catch (RemoteException e) {
<br /> e.printStackTrace();
<br />}
<br />
<br />...later in the same file...
<br />
<br />Handler mHandler = new Handler() {
<br /> public void handleMessage(Message msg) {
<br />
<br /> switch (msg.what) {
<br /> case Config.ACTION_LOGIN:
<br />
<br /> if (progressDialog.isShowing()) {
<br /> progressDialog.dismiss();
<br /> }
<br />
<br /> try {
<br /> ...process login results...
<br /> }
<br /> } catch (JSONException e) {
<br /> Log.e("JSON", "There was an error parsing the JSON", e);
<br /> }
<br /> break;
<br /> default:
<br /> super.handleMessage(msg);
<br /> }
<br />
<br /> }
<br />
<br />};
<br /></code>
<br /></pre>
<br /><p>
<br /> Any and all help is greatly appreciated and I'll even buy you a coffee or a beer if you fancy :D
<br /></p>
<br /><p>
<br /> Martyn
<br /></p>
<br/><a href='http://tips4all.net' title='This is a collaboratively edited question and answer site for professional and enthusiast programmers. It is 100% free, no registration required.'>Source: <strong><em>Tips4all</em></strong></a>Unknownnoreply@blogger.com7tag:blogger.com,1999:blog-865923359735383241.post-33910283540260273442012-06-11T22:10:00.005-06:002012-06-11T22:10:52.177-06:00Difference between a View"s Padding and Margin<p>
<br /> What is the difference between a View's Margin and Padding?
<br /></p>
<a name='more'></a><br/>
<br/><a href='http://tips4all.net' title='This is a collaboratively edited question and answer site for professional and enthusiast programmers. It is 100% free, no registration required.'>Source: <strong><em>Tips4all</em></strong></a>Unknownnoreply@blogger.com4tag:blogger.com,1999:blog-865923359735383241.post-20811084136435550772012-06-11T22:10:00.003-06:002012-06-11T22:10:26.855-06:00Getting the ID of the element that fired an event using JQuery<p>
<br /> Is there any way to get the ID of the element that fires an event?
<br /></p>
<a name='more'></a><br/><p>
<br /> I'm thinking something like:
<br /></p>
<br /><pre>
<br /><code>
<br /><html>
<br /> <head>
<br /> <script type="text/javascript" src="starterkit/jquery.js"></script>
<br /> <script type="text/javascript">
<br /> $(document).ready(function(){
<br /> $("a").click(
<br /> function(){
<br /> var test = caller.id;
<br /> alert(test.val());
<br /> }
<br /> );
<br /> });
<br />
<br /> </script>
<br /></head>
<br /> <body>
<br /> <form class="item" id="aaa"><input class="title"></input></form>
<br /> <form class="item" id="bbb"><input class="title"></input></form>
<br /> </body>
<br /></html>
<br /></code>
<br /></pre>
<br /><p>
<br /> Except of course that the var <code>test</code> should contain the id <code>"aaa"</code> , if the event is fired from the first form, and <code>"bbb"</code> , if the event is fired from the second form.
<br /></p>
<br /><p>
<br /> Can anyone help with this?
<br /></p>
<br/><a href='http://tips4all.net' title='This is a collaboratively edited question and answer site for professional and enthusiast programmers. It is 100% free, no registration required.'>Source: <strong><em>Tips4all</em></strong></a>Unknownnoreply@blogger.com5tag:blogger.com,1999:blog-865923359735383241.post-53136565806177110242012-06-11T22:10:00.001-06:002012-06-11T22:10:07.701-06:00Which keycode for escape key with jQuery<p>
<br /> I have two functions. When enter is pressed the functions runs correctly but when escape is pressed it doesn't. What's the correct number for the escape key?
<br /></p>
<a name='more'></a><br/><pre>
<br /><code>
<br />$(document).keypress(function(e) {
<br /> if (e.which == 13) { $('.save').click(); } // enter (works as expected)
<br /> if (e.which == 27) { $('.cancel').click(); } // esc (does not work)
<br />});
<br /></code>
<br /></pre>
<br/><a href='http://tips4all.net' title='This is a collaboratively edited question and answer site for professional and enthusiast programmers. It is 100% free, no registration required.'>Source: <strong><em>Tips4all</em></strong></a>Unknownnoreply@blogger.com9tag:blogger.com,1999:blog-865923359735383241.post-59376364694165624242012-06-11T22:09:00.003-06:002012-06-11T22:09:48.575-06:00jQuery lose focus event<p>
<br /> I'm trying to show up a container if a input field gets the focus and - that's the actual problem - hide the container if focus is lost. Is there an opposite event for jQuery's focus?
<br /></p>
<a name='more'></a><br/><p>
<br /> Some example code:
<br /></p>
<br /><pre>
<br /><code>
<br /><input type="text" value="" name="filter" id="filter"/>
<br />
<br /><div id="options">some cool options</div>
<br />
<br /><script type="text/javascript">
<br /> $('#options').hide();
<br />
<br /> $('#filter').focus(function() {
<br /> $('#options').appear();
<br /> });
<br /></script>
<br /></code>
<br /></pre>
<br /><p>
<br /> And what I'd like to do is something like this:
<br /></p>
<br /><pre>
<br /><code>
<br />$('#filter').focus_lost(function() {
<br /> $('#options').hide();
<br />});
<br /></code>
<br /></pre>
<br/><a href='http://tips4all.net' title='This is a collaboratively edited question and answer site for professional and enthusiast programmers. It is 100% free, no registration required.'>Source: <strong><em>Tips4all</em></strong></a>Unknownnoreply@blogger.com3