Trial

#!/usr/local/bin/perl -w $file = 'your file location goes here'; # must be readable/writable by your webserver's user open (FILE, "+>>" . $file) or die "cannot open $file for reading and appending: $!"; flock(FILE, 2) or die "cannot lock $file exclusively: $!"; seek FILE, 0, 0; my @file_contents = ; truncate FILE, 0; my $counterVar; if ($file_contents[0] =~ /^(\d+)$/) { $counterVar = $1; # $1 is captured by the ()'s in the regular expression } else { $counterVar = 'COUNTER ERROR'; # the regular expression didn't match } $counterVar++; # auto-increment the same variable with 1 # note: with this code, if counterVar is NOT an incrementable number, $counterVar will be set to 1. # that's not necessarily a bad thing. print FILE $counterVar; close (FILE); print STDOUT "Content-type: text/html\n\n"; # this line is always needed! print STDOUT "You are the " . $counterVar . "th visitor to this page. Welcome!
" . "\n"; end(0); JS Counter
JS Counter
JS Counter
VBScript Comment test

Check out these images

Comment test

This is the website

Comment test

This is the website

wikiHow Fan Page

Welcome to My Page!

This is a fan page for wikiHow. Make yourself at home!

Important Dates

January 15, 2019 - wikiHow's Birthday

Links

Here is a link to wikiHow: https://www.wikihow.com

wikiHow Fan Page

Welcome to My Page!

This is a fan page for wikiHow. Make yourself at home!

Important Dates

January 15, 2019 - wikiHow's Birthday

Links

Here is a link to wikiHow: https://www.wikihow.com

Bold text Italic text Underlined text Subscript text Superscript text

Welcome to My Page!

My name is Bob.

I hope you like it here.

/* Program to demonstrate time taken by function fun() */ #include #include // A function that terminates when enter key is pressed void fun() { printf("fun() starts \n"); printf("Press enter to stop fun \n"); while(1) { if (getchar()) break; } printf("fun() ends \n"); } // The main program calls fun() and measures time taken by fun() int main() { // Calculate the time taken by fun() clock_t t; t = clock(); fun(); t = clock() - t; double time_taken = ((double)t)/CLOCKS_PER_SEC; // in seconds printf("fun() took %f seconds to execute \n", time_taken); return 0; }

Ordered List with Numbers

  1. Bread
  2. Eggs
  3. Milk
  4. Coffee

Grocery list

  • Bread
  • Eggs
  • Milk
  • Coffee
Number Guessing Game

Guess The Number

We have selected a random number between 1 - 10. See if you can guess it.

// CPP program to print count of // vowels using pointers #include using namespace std; int vowelCount(char *sptr) { // Create a counter int count = 0; // Iterate the loop until null character encounter while ((*sptr) != '\0') { // Check whether character pointer finds any vowels if (*sptr == 'a' || *sptr == 'e' || *sptr == 'i' || *sptr == 'o' || *sptr == 'u') { // If vowel found increment the count count++; } // Increment the pointer to next location // of address sptr++; } return count; } // Driver Code int main() { // Initialize the string char str[] = "geeksforgeeks"; // Display the count cout << "Vowels in above string: " << vowelCount(str); return 0; } vector times, hits; times.resize(300); hits.resize(300); /** Record a hit. @param timestamp - The current timestamp (in seconds granularity). */ void hit(int timestamp) { int idx = timestamp % 300; if (times[idx] != timestamp) { times[idx] = timestamp; hits[idx] = 1; } else { ++hits[idx]; } } // Time Complexity : O(1) /** Return the number of hits in the past 5 minutes. @param timestamp - The current timestamp (in seconds granularity). */ int getHits(int timestamp) { int res = 0; for (int i = 0; i < 300; ++i) { if (timestamp - times[i] < 300) { res += hits[i]; } } return res; } // Time Complexity : O(300) == O(1) vector v; /* Record a hit. @param timestamp - The current timestamp (in seconds granularity). */ void hit(int timestamp) { v.push_back(timestamp); } // Time Complexity : O(1) /** Return the number of hits in the past 5 minutes. @param timestamp - The current timestamp (in seconds granularity). */ int getHits(int timestamp) { int i, j; for (i = 0; i < v.size(); ++i) { if (v[i] > timestamp - 300) { break; } } return v.size() - i; } // Time Complexity : O(n) HitCounter counter = new HitCounter(); // hit at timestamp 1. counter.hit(1); // hit at timestamp 2. counter.hit(2); // hit at timestamp 3. counter.hit(3); // get hits at timestamp 4, should return 3. counter.getHits(4); // hit at timestamp 300. counter.hit(300); // get hits at timestamp 300, should return 4. counter.getHits(300); // get hits at timestamp 301, should return 3. counter.getHits(301); $sql_call = "SELECT ".$counter_field. " FROM ".$db_table." WHERE ".$counter_page. " = '".$record. "'"; $sql_result = mysqli_query($db, $sql_call) or die("SQL request failed"); $row = mysqli_fetch_assoc($sql_result); $x = $row[$counter_field]; mysqli_close($db); return $x; } ?

Comments