Samstag, 13. November 2010

CSS Style for MySpace profile 1.0 and SiteModel.net

The code comes into the About Me section if you edit the profile:

<style>
table, tr, td {
   background-color:transparent !important;
   border:none !important;
   border-width:0px !important;
   }
body, .bodyContent {
   background-color:000000 !important;
   background-image:url(http://i293.photobucket.com/albums/mm73/byte2702/_MySpace/001.png);
   background-attachment:fixed !important;
   background-position:center center !important;
   background-repeat:no-repeat !important;
   scrollbar-face-color:3333FF !important;
   scrollbar-highlight-color:6666FF !important;
   scrollbar-3dlight-color:3333FF !important;
   scrollbar-darkshadow-color:000066 !important;
   scrollbar-shadow-color:0000CC !important;
   scrollbar-arrow-color:000000 !important;
   scrollbar-track-color:000066 !important;
   }
table, tr, td, li, p, div {
   color:CCCCCC !important;
   }
.btext {
   color:CCCCCC !important;
   }
.blacktext10 {
   color:CCCCCC !important;
   }
.blacktext12 {
   color:CCCCCC !important;
   }
.lightbluetext8 {
   color:CCCCCC !important;
   }
.orangetext15 {
   color:CCCCCC !important;
   }
.redtext {
   color:CCCCCC !important;
   }
.redbtext {
   color:CCCCCC !important;
   }
.text {
   color:CCCCCC !important;
   }
.whitetext12 {
   color:CCCCCC !important;
   }
.nametext {
   color:CCCCCC !important;
   }
a:active, a:visited, a:link {
   color:CCCCCC !important;
   text-decoration:underline !important;
   }
a:hover {
   color:CCCCCC !important !important;
   text-decoration:line-through underline !important;
   }
a.redlink:active, a.redlink:visited, a.redlink:link {
   color:CCCCCC !important;
   text-decoration:underline !important;
   }
a.redlink:hover {
   color:CCCCCC !important;
   text-decoration:line-through underline !important;
   }
a.navbar:active, a.navbar:visited, a.navbar:link {
   color:CCCCCC !important;
   }
table table {
   border-width:0px !important;
   background-color:transparent !important;
   }
.profileInfo {
   width:300px !important;
   border-width:1px !important;
   border-color:000066 !important;
   border-style:solid !important;
   padding:5px !important;
   background-color:transparent !important;
   background-image:url(http://i293.photobucket.com/albums/mm73/byte2702/_MySpace/008.png);
   background-attachment:fixed !important;
   background-position:left top !important;
   background-repeat:repeat !important;
   }
.contactTable {
   width:300px !important;
   height:151px !important;
   border-width:1px !important;
   border-color:000066 !important;
   border-style:solid !important;
   padding:5px !important;
   background-color:transparent !important;
   background-image:url(http://i293.photobucket.com/albums/mm73/byte2702/_MySpace/015.png);
   background-attachment:inherit !important;
   background-position:left top !important;
   background-repeat:repeat !important;
   }
.contactTable a img {
   visibility:hidden !important;
   }
.userProfileURL {
   width:300px !important;
   border-width:1px !important;
   border-color:000066 !important;
   border-style:solid !important;
   padding:5px !important;
   background-color:transparent !important;
   background-image:url(http://i293.photobucket.com/albums/mm73/byte2702/_MySpace/008.png);
   background-attachment:fixed !important;
   background-position:left top !important;
   background-repeat:repeat !important;
   }
.userProfileURL td {
   background-color:transparent !important;
   }
.interestsAndDetails {
   width:300px !important;
   border-width:1px !important;
   border-color:000066 !important;
   border-style:solid !important;
   padding:5px !important;
   background-color:transparent !important;
   background-image:url(http://i293.photobucket.com/albums/mm73/byte2702/_MySpace/008.png);
   background-attachment:fixed !important;
   background-position:left top !important;
   background-repeat:repeat !important;
   }
.userProfileDetail {
   width:300px !important;
   border-width:1px !important;
   border-color:000066 !important;
   border-style:solid !important;
   padding:5px !important;
   background-color:transparent !important;
   background-image:url(http://i293.photobucket.com/albums/mm73/byte2702/_MySpace/008.png);
   background-attachment:fixed !important;
   background-position:left top !important;
   background-repeat:repeat !important;
   }
.extendedNetwork {
   width:435px !important;
   height:120px !important;
   border-width:1px !important;
   border-color:000066 !important;
   border-style:solid !important;
   padding:5px !important;
   background-color:transparent !important;
   background-image:url(http://i293.photobucket.com/albums/mm73/byte2702/_MySpace/016.png);
   background-attachment:inherit !important;
   background-position:left top !important;
   background-repeat:repeat !important;
   }
.latestBlogEntry {
   width:435px !important;
   border-width:1px !important;
   border-color:000066 !important;
   border-style:solid !important;
   padding:5px !important;
   background-color:transparent !important;
   background-image:url(http://i293.photobucket.com/albums/mm73/byte2702/_MySpace/008.png);
   background-attachment:fixed !important;
   background-position:left top !important;
   background-repeat:repeat !important;
   }
.blurbs {
   width:435px !important;
   border-width:1px !important;
   border-color:000066 !important;
   border-style:solid !important;
   padding:5px !important;
   background-color:transparent !important;
   background-image:url(http://i293.photobucket.com/albums/mm73/byte2702/_MySpace/008.png);
   background-attachment:fixed !important;
   background-position:left top !important;
   background-repeat:repeat !important;
   }
.friendSpace {
   width:435px !important;
   border-width:1px !important;
   border-color:000066 !important;
   border-style:solid !important;
   padding:5px !important;
   background-color:transparent !important;
   background-image:url(http://i293.photobucket.com/albums/mm73/byte2702/_MySpace/008.png);
   background-attachment:fixed !important;
   background-position:left top !important;
   background-repeat:repeat !important;
   }
.friendSpace img {
   max-height:150px !important;
   max-width:100px !important;
   overflow:hidden !important;
}
.friendsComments img {
   max-height:100% !important;
   max-width:100% !important;
   overflow:hidden !important;
}
</style>
<br>Your Text<br>

The more !important, the better... ;-)

Sonntag, 7. November 2010

Abstract Data Type (ADT) in C/C++: Sorted Linked List

C/C++:

I won't explain the source code below. Either you understand it or you don't understand it.
My GNU C++ Compiler under Ubuntu does understand the source code, too. ;-)
The code is written for C++, but you can use the code for C as well.


Header file 'my_list.h': 
#ifndef MY_LIST_H
#define MY_LIST_H
struct node
{
  int data;
  node *next;
};
node *insert_element_in_ascending_order(node *mylist, int data);
node *insert_element_in_descending_order(node *mylist, int data);
void delete_mylist(node *mylist);
void write_mylist(FILE *textfile, node *mylist);
#endif


CPP file 'my_list.cpp':                 // replace 'my_list.cpp' by 'my_list.c' for a C program
#include <iostream>               // remove this line if it shall be a C program
#include <cstdio>                 // replace 'cstdio' by 'stdio.h' if it shall be a C program
#include <cstdlib>                // replace 'cstdlib' by 'stdlib.h' if it shall be a C program
#include "my_list.h"

using namespace std;              // remove this line if it shall be a C program

node *insert_element_in_ascending_order(node *mylist, int data)
{
  node *element = 0;              // replace '0' by 'NULL' if it shall be a C program
  node *newelement = 0;           // replace '0' by 'NULL' if it shall be a C program
  node *before = 0;               // replace '0' by 'NULL' if it shall be a C program
  if (mylist == 0)                // replace '0' by 'NULL' if it shall be a C program
  {
    // create a new list if it doesn't exist
    mylist
= new node;
    mylist->data = data;
    mylist->next
= 0;
             // replace '0' by 'NULL' if it shall be a C program
  }
  else
  {
    // insert at the end of the list
    element = mylist;
    while (element->next != 0)    // replace '0' by 'NULL' if it shall be a C program
      element = element->next;
    if (element->data < data)
 
    {
      newelement = new node;
      newelement->data = data;
      newelement->next
= 0;       // replace '0' by 'NULL' if it shall be a C program
      element->next = newelement;
    }
    else
    {
      if (mylist->data > data)
      {
        // insert at the beginning of the list
        newelement = new node;
        newelement->data = data;
        newelement->next
= mylist;
        mylist = newelement;
      }
      else
      {
        // insert somewhere between the beginning and the end of the list (sorted)
        for (element = mylist; element != 0; element = element->next)   // C: repl. '0' by 'NULL'
          if (element->data < data)
            before = element;
        newelement = new node;
        newelement->data = data;
 

        newelement->next = before->next;
        before->next = newelement;
      }
    }
  }
  return mylist;
}

node *insert_element_in_descending_order(node *mylist, int data)
{
  node *element = 0;              // replace '0' by 'NULL' if it shall be a C program
  node *newelement = 0;           // replace '0' by 'NULL' if it shall be a C program
  node *before = 0;               // replace '0' by 'NULL' if it shall be a C program
  if (mylist == 0)                // replace '0' by 'NULL' if it shall be a C program
  {
    // create a new list if it doesn't exist
    mylist = new node;
    mylist->data = data;
    mylist->next
= 0;
             // replace '0' by 'NULL' if it shall be a C program
  }
  else
  {
    // insert at the end of the list
    element = mylist;
    while (element->next != 0)    // replace '0' by 'NULL' if it shall be a C program
      element = element->next;
    if (element->data > data)
    {
      newelement = new node;
      newelement->data = data;
      newelement->next
= 0;       // replace '0' by 'NULL' if it shall be a C program
      element->next = newelement;
    }
    else
    {
      if (mylist->data < data)
      {
        // insert at the beginning of the list
        newelement = new node;
        newelement->data = data;
        newelement->next
= mylist;
        mylist = newelement;
      }
      else
      {
        // insert somewhere between the beginning and the end of the list (sorted)
        for (element = mylist; element != 0; element = element->next)   // C: repl. '0' by 'NULL'
          if (element->data > data)
            before = element;
        newelement = new node;
        newelement->data = data;
        newelement->next
= before->next;
        before->next = newelement;
      }
    }
  }
  return mylist;
}

void delete_mylist(node *mylist)
{
  node *temp = 0;                 // replace '0' by 'NULL' if it shall be a C program
  while (mylist != 0)             // replace '0' by 'NULL' if it shall be a C program
  {
    temp = mylist->next;
    delete mylist;
    mylist = 0;                   // replace '0' by 'NULL' if it shall be a C program
    mylist = temp;
  }
}

void write_mylist(FILE *textfile, node *mylist)
{
  int i = 0;
  node *element = 0;              // replace '0' by 'NULL' if it shall be a C program
  fprintf(textfile, "Output:\n\n");
  for (element = mylist; element != 0; element = element->next)   // C: replace '0' by 'NULL'
    fprintf(textfile, "%8d\t%8d\n", ++i, element->data);
} 



Example: 
#include <iostream>               // remove this line if it shall be a C program
#include <cstdio>                 // replace 'cstdio' by 'stdio.h' if it shall be a C program
#include <cstdlib>                // replace 'cstdlib' by 'stdlib.h' if it shall be a C program
#include "my_list.h"

using namespace std;              // remove this line if it shall be a C program
 
int main(void)
{
  struct node *mylist = 0;        // replace '0' by 'NULL' if it shall be a C program
  int dataarray[5] = {15, 3, 1, 20, 7};
  for (int i = 0; i < 5; i++)
    mylist = insert_element_in_ascending_order(mylist, dataarray[i]);
 
write_mylist(stdout, mylist);
 
delete_mylist(mylist);
}



The brown parts should be easy to memorize because the parts are equal.
The
violet parts show only the used functions of the Sorted Linked List.

The difference between the functions
insert_element_in_ascending_order(...) and insert_element_in_descending_order(...) is that the three red '<' and '>'
signs change their direction. That's all.

This program uses words like 'data' and 'before'. You should visit one of the following pages here:
- Official Webpage of Brent Spiner
- Official MySpace page of Brent Spiner
- Official Twitter page of Brent Spiner


Many thanks!