Friday, January 23, 2009

Setting Switch

Router 1
hostname R1 !
enable secret class !
no ip domain lookup !
interface FastEthernet0/0
ip address 172.17.50.1 255.255.255.0
no shutdown !
interface FastEthernet0/1
no shutdown !
interface FastEthernet0/1.1
encapsulation dot1Q 1
ip address 172.17.1.1 255.255.255.0 !
interface FastEthernet0/1.10
encapsulation dot1Q 10

ip address 172.17.10.1 255.255.255.0
!
interface FastEthernet0/1.20
encapsulation dot1Q 20
ip address 172.17.20.1 255.255.255.0
!
interface FastEthernet0/1.30
encapsulation dot1Q 30
ip address 172.17.30.1 255.255.255.0
!
interface FastEthernet0/1.99
encapsulation dot1Q 99 native
ip address 172.17.99.1 255.255.255.0
!

!
line con 0
line aux 0
line vty 0 4
login
password cisco
!

LAN Switching and Wireless: Inter-VLAN Routing Lab 6.4.1: Basic Inter-VLAN Routing
Switch 1
!
hostname S1
!
enable secret class
!
no ip domain lookup
!
interface FastEthernet0/1
switchport trunk native vlan 99
switchport mode trunk
!
interface FastEthernet0/2
switchport trunk native vlan 99
switchport mode trunk
!
interface FastEthernet0/3
switchport trunk native vlan 99
switchport mode trunk
!
interface FastEthernet0/4
switchport trunk native vlan 99
switchport mode trunk
!
interface FastEthernet0/5
no shutdown
!

!
interface Vlan1
no ip address
no ip route-cache
!
interface Vlan99
ip address 172.17.99.11 255.255.255.0
no shutdown
!
ip default-gateway 172.17.99.1
ip http server
!
line con 0
logging synchronous
line vty 0 4
login
password cisco
line vty 5 15
login
password cisco
!
end
Switch 2
!
hostname S2
!

LAN Switching and Wireless: Inter-VLAN Routing Lab 6.4.1: Basic Inter-VLAN Routing
enable secret class
!
no ip domain lookup
!
interface FastEthernet0/1
switchport trunk native vlan 99
switchport mode trunk
!
interface FastEthernet0/2
switchport trunk native vlan 99
switchport mode trunk
!
interface FastEthernet0/3
switchport trunk native vlan 99
switchport mode trunk
!
interface FastEthernet0/4
switchport trunk native vlan 99
switchport mode trunk
!
interface FastEthernet0/5
switchport access vlan 30
switchport mode access
!
interface FastEthernet0/6
switchport access vlan 30
switchport mode access
!
interface FastEthernet0/7
switchport access vlan 30
!
interface FastEthernet0/8
switchport access vlan 30
!
interface FastEthernet0/9
switchport access vlan 30
!
interface FastEthernet0/10
switchport access vlan 30
!
interface FastEthernet0/11
switchport access vlan 10
switchport mode access
!
interface FastEthernet0/12
switchport access vlan 10
!
interface FastEthernet0/13
switchport access vlan 10
!
interface FastEthernet0/14
switchport access vlan 10
!
interface FastEthernet0/15
switchport access vlan 10
!
LAN Switching and Wireless: Inter-VLAN Routing Lab 6.4.1: Basic Inter-VLAN Routing
interface FastEthernet0/16
switchport access vlan 10
!
interface FastEthernet0/17
switchport access vlan 10
!
interface FastEthernet0/18
switchport access vlan 20
!
interface FastEthernet0/19
switchport access vlan 20
!
interface FastEthernet0/20
switchport access vlan 20
!
interface FastEthernet0/21
switchport access vlan 20
!
interface FastEthernet0/22
switchport access vlan 20
!
interface FastEthernet0/23
switchport access vlan 20
!
interface FastEthernet0/24
switchport access vlan 20
!
interface Vlan1
no ip address
no ip route-cache
!
interface Vlan99
ip address 172.17.99.12 255.255.255.0
no shutdown
!
ip default-gateway 172.17.99.1
ip http server
!
line con 0
password cisco
logging synchronous
login
line vty 0 4
password cisco
login
line vty 5 15
password cisco
login
!
end
Switch 3
!
hostname S3

Design an IP addressing scheme.

Given the IP address block of 192.168.7.0 /24, design an IP addressing scheme that satisfies the
following requirements:
Subnet Number of Hosts
Subnet A 110
Subnet B 54
The 0 subnet is used. No subnet calculators may be used. Create the smallest possible subnets that
satisfy the requirements for hosts. Assign the first usable subnet to Subnet A.
Subnet A
Specification Student Input
Number of bits in the subnet 1
IP mask (binary) 11111111. 11111111. 11111111.10000000
New IP mask (decimal) 255.255.255.128
Maximum number of usable
subnets (including the 0 subnet)
2
Number of usable hosts per
subnet
126
IP subnetwork address 192.168.7.0
First IP host address 192.168.7.1
Last IP host address 192.168.7.126
Subnet B
Specification Student Input
Number of bits in the subnet 2
IP mask (binary) 11111111. 11111111.
11111111.11000000
New IP mask (decimal) 255.255.255.192
Maximum number of usable subnets
(including the 0 subnet)
2
Number of usable hosts per subnet 62
IP network address 192.168.7.128
First IP host address 192.168.7.129
Last IP host address 192.168.7.190
Host computers will use the first usable IP address in the subnet. The network router will use the last
usable IP address in the subnet.
Step 2: Write down the IP address information for each device.
Device IP address Mask Gateway
Host1 192.168.7.1 255.255.255.128 192.168.7.126
Router1-Fa0/0 192.168.7.126 255.255.255.128 -------------
Host2 192.168.7.129 255.255.255.192 192.168.7.190
Router1-Fa0/1 192.168.7.190 255.255.255.192 -------------
Table 1. IP Address Assignments
Before proceeding, verify your IP addresses with the instructor

CCNA Exploration: Network Fundamentals (Guided Case Study)

In order to send/receive packet through a data computer network, 2 types of addresses are necessary: Layer 2 and Layer 3 network addresses. (also known as L2 and L3 addresses)
While L2 addresses have a local scope, which allows another device to have the same L2 address in a different network segment, L3 addresses have a global scope. A L3 address assigned to a device must be unique all over the internet during the time this device is connected to the network.
In order to achieve data delivery, L2 addresses are (statically or dynamically) mapped to L3 addresses.
The address resolution protocol (arp) is a protocol used by the Internet Protocol (IP) [RFC826], specifically IPv4, to dynamically map IP network addresses (L3 addresses) to the hardware addresses (L2 addresses) used by a data link protocol. The protocol operates below the network layer as a part of the interface between the OSI network and OSI link layer. It is used when IPv4 is used over Ethernet.
The Internet Control Message Protocol (ICMP) is used by send error and control messages between devices. ICMP is a TCP/IP Network Layer protocol, first defined in RFC 792, September, 1981. ICMP message types were later expanded in RFC 1700. An extremely useful application called ping uses ICMP as the main protocol.
Task 1: Scenario
In this task, you will be asked to address and ping the devices on the same network. After the addressing is done, you will learn more about the arp protocol.
Task 1: Address the PCs
On your work PC, run the Packet Tracer 4.1 and load the ccna_discovery_cs_task1.pkt topology file into it; It contains 3 PCs connected to a switch. Once the file is loaded and you can see the topology, assign IP addresses and subnet masks to the PCs. Don’t worry about the DNS and default gateway for now. The PCs IP Addresses must match the table below:
PC1:
IP Address: 192.168.10.11
Subnet Mask: 255.255.255.0
PC2:
IP Address: 192.168.10.12
Subnet Mask: 255.255.255.0
PC3:
IP Address: 192.168.10.13
Subnet Mask: 255.255.255.0
Note: Since the addresses are being specified by you, the Static option must be chosen.
The topology is shown below:
Task 1: Verifying the addresses on the PCs
Once you have all the addresses assign to the PCs, check their addresses using the command ipconfig /all. The output of this command shows the L2 and the L3 address assign to the PC.
While the L3 address was assign by you, the L2 address was acquired from the network installed on the PC. The output of that command when issued on PC1 should look like this:
PC>ipconfig /all
Physical Address............: 00D0.BC00.5910
IP Address......................: 10.10.10.11
Subnet Mask.....................: 255.255.255.0
Default Gateway.................: 0.0.0.0
DNS Servers.....................: 0.0.0.0
PC>
On the output above the Physical Address line shows the L2 address of PC1
The IP Address line shows the L3 address of PC1, which was assigned by you.
Note: Since Packet Tracer is a simulation program, the PC’s Physical Addresses might be different on your system than the ones showed here.
Question 1: List the L3 and L2 addresses of the PCs.
Task 1: Ensuring Connectivity
ping operation is straight forward. The source computer sends an ICMP echo request to the destination. The destination responds with an echo reply. If there is a break between the source and destination, a router may respond with an ICMP message that host unknown or destination network unknown.
Ensure the PCs are able to reach each other by using the ping command. From each PC, ping the other 2 to ensure connectivity:
From PC1:
PC>ping 10.10.10.12
Pinging 10.10.10.12 with 32 bytes of data:
Reply from 10.10.10.12: bytes=32 time=157ms TTL=120
Reply from 10.10.10.12: bytes=32 time=75ms TTL=120
Reply from 10.10.10.12: bytes=32 time=94ms TTL=120
Reply from 10.10.10.12: bytes=32 time=84ms TTL=120
Ping statistics for 10.10.10.12:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 75ms, Maximum = 157ms, Average = 102ms
PC>
PC>ping 10.10.10.13
Pinging 10.10.10.13 with 32 bytes of data:
Reply from 10.10.10.13: bytes=32 time=67ms TTL=120
Reply from 10.10.10.13: bytes=32 time=82ms TTL=120
Reply from 10.10.10.13: bytes=32 time=84ms TTL=120
Reply from 10.10.10.13: bytes=32 time=70ms TTL=120
Ping statistics for 10.10.10.13:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 67ms, Maximum = 84ms, Average = 75ms
PC>
From PC2:
PC>ping 10.10.10.11
Pinging 10.10.10.11 with 32 bytes of data:
Reply from 10.10.10.11: bytes=32 time=73ms TTL=120
Reply from 10.10.10.11: bytes=32 time=86ms TTL=120
Reply from 10.10.10.11: bytes=32 time=77ms TTL=120
Reply from 10.10.10.11: bytes=32 time=89ms TTL=120
Ping statistics for 10.10.10.11:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 73ms, Maximum = 89ms, Average = 81ms
PC>
PC>ping 10.10.10.13
Pinging 10.10.10.13 with 32 bytes of data:
Reply from 10.10.10.13: bytes=32 time=136ms TTL=120
Reply from 10.10.10.13: bytes=32 time=86ms TTL=120
Reply from 10.10.10.13: bytes=32 time=77ms TTL=120
Reply from 10.10.10.13: bytes=32 time=77ms TTL=120
Ping statistics for 10.10.10.13:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 77ms, Maximum = 136ms, Average = 94ms
PC>
From PC3:
PC>ping 10.10.10.11
Pinging 10.10.10.11 with 32 bytes of data:
Reply from 10.10.10.11: bytes=32 time=91ms TTL=120
Reply from 10.10.10.11: bytes=32 time=70ms TTL=120
Reply from 10.10.10.11: bytes=32 time=84ms TTL=120
Reply from 10.10.10.11: bytes=32 time=71ms TTL=120
Ping statistics for 10.10.10.11:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 70ms, Maximum = 91ms, Average = 79ms
PC>
PC>ping 10.10.10.12
Pinging 10.10.10.12 with 32 bytes of data:
Reply from 10.10.10.12: bytes=32 time=96ms TTL=120
Reply from 10.10.10.12: bytes=32 time=88ms TTL=120
Reply from 10.10.10.12: bytes=32 time=86ms TTL=120
Reply from 10.10.10.12: bytes=32 time=95ms TTL=120
Ping statistics for 10.10.10.12:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 86ms, Maximum = 96ms, Average = 91ms
PC>
Task 2: Connecting to a Server
Task 2: Scenario
On Task 2 will learn more about clients and servers by placing a request from a client to a server. This task will use the HTTP as the illustrative protocol spoken between the client and the server.
Task 2: Preparing the Devices
In computer networks a very common structure is a Client-Server structure. In this structure, the device which requests information is called a client and the server which provides the information is called Server.
Run the Packet Tracer 4.1 program and load the ccna_discovery_cs_task2.pkt file into it.
The topology is also shown below:
On this topology the PC1 will act as a client and the Server1 will act as a server. In order to have connectivity between PC1 and Server1, assign L3 addresses to PC1 and to Server1 according to the table below:
PC1: 10.10.10.11
Subnet Mask: 255.255.255.0
Server1: 10.10.10.25
Subnet Mask: 255.255.255.0
Note: Again, chose the Static as address type and don’t worry about the DNS and default gateway information for now.
The Once the addresses were assigned, issue a ping command from PC1 to Server 1.
Task 2: Ensuring connectivity
The http protocol will be protocol spoken between the client and the server during this task. Since HTTP is a layer 7 protocol, ensure connectivity on the lower layers before start the upper layers communication.
Which command can be used to ensure connectivity on the lower layers?
Answer: The ping command. When a successful ping is issued, the layers 2 and 3 connectivity is ensured.
From PC1, ping Server1.
PC>ping 10.10.10.25
Pinging 10.10.10.25 with 32 bytes of data:
Reply from 10.10.10.25: bytes=32 time=69ms TTL=120
Reply from 10.10.10.25: bytes=32 time=90ms TTL=120
Reply from 10.10.10.25: bytes=32 time=97ms TTL=120
Reply from 10.10.10.25: bytes=32 time=91ms TTL=120
Ping statistics for 10.10.10.25:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 69ms, Maximum = 97ms, Average = 86ms
As showed above, the ping should be successful. If it was not, double check the addresses assigned to PC1 and to Server1.
Task 2: Requesting a HTTP page from the Server
Since the ping command from PC1 to Server1 was successful, it is safe to state that the lower layers connectivity was achieved. The network is now ready to support the upper layer protocols traffic.
Open a web browser on PC1, type the Server’s 1 ip address on it (10.10.10.25) and press enter. You should see a web page stored at Server1.
PC1, acting as a HTTP client, sends a HTTP request to Server1 asking for a web page located on that server. Since HTTP protocol uses the TCP protocol on port 80, this request is sent as TCP packet from PC1 to the Server1’s port 80.
Server1 is running HTTP server software and thus, is ready to respond HTTP requests. After Serve1 receive the HTTP packet from PC1, it interprets the request and answers properly. PC1 receives a TCP packet from Serve1 containing a web page and shows it on the web browser window. PC1 acted as client and requested information. Server1 acted as server and provided a response regarding the PC1’s request.
Task 2: The ARP Protocol
In order to send packets, the source and the destination devices must learn their L2 addresses and map it to the respective L3 address. Since this is an Ethernet environment, the L2 address is the MAC address.
The ARP protocol provides a way to dynamically map L2 to L3 addresses by querying all the devices on the segment about their L2 addresses. Suppose PC1 is trying to send data to PC3, below is a summary of the ARP protocol operation:
1. PC1 needs to know the MAC address of the PC3 before it can send any data. PC1 sends a broadcast packet out on the network. This packet has the question “Who has the IP address 10.10.10.13?” (10.10.10.13 is the IP address of PC3). This packet is known as ARP request.
2. PC2 receives the question but, since PC2’s IP address is 10.10.10.12 (and not 10.10.10.13), PC2 does not answer the question. The reason why PC2 receives the packet is the packet was a broadcast.
3. PC3 also receives the packet. PC3 checks the question the answers it because 10.10.10.13 is PC3’s IP address.
4. PC3 sends an UNICAST packet back to PC1 saying: “Hey, this PC3. I have 10.10.10.13 and my MAC address is: 000D.BD62.D826. This answer is known as ARP reply
5. Now PC1 has PC3’s MAC address and PC3 has PC1’s MAC address and the data communication between PC1 and PC3 can take place.
Notice that:
- Even though the process was initiate by PC1, at the end PC3 also knows PC1 MAC address. This is a feature of the ARP protocol. It assumes since PC1 needed PC3’s MAC address, chances are PC3 will send data to PC1 shortly and thus, PC3 also stores PC1’s MAC address. This keep PC3 to start a new ARP query to learn PC1’s MAC address.
- PC2 has no information about PC1 or PC3 MAC addresses because the process did not include PC2.
The ARP protocol keeps a table on the device’s memory called ARP table. This table maps L3 addresses to L2 address of the devices to which the local device sends data.
Task 2: The ARP table
The arp -a command can be issued on the PCs in order to list their ARP table.
Check the ARP table on PC1, PC2 and PC3 and answer the questions below.
At this point, what is the content of PC1, PC2 and PC3 ARP table?
Answer: Since no packets were sent or received, all three PCs should have empty ARP Tables.
Obs: Due the last step of Task2, PC1 might still have the Server1 entry on its Arp Table. It will depend on the amount of time since the last data packet was sent from PC1 to Server1.
From PC1, ping PC3. The ping should be successful.
Check the ARP table on PC1, PC2 and PC3 again and answer the questions below:
List the content of PC1 and PC3’s ARP table.
Answer: PC1 has an entry regarding PC3 and PC3 has an entry regarding PC1.
What is the content of PC2’s ARP table? Why?
Answer: No packets were sent to PC2, thus its ARP Table is empty.
Task 3: Getting out of the Local Network
Since the L2 addresses are unique within the same segment, within the same local network (local scope) why is the L3 addresses necessary?
Answer: L3 addresses are necessary mostly when sending packets to networks other than the local network. The source device, when sending data to a remote network, uses the L2 address to specify the intermediate (for routing purposes only) and the L3 address to specify the final destination of the data (usually a application)
So far all the packets were sent/received to/from devices within the same local network. The necessity of an upper layer address, a L3 address, rises when data must be sent to remote networks.
Run Packet Tracer 4.1 and load the ccna_discovery_cs_task3.pkt file. The topology is shown below:
When a packet must be sent out of the local network, an intermediate device must be used. Such device must be connected to the local network and to the remote network. This intermediate device is called router or gateway. (The term Gateway is more often used from the PCs viewpoint)
Obs: Usually, the intermediate device is not directly connected to the remote network. In those cases, it must have a path (or a route) through another intermediate device to reach the remote network. The process of learning paths and choosing the best one is called routing.
From PC1, ping the PC3 computer. The ping should be successful.
PC>ping 10.10.10.13
Pinging 10.10.10.13 with 32 bytes of data:
Reply from 10.10.10.13: bytes=32 time=67ms TTL=120
Reply from 10.10.10.13: bytes=32 time=82ms TTL=120
Reply from 10.10.10.13: bytes=32 time=84ms TTL=120
Reply from 10.10.10.13: bytes=32 time=70ms TTL=120
Ping statistics for 10.10.10.13:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 67ms, Maximum = 84ms, Average = 75ms
PC>
Check PC1’s ARP table.
PC>arp -a
What is the address listed on PC1’s ARP table?
Answer: PC1 has an entry regarding PC3
Now, still from PC1, ping Server2 (20.20.20.25)
PC>ping 20.20.20.25
Pinging 20.20.20.25 with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Ping statistics for 20.20.20.25:
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
PC>
Why PC1 is able to ping PC3 but it is not able to ping Server2?
Answer: No default gateway was defined on the PC1’s configuration
A Default Gateway is an intermediate device used when the destination device lies in a remote network. The local device concludes the destination device is not on the same network and thus the data must be forwarded to a third intermediate device, an endpoint device. This device is called Default Gateway.
PC1 has no default gateway information configured on it and thus is not able to reach any device which is not on its local network.
On the topology shown above, Router1 (10.10.10.1) is the default gateway for the PC1’s network. When Router receives a packet from PC1, it checks the destination IP address of the packet. Since the destination IP address is Server2’s IP address and not Router1’s IP address, Router1 understands it must route the packet. Router1 search its routing table looking for a matching route to the destination 20.20.20.25. Router1 finds a route to the network 20.20.20.0/24 via fa0/0 and forward the packet through that interface.
Open the PC1’s configuration tab and let Router1 (10.10.10.1) be PC1’s default gateway.
Now, issue the same again from PC1:
PC>ping 20.20.20.25
Pinging 20.20.20.25 with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Ping statistics for 20.20.20.25:
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
PC>
The ping still fails. Why?
Answer: Besides PC1 now has a default gateway, Server2 still doesn’t not have it.
Set the default gateway to be used by Server2.
Remember: A default gateway is the device used by the local network devices to reach networks out of the local network scope.
What is the IP address to be used as a default gateway on Server2?
Answer: 20.20.20.1 which is the IP address of Router1’s interface connected to the same network which Server2 is connected.
After you have the correct default Gateway configured on Server2, issue the ping command from PC1 again:
PC>ping 20.20.20.25
Pinging 20.20.20.25 with 32 bytes of data:
Reply from 20.20.20.25: bytes=32 time=122ms TTL=120
Reply from 20.20.20.25: bytes=32 time=180ms TTL=120
Reply from 20.20.20.25: bytes=32 time=175ms TTL=120
Reply from 20.20.20.25: bytes=32 time=164ms TTL=120
Ping statistics for 20.20.20.25:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 122ms, Maximum = 180ms, Average = 160ms
PC>
The ping is now successful.
Once you have established the lower layers and routing connectivity, access the web page stored at Serve2 via HTTP protocol by opening a web browser at PC1 and typing Server2 IP Address on it.
The web page stored on Server2 is now shown.
Task 3: The ARP Table When Sending Packets to Remote Metworks
Check PC1’s ARP Table again:
PC>arp -a
Internet Address Physical Address Type
10.10.10.1 0005.5e4e.8a38 dynamic
10.10.10.13 000d.bd62.d826 dynamic
PC>
The ping to Server2 was successful but why the entry for Server2 (20.20.20.25) is not listed on the ARP Table? What is the address listed on the PC1’s ARP Table?
Answer: Since Server2 lies in a remote network, the ARP protocol running on PC1 queries for the gateway’s MAC Address. Router1 is default gateway configured on PC1 and its IP Address (10.10.10.1) shows up on the PC1’s ARP Table.

Tools For Visual Basic

Build powerful line-of-business applications
Tap the development foundation of Tools for Visual Basic and Microsoft Visual Basic Add-Ins to automate the creation of Visual Basic controls and assist in the development process. Microsoft ActiveX® controls and properties are fully integrated with the Visual Basic Integrated Development Environment (IDE). Access the power of SQL Server
Minimize the effort required to create Microsoft SQL Server-based applications. Microsoft SQL Server database APIs can be accessed by using Tools for Visual Basic components to provide forward and backward record navigation, field validation, field value lookup, common event logging, multi-user contention, automated transaction rollback, and more. Reduce development time
Easily maintain SQL table data, generate new SQL tables, place Visual Basic controls on Visual Basic forms with application properties already set, and add new reports from Crystal Reports 10.0. In addition to programming components, Tools for Visual Basic provides design dictionary utilities to support the development process. Manage customizations
Allow users of your applications to perform customizations and extensions to your applications — without changing your source code. Applications created using Tools for Visual Basic are enabled for Microsoft Dynamics SL Customization Manager. Realize quick return on investment with MSDN
Achieve maximum return on your investment by mastering Tools for Visual Basic quickly with hands-on training that teaches the Visual Basic development environment used by Microsoft programmers. Also, the MSDN Library contains technical programming information including sample code, documentation, technical articles, and reference guides for Tools for Visual Basic and other Microsoft development environments.

Using the wwSQL class from WestWind

to make things
easier
WestWind
Web Connection is a great tool for all sorts of development efforts. I'm not a big fan of
views, or cursoradapters in VFP development. I prefer the rough and tumble SQL Pass Through (SPT)
method of manipulating data. The wwSQL class helps take the pain out of SPT for me. There are two
methods in particular that really help: SQLBuildInsertStatementFromObject and
SQLBuildUpdateStatementFrom Object. These methods accept an object as the first parameter, and the
name of the target table as the second parameter, and creates a string containing a valid INSERT or
UPDATE command matching the contents of the object.
There is a problem however. WestWind
targets these methods at either VFP tables or SQL Server
tables. There are some differences between SQL Server INSERT statements and MySQL INSERT
statements. I probably haven't found all of the differences, but the changes are minor.
The big difference is the representation of the empty date. In SQL Server, the empty date can be
represented by the empty string. In MySQL, the empty date is represented by a series of zeros in the
format of '00000000'.
WestWind
also wraps field names in square brackets to help avoid problems
with spaces in field names, and also to avoid problems with reserve words. In MySQL, fields wrapped
in square brackets throws an error.
So, I have subclassed the wwSQL class and created three new properties: cEmptyDate,
cFieldParamLeft, and cFieldParamRight. When in use against a MySQL table, I have populated
cEmptyDate with the zero formatted string as above, and set the cFieldParamLeft and
cFieldParamRight with the empty string as well.
I then overrode the SQLBuildInsertStatementFromObject and the
SQLBuildUpdateStatementFromObject to draw from these properties and it works like a charm. As a
side note, I have also created a function named DtoMySQLDate( toDate AS Date) function that returns
a date formatted as '20070620'
no matter what SET DATE is set to.
I hope that you have gotten some tips in how to get VFP to access a MySQL server. Once you try it, I
think you will find it a fast, robust, and inexpensive alternative to other solutions.
Kevin

ENGINE talk

MySQL allows for different databases to be governed by different engines. Two of the most popular is
MyISAM and INNODB. To bottom line the difference is that MyISAM does not support transactions,
while INNODB does. The performance difference between the two engines is just a couple of
percentage points, one way or the other based on my simple benchmarks that I have performed. There
are other benchmark statistics performed by far smarter and qualified people than myself, so run some
tests before you get started.
Remember that XAMPP has the INNODB engine turned off by default. A quick edit to my.cnf will add
it back in after a restart.

How to upsize VFP structures and data to MySQL

1. Upsizing wizard in VFP requires a DBC
2. Stru2MySQL.prg by Ed Leafe.
3. Stru2MySQL_2.prg – additions by Kevin Cully
The changes that I have made to Stru2MySQL include:
1. Script files are created for each open cursor/table
2. A script file is created that contains all of the individual script files.
3. The program creates an object, that can have properties/options set to better control the output.
4. Additional MySQL commands are added to the script which drops existing tables if they exist.
5. The program allows for alternative engines to be specified. INNODB vs. MyISAM as an
example.
I'll have the Stru2MySQL_2.prg uploaded back to Ed Leafe's downloads page at
http://leafe.com/dls/vfp. Feel free to make improvements and donate back to the community.

How To Install MySQL

I won't go into too much detail here about how to install MySQL. Partly because it is so easy. Go to
http://mysql.org/downloads/ and download the server for your platform. Make sure to check out the
“GUI Tools” section. It will really help administer your MySQL installation. I'll talk about the GUI
tools a bit later.
Another approach to take is to take a look at XAMPP at http://www.apachefriends.org/en/xampp.html.
XAMPP is a suite of FOSS goodness that includes Apache, MySQL, PHP, PHPmyAdmin and other
great packages. All in one easy to install bundle. Recommended.
One note is that XAMPP has the INNODB engine turned off by default. You'll need to adjust the
my.cnf file to have it turned on. More on this later.
What GUI tools are available to Administer and query
MySQL
There is not a shortage of GUI tools to help you administer and query the data that you have stored in
MySQL. Here are just a couple of the tools. Some are current, others are being moonlighted, and
others are still in beta.
1. MySQL Administrator – An administrative tool that enables you to control your environment
and gain better visibility into how your databases are operating.
2. MySQL Control Center – Another administrative tool that allows you to create and modify most
of the database objects in a trivial manner.
3. MySQL Query Browser – One of the easiest tools for creating, executing, and optimizing SQL
queries for your database.
4. PHPMyAdmin – A web based administrative tool that allows you to create databases, tables,
indexes, administer rights, etc. All in a browser.

Thursday, January 1, 2009

Tutorial Borland C++ Builder

Borland C++ Builder 1
C++ Builder can be used to create 32-bit Windows applications ranging from general-purpose utilities to sophisticated data access programs. When you start C++ Builder, you are placed within the object-orientated integrated development environment, the IDE. This environment provides all the tools you need to design, develop, test, debug, and deploy applications. To launch the IDE for C++ Builder, choose Programming from the Public menu on the Windows taskbar then choose C++ Builder5 from the ++ Builder option: The initial screen should appear like this:
Across the top of the window is the title bar with the minimise, maximise and close buttons on the right-hand side. Under the title bar are ten menus. The File, Edit and Search menus have all the usual Windows options, whilst the other menus contain options specific to the C++ Builder environment. The View menu allows you to view a number of windows containing program and environment information. Borland C++ Builder Introduction Starting The IDE The Menus 2 Borland C++ Builder The Project menu is for the manipulation of project files and control of all aspects of a project, allowing you to compile all or part of a program. The Run menu provides facilities testing and debugging the application. The Component menu allows for defining, specificatio and insertion of external objects into the application. The Database menu provides ways of interacting with several types of live database. The Tools menu allows you to run other programs, tools and utilities useful in the development of Windows applications, without leaving the IDE. The Help menu gives you access to on-line help including tutorials, programming syntax, examples and library information. Below the menu bar to the left is a block of buttons that represent commonly performed tasks: Pointing to a button will display its function.
To the right of the button bars is the Component Palette: Each tab in the Component Palette displays a group of icons representing the components you can use to design your application interface such as menus, buttons and dialogue boxes. These are the building blocks of every application. The main part of the IDE screen is taken up by a blank form on which you will create the user interface and other parts of your applicaion by placing components on it. The default form has Maximise and Minimise buttons, a Close button, and a Control menu. If you run the form now by pressing F9, you'll see that these buttons all work. (To return to design mode, click the X to close the form.) To the left of the Form is the Object Inspector. This is the connection between your application's visual appearance and the code that makes your application run. The object selector at the top of the Object Inspector is a dropdown list containing all the components that you have placed on the active form and it also displays the object type of the selected component. This lets you quickly display properties and events for the different components on the current form. The Object Inspector has two sections, the Properties page and the Events page with tabs provided as a means of switching between them. The Button Bars The Component Palette The Form The Object Inspector Borland C++ Builder 3 Before beginning a new application, you should create a folder to hold the source files. Each application is represented by a project. When you start C++ Builder, it creates a blank project by default. If another project is already open, choose New Application from the File menu to create a new project. A new project, automatically contains the following files: Project1.cpp - a source-code file associated with the project. Unit1.cpp - a source-code file associated with the main project form. This is called a unit file. Unit1.h - a header file associated with the main project form. This is called a unit header file. Unit1.dfm - a resource file that stores information about the main project form. This is called a form file. Each form has its own unit, header, and form files. If you
create a second form, a second unit (Unit2.cpp), header (Unit2.h), and form (Unit2.dfm) file are automatically created. You should save these files to the folder you have just created by choosing Save All from the File menu. When the Save dialogue appears: Navigate to your project folder.
Save Unit1 using the default name Unit1.pas.
Save the project using appname.bpr.
Where appname is a name of your choice.
You are now ready to add components to the form and to
associate actions and properties to them. Use the Help menu,
which contains tutorial assistance, to take you through
creating a simple application.
You should periodically resave your work by choosing Save All
from the File menu. When you save your project, C++ Builder
creates additional files in your project directory. These files
include:
appname.bpr which is the project options or makefile,
appname.res which is the Windows resource file.
You do not need to worry about these files but do not delete
them. The executable file for your application will be named
the same as the project name with an exe extension.
To compile and test your application at any time, choose Run
from the Run menu.
Once an application is up and running, you need to make it
available for others. A number of steps must be taken to deploy
an application to another computer so that the application is
completely functional.
The steps required vary, depending on the type of application.
It may require a number of supporting files such as DLLs or
helper applications. It may also require changes to be made to
the receiving computer's Windows registry. Consult the C++
Creating And
Running a Program
Adding Components
Saving The Project
Compiling And Testing
Deploying Applications
4 Borland C++ Builder
Builder Help section under the Help menu for details of how to
prepare your application for installation to other computers.
To end your session in the C++ Builder IDE, choose Exit from
the File menu.
Ending C++ Builder
 

Home | Blogging Tips | Blogspot HTML | Make Money | Payment | PTC Review

jump 4 life © Template Design by Herro | Publisher : Templatemu