More fun with Java 1.8 -ASCII “Art” 101 using Arrays….

This is the type of assignment I would hand out to first year programming students. After introducing the idea of lists, I implore them to solve the following:
Use a list to build an ASCII pyramid using the character of your choice and make it: a) appear “pyramidal” that is, no leaning, no right-angles at the base and give it some semblance of aesthetic quality b) your logic should generate EVERY level of the pyramid, that is, no coding “special cases” for the top, middle or bottom rows. The logic must hold sound to construct the entire pyramid as a stand-alone algorithm. c) print your src (source code) and the output of your program to prove to peers that it works.

    This task requires careful dissection of the elements involved:

  • variable number of rows
  • each row knows how many spaces to print and how many characters
  • this involves logical analysis for the left spaces, the chars AND the right spaces
  • The algorithm must know when to “endline”/”newline”/
  • Careful analysis and monitoring (QA/QC) of the variables during runtime may be needed

For the seasoned programmer this is fairly basic, but involves core mathematical concepts, an element of basic aesthetic design and a good grip on list variable storage; how they are both computed and sent to an output stream (System.out in this case) This is the rough equivalent of “cout <<” for you C/C++ guys

    For extra credit:

  • Add a user-interface to ask the user how big to build the pyramid. Include exception-handling for pyramid sizes that are not technically “pyramids” (height = 1 is not a pyramid) heights too large will lose their aesthetic, or their pyramidal structure entirely if built too large or too impractical for the user’s display. (I capped mine at 50 rows) – add warnings depending on the user interface).
  • Decorate the pyramid with one or more random characters in addition to your “foundation” block (I used hashtags for my foundation block).
  • Invert the pyramid.
  • Stack the pyramid atop the inverted one to make a diamond shape…make sure it lines up evenly. No bumps or other strangeness in the middle.

Here is a sample solution; note that I carefully tracked line size, space, building-block-count, row-count & the storage of each…this is crucial to accuracy and QC testing during development time.
This is an acceptable output:

a snap of the pyramid program in-process using the Netbeans IDE
seen w/in the Netbeans Integrated Development Environment. “I design them.”

 

Here is the source code – note brevity in my solution– ~20 lines-ungolfed!:
/*
author: Chris "Tapper" Welke
This program generates an ASCII-art 50 row pyramid using hashtags as a building block.
Solution provided for instructional/informational purposes in the areas of lists,
integers, type-casting, dynamic memory allocation, and open-source programming. If you
are new to Java, this is an excellent trial pgm to get you started.
Dist. under the GNU Public License. Free to distribute: please attribute though, ok?:
Last Stable Build: 5/23/15 at Tapper7.com and Self-Similarity Studios courtesy
The Netbeans (Netbeans.org) IDE, Java 1.8 and the std. javac compiler
OS: Win 8.1, Chipset by Intel. Laptop by Hewlett-Packard. Website provided by Media Temple
*/
package learn;
import java.util.Arrays;
public class HashTagASCIIPyramid{
protected static int charlinelength = 100;
public static void main(String[] arg){
float[] asciiStorage = new float[HashTagASCIIPyramid.charlinelength];
int totalHashtags = 1; //initialize builing block total
int charCount = 0; //count building blocks for QC testing
int[] cclist = new int[100]; //record the char generation as it happens
int leftspaces = (int)asciiStorage.length/2;
int rightspaces = (int)asciiStorage.length/2;
int height = 1;
for(int i = 0; i < asciiStorage.length/2; i++){
for (int l = 0; l < leftspaces; l++){
System.out.print(" "); charCount++;
}
for (int t = 0; t < totalHashtags; t++){
System.out.print("#"); charCount++;
}
for (int r = 0; r < rightspaces; r++){
System.out.print(" "); charCount++;
}
System.out.print('\n');
/*QC Tracking: height++; cclist[i] = charCount;*/
leftspaces--; totalHashtags +=2;rightspaces--;
}//end mn loop
}//end mn
}//end class #asciipyramid

Hints: I used space-fillers for the spaces (” “); – left and right brackets plus lots of variable outputs to see what was going on during run-time, my initial design yielded the following output:
run:
pyramid test1
WHOOPS!
Heh…so clearly there were multiple logic faults, (and I started with tildas, not hashtags….) but it was easy to track the movement of the left and right brackets that debugged the left and right SPACES and not shown are my debugging outputs that checked the length of each row for consistency(it was going over and under 100 – keeping the length of each row equivalent was key to my particular legitimate solution)— also that my iterators and arrays were misplaced and thus not controlling and the output correctly.

    Keys to victory:

  1. increment blocks by TWO; not one
  2. decrement spaces and increment blocks OUTSIDE the main loop rightSpaces--;leftSpaces--totalHashtags+=2;

Coming soon: Bill’s adventures at Los Alamos, More Netbeans experiments, tutorials and anything interesting that happens when I have my camera on me.

Lots of great ideas in the works…and let us not forget: Summer is Coming …. Go Santa Clara and Concord! Support your local drum corps by playing bingo, going to shows, donating your time, tailgating at shows and screaming your lungs out when corps brings you to it on the Field of Honor. All signs point to a another stellar season for Red and Blue Banners both; and I wouldn’t have it any other way (scratch that….I’d resurrect Bridgemen, Suncoast, Big 27, Star, Kingsmen, The Freelancers and The Velvet Knights) THEN it’d be roll-out time.
Under the circumstances, putting all politics aside; Thank God for Rosemont, Rockford, Madison, Garfield, Bloooooo, SCV/BD, Cru, Spirit and all other remamining “Big Time DCI” corps still in the hunt, still rockin’ it…gettin ready for the only kickoff I really care about: Memorial Day Weekend. A trial by fire where those who make it through will be ready for the best summer of their lives. Hang in there kids, you got this!
Music, Tech, Art, Love and Life; find it all right here at The SoCal Picayune. Your LA/OC home for Drum Corps, Culture, tech-security, experiments and solutions, the occasional off-color joke, scam-hunting, YT highlights and the best (and worst) direct from the minds of this writer, Tapper and Bill Feynman.
Maybe a Memorial Day Anecdote will inspire itself as we begin the approach. hmmmmm…..
[] Support my sponsors! All are reviewed regularly for legitimacy by the Senior Ethics Auditor: moi

Quick Update: Cal Poly, Site Update, Project Status Reports etc. et. al….

An image of a granite welcome sign near the western edge of campus- a vandal has added "burying the past to protect our future"

Hello Reader!

Thx for stoppig by…this is an old-school, (almost! teehee..!) txt only what-up post…..
Interesting news development directly related to
The Cal Poly San Luis Obispo News Archive
can be found at The California Register. Read it. Like actually read it. There you go…

Youtube and German Soccer League:
Dropped bogus Copyright claim….
“The Love Theme” from “Dances with Wolves” arr., performed, recorded, filmed, edited and published by Chris Welke in honor of Dominique Mainon (1971-2012) is safe locally and viewable on Youtube by anyone at anytime.
There is no me or anything worth reading BY me w/o her guidance and wisdom.
Please visit her author page on Amazon-film buffs will not be disappointed.
All book purchases benefit her memory and your film-knowledge-base.
Your book collection will also benefit- it’s Value_Add CITY!

Podcast: coming soon – to integrate w/ this blog to provide decent content. More fun. Less words. Clarity++; Info++; Entertaining^2; Boring–;

More-on: Cygwin, Github, C/C++, C++STL, Linux, GNU, C#, D, R, CodeGolf, Bash, csh, gcc, UNIX, Solaris, Raytracing, Netbeans and Howto’s for all my Technophiles…all day and all night “it’s all good baybabaybeh!!!!” -BigPop
#NOTE: Author of “SonOfSamantha.com” still missing plz contact this site if you have info
…if you ARE her all my assistance/resources/protection are yours.
Much love,
-Tapper

On legitimacy, responsibility and my attempt at both (fully revised)

What makes this Web page legitimate? Should you trust what you read on this site?

NO!!!! Don’t trust any blog site. In general there are common themes in  blogs that are yellow-flags(read but don’t trust), red-flags(main page offers the best product/service EVER at a LOW LOW price, and …blackhat blogs that will attempt to use scripting to take over your computer entirely. If it is a business website they will attempt to strip SSN, Bank routing numbers, credit card numbers, PINS and bleed you dry. There are poorly made attempts at this in the eastern world. There are people who can hack into your BANK (your bank is more more secure than any government agency)…they can still get in.

Don’t even bother…I have everything you need to know if you are seeking approval from Google Adsense, WHY I applied and a primer on responsible ad placement and usage from a professional journalists standpoint who is also brand new to “professional blogging” as opposed to my previous iterations of blogspot.com personal journals I that are still I keep only as archive material to be picked clean for your information and amusement at which time I will index them from the web myself.

There is a metric that gives you a little insight into legitimacy.
tested:
****Tapper7.com rates slightly above average with search engines…it’s how most of you found the site. (thank you for going to page 3, 4 ,5 to find me unless you were looking for “Tapper” or “Tapper7” in which case it will be easier to bookmark it in some way, just take a sharpie and draw it on the drywall.
It has been tested for quality of design and multi-platform functionality by the me obsessively and by several 3rd parties at the client, server and at the reader (user) level. I’m uclear on how to properly state that I’m approved by the Google Adsense program and what it means about me, the site and you. I will try though. I could locate only a handful of requirements offered upon application from the company – and all 3rd party info is shameful attempts to bypass and ruin a system that is certain to become even more exclusive than it was….I should have waited …but im glad I did not, it could easily go on 100% lockdown at anytime now.

If yours is legit—submit it now.

Most blogs are not accepted into this program. They are dedicated to illegal downloads, pirating, compromising online security…..etc. The name and descriptors/categories and other tags do not match the content. Many sites function only as spam-bots. They index every site possible to back link to themselves, appear to have tons of traffic increase their search engine rank and try to scam advertisers or sell a worthless site whose real value is 0 or less than 0. This led to the recent “has verified owner actively posted content for over 6 months?”-TEST.

Malicious sites from China and India are flagged for this, but the rule applies to all domains now.

    Here are some metrics Google used to audit this site:

  • Is documentation avail. proving author-ownership of the site?
  • Is there is easy to contact The Webmaster of Tapper7.com?
  • Is his name, address, email, age verifiable?
  • Does this site meet design standards?
  • Is the content and design w3c compliant?
  • Is the site growing? Does the site meet a minimum standard of audience size?
  • What is the ratio of new vistor/returning visitor?
  • how many pages do they visit?
  • how long do they stay?
  • Is it easy to navigate?
  • Is content structured by category? does content match these categories?
  • Is there a sub-index of tags for quick-access to other subjects in the posts?
  • Is it structured in abstraction layers making it easy to index?
  • Is a standard format used?
  • does the code he used indicate an working knowledge of communications via the Web?
  • Is the author’s really written by the stated author?

All of the above can be verified by a big-ass algorithm and processing power. In the spirit of being honest with my audience, I added a metatag to the site that IDs it as “Mature Content,” I deal with mature themes like violence, murder, rape, drugs, and I have a tendency to veer into jokes that are in poor taste, are offensive, contain racism or misogyny…everyone gets bashed EQUALLY. No one is safe from my jokes or my criticism. It’s all clearly labeled up front in my visible text and embedded so your browser can see it. Parents can set any browser to exclude my site because I tagged it as “Mature”—-Google will not approve “Adult” sites…by that they mean sites that publish pornography.. I didn’t look up any of these rules. I submitted my site for the highest level of validation available on the internet….it was approved by an extremely complex algorithm that everyone else claims to understand. I don’t understand it myself—-> but I can deduce most of what data it vacuums up, how it process the data and the parameters and probability of APPROVED vs. CHANGE & RESUBMIT. I don’t know how long it takes if you aren’t approved on the first try – I believe it is three months. (???) The probability of a random blog being approved is <1% or maybe zero. A completely legit site …probably better than mine in every way..will not violate the written rules, but nobody has the real algorithm – if they did it would be OBS w/in a week

Ethically I have a duty to tell you that I’ve enabled Google to post advertisements on this page and others. I clearly label every section that I allocated ad space to per SPJ code of ethics. ads are allegedly targeted to the demographics of what I post and who reads it. Most readers are educated, lower-middle to upper class, open-minded, interested in technology, always learning, tolerant and intelligent….w/o those qualities you wouldn’t “get” this site. 3rd parties I’ve allowed to post ads are carefully screened by Google…are they as legitimate? SHIT – BEATS ME! They are safe though. to be on my site…some of the pages load a tad slower, ill be ill be working on that to improve the experience for everyone associated with Taaper7.com.

In addition to class, readers predominately reside in LA/OC, the Bay Area, Chicago and New York. Without specifying company names-  I noted a specific brand of a major American car company, a high-technology certification program located where many of you live, a brand new high-end-mobile phone, an expensdive men’s clothing line, a post-graduate software engineering certification, a master’s degree Accounting program and an MBA program.  It confirms what I had always assumed was true of MOST readers. My target demographic.


Continue reading “On legitimacy, responsibility and my attempt at both (fully revised)”