I made this widget at MyFlashFetish.com.

Saturday, April 9, 2011

Programming language



A programming language is an artificial language designed to express computations that can be performed by a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine, to express algorithms precisely, or as a mode of human communication.
The earliest programming languages predate the invention of the computer, and were used to direct the behavior of machines such as Jacquard looms and player pianos. Thousands of different programming languages have been created, mainly in the computer field, with many more being created every year. Most programming languages describe computation in an imperative style, i.e., as a sequence of commands, although some languages, such as those that support functional programming or logic programming, use alternative forms of description.
A programming language is usually split into the two components of syntax (form) and semantics (meaning) and many programming languages have some kind of written specification of their syntax and/or semantics. Some languages are defined by a specification document, for example, the C programming language is specified by an ISO Standard, while other languages, such as Perl, have a dominant implementation that is used as a reference.

FIVE STEPS OFf PROGRAMMING

1. Clarify Programming Needs
·                     Clarify objectives and users
·                     Clarify desired outputs
·                     Clarify desired inputs
·                     Clarify desired processing
·                     Double - check feasibility of implementing the program
·                     Document the analysis
2. Design the Program
·                     Determine program logic through top down approach and modularization, using a hierarchy chart
·                     Design details using procedure and/or flowcharts, preferably involving control structure. 
3. Code the Program
·                     Select the appropriate high-level programming language
·                     Code the program in that language following the syntax carefully 
4. Test the Program
·                     Alpha testing is the process of reading through the program in search of errors in logic. The second step is to run a diagnostic program to search for syntax or input errors.
·                     Beta testing involves using the program in the real world to see if it contains any bugs or other deficiency
5. Document and Maintaiin               Write user documentation
·                     Write operator documentation
·                     Write programmer documentation
·                     Maintain the program 

Do...Loop Statement

Repeats a block of statements while a Boolean condition is True or until the condition becomes True.

Use a Do...Loop structure when you want to repeat a set of statements an indefinite number of times, until a condition is satisfied. If you want to repeat the statements a set number of times, the For...Next Statement is usually a better choice.
You can use either While or Until to specify condition, but not both.
You can test condition only one time, at either the start or the end of the loop. If you test condition at the start of the loop (in the Do statement), the loop might not run even one time. If you test at the end of the loop (in the Loop statement), the loop always runs at least one time.
The condition usually results from a comparison of two values, but it can be any expression that evaluates to a Boolean Data Type (Visual Basic) value (True orFalse). This includes values of other data types, such as numeric types, that have been converted to Boolean.
You can nest Do loops by putting one loop within another. You can also nest different kinds of control structures within each other. For more information, seeNested Control Structures (Visual Basic).

DO WHILE

Executes statements repetitively while a condition is true

Valid:
in a DATA step
Category:
Control
Type:
Executable


SYNTAX

DO WHILE (expression);
…..more SAS statements…
END;

ARGUMENTS.

(expression)
is any SAS expression, enclosed in parentheses. You must specify at least one expression.

DETAILS.
The expression is evaluated at the top of the loop before the statements in the DO loop are executed. If the expression is true, the DO loop iterates. If the expression is false the first time it is evaluated, the DO loop does not iterate even once.
COMPARISONS.
There are three other forms of the DO statement:


  • The DO statement, the simplest form of DO-group processing, designates a group of statements to be executed as a unit, usually as a part of IF-THEN/ELSE statements.
  • The iterative DO statement executes statements between DO and END statements repetitively based on the value of an index variable.
  • The DO UNTIL statement executes statements in a DO loop repetitively until a condition is true, checking the condition after each iteration of the DO loop. The DO WHILE statement evaluates the condition at the top of the loop; the DO UNTIL statement evaluates the condition at the bottom of the loop.
  • Note:   If the expression is false, the statements in a DO WHILE loop do not execute. However, because the DO UNTIL expression is evaluated at the bottom of the loop, the statements in the DO UNTIL loop always execute at least once.  


EXAMPLES.
These statements repeat the loop while N is less than 5. The expression N<5 is evaluated at the top of the loop. There are five iterations in all (0, 1, 2, 3, 4).
n=0;
   do while(n<5);
      put n=;
      n+1;
   end;


DO UNTIL

 Executes statements in a DO loop repetitively until a condition is true
Valid:   in a DATA step
Category:         Control
Type:    Executable


DO UNTIL (expression);
...more SAS statements...
END;


ARGUMENTS.
(expression)
is any SAS expression, enclosed in parentheses. You must specify at least one expression.
Details
The expression is evaluated at the bottom of the loop after the statements in the DO loop have been executed. If the expression is true, the DO loop does not iterate again.

Note:   The DO loop always iterates at least once. 
Comparisons
There are three other forms of the DO statement:

The DO statement, the simplest form of DO-group processing, designates a group of statements to be executed as a unit, usually as a part of IF-THEN/ELSE statements.
The iterative DO statement executes statements between DO and END statements repetitively based on the value of an index variable.

The DO WHILE statement executes statements in a DO loop repetitively while a condition is true, checking the condition before each iteration of the DO loop. The DO UNTIL statement evaluates the condition at the bottom of the loop; the DO WHILE statement evaluates the condition at the top of the loop.

Note:   The statements in a DO UNTIL loop always execute at least one time, whereas the statements in a DO WHILE loop do not iterate even once if the condition is false. 

Examples
These statements repeat the loop until N is greater than or equal to 5. The expression N>=5 is evaluated at the bottom of the loop. There are five iterations in all (0, 1, 2, 3, 4).

n=0;
   do until(n>=5);
      put n=;
      n+1;
   end;


 DO WHILE VERSUS DO UNTIL.

The do-while loop is similar to the while loop, except that the test condition occurs at the end of the loop.  Having the test condition at the end, guarantees that the body of the loop always executes at least one time.
The do-while loop is an exit-condition loop.  This means that the body of the loop is always executed first.  Then, the test condition is evaluated.  If the test condition is true, the program executes the body of the loop again.  If the test condition is false, the loop terminates and program execution continues with the statement following the while….

Do...Loop enables the script to continue to perform certain actions until a specific condition occurs. Do While...Loop enables your script to continue to perform these actions as long as the specified condition remains true. Once the specified condition is no longer true, Do While...Loop exits. In contrast, Do Until...Loop has the opposite effect the script continues to perform the action until a certain condition is met….




PSEUDOCODE

What is pseudocode?
Pseudocode consists of short, English phrases used to explain specific tasks within a program's algorithm. Pseudocode should not include keywords in any specific computer languages. It should be written as a list of consecutive phrases. You should not use flowcharting symbols but you can draw arrows to show looping processes. Indentation can be used to show the logic in pseudocode as well. For example, a first-year, 9th grade Visual Basic programmer should be able to read and understand the pseudocode written by a 12th grade AP Data Structures student. In fact, the VB programmer could take the other student's pseudocode and generate a VB program based on that pseudocode.

Why is pseudocode necessary?
The programming process is a complicated one. You must first understand the program specifications, of course, Then you need to organize your thoughts and create the program. This is a difficult task when the program is not trivial (i.e. easy). You must break the main tasks that must be accomplished into smaller ones in order to be able to eventually write fully developed code. Writing pseudocode WILL save you time later during the construction & testing phase of a program's development.

How do we write pseudocode?
First you may want to make a list of the main tasks that must be accomplished on a piece of scratch paper. Then, focus on each of those tasks. Generally, you should try to break each main task down into very small tasks that can each be explained with a short phrase. There may eventually be a one-to-one correlation between the lines of pseudocode and the lines of the code that you write after you have finished pseudocoding.

It is not necessary in pseudocode to mention the need to declare variables. It is wise however to show the initialization of variables. You can use variable names in pseudocode but it is not necessary to be that specific. The word "Display" is used in some of the examples. This is usually general enough but if the task of printing to a printer, for example, is algorithmically different from printing to the screen, you may make mention of this in the pseudocode. You may show functions and procedures within pseudocode but this is not always necessary either. Overall, remember that the purpose of pseudocode is to help the programmer efficiently write code. 

Therefore, you must honestly attempt to add enough detail and analysis to the pseudocode. In the professional programming world, workers who write pseudocode are often not the same people that write the actual code for a program. In fact, sometimes the person who writes the pseudocode does not know beforehand what programming language will be used to eventually write the program.

Quick Tip: Configuring Eclipse to Run for the First Time


For Java developers, Eclipse is a convenient tool to develop software in broad range of programming languages. This tip is intended to help fellow developers who never use Eclipse before but are eager to start developing applications using Eclipse IDE.
Even though Eclipse is cross-platform, there is no guarantee that the tip provided in this post will also work for version of software and environment other than ones described below:
·                                 OS: Windows
·                                 Eclipse version: Eclipse 3.5 Galileo
·                                 JDK version: Java EE 6 SDK

Before we proceed with the configuration, you should have downloaded Eclipse from its homepage. If you haven’t installed Java EE SDK, you also need to download the JDK from Sun’s Java download page (make sure you download JDK with Java EE package). Eclipse requires JDK to run. It is advised to install Java EE SDK before extracting the zip file of Eclipse.

Java EE SDK installation is straightforward. You will be provided a standard wizard and you can simply go through all the steps. In the following picture, you can see the wizard is installing Glassfish web container in the disk (the installer is in Korean, though). One thing you should pay attention to is the port number of the default web server shipped along with the JDK. If you plan to use another web container like Tomcat while working with Eclipse, it is better to avoid using port number 8080 as the default web server port. Otherwise, you will be busy starting and stopping service of each web server.

After saving the modification, click eclipse.exe or the shortcut. Voila! You are now ready to create your first software project using Eclipse.

Sample PHP Application: A Simple PHP Command Line-based File Generator


PHP is a great scripting language to build web applications. Despite the sluggish improvement and development towards a more architecturally robust, more feature-rich, and less quick-and-dirty programming language recently, I still love coding bytes in PHP. Some people may think of PHP as the language for programming the web quickly. Write some HTML, embed some javascript, add some CSS, put some PHP code, and voila… a dynamic web page is created. I won’t praise how good PHP is for developing a web application. Several companies may have done that. Name Facebook and Yahoo as examples. With some optimization to native PHP codes, both companies have shown how to use the language to cater to millions of users and run a serious business.
In this post, I’d like to highlight another feature of PHP, the command line interface (CLI). PHP CLI can be an alternative to some administrative tasks. Linux users may have been familiar with shell scripting for carrying out system management and configuration tasks. So, why must PHP? The answer is portability. The same PHP code should work not only on Linux but also on Windows. Some critics may argue that other languages may also have answer for portability. I concur to that criticism while at the same time emphasizing PHP as another viable option.
The application to be shown immediately is a file generator. It will create a file of random content with size specified by user when executing the file. The content consists of alphanumeric ASCII characters that are picked randomly. No newline are included in the file. Yet, user can tweak the application to make the generated output file also include newline.
This application can be useful for those who are learning how to write a command line-based PHP utility and also for others who want to conveniently generate files of various sizes for workload testing purpose.
Source code and snapshots are provided below:
a. Source code: filegenerator.php


If you want to play with this simple application, you can download it directly from the following link:



IMPORTANCE OF TECHNOLOGY IN BUSINESS

Technology plays a vital role in business. Over the years businesses have become dependent on technology so much so that if we were to take away that technology virtually all business operations around the globe would come to a grinding halt. Almost all businesses and industries around the world are using computers ranging from the most basic to the most complex of operations. In chapter 15, we learn about how computer technology can introduce new ways for business to compete with each other. Technology make changes such as create new products, enterprise and new customer and also supplier relationship. 





Technology played a key role in the growth of commerce and trade around the world. It is true that we have been doing business since time immemorial, long before there were computers; starting from the simple concept of barter trade when the concept of a currency was not yet introduced but trade and commerce was still slow up until the point when the computer revolution changed everything. Almost all businesses are dependent on technology on all levels from research and development, production and all the way to delivery





Small to large scale enterprises depend on computers to help them with their business needs ranging from Point of Sales systems, information management systems capable of handling all kinds of information such as employee profile, client profile, accounting and tracking, automation systems for use in large scale production of commodities, package sorting, assembly lines, all the way to marketing and communications. It doesn't end there, all these commodities also need to be transported by sea, land, and air. Just to transport your commodities by land already the use of multiple systems to allow for fast, efficient and safe transportation of commodities. 



Without this technology the idea of globalization wouldn't have become a reality. Now all enterprises have the potential to go international through the use of the internet. If your business has a website, that marketing tool will allow your business to reach clients across thousands of miles with just a click of a button. This would not be possible without the internet. Technology allowed businesses to grow and expand in ways never thought possible. 


The role that technology plays for the business sector cannot be taken for granted. If we were to take away that technology trade and commerce around the world will come to a standstill and the global economy would collapse. It is nearly impossible for one to conduct business without the aid of technology in one form or another. Almost every aspect of business is heavily influenced by technology. Technology has become very important that it has become a huge industry itself from computer hardware manufacturing, to software design and development, and robotics. Technology has become a billion dollar industry for a number of individuals.



The next time you browse a website to purchase or swipe a credit card to pay for something you just bought, try to imagine how that particular purchase would have happened if it were to take place without the aid of modern technology. That could prove to be a bit difficult to imagine. Without all the technology that we are enjoying now it would be like living in the 60's again. No computers, no cellular phones, no internet. That is how important technology is in business.