FINALLY! SOME UPDATES! This website is being reconstructed. Some content will go away soon. If you want to see my new stuff, visit my github: https://github.com/jrcharney/.

April 29, 2012

Here, have a program!

In the next few days, expect more programs to be uploaded. Today, I submit to you new_c.sh! This wonderful bash shell script in the product of a few months of forethought and one day one finally coding it. It would have been here sooner, but great programs aren't always though up overnight.

new_c.sh (or as I've put it in a directory devoted to C/C++ projects as ./new is probably the most complex of all my "new" programs. If you haven't explored the hierarchy of my site yet, I wrote "new" files for Java, Perl, PHP, and Bash about a month or so ago, but I don't think they are as nice as this file I just wrote. All of these scripts are designed to generate files with as little mental though as possible. You focus on writing the program rather than remembering how to write the program. It's ideal if you know a few programming languages, a CS student, or someone who is looking for a template to start a program.

To use this program, you type in the path of the program (even if it is not defined) and the file name. You can add another extension or a "main" to tell the script to insert code used for modules and main program files. Let's show how that works with a few visible examples in the shell.

$ ls
new
$ ./new test1/demo1.h		# this works similarly with demo1.c or demo1.cpp
$ ls
new  test1
$ ls test1
demo1.h
$ ./new test1/demo2.h c
$ ./new test1/demo3.c h
$ ./new test1/demo4.h cpp
$ ./new test1/demo5.cpp h
$ ls test1
demo1.h  demo2.c  demo2.h  demo3.c  demo3.h  demo4.cpp  demo4.h  demo5.cpp  demo5.h
# ./new test2/demo6.c main	# this works similarly with demo6.cpp

OK, so what's so great about this? A program that creates another file? Consider the contents of these files. When they are created, they have their own headers (all of them), they are set up for modules (demos2 through 5), they have their own main function (demo6). I'll admit this is a start and to some programmers you may claim doing this is easy without this script. It is, but if you want to have a uniform system (which you should) to create files, wouldn't it be much better typing in a command that does this for you rather than making work for yourself?

If there is one thing that I've learned over the years, it is that documentation doesn't need to be elaborate but it is necessary. Just be sure to write the name of the file, the date, your name and email address, and a little bit of information about what the program does and do likewise with any methods, classes, or tables you define along the way.

It is also important to know that scripts like this one are works in progress. I wanted to make a version of this to write files for OpenGL source code, but it's been a few years since I did some OpenGL. Nothing going back to some old notes I have won't jog my memory on.

I've yet to define "new" files for several other file types including HTML5, CSS3, JavaScript, JavaScript for Canvases, Python, XML, SQL, and maybe even Ruby if I feel like it. I'll assure you this week, programs that are uploaded will get more complex. They will also be compilable so as long as you have version of the GCC compiler via a Linux, UNIX, or BSD distribution, Mac OSX, or if you have Cygwin or MinGW on Windows, or better yet find a service online that offers SSH (free is OK, but webhosts like DreamHost also offer SSH as a service) and use an SSH program like PuTTY to connect. Just make sure that the server is UNIX, BSD, or Linux based.

I'm considering uploading some of my scrap programs used to try out features of a language before using them in code. I've had these on my computer for about a couple of years, but didn't feel like they were professionally written enough to put in the files directory. The uploaded version should be cleaned up enough to impress some folks.

Tomorrow, expect to see one of my favorite shell hacks that Linux, UNIX, BSD, and probably OSX users can do, but you probably won't see it on Windows shells: COLORS in your code!

April 18, 2012

Ideas for the Future

It's been about a month since I last updated this site so there's much to catch up on.

I had some ideas today for what I'd like to to with this site.

Firstly, modify the blog entries to be more XML based. Though I'm used to doing this with XHTML, I'm sort of wondering how this would work with the new HTML5 elements. It's an experiment I'm really interested in trying as it would allow posts to be viewed individually in the future, tag lists to be added, publishing control (published and drafted), and make posts searchable from within this site. It's been something I've been interested from the start.

It would also pave the way for a search engine idea that is part Google and part Shimmie, an imageboard software that allows users to refine their searches by adding terms and excluding them. The combination would be a throwback to Northern Light back when their search engine features were public.

If anyone remembers who Northern Light was back in the Dot-Com Era, they were the search engine that claimed they were "U.S. Patented" with blue folders that filtered search results. To me, I thought this was a good search engine as the blue folders where related terms that were often used in other searches.

Shimmie 2 behaves somewhat similar, but it's applied to a list of images that are part of an image gallery that users have to submit pics. So far, the use of Shimmie has been used by anime geeks what appears to be some folks with a lot of free time. (Let's not elaborate for what. The Internet can be creepy at times!)

A better use for the latter would be to apply it to webcrawling or as search engine. For now, I think either modifying it or creating something similar to combine with the simple Tumblr-esque features that I'd like to use with this blog. Eventually using Shimmie as an example would also be idea for its original purpose (as an image gallery) and to present files for projects. I've decided to study its data structures as it would be beneficial and a breathe of fresh air compared to Wordpress's need to track and tag everything.

If fact, that brings me to my biggest point about the search engine idea: NO MORE TRACKING! At least not for Joe Six Pack who just wants to find whatever he wants. Spam keywords will definitely get you tracked. As much as Google likes to follow people around for "marketing purposes", the civil liberties folks have reason to be wary about Google's intentions. Not because of Google itself specifically, but because of all the corporations that are not Google who are trying to leverage governments into having Google fork over their data so that these other companies can cast influence upon others.

A website called Duck Duck Go has been getting a lot of praise lately for not tracking users and for not "bubbling" users within a set of common search results. The pitfall with Duck Duck Go is that it still relies heavily on Google and Bing for many search features. If Duck Duck Go really wants to impress some folks, they would create their own spiderbots (programs that search the web for web pages) and not be influenced by outside entities that have been trying to control and censor the Internet as of late.

On your end, you can easily stop the tracking by major search engines by modifying your ad-blocker to deny Google Analytics, and what ever Bing uses that is similar to Google Analytics. You can also tunnel your web connection through a proxy server. Basically, this is what Duck Duck Go does. It searches Google and Bing for you so that the big search engines track them instead of you.

So if there is no tracking and no bubbling, and definitely no DATA STORAGE--of which if you're going to need a lot of expandable, well-ventilated space if you're going to track so much information generated by people every day and just as much energy to run it all--there's no reason for companies like Google and Microsoft to buy up all this extra land to fill it with trailers full of energy-chomping servers and air conditioners for other companies that aren't tech savvy enough to hire a hacker to grab the data for free instead of doing it the legalese way where lawyers, judges, and juries have trouble picking out a computer at Best Buy just to make Google and Bing work for them instead of the way things currently work the other way around.

This would seem like a project that anyone can do (and has been done many times before by college students out of their dorm room) who have the knowledge and a few friends who are business majors and law majors to ensure that neither large businesses or their lawyers can take advantage of their technology as if the programmers who made the new next thing were naive. In reality, programmers are pretty aware of how one company with an obsession for software patients can easily hinder the technology of the future Yahoo!, Facebook, or Google simply to preserve the status quo. That's worked so well in Detroit with the Auto Industry. I can't imagine the implications of such a thing in Silicon Valley!

Perhaps we should ask Oracle that once they are done suing Google over the Android operating system that's been using Java well before Oracle bought Sun Microsystems for the purpose of snagging MySQL.

So there's much to think about in the future for this website, the Internet, and computing in general. I'd just really like to get started on working on a project like this with a few other people.

This weekend's project will be to wrap up the Numerical Analysis program I promised. It's currently being prototyped in Perl, but I'd really like to migrate the good parts back to C++. After that, this beautiful HTML Canvas idea that I sketched up last week.

It's a busy day tomorrow. And I'm looking forward to it.

March 24, 2012

Division Algorithm

Last week, I had mentioned I wanted to develop a math related program to go along with the whole "Pi Day" celebration. I intended to write it in Java. I ended out writing it in C++.

It deviated into another programming language when I couldn't recall what Java does to invoke exception handling. I can use exception handling just fine in C++, PHP, and JavaScript. But I guess I haven't been programming enough Java to know all of Java's predefined exceptions. That is one of Java's pitfalls. Just everything is defined for you right about at the time you'd rather make the discovery on your own. In this case, I wanted to demonstrate how computers divide and find square roots (or nth roots for that matter).

I think what really has me in a bind is that some of my job leads wanted me to know Hibernate and Spring. That would be all fine to work with if Eclipse wasn't such a Leviathan to work with and the software developer though about everyone who doesn't use the Enterprise Edition of Java.

To me, Eclipse and Java EE is being told that if you want to be a pilot, you have to fly a big commercial aircraft. Where as I have more experience flying the small airplanes (Vim and Java SE) which I am more comfortable with using.

But I can't have "no" in my heart, which has been one of my issues when I look for work to apply my skills. It's a challenge I am working to overcome. I mostly do it because I'm quite timid with working for someone who expects me to know everything and perform some sort of alchemy to spin thread into gold and to make a lot gold immediately.

What I do is not magic and is not done instantaneously. Rarely is great software written overnight by one person with no support or co-workers to fall back on when things are tough or when you need to know how to do something to make your task work. If you have ever seen the movie The Social Network, even Mark Zuckerberg had to rely on Eduardo Saverin, Dustin Moskovitz, and Chris Hughes to make Facebook possible. It was not a one person gig. The same can be said about Microsoft, Apple, Google, or any other successful software or hardware company in existence.

These things don't take off from the ground by having some guy with an MBA just hire some guy with a CS degree to create everything for him especially if it is something an IT person should be doing. A more responsible person hires several people, each with a unique talent or forte to assemble to components that can be put together to create the software he wants to sell. The maestro needs to assemble his orchestra and practice before he can invite the public to the concert.

Today, I am sharing one of my solo pieces with the audience.

Computers, by their design, can not divide. They can add, subtract (by modifying addition), and multiply. But on their own, they can not perform the most complex of the four basic arithmetic operations: Division. Even when they can divide, it takes at least four times as many clock cycles to complete division than it does for addition or multiplication. Part of the reason is that division requires modification of the division, to turn in into multiplication through a set of calculations using a method from the field of numerical analysis called the Newton-Raphson Method. I hope in the future to modify this post to explain it mathematically. The best I can do is come up with a video on YouTube in the near future that will describe the mathematics behind it. But for now, let's stick with the code.

After I attempted to try this with Java, I retried my method by writing it on a TI-83 graphing calculator. It was during this phase, I realized that instead of letting the pick the number to use to guess with, the computer--rather the calculator--could do this.

Since our Newton method formula requires that we turn division into multiplication by multiplying the dividend, or numerator, by the reciprocal of the divisor, or denominator, of which the key part of the division is finding the reciprocal of the divisor, all guesses had to have been a value greater than zero and less than 1. And to start out, our first guess had to be 0.1 (or 1/10). Using the first guess, we could find the value of what the next guess is. If the initial guess was larger than the next guess, such that the difference between the next guess and the initial guess was less than zero, an new initial guess had to be use that was smaller than the present initial guess. To find the new initial guess, we take the original guess and multiply it by 0.1. Thus 0.1 times 0.1 is 0.01. And if that is still too big, we can do that again and get a product of 0.001 and so on until it fit. This will go on so as long as the guess is greater than the precision variable or if the next guess generated was equal to zero.

When the reciprocal was discovered, it would return the value to the division function by multiplying it by the dividend producing the desired quotient answer.

So, submitted for my portfolio, with a downloadable version coming shortly, I present my division program.

division.cpp - Division Algorithm (Teacher, please report cheaters. I worked hard on this one! --J)

A more advanced version of this program including a algorithm for nth roots (as I previously stated) should be coming soon. I just want to use the methods in this program in the other program and for polynomials in the future. Who knows, I'll probably throw in some OpenGL graphics. For now, this works. I will produce more programs like this in the near future.

March 13, 2012

Numerical Analysis for Everyone

Chalk up another set of examples for my portfolio.

I spent most of the day today digging up some of my Numerical Analysis stuff from the past few years. Mainly the simple stuff involving the Newton-Raphson method for finding roots and reciprocals of numbers without the use of division. I though about how logarithms would use this method such that computers could do logarithms, but everytime I derived the divisor for Newton's Method, the logarithm function kept showing up. So, I'm going to have to shelve that for now.

I'm also interested in redeveloping a polynomial program that I wrote in C++ and this time letting Java handle that too. Perhaps apply it to some sort of application like encryption, factoring polynomials, drawing Bezier curves in HTML5 Canvas (yeah, there's a function that does it but I'm interested anyway), among other things.

Tomorrow being Pi Day, I'd though I'd give my Java skills an online exercise with some numerical analysis. And share the two iteration steps that have long since been forgotten.

I think the spring air is what's got me motivated and full of energy to do things lately. If I ever get around to it, I think I should sketch out some ideas for an app that allows users to post files (or photos) from their phone to FTP. (I wonder how the guys at Blogger or Tumblr do that?)

I'd still like to post math formulas on here. But I'm thinking of just scanning the paper I wrote my notes down this afternoon on to here. There's not a whole lot else going on at moment.

March 12, 2012

Entity Relationships

Today is a slow day. I know I have better things to do but for some reason it is so nice outside. (I should really upload some pictures later. Stay tuned for that!) It just makes you want to slack off.

Case in point, today's post is part slacking-off and part portfolio submission.

If there is one of the few joys in life it is being able to set aside $8 each month for a Netflix subscription. Netflix offers a lot of content that just doesn't seem to be aired on TV. Perhaps there's not enough interest. But more than likely, it is cheaper to just hire some people nobody is interested in to create a crappy reality TV show. ("Today on the History Channel: Rednecks making moonshine! It's tradition!" Seriously?)

Netflix is popular because the audience is in control of the programming. They can watch whatever they want as much as they want as many times as they want. Some ISPs, especially the Kardashian-controlled Comcast, don't really like it because it is an alternative to watching their family trainwreck on five separate channels (E!, Bravo, Oxygen, Lifetime, and G4?) that nobody would watch if they didn't control Internet usage by avoiding necessary equiment upgrades needed to handle such bandwith. And they expect other ISPs to get on board with this. And they wonder why hacking is becoming more popular.

One of the genre's of that Netflix hosts, that TV rarely does these days, in Japanese Anime. While the TV set has people associating anime with kids shows, ADHD, and stereotypical martial arts, the Internet gets to see everything else anime has to offer, which is great considering I've never liked any of the Dragonball series. (Too much yelling and the story is so very slow! A half-hours worth content is streched out for a month with commercials on TV, of which 20 minutes of every hour is devoted to advertising.)

So this afternoon I decided to play around with Dia, which I think I may have mentioned before and how it is like Microsoft Visio or Rational Rose. Today I decided to make a Entity Relationship (ER) diagram mapping out the relationship of the characters from the anime Keroro Gunso or as it is called here in the United States Sgt. Frog. I spent the last couple of months watching this anime comedy on Netflix, which the rest of the series has yet to be uploaded. I really liked it and hope that Funimation can get the rights to the rest of the series.

So today, I was browsing the Internet and I though about how I could create another example for my portfolio. This ER diagram this the product of what happens when one inspires the creation of something else. (See Everything is a Remix by Kirby Ferguson.)

An ER Diagram
An ER diagram showing the relationships between the characters on Sgt. Frog

Sometimes a good idea can be developed from the use of other ideas and those ideas go one to inspire other ideas. The film The Matrix had been influneced by a lot of other science fiction, martial arts films, and anime as Ferguson points out. Yet, because of these influences, a creative blockbuster film was developed. (It's a shame the other two films weren't as much--in fact, don't see the other two.) But that is what made it such an outstanding film other than the groundbreaking special effects and innovative cinematography techniques.

Generally in a more professional element, ER Diagrams would indicate how customers are related to the products they buy. More throughly, how customer information is logged into a database, how products are listed in the database, what products the customer wants to buy, and how they buy them.

The entities (the squares) are generally used to identify objects. The relationships (the rhomobuses) how they are related to each other and generally used to identify actions. Attributes (the ellipses) are used to describe the enetities. I guess if it were acceptable, attributes could be used on relationships too, much like an adverb is used to describe an action.

Perhaps later I could post an ER diagram to describe these objects as they are used in English grammar. We know that in every entity-relation, there are there are the nouns (entities), verbs (relationships), direct objects (a noun/entity aslo attached to a verb/relationship), and adjectives (attributes).

Using these structures, we can develop databases, create forms for webpages, and process data between the client and the server.

Of course, in business, the diagrams would be more complex, which is probably where UML comes in handy.

Tags

Under Construction