How to kill windows taskbar using VB.net

If you are looking to kill the taskbar in windows, or explorer.exe, the snippet of code below, when compiled, will kill the Windows explorer.exe process. This willremove your TaskBar. You can set this compiled exe file up in the windows Startup folder to kill the taskbar on startup, instead of installing a replacement Windows Shell.


Module taskbar_killer

Sub Main()
KillExplorer()
End Sub

Sub KillExplorer()

Dim taskKill As ProcessStartInfo = New ProcessStartInfo("taskkill", "/F /IM explorer.exe")
taskKill.WindowStyle = ProcessWindowStyle.Hidden
Dim Process As Process = New Process()
Process.StartInfo = taskKill
Process.Start()
Process.WaitForExit()

End Sub

End Module
Posted in .NET, Shell Scripting, Technical Decisions, VB.net | Tagged , , , , | Leave a comment

Creating objects in Javascript, a quick example

Background

In JavaScript, object classes can be created using functions, and calling the function using “new”. You must label all attributes and methods within the function as “this”. These function references will be used by the object constructed. The reference created by “this” refers to the current instance of the object.

Check out the example of a Car object below which can be instantiated by typing the following code:

Instantiation of Car Object:

var car = new Car();

Example of Car Object:


function Car()
{
/* Attributes */
this.make;
this.model;
this.color;
this.accessories = new Array();

/* Methods */
this.add_accessory = function( acc )
{
     this.accessories.push( acc );
}

}
Posted in JavaScript and JQuery, Web Development | Tagged , , | Leave a comment

Using GWT and Hibernate (Part 2)

Overview

This two part tutorial will be about using the popular data abstraction technology, Hibernate, along with Google’s “Google Web Toolkit” to build data driven web applications. It will show the basics of setting up the project, the UI, and then linking the GWT app to access a MySQL database through the Hibernate layer by building a simple employee database application.

This is the second part of our tutorial on using GWT and Hibernate. If you didn’t do part one I highly recommend doing so since I will be picking up where we left off. In this part we will be adding database functionality to our interface we previously built.

Setup the Database

First thing we need is a database to connect to. In this tutorial we will be using MySQL, but Hibernate is capable of connecting to a number of different SQL databases. Login to whatever DBMS you use (I use phpMyAdmin because I find it very simple to use) and either create a new database or navigate to whatever database you plan on using; I will be using a database named “igoedesign.” Here we will be creating a table named “employees” with the following structure:

CREATE TABLE IF NOT EXISTS `employees` (
  `id` int(4) NOT NULL,
  `name` varchar(255) NOT NULL,
  `position` varchar(32) NOT NULL,
  `department` varchar(32) NOT NULL,
  `salary` decimal(10,2) NOT NULL,
  PRIMARY KEY (`id`)
)

Setting up Hibernate

To setup Hibernate we’ll actually be using a project called Gilead. You can find the zip file here. Extract it and then you will move the following files into your war/WEB-INF/lib folder.

/gilead4gwt-1.3.2.1839.jar

/gilead-core-1.3.2.1839.jar
/gilead-hibernate-1.3.2.1839.jar
/gilead-core/lib/beanlib-hibernate-5.0.2beta.jar
/gilead-core/lib/dom4j-1.6.1.jar
/gilead-core/lib/servlet-api.jar
/gilead-core/lib/slf4j-api-1.5.8.jar
/gilead-core/lib/slf4j-jdk14-1.5.8.jar
/gilead-core/lib/proxy/commons-lang-2.2.jar
/gilead-core/lib/proxy/javassist-3.4.GA.jar
/gilead-test/lib/commons-logging-1.1.jar
/gilead-test/lib/hibernate3.jar
/gilead-test/lib/hibernate-annotations.jar
/gilead-test/lib/ejb3-persistence.jar
/gilead-test/lib/runtime/antlr-2.7.6.jar
/gilead-test/lib/runtime/jta-1.1.jar
/gilead-test/lib/runtime/log4j-1.2.9.jar

Next thing we need to do is get the MySQL driver from here. Just click the “No thanks…” link and then select a mirror near you. When the download finishes extract the folder and move the mysql-connector-java-5.1.18-bin.jar into the war/WEB-INF/lib folder as well. Now that we have all of the jar files we need, we can get to configuring Hibernate to connect to our database. Right-click on the src folder in Eclipse’s package browser and choose New>File, name the file hibernate.cfg.xml. Now add this into the file making sure to change all the info to your server.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "
    -//Hibernate/Hibernate Configuration DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
<session-factory name="EmployeeDatabaseFactory">

    <property name="hibernate.connection.driver_class">
        com.mysql.jdbc.Driver
    </property>
    <property name="hibernate.connection.url">
        jdbc:mysql://localhost/igoedesign
    </property>
    <property name="hibernate.connection.username">igoed</property>
    <property name="hibernate.dialect">
        org.hibernate.dialect.MySQLDialect
    </property>
    <property name="hibernate.current_session_context_class">
        thread
    </property>
    <property name="show_sql">true</property>

    <!-- Mappings -->

    <mapping class="com.igoedesign.blog.shared.db.Employee"/>

</session-factory>

</hibernate-configuration>

In this you’ll see a few interesting things, the first thing that jumps out immediately is all of the access information to connect to our database, make sure you change these things to reflect your setup. Next thing is the dialect property, Hibernate uses this to determine how our queries are generated into true SQL. The current_session_context_class property defines how Hibernate will manage the user’s session, by setting it to thread we are using Hibernate’s built-in session manager.

First, in addition to implementing the IsSerializable interface make it extend the LightEntity class. These two things allow GWT to serialize the object and send it over the wire to be used. Next, we need to add two annotations to the Employee class, @Entity and @Table(name=”employees”). These let the application know what that this class is representing a database table and exactly which table it is representing. To determine which values are mapped to a column in the table we use @Column(name=”
“), you can put this annotation either just before the declaration of the field or just before the getters and setters for that variable (I prefer putting it before the getters and setters). Following these the Employee class should look like this:

@Entity
@Table(name = "employees")
public class Employee extends LightEntity implements IsSerializable {

	private int id;
	private String name;
	private String position;
	private String department;
	private double salary;

	@SuppressWarnings("unused")
	private Employee() {}

	public Employee(int id, String name, String position,
			String department, double salary) {
		this.id = id;
		this.name = name;
		this.position = position;
		this.department = department;
		this.salary = salary;
	}

	@Id
	@Column(name="id")
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}

	@Column(name="name")
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}

	@Column(name="position")
	public String getPosition() {
		return position;
	}
	public void setPosition(String position) {
		this.position = position;
	}

	@Column(name="department")
	public String getDepartment() {
		return department;
	}
	public void setDepartment(String department) {
		this.department = department;
	}

	@Column(name="salary")
	public double getSalary() {
		return salary;
	}
	public void setSalary(double salary) {
		this.salary = salary;
	}

}

You’ll notice I have a private empty constructor, the reason for this is that in order for something to be serialized by GWT it needs either no constructors or if you define one (like we are using the explicit one) you need to have an empty constructor with any visibility. You can read more about GWT’s serialization rules here. Also, every POJO which is being mapped to a table in a database needs to have an Id. If your table has a composite key you can define one using an @EmbeddedId. For example, say you wanted to create a key which was a composition of employee id and some project id.

@Embeddable
@LightEntity
public class EmployeeProjectPK extends LightEntity implements IsSerializable {
    @Column(name="employees.id")
    public int employeeId;

    @Column(name="projects.id")
    public int projectId;
}

// And then you'd use these lines in your mapping class to declare it
@EmbeddedId
public EmployeeProjectPK primaryKey;

Now let’s get to the model of our Model-View-Controller. First, in the client package you’re going to need to make two interfaces for our remote service. We can name them EmployeeService (this should extend the RemoteService interface) and EmployeeServiceAsync, in GWT every remote service needs to have an asynchronous counter-part since GWT applications use AJAX-style RPCcalls. For now we can just have them be empty and we’ll come back to them when we’re implementing some functionality.

Our service implementation will go in the server package and be named EmployeeServiceImpl, it should implement our EmployeeService and extend RemoteServiceServlet. We need to initialize a few things in the constructor so right now your service implementation should look like this:

public class EmployeeServiceImpl extends RemoteServiceServlet implements EmployeeService {

    private HibernateUtil util;

    public EmployeeServiceImpl() {
        SessionFactory sf = AnnotationConfiguration.configure().buildSessionFactory();
        util = HibernateUtil.getInstance();

        util.setSessionFactory(sf);
    }

}

The session factory object we create here looks for the hibernate.cfg.xml file we created before; you can change it to look for a different one, but it is much more convenient to just use this. We will use the HibernateUtil singleton in order to access our session and begin/commit transactions. Now we need to tell our application where it can find our servlet, navigate to the war/WEB-INF/web.xml file in your project. Here you’ll see pre-generated code pertaining to the GreetingService that is used as sample code, you can get rid of all of that and add this:

<servlet>
    <servlet-name>empServlet</servlet-name>
    <servlet-class>com.igoedesign.blog.server.EmployeeServiceImpl</servlet-class>
</servlet>

<servlet-mapping>
    <servlet-name>tutServlet</servlet-name>
    <url-pattern>/gwthibernatetut/emp</url-pattern>
</servlet-mapping>

You’re also going to have to add @RemoteServiceRelativePath(“emp”) to the EmployeeService interface so that it looks like this:

@RemoteServiceRelativePath("emp")
public interface EmployeeService extends RemoteService {

}

We’re almost able to start adding functionality to our interface, but first we need to make a controller to allow communication between the model and the view. Make an EmployeeController class in the controllers package we made in the last part that has an EmployeeView and an EmployeeServiceAsync as fields. It’s constructor should look like this (assuming your EmployeeView and EmployeeServiceAsync fields are named panel and server, respectively):

public EmployeeController(EmployeeView panel) {
    this.panel = panel;
    server = GWT.create(EmployeeService.class);
}

The GWT.create() method takes a class literal and returns an instance of it, by instantiating our asynchronous service like this GWT is able to make RPC calls to our servlet without interrupting the user’s experience on the site. Now we need to make an EmployeeController field in the EmployeeView class and instantiate it in the constructor by passing “this” into the constructor.

Connecting the Interface and Database

Now we’re ready to start linking our interface up to the database. The first thing we’ll do is add functionality to our “Add Employee” button. You’ll need to add the following declarations to the EmployeeService and EmployeeServiceAsync interfaces.

// This goes into EmployeeService
public void addEmployee(Employee emp);

// This goes into EmployeeServiceAsync
public void addEmployee(Employee emp, AsyncCallback<Void> callback);

For every method in the remote service we need to have a corresponding one in the asynchronous class. Every method in the asynchronous class will have a void return type and then the return type of the remote service as the AsyncCallback’s type (since null can be returned you must use wrapper classes for primitives just as you do for ArrayList’s).

Next, let’s add the definition of this to our servlet. Inserting new rows to our database with Hibernate is incredibly easy. Since Employee is already mapped to a table, all we need to do is retrieve our current session with “util.getSessionFactory().getCurrentSession()”, use this session object to begin a new transaction, and then pass the Employee object to the session’s save method and commit. Our addEmployee method in EmployeeServiceImpl should look like this:

@Override
public void addEmployee(Employee emp) {
    Session session = util.getSessionFactory().getCurrentSession();

    session.beginTransaction();
    session.save(emp);
    session.getTransaction().commit();
}

That’s it! This is all we need to add a new employee to our database. So lets make an addEmployee method to our controller like this:

public void addEmployees(Employee emp) {
    server.addEmployee(emp, new AsyncCallback() {
	@Override
	public void onFailure(Throwable caught) {
	    caught.printStackTrace();
	}

	@Override
	public void onSuccess(Void result) {
	    // You could display some sort of message here
	}
    });
}

And now go into the click handler of our submit button in EmployeeView and make a call to this with the EmployeeController field object we created earlier. There we are, now we’re able to add new employees to our database, but that doesn’t mean much if it doesn’t get displayed when we load the page and also if you remember we were determining the next employee id programmatically so we will also run into some primary key problems right now.

In order to display the employees currently in the database when the page loads, we’re going to need to add a few things. First, we need our server implementation which will use Hibernate to gather all of the data. So using the add employee method as a template, go ahead and add the definition in both the remote interface and the async interface (I can’t just give you all the code); let’s call the method getEmployees and it will have no parameters and List as the return type. Next thing we need to add is the server implementation. This code I will give you since there’s a few things that are confusing and I do some sorting to make sure its easy to find the new ID when the page loads up.

@SuppressWarnings("unchecked")
@Override
public List getEmployees() {
    Session = util.getSessionFactory().getCurrentSession();
    session.beginTransaction();

    Query q = session.createQuery("from Employee");
    List ret = q.list();

    session.getTransaction().commit();

    if (ret.size() > 0) {
        Collections.sort(ret, new Comparator() {
            @Override
            public int compare(Employee arg0, Employee arg1) {
                return (arg0.getId() - arg1.getId());
            }
        });

        return ret;
    }

    return null;
}

As you can see we start this method off just like addEmployee, but after we create the session object we do something a little different. Now we create a Query object from our session. The string you pass into createQuery is your query written in HQL (you can find more documentation about HQL on Hibernate’s site). Just typing “from Employee” is the equivalent of writing “SELECT * FROM employee” in SQL (in fact you can actually write this out and have it work, but let’s be serious). Then we pass the list into the Collections.sort method with a Comparator which just compares the two employee’s ID’s.

Now we’ll make a corresponding getEmployees method in the EmployeeController class, use the addEmployees method as a guide, but just put this line in the onSuccess method of the callback:

panel.displayEmployees(result);

As you can see we don’t have this method defined yet, but we are going to do that in just a second. So switch over to the EmployeeView class, we want the getEmployee method to be called every time the page loads. The best place for that is in the constructor so add a call to the controller’s getEmployee method just after the call to initColumns. Now for the displayEmployees method:

public void displayEmployees(List emps) {
    if (emps != null) {
        nextId = emps.get( emps.size()-1 ).getId() + 1;
        dataProvider.setList(emps);
    }
}

The first thing we need to do is make sure that the server call didn’t return a null value, which would mean that our database holds no employee information at that time. Next, we get the last employee in the list and set nextId to one higher that its ID (since we sorted the list on the server side this will guarantee that it will always be the nextId. Then we use the data provider’s built-in setList method associate the list to our grid.

There you have it, you can now add employees and have your work persist until your next visit. As an exercise I’ll leave removing employees up to you, but I will give you one tip, since a user can use SHIFT and CTRL to multiselect employees you’re probably going to want to pass a Set of employees to your method and not just a single Employee.

Conclusion

In these two parts we have learned how to use some very powerful tools. With GWT and Hibernate you can quickly make some very powerful user interfaces and get them hooked up to a database very easily. The ways I showed you here are just basic ways that I figured out when I was first learning, there are many ways to set everything up.

If you have any questions about working with GWT and Hibernate, drop them in the comments section or send us an e-mail.

Posted in Java, Web Development | Tagged , , , , | 1 Comment

Using GWT and Hibernate (Part 1)

Overview

This two part tutorial will be about using the popular data abstraction technology, Hibernate, along with Google’s “Google Web Toolkit” to build data driven web applications. It will show the basics of setting up the project, the UI, and then linking the GWT app to access a MySQL database through the Hibernate layer by building a simple employee database application.

In this part I will give you a brief overview of GWT and Hibernate and what they are used for. The main focus will be about using GWT to build powerful interfaces using only built in widgets.

What are GWT and Hibernate?

The Google Web Toolkit is an extremely powerful piece of tech; it allows the developer to focus less on browser compatibility and focus more on building complex web applications. All you need is some basic Java knowledge and your already well on your way to making some extravagant interfaces.

Hibernate is an Object/Relational Mapping technology which allows users to access and manipulate databases through POJO’s (Plain Old Java Objects). It relieves the headache of building efficient queries with tons of joins.

Before Continuing

This tutorial will use the Eclipse GWT plugin to make project setup and such simpler, so be sure to head over to the GWT site and follow their steps to set everything up. If you don’t plan on using Eclipse the getting started page has steps to use the SDK without using an IDE, but for the purposes of this tutorial I will be using Eclipse.

Building the Interface

In the first part of this tutorial, I’ll go through the process of building the interface. First things first, lets setup the project in Eclipse. Bring up the new project dialog and expand the “Google” folder, here you’ll choose “Web Application Project.” Leave everything on their defaults except “Use Google App Engine,” we aren’t going to be using the app engine so we don’t want this checked. To make things simpler I’m going to refer to this project as EmployeeDatabase, but make sure wherever you see this to put in the name of your project.

While building the interface we’re going to need the POJO which is going to represent the employee database. To keep things simple we’re just going to have one employees table that will have the employee’s name, position, department, and salary as fields. So for now just use this as your Employee.java and put it in a new subpackage under shared called “db”, we’ll get into using this as a mapping to the database in the next part.

public class Employee implements IsSerializable {

    private int id;
    private String name;
    private String position;
    private String department;
    private double salary;

    // Getters and setters and explicit constructor
    // omitted to save space

}

Another thing we’re going to need is to initialize the module. In the war folder that GWT created, open the EmployeeDatabase.html file, take out all the extra stuff after the h1 tag, and add two divs with the id’s “mainContent” and “formContent”. The mainContent one is pretty self explanatory and I’ll get into the formContent later on. So the end of the html file should have these lines just above the closing body and html tags.

<h1>Employee Database</h1>
<div id="mainContent"></div>
<div id="formContent"></div>

Also, add these lines to the end of the EmployeeDatabase.css file.

.gwt-Label {
	width: 100px;
}

#mainContent {
    float: left;
    margin-right: 10px;
}

Now go into the main client package where you’ll find the EmployeeDatabase.java file. Take out all the pre-generated code so all you have is an empty onModuleLoad() method. Inside the onModuleLoad() method we are going to add the following lines:

Panel mainContent = RootPanel.get("mainContent");
mainContent.add(new EmployeeView());

I’m going to follow the Model-View-Controller (MVC) design pattern to make the code a little easier to follow, so using the package structure that the sample code makes add views and controllers subpackages under client (We’ll have the views in client.views and the controllers in client.controllers). The model will be the server implementation of our remote service, but we’ll get into that in the next part.

So now lets make a new EmployeeView class in the views package and have it extend the VerticalPanel class. Having the views extend a vertical panel isn’t required, but it makes it easier to add new widgets to the page your working on. The main thing that we need in any database management application is a table to display the contents of the table we are working with. For these kinds of tables I like to use CellTable’s, they have a lot of optional functionality that can make the table even more useful while only adding a few lines of code. A few other objects we’re going to want is a ListDataProvider, SimplePager, and MultiSelectionModel. Since some of these classes use generics we’re going to be using our Employee class to instaniate them. We’ll have all of these objects as fields of the EmployeeView class and initialize them in the constructor.

public class EmployeeView extends VerticalPanel {

    private CellTabletable<Employee> table;

    private ListDataProvider<Employee> dataProvider;
    private MultiSelectionModel<Employee> selectionModel;
    private SimplePager pager;

    public EmployeeView() {
        table = new CellTabletable<Employee>();
        dataProvider = new ListDataProvider<Employee>();
        selectionModel = new MultiSelectionModel<Employee>();
        pager = new SimplePager();

        // We have to associate all the utilities to the table
        pager.setDisplay(table);
        dataProvider.setDataDisplay(table);
        table.setSelectionModel(selectionModel);

        // Add the widgets to our EmployeeView panel
        add(table);
        add(pager);
    }

}

Now that we have all the objects we need to interact with our data table, we have to setup all the columns of our table. I usually like to make a separate method to do this to keep things a little more organized so right after the table.setSelectionModel() line make a call to initColumns(). We’ll have a column for each, but to keep this short and give you a little homework I’ll just show you how to make the id column.

private void initColumns() {
    // Employee id
    Column idColumn = new Column(
            new TextCell()) {
        @Override
	public String getValue(Employee object) {
		return Integer.toString(object.getId());
	}
    });
    // You will add the rest of the columns here

    table.addColumn(idColumn);
}

Now you can save your work and run the project, when you go to the URL it will take a bit for the table to show up depending on your computer’s hardware. This is because it’s doing some computations to display the Java code on the page, but when you actually use the GWT compile tool and move it to your Tomcat server (or whatever java enabled server you use) it will be in super efficient Javascript and be lightning fast. Since it’s just the table with no data it’s not very exciting, but you see how easily and quickly we have our table with paging and multi-selection capabilities.

Next thing we’re going to add are some buttons to add/remove employees into the table. This is where that formContent div is going to come in; when the user clicks the “Add Employee” button we’ll have a form display in this div. For now we’re just going to be using the dataProvider to add/remove entries in the table, in the next part we’ll also be making server calls to manipulate our MySQL database.

Google made making buttons and adding functionality to them just as simple as it is in the Java swing libraries. In this code block we’ll make the buttons, add handlers to them, and put the buttons into a HorizontalPanel to have them side by side. These will go just after the initColumns line and you should add an add(buttons) line to the end of the constructor.

Button addButton = new Button("Add Employee");
Button removeButton = new Button("Remove Employee");

addButton.addClickHandler(new ClickHandler() {
    @Override
    public void onClick(ClickEvent event) {
        buildForm();
    }
});

removeButton.addClickHandler(new ClickHandler() {
    @Override
    public void onClick(ClickEvent event) {
        List list = dataProvider.getList();
        Set selected = selectionModel.getSelectedSet();

        list.removeAll(selected);
    }
});

HorizontalPanel buttons = new HorizontalPanel();
buttons.add(addButton);
buttons.add(removeButton);

We’ll make the buildForm() method now. As with the initColumns() method I’ll only give you one element of the form and you’ll have to add the rest yourself. The other part of any form is the submit button. In the handler of this we’ll do a bit of error checking (you should do more than what I have here in a real application), create a new Employee object, and then add it to the table. We’re only going to have the name, position, department, and salary fields be set by the user; the id field we will set programmatically. For the id field create a global int called nextId and have it initialize to 0. Every time we add an employee we will increment this and in the next part we’ll get the initial state when we retrieve the data at the start of the application.

private void buildForm() {
    VerticalPanel form = new VerticalPanel();

    // Text boxes for all of the fields in the table
    final TextBox nameBox = new TextBox();

    // We want the boxes to have a label so throw them into a HorizontalPanel
    HorizontalPanel namePanel = new HorizontalPanel();
    namePanel.add(new Label("Name:"));
    namePanel.add(nameBox);

    form.add(namePanel);

    Button submit = new Button("Submit");
    form.add(submit);

    submit.addClickHandler(new ClickHandler() {
	@Override
	public void onClick(ClickEvent event) {
		String name = nameBox.getText();
		String position = positionBox.getText();
		String dept = departmentBox.getText();
		String salaryS = salaryBox.getText();

		if (name.length() <= 0 || position.length() <= 0 ||
		        dept.length() <= 0 || salaryS.length() <= 0)
		    Window.alert("Please fill out all of the fields.");
		else {
  		    double salary = Double.parseDouble(salaryS);

		    Employee newEmp = new Employee(nextId++, name, position, dept, salary);
		    dataProvider.getList().add(newEmp);

		    RootPanel.get("formContent").clear();
		}
	}
    });

    Panel formDiv = RootPanel.get("formContent");
    formDiv.clear();

    formDiv.add(form);
}

Now go ahead and save your work again and try it out. All works pretty well, huh? In under 200 lines we have a working interface which we can hook up to the database and manage our employees.

A few extra things we could do is add sorting and editing features. With some simple built-in options you can have functionality to click the headings and sort the table based on that column or even when you click a field you can edit that value for the employee. I’ll leave these things for you to find and learn though. This concludes the first part of the tutorial, next time we’ll be adding our database support with the help of Hibernate.

Posted in Java, Web Development | Tagged , , , , | 1 Comment

How to start building a WordPress website.

WordPress is a CMS that is mainly focused around Blogging, so if you are planning to develop a powerful web application, this is probably not the best option you have. WordPress has the ability to use custom templates and themes for both pages and posts.

I suggest using WordPress to create simple sites and blogs, or sites with blogs attached. Giving the user control over their content, and training the user how to effectively get the most out of their web presense is the key to deploying a successful WordPress web site.

Step 1:
Install WordPress, visit the wordpress website and install the latest version of wordpress on your http://wordpress.org/download/ is their website. Follow instructions on installing a new copy of wordpress on this website at http://codex.wordpress.org/Installing_WordPress and familiarize your self with the admin panel.

Step 2:
Start themeing, once you have familiarized yourself with the administration panel, simply add the pages you wish to have on your website in the Pages section of wordpress.

Example: a simple 5 page site.

For this site as an example, below, there are five distinct pages Home, About, Web,Mobile,Contact there is also the attached Blog component, the basis of WordPress

WordPress Website Pages

When you create the pages, set the Order of the page in order to set the menu in the order you want within your template.

If you would like your site to have the Blog as the front page, this is the default setting, otherwise you will have to go into the Reading Settings found on the right hand Settings menu and set which of these added pages you would like to be your front page.

Step 3:

Creating custom templates for each page. If each page will be using its own template you can do the following.

  1. Copy the file single.php into a tile template-pagename.php.
  2. Edit the comment on the top of the file to be the following:
/**
 * Template Name: My Page Template
 */

These files will be used for creating your custom designed template pages for your WordPress website. Visit the following page to get started: http://codex.wordpress.org/Theme_Development

Step 4:

Go back to each of the pages and set which template they should use for each of the pages.

After doing this you should be on the basic track for creating a basic 5 page site with a blog for yourself.

Onward, the next things you will want to do is install some plug-ins to help you with your website creation some of my favourites are W3 Total Cache, Portfolio, Custom Content Type Manager, SEO plug-in, Google XML Sitemaps, and Multiple Content Blocks.

By using some basic WordPress, PHP, HTML, and CSS knowledge and this simple setup, you will be on your way to a custom themed WordPress website.

Posted in Copywriting, HTML, SEO, Web Development, Wordpress | Tagged , , , , , | Leave a comment

The three W’s of WWW: Web Designers, Web Developers, and Web Masters

So you are looking for help, design, or development for your existing or future web product. If you are not current with the lingo you may be confused as to what you are looking for.

First of all: What is a web product?

A web product is any particular Internet based application, or presence. Today, stronger than ever, there is a strong shift towards web application operations to be the dominant application structure, over taking many traditionally platform based applications, and even platform independent applications. This shift has been highly influenced by the increase in bandwidth and network capabilities over the past few years.

You know that you need some assistance, but who specifically are you going to call?

If you answered “Ghost Busters!”, unfortunately this is not the answer this time. I will throw in an obvious plug for ourselves and say Igoe Solutions LLC! However in a more generic sense, there are three types of “web guys” which you would want to talk to depending on your needs for your web product.

Who are these “web guys”? Web Designers, Web Developers, and Web Masters.

Web design is a process which encompass the planning and creating a website or web product. This includes layout and appearance of text, images, digital media and interactive elements. These elements are shaped by a web designer to produce the output of what is seen on the page. This is a more specific term used to address graphical and aesthetic appearance of a web product. This work is typically performed by digital graphic artists and graphic designers.

Web development is more of a broader term for web work which can involved an entire process of developing a website or web product. The term web development encompasses the field of web design, but adds more where it lacks. Web development includes web content development, client liaison, client-side/server-side scripting, web server and network security configuration, and e-commerce development. An emerging term for web developers is web engineers. Many web processionals distinguish themselves from web designers in the sense that “web development” typically refers to the non-design aspects of building web products: writing markup and coding front-end and server side scripting. Web development can range from developing a simple static single page of plain text to the most complex web-based internet applications, electronic businesses, or social networks, and automated web services. Web development work is typically performed by computer scientists, computer engineers, and software engineers.

Web masters are the people who are responsible for maintaining your website. Your web master’s duties may include: ensuring that the web server is operating properly, making small changes to the website, generating and revising web pages, replying to user comments, and examining traffic through the site. For static sites the web master may be someone who knows how to alter basic HTML and structure of web pages. For content management sites, the web master can be just about anybody. Mastering your own web page is made possible by the work of web designers and web developers working together to create a user friendly administration for your database driven website.

Now that you know what these people do, you can match them up with your needs and get out there to get your web product off the ground.
At Igoe Solutions LLC we are focused web and mobile software development engineers, and we offer all these services and more.

Posted in Technical Decisions, UX Design, Web Development | Tagged , , , , , , , , , , | 3 Comments

Memcached and its applications for mobile web application use

This is not a how to, there will be no code examples here, there are plenty of great links at the end. This is an overview of the software, paradigm, and concepts.

What is it?

Memcached is a general-purpose distributed memory caching system. But what is caching? To put simply caching is the act of storing frequently used information so that is is more easily accessible for the next use. There are different types of cache. Server side caching, and client side caching.

The more commonly known form of caching is client side caching of web browser applications. Your web browser right now has cached information about this and other web pages you have visited recently, some of these things may be the HTML, CSS, or image assets to the pages you have visited. “Clearing your cache” to get the updated assets for a web site is a common act done by all patrons of the internet. This effectively clears the “commonly used assets” that are stored and re-caches the newer assets.

Memcached is a server side cache system where the server tracks what information is requested by clients most often, so that it can access this information in a more timely manner than less requested information or assets.

Each cached portion of data is stored with a key/value which is specified however you wish, traditionally generated by either a function or a specific standard. It is important to note that the key/value pair is limited to the specifications of the software in that there is a finite amount of space that can be located for each key/value.

Depending on how the server is configured, memcached can store different information for varying amounts of time. The “cost” of cache is time and space on the server so proper configuration, clearing and resetting of cached values should be practiced. When one says “cost” they are talking about the affordance of processing time, and the affordance of memory allocation for the referenced values. This might help one understand that the finite limits on the allocation per key/value pair is in place to limit “costs”.

Now that we know what memcached is, what we can do with it, and what the “cost” is, what practical uses can be deployed using memcached?

When to use it, when not to use it.

Do not use memcached for session handling, database replacement, or queueing.

Memcached is a very simple and lightweight cache, some of the more practical uses of memcached could be the following:

  • Cache commonly returned results for simple searches. Depending on the amount of information returned, you may cache simple information returned from commonly requested searches. If a database row id, of field can be cached for a common search, cache it. This way you will be either returning the field, or searching MySQL by id as opposed to using a %LIKE% comparison search.
  • Along the same lines, Cache negative search results. This will prevent queries with negative lookups from hitting the database, and costing the server.
  • Cache any small data set returning queries that take a long time to process.
  • Latest posts on a custom blog application, or news feed. Cache the lastest news feed item, clear the cache every so often.

Relation to mobile computing.

Often times with mobile web applications, they will involve expensive queries that return small data sets. Bullet number three above is exactly this. Mobile applications with networking will typically return values from the server in pieces or in whole to be stored locally in an sql lite database. If caching of data sets server side can be used to reduce time, then the entire process of transmission of the data set, and local storage can be cut down considerably. This is what the world of mobile computing is all about. Instant information, or, information as fast as we can get it.

Read other articles on our site about mobile computing, web application development, and mobile application development.

Please read the articles below for further reference.

Links:

http://joped.com/2009/03/a-rant-about-proper-memcache-usage/

http://www.majordojo.com/2007/03/memcached-howto.php

Posted in Android, Mobile Computing, PHP and MySQL, Technical Decisions, Web Development | Tagged , , , | Leave a comment

Parsing JSON with interior array in Android

Here is a quick way for parsing over JSON that contains an interior array while using Android..

 

Traditionally you will first get the JSON string and create a JSON object with it:

JSONObject jsonResponse = new JSONObject(jsonString);

 

Secondly you would extract the interior array from the jsonString as a JSONArray:

  JSONArray moreArray = jsonResponse.getJSONArray("more_data");

 

But, If you cannot get a reference for any reason because of other values within the initial JSON array, you may find more success in reconstructing the JSONObject by creating a JSONObject after extracting the JSONString from the interior and prefixing it with the interior array’s key.

Example of prefixing JSONString with JSONArray key to get JSONArray.


try {
JSONObject jsonResponse = new JSONObject(jsonString);

// Immediate variables.
Boolean success = jsonResponse.getBoolean("success");
String message = jsonResponse.getString("message");

// Check for success.
if (success) {
// Now parse further, if there is more information.
String moreData = jsonResponse.getString("more_data");
JSONObject moreDataObject = new JSONObject("{\"more_data\":" + moreData + "}");
JSONArray moreArray = moreDataObject.getJSONArray("more_data");
} else {
// Error reported from server.
}
} catch (Exception e) {
Log.e("Exception", "Exception when parsing response JSON.");
}
Posted in Android, Mobile Computing | Tagged , , | Leave a comment

Custom view * is not using the 2- or 3-argument View constructors; XML attributes will not work

Today I was extending an element such as Button in an Android project and I ran across this error in the GUI editor error logs.

Custom view * is not using the 2- or 3-argument
View constructors; XML attributes will not work

Some of you might have had this same issue, well the solution is simple, you just need to include all three types of constructors for the parent class.

public class ExtendedClass extends Button {

public ExtendedClass(Context context) {

super( context, attrs );
}

public ExtendedClass(Context context, AttributeSet attrs) {

super( context, attrs );
}

public ExtendedClass(Context context, AttributeSet attrs, int defStyle) {

super( context, attrs, defStyle );
}

}
Posted in Android, Mobile Computing | Tagged , , , , , | 1 Comment

Coping with large requirements by scaling down project scope

Most important questions when taking on a client include

  1. What is your estimated budget for this project?
  2. What is your estimated time frame for this project?

These questions are partnered with the overall specification of work or request for proposal (RFP) and they give a stong insight into what kind of work hours are needed, resources to be gathered, or research to be done.

Often marked with ‘N/A’ or ‘As cheap as possible’, ‘As fast as possible’. Why do these questions matter so much?

If your budget is $100 and your time frame is one week, and your requested job is a full website, it is a lot easier to read a couple of fields, and politely instruct you to post on Craigslist. Then there is the other scenario where I end up spending time, preparing a full estimate based on actual cost of development, and then having one decide that the cost is far out of their budgetary constraints.

Without fail, it is like pulling teeth to get the answers for these questions. Why? One can only speculate, however when reflecting back on The Project Triangle, mentioned in an earlier post. Clients are asked to specify a project, and how they would like it completed; good, fast, cheap: choose two. Everyone wants all three, and a lot of approaches do not know the general cost of web application development.

A great article about “Web Development Cost / Rate Comparison” by Bernard Kohan can be found here. (http://www.comentum.com/web-development-cost-rate-comparison.html)

What he is saying is: do not be surprised if you hear a wide range of numbers thrown at you for web application development or mobile development . Based on the work you specify, and the stature of the company you have sought, the numbers could be fairly different. He goes further into classifying web development shops and classes of persons/businesses you could find to get the job done.

One way to find a happy medium between the three regions is to scale down your project scope. Version and build numbering occurs for all software, even web sites and web applications. By reasonably trimming the fat off of your specification documents, you may be able to oust a release of your product with “all the essentials” of what the pending version of your product should encompass.

It is important to realize that software and web applications are not spawned overnight, and they take many iterations to arrive at an end result. Iterations through the software development process help one arrive at the end product.

It can be helpful to reorganise your specification into requirements and features that “can wait”, and often this is based on the position of your company or the birth time of your web application. If you are on an initial release, then this is easier to trim than say a third or fourth revision, as you may have users waiting for certain features.

Others may argue for alternative solutions, but if your budget or timeline is tight, there is almost always wiggle room by scaling down project scope requirements to fit a project more closely into ones budget.

Posted in Project Managment, Technical Decisions, Web Development | Tagged , , , , , | Leave a comment