MSN Messengar: Quickening@live.com

Sunday, March 16, 2008

The Twelve Commandments of Having Nuffnang Ads

I actually posted my old homework assignments in this blog, can you believe it? Reasons to it pertain as insurance; a lot of kids tend to look up online for homework answers. It’s all for blog traffic, of course.

After all, I got me a shiny new advertorial campaign! Whoo-hoo!


My Friday’s special... I can post this here, right? (eeep!)


I didn’t expect a second one so soon after my very first one; I had thought the one before was a fluke. Me blog ain’t really so hot as if you check out them big names like Estherchin or 3POINT8.

But hey, when ad marketing calls, I iz answering to ze call of ze ka-ching!

Never said I wasn’t mercenary. Still, there are some lines I won’t cross (maybe a toe or two on it). Just for a bedtime mantra, I’m wrote a discipline list about the rights to being a Nuffnang-Ad-added-blogger.

The Twelve Commandments of Having Nuffnang Ads.

1. Thou shall not put ads EVERYWHERE on thy blog. That’s just plain ridiculous.

2. Thou shall not haunt cyber cafes just to click thy own ads. It actually costs more to do that.

3. Thou shall not mess with thy busy officemates by calling over thy cubicle, “Aiyo c’mon, click-ler!”

4. Thou shall also not bother thy friends, family, neighbours, colleagues, instructors, shop owners and random strangers-on-thy-street about thy blog unless thou are actually blogging!

5. Thou will stop messing with thy public PCs’ Internet browsers by changing home address properties.

6. Thou shall click thy own ads thyself and not make bad funny of the advertising of thy ads; even if thy opinion is too true.

7. Thou may be overly sexy with super high visitor count and living in exotic South America, but thou shall still only be paid in Malaysian currency.

8. Thou shall not evaluate thy Nuffnang stats in pitying results as compared with dozens and dozens of other overly used blog stat counters.

9. Thou shall not commit exaggerated brown-nosing to thy Nuffnang Team for the ‘Featured Blog’ monthly.

10. Thou shall not prevaricate thy Nuffnang ads when thy ads ended up becoming more interesting than thee *cough*Dreamgirls*cough*.

11. Thou shall nag Nuffnag- *cough*, Nuffnang for income only if thy sure the check is not in thy mail yet.

12. Thou shall have all brag rights about thy income only if thou will belanja dinner to everbody who comments thee.


I'm sorry I wasn't around for the Great Nuffnang Birthday/Pajamas Party. From the snippets I got from blog hoppin', the results was estatic. I'll be checking on various random/expected bloggers for them pictures. PICTURES PEOPLE, YAY!!

PS: If there’s any more you can add to the list, I’m all ears. Not that I shamelessly asking for visitor returns, oh no-no-no-no-no-no-nuuuuuuuuuuuooo...

...maybe. *hehehe!*

Simple Java Programming: Sorting An Array

This is the Java program, MyList, an interactive system which allows users to input the size of an array and the desired elements for the array. The array is then sorted using the java.util package.

It contains the following functions:
- showAscending: using for-loop, it shows the elements in an ascending order
- showDescending: using for-loop, it prints the array in reverse, from last to first
- showMax: it selects the last element in the sorted array
- showMin: it selects the first element in the sorted array
- showPrime: calculates each element in the array using a Boolean expression by selecting an odd number value and divides it within a while-loop. Shows only prime numbers


Flowchart


---START---

public class MyList{

//Main insertion sorting
static void insert(int[] array, int free_pos, int val) {
int pos = 0;
for(; pos < free_pos; ++pos) {
if(array[pos] > val) {
break;
}
}

for(int i = free_pos; i > pos; --i) {
array[i] = array[i - 1];
}

array[pos] = val;
}
//Array command for insertion sort
static void sort(int[] array) {
for(int i = 1; i < array.length; ++i) {
insert(array, i, array[i]);
}
}

//Main Command
public static void main(String args[]){

int x=Integer.parseInt(args[0]);
int[] y;
y = new int[x];

for(int i = 0; i < x.length; ++i) {
int y=Integer.parseInt(args[i]);
}

System.out.println("The ascending is: " +x);

System.out.println("The descending is: ");

System.out.println("The max number is: ");

System.out.println("The min number is: ");

System.out.println("The prime numbers are: ");

}
}

---END---


Output Screenshot *click to see*


References:
J. R. Hubbard, Ph.D, Schaum’s Outlines: Programming with Java, Second Edition, McGraw-Hill, USA, 2004.

Simple C Programming: Alternative to Merge Sort By Using Insertion Sort

Note: Purely informative; just in case this might come up in your exams or something. Sometime ago, I was asked by the lecturer to write and compile a simple C-program.

The backbone of the labtest was to re-create the structure of the Merge Sort, but it was so bloody difficult coding that, with me running out of time, I exploited a loophole in the question.

It didn’t specifically said Merge Sort. I instead used an more extensively memorized Insertion Sort... with extra coding. *hehehe!*

Question: Write a c program to merge two ordered lists of numbers and store the result in a third list.

Answer:

---START---

#include
#include
#define MAX 6
#define MAXTWO 12

//Three lists (listOne, listTwo and listMerge)
//Insertion Sort function
//Merge Sort function


void insertion (int list[],int size);
void merge (int list01[],int list02[],int list03[],int size);

void main()
{
int listOne[MAX];
int listTwo[MAX];
int listMerge[MAXTWO];
int i, j=MAX, size=MAX;

printf("Enter 6 set of numbers for the First List: \n");
for(i=0; i{

scanf("%d", &listOne[i]); //Enter for listOne

}
insertion (listOne, size); //Insertion Sort for listOne
printf("\n\n");

printf("Enter 6 set of numbers for the Second List: \n");
for(i=0; i{
scanf("%d", &listTwo[i]); //Enter for listTwo
}
insertion (listTwo, size); //Insertion Sort for listTwo
printf("\n\n");

for(i=0; i{
printf("%d ", listOne[i]); //Display ordered listOne
}
printf("\n");

for(i=0; i{
printf("%d ", listTwo[i]); //Display ordered listTwo
}
printf("\n\n");

size=MAXTWO; //change size from MAX to MAXTWO

for(i=0; i//Merging listOne and listTwo into listMerge
{
listMerge[i]=listOne[i];
listMerge[j]=listTwo[i];
j++;
}
insertion (listMerge, size); //Insertion Sort for ListMerge

printf("Merged list: ");
for(i=0; i{
printf("%d ", listMerge[i]); //Display ordered listMerge
}
printf("\n\n");
}

void insertion (int list[], int size) //Insertion Sort function
{
int a, b, tmp;

for(a=0; a{
tmp = list[a];
for(b = a-1; b >= 0 && tmp < list[b]; b--)
list[b+1]=list[b];
list[b+1]=tmp;
}
}

void merge (int list01[],int list02[],int list03[],int size) //Merge Sort function
{
int a=0, b=0, c;
//int a = listOne counter
//int b = listTwo counter
//int c = listMerge counter

for(c=0; c{
if(list01[a]{
if(a==6)
{
list03[c]=list01[a];
}
else
{
list03[c]=list01[a];
a++;
}
}
else
{
if(b==6)
{
list03[c]=list02[b];
}
else
{
list03[c]=list02[b];
b++;
}
}
}
}
//Weakness: There maybe some repeating values.

---END---


Output Screenshot *click to see*


It was only after I got passed my semester that somebody finally posted the C-programming codes to Merge Sort on Wikipedia. I’ve already passed and moved on to Java (my lecturer, a good sport she was, complimented me on ingenuity, but she still could only give me an A- score for that).

Maybe someday when C-programming becomes compulsory as a primary school subject, I can tell my little grandchildren how to take advantage of exam question loopholes.

Source: Insertion Sort, Merge Sort

More Weeds...

Add to Technorati Favorites Blogroll.net Bloggapedia, Blog Directory - Find It! Blog Flux Directory blog directory Blog Directory & Search engine Show off your blog Blogarama - The Blog Directory BlogGod Webloogle Blog Directory Blogging Fusion Blog Directory All Malaysian Bloggers Project