POP Goes the Email

August 7, 2009

If you’re using email, there is a vig chance that you have heard or have read something that said POP, but what exactly is POP. POP is an acronym for Post Office Protocol, and it is a set of protocols (or rules) that tells how your computer send and receives email from other computer users.

When somebody sends you an email it doesn’t go directly to your PC, what happens is the email gets stored in a central storage location, typically your internet service provider’s (ISP’s) servers, its there sitting in a folder setup for your email account waiting to be downloaded. So say xyz@domain.com sends an email to qrs@domain.com, the message gets sent to domain.com’s server. Then the server will search whether they have a folder created for user qrs, if one is found, the email is saved in that folder, otherwise the domain.com’s server will fire up a reply to sender xyz telling them that user qrs does not exist.

In a nutshell, POP allows you to do the following;

  1. Retrieve mail from an ISP and delete it on the server.
  2. Retrieve mail from an ISP but not delete it on the server.
  3. Ask whether new mail has arrived but not retrieve it.
  4. Peek at a few lines of a message to see whether it is worth retrieving.

In retrieving emails, the POP server waits for an event by listening on PORT 110 for any incoming requests from an email client (like Outlook Express, Thunderbird etc.). After connectiong to the POP server, it will then check for the username and password. Only then will it allow access to your folder to retrieve you email messages. It will then check if there is a new email on the server, if there are any, the server will now send out information about how many emails you have and how big they are, otherwise, it will pass back a message to your email client that now new email is present.

On the user’s request, the emails can be retrieved from the server, POP sends a “retieve” command to the POP server and allows your email client to download your messages to your PC. Unless specified, your email client can erase the messages after the download or it can leave a copy of the messages on the server. Giving you the opportunity to read them even if you don’t have your PC with you.

POP can also issue a command to “erase” an email, and once you are done doing all these request POP can now issue an “exit” command to the server so it can close the connection from it.

Bubble Sort Illustrated

Wikipedia defines sorting as “… any process of arranging items in some sequence and/or in different sets, and accordingly…”, and then further defines that “… in computer science and mathematics, a sorting algorithm is an algorithm that puts elements of a list in a certain order…”

Simply put, sorting is the ominous process of putting things into order. below are code samples for the sorting techniques found on virus’ link (most of them atleast). The codes are not mine some of them are from kodeks and some are lifted from data structures books (but i have converted them from C to C++).

Bubble Sort
Exchange two adjacent elements if they are out of order. Repeat until array is sorted. This is a slow algorithm.

Selection Sort
Find the largest element in the array, and put it in the proper place. Repeat until array is sorted. This is also slow.

Insertion Sort
Scan successive elements for out of order item, then insert the item in the proper place. Sort small array fast, big array very slowly.

Quicksort
Partition array into two segments. The first segment all elements are less than or equal to the pivot value. The second segment all elements are greater or equal to the pivot value. Sort the two segments recursively. Quicksort is fastest on average, but sometimes unbalanced partitions can lead to very slow sorting.

Mergesort
Start from two sorted runs of length 1, merge into a single run of twice the length. Repeat until a single sorted run is left. Mergesort needs N/2 extra buffer. Performance is second place on average, with quite good speed on nearly sorted array. Mergesort is stable in that two elements that are equally ranked in the array will not have their relative positions flipped.

Heapsort
Form a tree with parent of the tree being larger than its children. Remove the parent from the tree successively. On average, Heapsort is third place in speed. Heapsort does not need extra buffer, and performance is not sensitive to initial distributions.

For more info do check out the following texts, though most codes are in C they can be easily switched to C++ (or any language)

    • Robert Sedgewick, “Algorithms in C” (this one’s a great read)
    • Mark Allen Weiss, “Data Structures and Algorithm Analysis”
    • Tenenbaum, Langsam, Augenstein, “Data Structures Using C”

    Bubble Sort Code

    #include <iostream>
    using namespace std;

    int compare(int, int);
    void sort(int[], const int);
    void swap(int *, int *);

    int compare(int x, int y)
    {
    return(x > y);
    }

    void swap(int *x, int *y)
    {
    int temp;
    temp = *x;
    *x = *y;
    *y = temp;
    }

    void sort(int table[], const int n)
    {
    for(int i = 0; i < n; i++)
    {
    for(int j = 0; j < n-1; j++)
    {
    if(compare(table[j], table[j+1]))
    swap(&table[j], &table[j+1]);
    }
    }
    }

    int quantity;
    int* tab;

    int main()
    {
    cout << "Input quantity: ";
    cin >> quantity;
    tab = new int [quantity];
    cout << "Input numbers: \n\n";
    for (int i = 0; i < quantity; i++)
    {
    int x = i;
    cout << "#" << ++x << ": ";
    cin >> tab[i];
    }

    cout << "\nBefore sorting: ";
    for (int i = 0; i < quantity; i++)
    {
    cout << tab[i] << " ";
    }

    cout << "\nAfter sorting: ";
    sort(tab, quantity);
    for(int i = 0; i < quantity; i++)
    {
    cout << tab[i] << " ";
    }
    return 0;
    }

    selection sort code

    void SelectionSort(int A[], int length)
    {
    int i, j, min, minat;
    for(i = 0; i<(length-1); i++)
    {
    minat = i;
    min = A[i];

    for(j = i+1;j < length; j++) //select the min of the rest of array
    {
    if(min > A[j]) //ascending order for descending reverse
    {
    minat = j; //the position of the min element
    min = A[j];
    }
    }
    int temp = A[i];
    A[i] = A[minat]; //swap
    A[minat]=temp;
    }
    }//end selection sort

    insertion sort code

    #include <iostream>

    #define ELEMENTS 6

    void insertion_sort(int x[],int length)
    {
    int key,i;
    for(int j=1;j < length;j++)
    {
    key=x[j];
    i=j-1;
    while(x[i]>key && i>=0)
    {
    x[i+1]=x[i];
    i--;
    }
    x[i+1]=key;
    }
    }

    int main()
    {
    int A[ELEMENTS]={5,2,4,6,1,3};
    int x;

    cout <<"NON SORTED LIST:"<<endl;
    for(x=0;x<ELEMENTS;x++)
    {
    cout<<A[x]<<endl;
    }
    insertion_sort(A,ELEMENTS);
    cout<<endl<<"SORTED LIST"<<endl;
    for(x=0;x<ELEMENTS;x++)
    {
    cout<<A[x]<<endl;
    }
    return 0;
    }

    merge sort code

    #include <iostream>
    using namespace std;

    //Function Declarations
    void mergeSort(int numbers[], int temp[], int array_size);
    void m_sort(int numbers[], int temp[], int left, int right);
    void merge(int numbers[], int temp[], int left, int mid, int right);

    int main()
    {
    int arrayOne[5] = {65, 72, 105, 55, 2};
    int arrayTwo[5];

    mergeSort(arrayOne, arrayTwo, 5);

    for (int i = 0; i < 5; i++)
    {
    cout << arrayOne[i] << " ";
    }//end for

    return 0;
    }//end main

    // "Main" function of the sequence
    // From here on out everything is called recursively
    void mergeSort(int numbers[], int temp[], int array_size)
    {
    m_sort(numbers, temp, 0, array_size - 1);
    }

    void m_sort(int numbers[], int temp[], int left, int right)
    {
    int mid;

    if (right > left)
    {
    mid = (right + left) / 2;
    m_sort(numbers, temp, left, mid);
    m_sort(numbers, temp, (mid+1), right);

    merge(numbers, temp, left, (mid+1), right);
    }
    }

    void merge(int numbers[], int temp[], int left, int mid, int right)
    {
    int i, left_end, num_elements, tmp_pos;

    left_end = (mid - 1);
    tmp_pos = left;
    num_elements = (right - left + 1);

    while ((left <= left_end) && (mid <= right))
    {
    if (numbers[left] <= numbers[mid])
    {
    temp[tmp_pos] = numbers[left];
    tmp_pos += 1;
    left += 1;
    }
    else
    {
    temp[tmp_pos] = numbers[mid];
    tmp_pos += 1;
    mid += 1;
    }
    }

    while (left <= left_end)
    {
    temp[tmp_pos] = numbers[left];
    left += 1;
    tmp_pos += 1;
    }
    while (mid <= right)
    {
    temp[tmp_pos] = numbers[mid];
    mid += 1;
    tmp_pos += 1;
    }

    //modified
    for (i=0; i < num_elements; i++)
    {
    numbers[right] = temp[right];
    right -= 1;
    }
    }

    quicksort code

    #include <process.h>
    #include <iostream.h>
    #include <conio.h>
    #include <stdlib.h>

    int Partition(int low,int high,int arr[]);
    void Quick_sort(int low,int high,int arr[]);

    void main()
    {
    int *a,n,low,high,i;
    clrscr();
    cout<<"/**************************Quick Sort Algorithm
    Implementation*****************/

    ";
    cout<<"Enter number of elements:
    ";
    cin>>n;

    a=new int[n];
    /* cout<<"enter the elements:
    ";
    for(i=0;i<n;i++)
    cin>>a;*/
    for(i=0;i<n;i++)
    a[i]=rand()%100;
    clrscr();
    cout<<"
    Initial Order of elements
    ";
    for(i=0;i<n;i++)
    cout<<a[i]<<" ";
    cout<<"
    ";

    high=n-1;
    low=0;
    Quick_sort(low,high,a);
    cout<<"
    Final Array After Sorting:
    ";

    for(i=0;i<n;i++)
    cout<<a[i]<<" ";

    getch();
    }

    /*Function for partitioning the array*/

    int Partition(int low,int high,int arr[])
    { int i,high_vac,low_vac,pivot/*,itr*/;
    pivot=arr[low];
    while(high>low)
    { high_vac=arr[high];

    while(pivot<high_vac)
    {
    if(high<=low) break;
    high--;
    high_vac=arr[high];
    }

    arr[low]=high_vac;
    low_vac=arr[low];
    while(pivot>low_vac)
    {
    if(high<=low) break;
    low++;
    low_vac=arr[low];
    }
    arr[high]=low_vac;
    }
    arr[low]=pivot;
    return low;
    }

    void Quick_sort(int low,int high,int arr[])
    {
    int Piv_index,i;
    if(low<high)
    {
    Piv_index=Partition(low,high,arr);
    Quick_sort(low,Piv_index-1,arr);
    Quick_sort(Piv_index+1,high,arr);
    }
    }

    hope this helps <:)

On Resetting IE 7

July 24, 2009

Ever experienced IE 7 acting funny on you? Does your browser close out by itself? Does it give you a message saying it had enountered an error? If you answered YES, then its likely that your IE settings needs to be reset.

By resetting Internet Explorer settings, you send it back to the state it was when it was first installed on your PC. Doing so fixes some of the common problems associated with browsing like deleting personal settings, taking out cookies, form data, passwords, cache files and even add-ons that are not working properly.

IE settings affected by a reset

Category Items affected
Settings that are deleted
  • Disabled toolbars and add-ons
  • Websites added to intranet, trusted, or restricted zones
  • Websites added for special cookie handling under the Privacy tab
  • Websites allowed to use pop-ups under Pop-up Blocker settings
Settings that are reset to Windows, manufacturer, Internet provider, or corporate defaults
  • Home page
  • Search providers, tabbed browsing settings
  • Colors, languages, fonts, and accessibility settings (General tab)
  • Security settings for all zones (Security tab
  • Advanced tab settings
  • Privacy tab settings
  • Pop-up blocker,AutoComplete, SmartScreen Filter, and Zoom settings
  • Page setup, toolbar, and text size settings
  • Feeds settings (sync and notification, not feeds themselves)
  • ActiveX controls that are not on the pre-approved list (reset to opt-in state)
  • Toolbars, browser helper objects, and browser extensions are disabled
Settings that are deleted (Delete personal settings is selected)
  • Browser history, temporary Internet files, cookies, form data, and stored passwords
  • Typed URL information, menu extensions
  • InPrivate Filtering data
  • Explorer most recently used list
Settings and items that are not affected
  • Favorites
  • Feeds and Web Slices
  • Content Advisor settings
  • Pre-approved ActiveX controls
  • Temporary Internet file (cache) path settings
  • Certificate information
  • Internet Programs (email, instant messenger, and other programs associated with Internet use)
  • Internet connection, proxy, and VPN settings
  • Default web browser setting
  • Toolbars are not restored

What are WinSocks?

May 21, 2009

WinSocks (Windows Sockets) are routines that Windows uses to work with TCP/IP. In Windows they are found inside the WinSock.DLL file.

Applications using WinSock (Example IE)
|
WinSock.DLL
|
TCP/IP
|
Modem or Network Card
|
Network and/or Internet

Your application tells windows what it wants and windows informs WINSOCK.DLL and it translates the request into commands for TCP/IP, and TCP/IP does the rest.

Windows sockets settings may get corrupted due to the installation of a networking software, or perhaps due to Malware infestation. You will be able connect to the Internet, but the packets won’t transfer back and forth. And errors such as Page cannot be displayed may occur when using Internet Explorer.

Fortunately, starting with Windows XP SP2, a command for resetting the WinSock settings to default is available. You can use the Command Prompt Window to run the command;

NETSH WINSOCK RESET

Do note that you need to be in Administrator mode if you are running Windows Vista.

But with Windows XP SP1 and below, they have to be manually removed from the registry and TCP/IP needs to be reinstalled.

Sources:

http://support.microsoft.com/kb/811259
http://windowsxp.mvps.org/winsock.htm
http://www.faqs.org/faqs/windows/winsock-faq/

What is TCP/IP?

May 21, 2009

TCP/IP (Transmission Control Protocol/Internet Protocol Suite) are rules that dictate how information is moved from one computer to another. It is a standard used for any computer that will be connecting to a network, like the internet, and is built-in as part of the Windows operating system.

TCP/IP can get damaged or corrupted when poorly designed software applications or hardware drivers tries to modify the registry entries for TCP/IP. But starting with Windows XP, TCP/IP has become part of the OS itself, so removing it is no longer an option. Fortunately, it can be reset to its original (aka default) settings. This can be done by using the command below;

netsh int ip reset c:\resetlog.txt

Where c:\resetlog.txt are where the logs for changes made are saved, and can actually be changed to any filename that you want to use (e.g. 123.txt will be valid).

After typing in the command Windows will re-write (changes made) the TCP/IP entries on the registry (This has the same effect as removing and reinstalling the protocol from previous windows versions). For reference it will change the following entries;

SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\
SYSTEM\CurrentControlSet\Services\DHCP\Parameters\

That is why we need to restart the pc for changes to take effect.

Sources:
http://johnsheadtree.headtreez.com/doc/e93beb4d-6466-49c7-b05a-1f396bdd85b5
http://support.microsoft.com/kb/299357
forums.techguy.org/networking/420815-tcp-ip-stack-corrupted.html

Software refers to the programs that tell your computer what to do. They can be the operating system on your computer, your word processor, your spreadsheet and the one you used to create you presentation on. Now if we walk to a computer store, you’ll find lots of software that you can buy and readily install on your computer at home, or in the office. Now depending on what you need and what the software’s task, the price can range from as low as one thousand pesos to as much as thirty thousand pesos. You also have to take into consideration how many computers will you be installing the software into, because if you don’t you might find yourself in the middle of a copyright infringement suit.

Now how do you fit your budget and get all the software that you need? The answer to this question is by using Free and Open Source Software (FOSS). FOSS is software which is liberally licensed to grant the right of users to study, change, and improve its design through the availability of its source code. This approach has gained both momentum and acceptance as the potential benefits have been increasingly recognized by both individuals and corporate players. Free software licenses (FSL) are used by many software packages. These same programs can be downloaded from the internet and installed on your computer totally free of charge.

There is no documentation on which software was first offered using an FSL, but an early version of a typesetting program called TeX (ca. 1960s) is distributed freely in the early days of computer science. Then around the 1980s, the X11 or the windowing system that implements the X display protocol came into the picture and became a fixture on several computer screens.

The Free Software Movement (FSM) started around 1983. In 1998, a group of individuals advocated that the term free software be replaced by open source software (OSS) as an expression which is less ambiguous and more comfortable for the corporate world. Software developers may want to publish their software with an open source license, so that anybody may also develop the same software or understand how it works. Open source software generally allows anyone to make a new version of the software, port it to new operating systems and processor architectures, share it with others or market it. The aim of open source is to let the product be more understandable, modifiable, easily duplicated, reliable or simply accessible, while it is still marketable. The Free Software Foundation (FSF), started in 1985, and they intended the word ‘free’ to mean “free as in free speech” but not “free as in free beer” with emphasis on the “positive freedom” to distribute rather than a “negative freedom” from cost.

In 1983, Richard Stallman, longtime member of the hacker community at the MIT Artificial Intelligence Laboratory, announced the GNU project, saying that he had become frustrated with the effects of the change in culture of the computer industry and its users. Software development for the GNU operating system began in January 1984, and the Free Software Foundation (FSF) was founded in October 1985. He developed a free software definition and the concept of “copyleft”, designed to ensure software freedom for all.

Free software is a widespread international concept, producing software used by individuals, large organizations, and governmental administrations. Free software has a very high market penetration in server-side Internet applications such as the Apache web server, MySQL database, and PHP scripting language.

Completely free computing environments are available as large packages of basic system software, such as the many GNU/Linux distributions and FreeBSD. Free software developers have also created free versions of almost all commonly used desktop applications, including Web browsers, office productivity suites, and multimedia players. It is important to note, however, that in many categories, free software for individual workstations or home users has only a fraction of the market share of its proprietary competitors. Most free software is distributed online without charge, or off-line at the marginal cost of distribution, but this pricing model is not required, and people may sell copies of free software programs for any price.

The economic viability of free software has been recognized by large corporations such as IBM, Red Hat, and Sun Microsystems. Many companies whose core business is not in the IT sector choose free software for their Internet information and sales sites, due to the lower initial capital investment and ability to freely customize the application packages.

Also, some non-software industries are beginning to use techniques similar to those used in free software development for their research and development process; scientists, for example, are looking towards more open development processes, and hardware such as microchips are beginning to be developed with specifications released under copyleft licenses (see the OpenCores project, for instance). Creative Commons and the free culture movement have also been largely influenced by the free software movement.

Wikipedia defines a blog as a type of website, maintained by an individual with regular entries of commentary, event descriptions, or other materials such as graphics or video, in which they are displayed in reverse-chronological order (meaning the latest post is always on top).

Blogging has given online interaction a new face, a new medium to express one self and share one’s interest. Ones blog can be about their hobby, the places they visited, their opinions and views and even talk about what they had for breakfast.

The beauty of blogging is the availability of free, yes you heard it right, tools for maintaining your online presence. Blog services like WordPress, Blogspot and the like, are doing their earnest in winning the hearts and minds of current and future bloggers.

I for one started to get serious about blogging just this month, and boy do i find it addicting. Just imagine, the tools are free and they offer a great variety of thingamajigs you can use to spruce up your page. My weapon of choice for this area is WordPress, I got introduced to WordPress by looking at another person’s blog. I clicked on their link and whoah, cool, free and easy to use.

As much as I would like to be, I am not in any sense one helluva writer (I’m still a work in progress in that area) but what I have learned so far from my experience (ok some might say a month of blogging is not that long) and from other bloggers is that, everyone has their free hand in their blogging style. It’s all about expression and content. Express what you have on mind and type away on your keyboard caring less about the restrictions of composition writing. Its all about getting your idea across, and for me it offers a great outlet from getting away from work and school, my own realm, my own world.

Moodle is a free and an Open Source Course Management System (CMS), also known as a Learning Management System (LMS) or a Virtual Learning Environment (VLE). A tool that is very popular among educators around the world. As of February 2009, it is said that it has 49,256 registered users with 28,177,443 users in its 2,571,822 courses (Source: Wikipedia)

Moodle was designed in a concept where students and educators can create online courses with chances of interaction. It was created by Martin Dougiamas from Curtin University, Australia.

To see moodle in action you can check this link for organization’s using Moodle as their e-learning platform.

And for information on how to download and use Moodle click here.