SlideShare ist ein Scribd-Unternehmen logo
1 von 11
Microsoft® Small Basic Debugging Aids Estimated time to complete this lesson: 1 hour
Debugging Aids In this lesson, you will learn about: Using the TextWindow.WriteLine operation to debug your programs.
Debugging  Even a minor bug in a program can defeat the efforts of the programmer! Debugging is a method of detecting and resolving bugs in your computer program. Every programmer develops the skill to detect bugs and debug his or her program. While working on large programs, programmers write debugging support code that is not included in the final program. This is to determine the point where a program fails to run.
TextWindow.WriteLine As a Debugging Helper So how can you debug programs in Small Basic? To debug your program, you can use the TextWindow.WriteLine operation. This operation acts as a debugging helper, and it provides information to help debug your program.
TextWindow.WriteLine As a Debugging Helper In this program, you first display an ellipse on the graphics window. In case your program does not run as expected, you need to debug it!  This is when you can use the TextWindow.WriteLine operation as a debugger. It can help you trace the value of “i” on every iteration of the For…EndFor loop. The value of “i” is displayed in a separate text window, enabling you to easily detect a bug and fix it. Let’s look at an example that uses the TextWindow.WriteLine operation for debugging.
TextWindow.WriteLine As a Debugging Helper Oh! The image you requested is not visible on the graphics window. It’s time to debug your code! Now, let’s use the TextWindow.WriteLine operation in another program and see how it can help you debug the program. In this example, you use the Flickr object to download a photo from www.flickr.com and display it on the graphics window.
TextWindow.WriteLine As a Debugging Helper One of the possibilities could be unavailability of an Internet connection or no access to the website.  To check this possibility, you can use the TextWindow.WriteLine operation for displaying the path of the image from the website. If the Internet connection is working fine, the path of the image will be displayed in the text window. Otherwise, the text window will not display any path. As you can see, the text window is not displaying the path of the image, which means you are not connected to the Internet.
 TextWindow.WriteLine As a Debugging Helper You may not see the contents of the file in the text window because: ,[object Object]
 The file may not be present at the specified source.
 The name of the specified file may be incorrect.Now, let’s write a program to copy a file and display its contents in the text window. Now how do we detect the error? It’s time to debug your code once again… In this example, if the CopyFileoperation is successful, the text window displays the contents of the file.
TextWindow.WriteLine As a Debugging Helper Let’s use the TextWindow.WriteLine operation to detect the error. You can modify your program and use  TextWindow.WriteLine to display the return value of the CopyFile operation in the text window  which will either be SUCCESS or FAILED. So, if your program is unable to run due to the CopyFile operation error, you immediately know about it!

Weitere ähnliche Inhalte

Was ist angesagt?

Programming language environments
Programming language environmentsProgramming language environments
Programming language environmentsMr McAlpine
 
Step by Step guide for creating first ABAP report in SAP
Step by Step guide for creating first ABAP report in SAPStep by Step guide for creating first ABAP report in SAP
Step by Step guide for creating first ABAP report in SAPnityaabap
 
Android application (how to add a splash screen with timer) tutorial #4
Android application (how to add a splash screen with timer) tutorial #4Android application (how to add a splash screen with timer) tutorial #4
Android application (how to add a splash screen with timer) tutorial #4Yasmine Sherif EL-Adly
 
Creating a Personalized ipad Wallpaper
Creating a Personalized ipad WallpaperCreating a Personalized ipad Wallpaper
Creating a Personalized ipad Wallpaperszanotti
 
Stepshot Intro
Stepshot IntroStepshot Intro
Stepshot IntroStepShot
 
Android application (how to change the background) tutorial #3
Android application (how to change the background) tutorial #3Android application (how to change the background) tutorial #3
Android application (how to change the background) tutorial #3Yasmine Sherif EL-Adly
 
Creating a package_in_abap_navigator
Creating a package_in_abap_navigatorCreating a package_in_abap_navigator
Creating a package_in_abap_navigatornityaabap
 
How To Make A Quikmap
How To Make A QuikmapHow To Make A Quikmap
How To Make A Quikmapsatonner
 
Android application (how to change the icon )tutorial #2
Android application (how to change the icon )tutorial #2Android application (how to change the icon )tutorial #2
Android application (how to change the icon )tutorial #2Yasmine Sherif EL-Adly
 
How to add gadgets
How to add gadgetsHow to add gadgets
How to add gadgetsRuth Aw
 
Amazing photoshop light effect in 10 steps
Amazing photoshop light effect in 10 stepsAmazing photoshop light effect in 10 steps
Amazing photoshop light effect in 10 stepsIrene Situmorang
 
Android hello world application tutorial #1
Android hello world application tutorial #1Android hello world application tutorial #1
Android hello world application tutorial #1Yasmine Sherif EL-Adly
 
Images & Dreamweaver
Images & DreamweaverImages & Dreamweaver
Images & DreamweaverjbellWCT
 

Was ist angesagt? (16)

Moreno Xec
Moreno XecMoreno Xec
Moreno Xec
 
Small basic
Small basicSmall basic
Small basic
 
Programming language environments
Programming language environmentsProgramming language environments
Programming language environments
 
Step by Step guide for creating first ABAP report in SAP
Step by Step guide for creating first ABAP report in SAPStep by Step guide for creating first ABAP report in SAP
Step by Step guide for creating first ABAP report in SAP
 
Android application (how to add a splash screen with timer) tutorial #4
Android application (how to add a splash screen with timer) tutorial #4Android application (how to add a splash screen with timer) tutorial #4
Android application (how to add a splash screen with timer) tutorial #4
 
Creating a Personalized ipad Wallpaper
Creating a Personalized ipad WallpaperCreating a Personalized ipad Wallpaper
Creating a Personalized ipad Wallpaper
 
Stepshot Intro
Stepshot IntroStepshot Intro
Stepshot Intro
 
Android application (how to change the background) tutorial #3
Android application (how to change the background) tutorial #3Android application (how to change the background) tutorial #3
Android application (how to change the background) tutorial #3
 
Creating a package_in_abap_navigator
Creating a package_in_abap_navigatorCreating a package_in_abap_navigator
Creating a package_in_abap_navigator
 
How To Make A Quikmap
How To Make A QuikmapHow To Make A Quikmap
How To Make A Quikmap
 
Android application (how to change the icon )tutorial #2
Android application (how to change the icon )tutorial #2Android application (how to change the icon )tutorial #2
Android application (how to change the icon )tutorial #2
 
How to add gadgets
How to add gadgetsHow to add gadgets
How to add gadgets
 
812 wordpress tablet
812 wordpress tablet812 wordpress tablet
812 wordpress tablet
 
Amazing photoshop light effect in 10 steps
Amazing photoshop light effect in 10 stepsAmazing photoshop light effect in 10 steps
Amazing photoshop light effect in 10 steps
 
Android hello world application tutorial #1
Android hello world application tutorial #1Android hello world application tutorial #1
Android hello world application tutorial #1
 
Images & Dreamweaver
Images & DreamweaverImages & Dreamweaver
Images & Dreamweaver
 

Andere mochten auch

3.3 the math object
3.3   the math object3.3   the math object
3.3 the math objectallenbailey
 
4.2 responding to events
4.2   responding to events4.2   responding to events
4.2 responding to eventsallenbailey
 
4.1 playing with shapes
4.1   playing with shapes4.1   playing with shapes
4.1 playing with shapesallenbailey
 
3.2 stacks and arrays
3.2   stacks and arrays3.2   stacks and arrays
3.2 stacks and arraysallenbailey
 
4.4 advanced games
4.4   advanced games4.4   advanced games
4.4 advanced gamesallenbailey
 

Andere mochten auch (6)

3.3 the math object
3.3   the math object3.3   the math object
3.3 the math object
 
4.2 responding to events
4.2   responding to events4.2   responding to events
4.2 responding to events
 
4.1 playing with shapes
4.1   playing with shapes4.1   playing with shapes
4.1 playing with shapes
 
3.2 stacks and arrays
3.2   stacks and arrays3.2   stacks and arrays
3.2 stacks and arrays
 
4.4 advanced games
4.4   advanced games4.4   advanced games
4.4 advanced games
 
Mlp_winter-2015
Mlp_winter-2015Mlp_winter-2015
Mlp_winter-2015
 

Ähnlich wie 3.6 debugging aids

Introducing small basic
Introducing small basicIntroducing small basic
Introducing small basicAn I
 
Introducing small basic
Introducing small basicIntroducing small basic
Introducing small basicSara Samol
 
Progressive Web Application by Citytech
Progressive Web Application by CitytechProgressive Web Application by Citytech
Progressive Web Application by CitytechRitwik Das
 
Programming Without Coding Technology (PWCT) Features - Framework & Extension
Programming Without Coding Technology (PWCT) Features - Framework & ExtensionProgramming Without Coding Technology (PWCT) Features - Framework & Extension
Programming Without Coding Technology (PWCT) Features - Framework & ExtensionMahmoud Samir Fayed
 
4007655 introduction-to-javascript
4007655 introduction-to-javascript4007655 introduction-to-javascript
4007655 introduction-to-javascriptVikash Chandra
 
Introducing small basic
Introducing small basicIntroducing small basic
Introducing small basicsom_nangia
 
VISUAL_BASIC_LECTURE_NOTE_A_Z_MADE_EASY.pdf
VISUAL_BASIC_LECTURE_NOTE_A_Z_MADE_EASY.pdfVISUAL_BASIC_LECTURE_NOTE_A_Z_MADE_EASY.pdf
VISUAL_BASIC_LECTURE_NOTE_A_Z_MADE_EASY.pdfNALANDACSCCENTRE
 
Explaindio is a versatile tool for creating animated videos
Explaindio is a versatile tool for creating animated videosExplaindio is a versatile tool for creating animated videos
Explaindio is a versatile tool for creating animated videosFoyezAhmed10
 
MVC for Desktop Application - Part 1
MVC for Desktop Application - Part 1MVC for Desktop Application - Part 1
MVC for Desktop Application - Part 1晟 沈
 
Pixlr and small apps in the classroom
Pixlr and small apps in the classroomPixlr and small apps in the classroom
Pixlr and small apps in the classroomArtfulArtsyAmy
 
LabsLab8.htmlLab 8 Im Thinking of a NumberBefore yo.docx
LabsLab8.htmlLab 8 Im Thinking of a NumberBefore yo.docxLabsLab8.htmlLab 8 Im Thinking of a NumberBefore yo.docx
LabsLab8.htmlLab 8 Im Thinking of a NumberBefore yo.docxDIPESH30
 
Developers Border Line: Unit Testing
Developers Border Line: Unit TestingDevelopers Border Line: Unit Testing
Developers Border Line: Unit TestingSikandar Ahmed
 
Membangun Desktop App
Membangun Desktop AppMembangun Desktop App
Membangun Desktop AppFajar Baskoro
 
Copycat Site BluePrint - make money online fast
Copycat Site BluePrint - make money online fastCopycat Site BluePrint - make money online fast
Copycat Site BluePrint - make money online fastEdward806784
 

Ähnlich wie 3.6 debugging aids (20)

Java script hello world
Java script hello worldJava script hello world
Java script hello world
 
Introducing small basic
Introducing small basicIntroducing small basic
Introducing small basic
 
Introducing small basic
Introducing small basicIntroducing small basic
Introducing small basic
 
Introducing Small Basic.pdf
Introducing Small Basic.pdfIntroducing Small Basic.pdf
Introducing Small Basic.pdf
 
Progressive Web Application by Citytech
Progressive Web Application by CitytechProgressive Web Application by Citytech
Progressive Web Application by Citytech
 
Programming Without Coding Technology (PWCT) Features - Framework & Extension
Programming Without Coding Technology (PWCT) Features - Framework & ExtensionProgramming Without Coding Technology (PWCT) Features - Framework & Extension
Programming Without Coding Technology (PWCT) Features - Framework & Extension
 
4007655 introduction-to-javascript
4007655 introduction-to-javascript4007655 introduction-to-javascript
4007655 introduction-to-javascript
 
Introducing small basic
Introducing small basicIntroducing small basic
Introducing small basic
 
VISUAL_BASIC_LECTURE_NOTE_A_Z_MADE_EASY.pdf
VISUAL_BASIC_LECTURE_NOTE_A_Z_MADE_EASY.pdfVISUAL_BASIC_LECTURE_NOTE_A_Z_MADE_EASY.pdf
VISUAL_BASIC_LECTURE_NOTE_A_Z_MADE_EASY.pdf
 
Explaindio is a versatile tool for creating animated videos
Explaindio is a versatile tool for creating animated videosExplaindio is a versatile tool for creating animated videos
Explaindio is a versatile tool for creating animated videos
 
MVC for Desktop Application - Part 1
MVC for Desktop Application - Part 1MVC for Desktop Application - Part 1
MVC for Desktop Application - Part 1
 
Part1
Part1Part1
Part1
 
Slide 01
Slide 01Slide 01
Slide 01
 
Pixlr and small apps in the classroom
Pixlr and small apps in the classroomPixlr and small apps in the classroom
Pixlr and small apps in the classroom
 
LabsLab8.htmlLab 8 Im Thinking of a NumberBefore yo.docx
LabsLab8.htmlLab 8 Im Thinking of a NumberBefore yo.docxLabsLab8.htmlLab 8 Im Thinking of a NumberBefore yo.docx
LabsLab8.htmlLab 8 Im Thinking of a NumberBefore yo.docx
 
Developers Border Line: Unit Testing
Developers Border Line: Unit TestingDevelopers Border Line: Unit Testing
Developers Border Line: Unit Testing
 
Question 4 evaluation
Question 4  evaluationQuestion 4  evaluation
Question 4 evaluation
 
django
djangodjango
django
 
Membangun Desktop App
Membangun Desktop AppMembangun Desktop App
Membangun Desktop App
 
Copycat Site BluePrint - make money online fast
Copycat Site BluePrint - make money online fastCopycat Site BluePrint - make money online fast
Copycat Site BluePrint - make money online fast
 

Mehr von allenbailey

4.3 collision detection
4.3   collision detection4.3   collision detection
4.3 collision detectionallenbailey
 
3.5 the controls object
3.5   the controls object3.5   the controls object
3.5 the controls objectallenbailey
 
2.6 flickr, image list, and network objects
2.6   flickr, image list, and network objects2.6   flickr, image list, and network objects
2.6 flickr, image list, and network objectsallenbailey
 
2.5 clock, desktop, and dictionary objects
2.5   clock, desktop, and dictionary objects2.5   clock, desktop, and dictionary objects
2.5 clock, desktop, and dictionary objectsallenbailey
 
2.3 exploring shapes
2.3   exploring shapes2.3   exploring shapes
2.3 exploring shapesallenbailey
 
2.2 turtle graphics
2.2   turtle graphics2.2   turtle graphics
2.2 turtle graphicsallenbailey
 
2.1 graphics window
2.1   graphics window2.1   graphics window
2.1 graphics windowallenbailey
 

Mehr von allenbailey (8)

4.3 collision detection
4.3   collision detection4.3   collision detection
4.3 collision detection
 
3.5 the controls object
3.5   the controls object3.5   the controls object
3.5 the controls object
 
2.6 flickr, image list, and network objects
2.6   flickr, image list, and network objects2.6   flickr, image list, and network objects
2.6 flickr, image list, and network objects
 
2.5 clock, desktop, and dictionary objects
2.5   clock, desktop, and dictionary objects2.5   clock, desktop, and dictionary objects
2.5 clock, desktop, and dictionary objects
 
2.3 exploring shapes
2.3   exploring shapes2.3   exploring shapes
2.3 exploring shapes
 
2.2 turtle graphics
2.2   turtle graphics2.2   turtle graphics
2.2 turtle graphics
 
2.1 graphics window
2.1   graphics window2.1   graphics window
2.1 graphics window
 
1.3 variables
1.3   variables1.3   variables
1.3 variables
 

Kürzlich hochgeladen

Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 

Kürzlich hochgeladen (20)

Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 

3.6 debugging aids

  • 1. Microsoft® Small Basic Debugging Aids Estimated time to complete this lesson: 1 hour
  • 2. Debugging Aids In this lesson, you will learn about: Using the TextWindow.WriteLine operation to debug your programs.
  • 3. Debugging Even a minor bug in a program can defeat the efforts of the programmer! Debugging is a method of detecting and resolving bugs in your computer program. Every programmer develops the skill to detect bugs and debug his or her program. While working on large programs, programmers write debugging support code that is not included in the final program. This is to determine the point where a program fails to run.
  • 4. TextWindow.WriteLine As a Debugging Helper So how can you debug programs in Small Basic? To debug your program, you can use the TextWindow.WriteLine operation. This operation acts as a debugging helper, and it provides information to help debug your program.
  • 5. TextWindow.WriteLine As a Debugging Helper In this program, you first display an ellipse on the graphics window. In case your program does not run as expected, you need to debug it! This is when you can use the TextWindow.WriteLine operation as a debugger. It can help you trace the value of “i” on every iteration of the For…EndFor loop. The value of “i” is displayed in a separate text window, enabling you to easily detect a bug and fix it. Let’s look at an example that uses the TextWindow.WriteLine operation for debugging.
  • 6. TextWindow.WriteLine As a Debugging Helper Oh! The image you requested is not visible on the graphics window. It’s time to debug your code! Now, let’s use the TextWindow.WriteLine operation in another program and see how it can help you debug the program. In this example, you use the Flickr object to download a photo from www.flickr.com and display it on the graphics window.
  • 7. TextWindow.WriteLine As a Debugging Helper One of the possibilities could be unavailability of an Internet connection or no access to the website. To check this possibility, you can use the TextWindow.WriteLine operation for displaying the path of the image from the website. If the Internet connection is working fine, the path of the image will be displayed in the text window. Otherwise, the text window will not display any path. As you can see, the text window is not displaying the path of the image, which means you are not connected to the Internet.
  • 8.
  • 9. The file may not be present at the specified source.
  • 10. The name of the specified file may be incorrect.Now, let’s write a program to copy a file and display its contents in the text window. Now how do we detect the error? It’s time to debug your code once again… In this example, if the CopyFileoperation is successful, the text window displays the contents of the file.
  • 11. TextWindow.WriteLine As a Debugging Helper Let’s use the TextWindow.WriteLine operation to detect the error. You can modify your program and use TextWindow.WriteLine to display the return value of the CopyFile operation in the text window  which will either be SUCCESS or FAILED. So, if your program is unable to run due to the CopyFile operation error, you immediately know about it!
  • 12. Let’s Summarize… Congratulations! Now you know how to: Use the TextWindow.WriteLine operation to debug programs.
  • 13. It’s Time to Apply Your Learning… A program creates a slide show of images in the graphics window. All these images are stored in a local folder. With every mouse click, a new image is displayed in the graphics window. Use the TextWindow.WriteLine operation as a debugging helper by displaying the path of each image in the text window.

Hinweis der Redaktion

  1.  Slide Notes:In this program, you first display an ellipse on the graphics window. Next, you use the SetOpacity operation of the Shapes object to set the opacity level of the ellipse. You place this code within a For…EndFor loop, to change the opacity with every single iteration. Similarly, you set the zoom level of the ellipse within the same loop.  In case your program does not run as expected, you need to debug it! This is when you can use the TextWindow.WriteLine operation as a debugger.  The TextWindow.WriteLine operation can help you trace the value of “i” on every iteration of the For…EndFor loop. The value of “i” gets displayed in a separate text window, enabling you to easily detect the bug and fix it.Code:GraphicsWindow.Height = 400GraphicsWindow.Width = 600Ellipse = Shapes.AddEllipse(200,200)Shapes.Move(Ellipse,200,100)For i = 1 To 5Program.Delay(1000)Shapes.SetOpacity(Ellipse,5*i) Shapes.Zoom(Ellipse,i * 0.4,i * 0.4) TextWindow.WriteLine("Value of i at this moment is " + i) EndFor 
  2. Code:Sourcepath = Program.Directory+"Sourcedata.txt"Destpath = Program.Directory+"dest"file.CopyFile(Sourcepath,Destpath)TextWindow.WriteLine(File.ReadContents(File.ReadContents(destPath+"data.txt")))
  3. Code:Sourcepath = Program.Directory+"Sourcedata.txt"Destpath = Program.Directory+"dest"TextWindow.WriteLine(file.CopyFile(Sourcepath,Destpath))TextWindow.WriteLine(File.ReadContents(File.ReadContents(destPath+"data.txt")))
  4. Solution:Please Note: Ensure that a folder containing the images exists at the path specified in the program.ImagePath = program.Directory + "img" i = 1GraphicsWindow.Width = 600GraphicsWindow.Height = 450GraphicsWindow.Top = (Desktop.Height-450) / 2GraphicsWindow.left = (Desktop.Width-600) / 2 GUI()SmallBasicImage = File.GetFiles(ImagePath) GraphicsWindow.DrawResizedImage(SmallBasicImage[i], 50, 50, 500, 300) Controls.ButtonClicked = SlideShowSub GUI GraphicsWindow.BackgroundColor="LightSlateGray" GraphicsWindow.FontSize=25 nxtBtn = Controls.AddButton("<",50,370) bckBtn = Controls.AddButton(">",500,370) Controls.SetSize(nxtBtn, 50, 50)Controls.SetSize(bckBtn, 50, 50) EndSubSubSlideShowIfControls.GetButtonCaption(Controls.LastClickedButton) = ">" ThenIfi < Array.GetItemCount(SmallBasicImage) Theni = i + 1 images[i] = ImageList.LoadImage(SmallBasicImage[i]) GraphicsWindow.DrawResizedImage(images[i], 50, 50, 500, 300) TextWindow.WriteLine("Image Name:" + SmallBasicImage[i]) EndIfEndIfIfControls.GetButtonCaption(Controls.LastClickedButton) = "<" ThenIfi > 1 Theni = i - 1 images[i] = ImageList.LoadImage(SmallBasicImage[i]) GraphicsWindow.DrawResizedImage(images[i], 50, 50, 500, 300) TextWindow.WriteLine("Image Name:" + SmallBasicImage[i]) EndIfEndIfEndSub