• Links Round Up for 10/31/10

  • | |

    Quick Tip: User Level Themes for Client Site Reviews in WordPress

    Recently I launched a couple of websites using WordPress and instead of using a temp directory for testing/client review, I used a plugin & theme instead. Using this technique I didn’t have to worry about moving directories, changing the WordPress directory/blog URLs,  or checking image sources in posts. Here’s how I did it.

    Read More “Quick Tip: User Level Themes for Client Site Reviews in WordPress”

  • | |

    Create a Temp/Splash Page in WordPress

    Often times I will be working on a WordPress theme that I want to live test, but I don’t want to reveal it to the world yet. The solution would be to throw up a temp page while you work. However, you may have noticed that throwing an index.html file in the WordPress directory or similar solutions break WordPress. Today I’ll tell you how to get around that.

    Read More “Create a Temp/Splash Page in WordPress”

  • | |

    Directory Handler at Theme Forest

    I’m happy to announce my first Theme Forest component, Directory Handler. it’s a simple set of 2 classes that handle (in several ways) listing the contents of a directory. The main class, DirectoryHandler, includes several functions that:

    • Get and/or print the entire contents of a directory
    • Normalize the name of a file or directory (replace special characters with spaces)
    • Return the extension of a file
    • Return all of the files of a directory in an array
    • Return all of the sub directories of a directory in an array

    TheImageDirectory class extends the functionality of DirectoryHandler by changing the get and print directory functions to:

    • Print a thumbnail version of the image
    • Integrate lightbox for easy image viewing/browsing.

    You can view a live demo here and Download the full documentation here.

  • State Drop Down box

    Today, working on a project, I searched for a ‘State Drop Down Box’ for a form. Believe it or not, I couldn’t really find one, and had to ‘borrow’ own. So figured why not add one that is easy to get to my site. on top of Code I have added ‘Code Cips as a category, and for this post, the slug is state-drop-down, so the url should be https://casabona.org/?p=state-drop-down/. Easy enough, right?

    Just copy and paste*! When processing the form, the variable name for it is ‘state’. Later!

    *OK- it’s not showing up right in the textarea, but it will in an HTML doc.

  • Writing a User log-in

    Here is the user login code I have been promising. It’s an image so it looks nice. You can download it at the bottom of the post. Keep in mind- This must be placed before the head tag in the page so if cookies are created, they can be…

    This might not be the most efficient code, but it does work. To get the actual code, click here. And if you do make it better, please let us know in the comments! Later

  • Types of classes, part 2

    Today I will continue my series on classes in Java. To review where we are, you can read this post.

    First of all, we need to add a couple of methods to our class. There are two other types of methods in classes: reporters and mutators. A reporter does exactly that. As you might notice, our instance variables are private, meaning that only that class can see it. So if we want to know certain information about the student, we must write a method that looks at the variable in question and reports it. A mutator method changes the object in some way. So, that being said, lets write a couple of these methods.

    ………..

    public String tellName(){
    return name;
    }

    public void computeGPA(float newAvg){
    float oldAvg= gpa;
    gpa= (oldAvg+newAvg)/2;
    }

    Here, we have added two methods to our class- a reporter and a mutator. Our reporter, tellName, looks at the current value of String name and returns it. Since we are returning a value, the method must be of the type we are returning. It is public so it can be accessed from outside our class. Now, here I just wrote one for name, but to get the other values (age, gpa, status), you must write a reporter method for each variable, as it’s respective type (an age reporter would be of type int).

    Our next method is a mutator that figures out a new gpa. This is a simple one that accepts a new GPA from the client and averages the new and old one together. This method is not returning anything, just doing a calculation, so it is a void method. It is accepting a variable of type float, which we declare in the parentheses before the do work in the method. Then we perform the calculation. We declare a new variable called oldAvg that gets the value of gpa, and then we assign the new value to gpa.

    That is all there is to other types of methods. They can be as simple or as complicated as you see fit. Next time, I will talk about inheritance and extensions. Later!

  • Types of classes

    Today and over the last couple of days we have been talking about classes in Java. I’m fairly certain I understand them enough to now talk about them here. Tonight I will introduce them and continue the discussion later.

    Basically, a class “consists of a collection of types of encapsulated instance variables and types of methods, possibly with implementation of those types together with a constructor function that can be used to create objects of the class. A class is a cohesive package that consists of a particular kind of compile-time metadata. A Class describes the rules by which objects behave; these objects are referred to as “instances” of that class. …” In basic terms, it is the blue prints of an object. Inside of a class, you will find instance varibles with values, methods to manipulate these variables, and constructors of those objects. If we were to make a class called Student , it might look something like this:

    public class Student{

    private String name;
    private int age;
    private float gpa;
    private char status;

    public Student (String stuName, int stuAge, float stuGpa, char stuStat){
    name= stuName;
    age= stuAge;
    gpa= stuGPA
    status= stuStat

    }
    public Student(){
    name= “”;
    age= 0;
    gpa= 0.0;
    status= null;
    }

    }

    This class has 2 methods- both constructors- and 4 instance variables in it. The variables are initialized, but have no values. This is where the constructors come in. The first constructor for Student has 4 arguments sent to it. One for name, age, gpa and status. The constructor takes these 4 values sent by the client (NOT necessarily a user) and applies them to our 4 instance variables. The second constructor, which has no arguments, simply creates an object where all of them variables are set to nothing values.

    For right now we only have constructors in our class. Next time, I will talk about other possible methods for our Student class, and subclasses that might inherit out Student class. Later

    PS- to read ahead, and check out the counter class we have been working on in class, you can find it here
    I know this was a little rushed, so if you have any questions, feel free to comment them or email me.