Archive | Programming RSS for this section

Portfolio Website

Pretty late post tonight, but sometimes I just get sucked into work and I don’t even feel like I need sleep!  I have started work on building a personal website that will serve as a portfolio/life update website.  I plan on keeping it pretty minimal, but I didn’t want it to just be a boring white website.  So I am starting to experiment with shapes and vibrant colors to keep it happy.  Without further ado, here is my progress after the first night!

The home page

My about page

My portfolio page, currently empty

Always a good idea to leave yourself open to be contacted!

Well there you have it!  As you can see, there is also a blog link and it links off to this blog.  I hope to add more color, and find a way that everything with work aesthetically.  It will be a whole different issue when I get around to choosing the font type.  Joys!  Any feedback is wanted and appreciated.  I also plan on going to a Starcraft II tournament tomorrow, and I hope to take some cool pictures.  I am excited!

Brett

Web Development Class & A Resource

I have been trying to improve my own web development skills over this break to exceed the skills that our professor has been teaching us.  In about a month and a half we will have to present our web site to the class.  I don’t know about anyone else, but I am a bit competitive and I will be bummed out if my group does not have the best site in the class.

I consider it necessary to have a clean and appropriate look to the website, as well as full functionality and the impassibility that the site would actually go live after the class.  In my groups case, the plan is to make the site a full time site for a Fraternity on campus.  This makes it a lot easier for the color scheme, so it won’t drive me crazy looking for hours for a great theme.  I hope to have the design and HTML/CSS done by the time we start class again next week, that way we can focus on the functionality and the server side programming.

If I get something up and running that is semi presentable I will post it here, and hopefully get some feedback.  But before I go, I want to leave this link to a pretty good resource.  This is especially good if you are just starting out with web development and it helped me work a little more with CSS: 30 Days to Learn HTML & CSS

All 30 days are already posted, so you can work through them at your own pace.  Hopefully someone will find it useful.  Later!

Quicksort

I always find certain algorithms extremely simple yet sophisticated.  And I would have to say that Quicksort is one of those algorithms.  I was working on a bit of JavaScript for my web development and I kind of ended up on a tangent that had me wanting to be able to search through a bunch of numbers to see if it is included in the data.  So I figured I would use Binary Search to find it, but then I remembered that I would need sorted data for that to work.  Because I knew I wasn’t going to get pre-sorted data I would have to take the information as an array and sort it on my own.

Anyone who has studied algorithms knows that the other options that come to mind are usually selection sort, insertion sort, bubble sort and mergesort (from a basic algorithms class.)  The first three all share the same worst case performance of O(n2) and both insertion and bubble have a best case performance of O(n).  Merge sort and Quicksort are both O(n log n) in the average case, and I wasn’t to worried about a stable sort so I went with Quicksort.  I looked it up online to make sure that I still remembered the concept, but I have never written a Quicksort algorithm.  I will first post some pseudo code for a Quicksort and then I will talk about it and follow it up with my JavaScript implementation of the algorithm!  Lets get started:

 

Pseudo Code

function quicksort (Array A)

    if length of A <= 1:

        return A

    get pivot value.

    remove pivot value from array.

    create empty arrays less and greater.

    for x in length A:

        if x <= pivot:

            append x to less
 
       else:

            append x to greater

    return concatenation(quicksort(less), pivot, quicksort(greater))

The Explination

The idea is that you take the unsorted array (or list) and pick a random index to use as the pivot value.  Then once you get the pivot value, you remove that value from the array so you don’t compare the value to itself.  Then for all other values in the array you compare them to the pivot value.  If the value in the array is less than or equal to the pivot value it is to be stored into the new array called less.  Otherwise, it is stored into the new array called greater.  Pretty straight forward.  The interesting bit comes in with the use of recursion.  The return calls the quicksort function, this time on each separate array.  It concatenates the answer to have the new sorted less array, followed by the pivot value (which is now in its final spot), and then the sorted greater array.

Pretty cool right?  This is called a Divide and Conquer algorithm because it is splitting the data that needs to be sorted into smaller and smaller subgroups until the problem is solved! This can be adapted for any language you are working with, and as promised here is my code that I wrote using JavaScript to implement this algorithm.

 

The JavaScript

//The quicksort function that allows the binary search to work properly.
function quicksort(numData)
{
    //returns the array if only one element or none at all
    if(numData.length <= 1)
        return numData;

    //creating the two new empty arrays and an index var
    var less = new Array();
    var greater = new Array();
    var i;

    //picking a random pivot point
    var pivotIndex = Math.floor(Math.random() * numData.length);
    var pivotValue = numData[pivotIndex];

    //remove the pivotValue from the array
    numData.splice(pivotIndex, 1);

    //now for the rest of the array, put the data in the correct subarray
    for (i = 0; i < numData.length; i++)
    {
        if (numData[i] <= pivotValue)
            less.push(numData[i]);
       else
            greater.push(numData[i]);
    }

    //recursivly calls quicksort as well as concatenates the answers
    return quicksort(less).concat(pivotValue,quicksort(greater));

}

Conclusion

I hope that this helped you understand a little bit more about the Quicksort algorithm, and hopefully you can now implement this as well for any of your sorting needs!  If you have any questions, or need some clarification, let me know!

Android Project: Grade Tracker

I finally found something that I would want to write for myself.  It is hard to think of useful apps sometimes and I want to make something that I would want to use as well.

I noticed that the Professors at my University really do not like to keep our grades updated on our portal, and I hate that feeling of being in the dark.  Sure I have a rough guess of what I have, but the grades I receive are usually strewn all about my room throughout the semester (I am willing to admit that I am not the most organized when it comes to desk space.)

So how to fix this problem?

Easy!  I create an application that is simple, and keeps track of my grade as I progress through the semester.  This would require 3 components: Class separation, Grade Entry, and Weight setup.

 

Class Separation: This lets you set up each class individually, and there will be a nice menu set up to choose which class you would like to view.

Weight Setup: When you create a new class, you will be prompted to enter the weighing of the class (ie 40% quizzes, 10% hw, etc.)

Grade Entry: Within each class will be the option to enter a new grade, and to place it in which category (Such as Homework, Test, Attendance…)

 

Using this as a framework, I will be able to set up a light application for an Android phone that a student can keep track of their grades as the semester progresses.  Rather than thinking I have an A, I will know the exact percentage that I have!  I think that will be really useful in the long run and I will know what classes I am falling behind in so I can up that GPA


Weekly Update: School, Android and Web Dev

I want to blog regularly so I will probably drop in at least once a week just to chat about what I have been up to!

Between the last two weeks it has been quite busy for me.  I had my first round of test spanning these last two weeks, and I have started to learn how to develop an Android app. While I have been working on ScratchPad and some new features (I have a basic calculator!)  I decided that what I really want to do before I graduate is to get my own app on the market.  While I don’t expect to make any money off of it, just the idea of telling a friend to check out something that I made really excites me.  So I decided to find some online tutorials for android programming until I have a little cash to spare so I can get a book as well.

If you have not yet, I would check out The New Boston for tech tutorials.  He has created some Java, Python and other tutorials.  But most noted, in relation to this post he had someone do 200 Android tutorials.  Yeah, 200!  I am currently on 21 right now, and hope to get another chunk done this weekend.  So far it has been a blast just running something on an emulator, and I can’t wait to have all the tools to create my first app (which is still in its planning stages!)

Last but not least we put in our Web Development project idea yesterday.  Since one of our group members is in a Fraternity, we are creating a website to help him and his brothers out.  We really wanted to make something that would end up going live at the end of the process, and not just sit and die in a folder so we decided to make something people would actually use.  I am going to write about some of the design and decision process we go through, as well as the actual coding and execution of the site.  So if you are interested in Web Development, be sure to subscribe to keep updated on that!

That is pretty much all for this week, and I will pop in this weekend to talk a little bit more about Android if I feel like there is something worthy of talking about.  If you have any experience developing for Android and have any tips, I would love to hear them!  Until next time.