SimpleBlog Work Post   Leave a comment

Last time, I put together the basic HTML of the simple blog. Today I’m going to work out the interchanges.

When a user first comes to the simpleblog index page, they’ll be presented with a list of the ten most recent entries, a login form, and buttons to display the next ten or previous ten entries chronologically.

So the first thing that has to happen is that the page must ask the controller for the ten most recent blog entries. This means the controller must ask the model for the ten most recent blog entries, to share them with the view, the page.

If the user enters data in the login form and presses the login button, the page must give that data to the controller to compare it with the login data in the MySQL database. I’ll enter that data directly, since it’s a one person blog. So there’ll need to be a model for the login database as well, and functions to access it.

When a user successfully logs into the blog, a persistant field will be created so that the user stays logged in. The sidebar will also be changed to include post and logout buttons via a script, and hide the login form.

When a user is logged in, each post will include edit and delete buttons. Edit will bring up a version of the post page with the data from that post. Delete will bring up a dialog box to confirm, then on confirmation will delete the post.

The post button will bring the user to the post page to allow them to post a new entry.

The Post Page itself will be a simple form with a post button. If the post page is shown in edit mode, it will say confirm edit instead. The post button will create a new post in post mode, or save the changes to a post in edit mode.

In edit mode, the Post page will load a previous post, so there will need to be a function for that in the controller and model, and a function to save over the post.

That should be everything. If I’m missing anything it’ll be discovered along the way.

Now I’m going to bed. It’s been a long day but I’m glad I found time to work on this.

Posted October 11, 2013 by Arthur Payne in Current Projects, SimpleBlog

Simple Blog   Leave a comment

So I’ve given some thought to the WebMUCK Project and I’ve decided to put it on the back burner. It’s more complicated than I had anticipated, and it’s not going to be done for a while. I need to pump out some good, short projects for my portfolio, so I’m going to do what most of my class did back in school and write a simple blog. Well, I’ll do it a bit fancier than they did. I’m going to use all my HTML5, CSS3, JQuery, AJAX, PHP and MySQL skills. Well, as many of them as I can squeeze in there at least.

Now I’m going to do a rough inventory of what I’ll need to create to do this.

Viewing Page
Post/Edit Page

Just three pages. Lots of scripts though.

The Viewing Page will need to access a PHP Script that will show blog entries. It’ll need to be able to tell which entries it’s showing, so that it can show pages of ten entries at a time. There’ll also be a login box for the blog owner to log in and make and edit posts. That means it’ll also need to keep persistant login data.

The post/edit page will be simple by comparison. All it has to do is send form data to a PHP script that will push the data into the database. In the case of editing, it’ll first load a post, but that shouldn’t be much more complex.

I’ll try to keep to the MVC format, so there’ll be a controller_Blog.php script that the pages make RESTful calls to, and a model_Blog.php script that models the database and permits interaction with it.

I think I’ll start by making the basic HTML of the pages, then plan out the functions and methods for the scripts and how they interact, before implementing them. I find it helps to have something to look at to put everything in perspective.

—–

Alright, the HTML and CSS for the basic index page are done. I’ll have to edit them once I start actually programming, but this gives me something to start with. Next I’ll do up a form for posting/editing entries.

—–

And that’s a nice little post page. I think that’s enough for one update. I’ll share the github repo later.

Posted October 9, 2013 by Arthur Payne in Uncategorized

Progress Update   Leave a comment

MyFirstChatroom is coming along. I’ve decided to start by getting the hand-entered entries from the database onto the chatroom box to make sure my pipeline is working, before moving on to live updates and posting entries.

It’s been a while so I’ve got to refresh my memory on how to have two PHP scripts talk to eachother. Looks like the only way is to have the controller contain an instance of the model.

The model has an array that the controller needs to access in a variety of ways but I don’t want to make it public, so I’ll have to make a variety of accessor functions next. For now, I’m out of time.

Posted September 28, 2013 by Arthur Payne in WebMUCK

Tagged with , , , ,

  Leave a comment

So despite life’s penchant for getting in the way, I’ve been continuing to work on the MyFirstChatroom prototype. So far I’ve made most of the controller and database and started on the view.

So far it’s just two text areas and a post button that runs an empty click handler. Before I do the click handler though I want to do the function that gets the chat from the server, and before I do that I want to make sure I can set up an event timer. I thought there was one in JQuery but I can’t find it, so I’m going to try JavaScript.

—–

I actually folded up my laptop and left my work overnight, so the following is the next day’s work. I was easily able to find a JavaScript timing function that works wonderfully with JQuery; that’s probably why they don’t have their own. I’m working on the AJAX for getting the chat entries now.

I’ve got the most basic infrastructure down, but today’s just not flowing right so I’m going to take a break and maybe work more at home later. I think I may want to work out the interactions between the controller and view ahead of time next.

Posted September 25, 2013 by Arthur Payne in Uncategorized

  Leave a comment

I’ve been on medication for only four days but it feels like so long. I wouldn’t have guessed it was that short if I hadn’t just looked at my project changelog. The last entry was the 4th. I’m feeling somewhat better and so I’m able to go off of the mind-bending pain killers and just use the standard kind.

My next task is to complete the Create() function in the model_Chatroom class that’ll create new chat entries and delete the oldest after the buffer fills. The function will return true if it works, false if not.

It’s been a while since I used PHP MySQL querries so I’ll need to refresh my memory. *refresh*

*work work work*

And there we go. It deletes the oldest entry by timestamp if there are over 200 entries using the most arcane MySQL command I’ve ever used. Short and effective though, and safe as far as I can tell. Very good.

I’ve added an empty UpdateViews function, to interface with the views later when they’re added. Basically, it’ll have to tell everybody when something is updated, or they’ll have to constantly ask, one or the other.

It occurs to me at this point that I’m building a completely annonymous chatboard. Well, I suppose that’s to be expected without adding an account system. I might do that for a second version before starting the WebMuck proper. There won’t be any security or admins either, just a bunch of text blocks listed by timestamp. Oh god, I’m making 4chan aren’t I?

Next time, I work on the controller.

Posted September 8, 2013 by Arthur Payne in Uncategorized

Sick Break   Leave a comment

If anybody out there is curious why updates suddenly stopped, well, I got sick in a bad way. Infected tooth, extreme pain, I’ve been heavily medicated for like a week now. I’ll be doing more work once I’m better.

Posted September 8, 2013 by Arthur Payne in Uncategorized

More MyFirstChatroom Design   Leave a comment

So, I’m continuing to work on the basic design of MyFirstChatroom. After discussing it with my brother, I’ve decided that the model_Chatroom class will model the entire database. So, it will have an array of 201 entries, and when that list fills up it will delete the last one and push the newest one in.

Database:
id
timestamp
chatentry

I’ll make the chatentry a TEXT type. That’ll give it a max size of 65,535, way more than enough for any chatting. I’ll have to make sure to limit the input to nothing beyond that, though.

Okay, the table has been placed on the database. If I need to change it, I can modify it later.

*work work work*

It occurs to me that a timestamp must be unique, since it’s accurate down to the clockspeed of the cpu and thus each call to the timestamp function is at a different time, so I can use it as the primary key of my db after all. That’ll save me the trouble of recycling 200 ids and simplify everything, so I’ll do that. *does that*

*work work*

For the most part I’m just copying the structure of most of my PHP programs. I’ve got a nice, commented block of code for accessing databases that I use. Not much to say about it. Making the model_Chatroom class work.

I’ve finished the Retrieve() function, which gets the list of chat entries from the database. Now I’m doing the Create() function, which creates a new entry, and deletes the oldest if there are already 200.

Alright I think that’s enough for now. The next thing I need to do is write the code that determines if there are over 200, and finds the oldest to delete it. I might have to figure out a different way of sorting the chat entries in order to rank them in age. Timestamp is probably different between MySQL and PHP.

Posted September 4, 2013 by Arthur Payne in WebMUCK

Tagged with , , , , , ,

Designing MyFirstChatroom   Leave a comment

So to start with I’m making a chatroom. I’m calling the project MyFirstChatroom since it kind of is, and it’s simple.

There’ll be an AJAX/JQuery View, a PHP Script Controller and Model covering a MySQL Database. For this version of the chatroom I’ll be recording a log of the last, let’s say two hundred things said on the chatroom. When I convert it to a MUCK I’ll probably just fill the user’s view with whatever is posted in their vicinity instead, so that they can carry it with them room to room.

I’ve hit my first problem with the design. I’ll be keeping a database of previous paragraphs up to two hundred. But, as they pass that and are deleted, the id of the stored paragraphs will keep going up, eventually running out. So, I’ll have to set it up to recycle ids after it gets to two hundred.

Hmm… If I’m going to be saving chat lines, that’ll be seperate from the chatroom itself, and eventually the users. So, I’ll have to make a model for chat paragraphs as well.

The way I’m thinking about it now, I’m pretty sure I’m violating database rules. Maybe 1st Normal Form…

I talked about it with my brother some, and he thinks I should be good to just make the model an array of entries representing the one table. So I’ll give that a go.

Posted September 2, 2013 by Arthur Payne in WebMUCK

Tagged with , , , , , ,

WebMUCK   Leave a comment

Well Ludum Dare didn’t go so well, I spent the whole weekend trying to get my tools to work. Hopefully I’ll be better prepared next time.

I’m starting a new project today, something I should be able to put proudly into my portfolio. I’m going to make a Web based MUCK. MUCK stands for Multi User Chat Kingdom. They’ve been around since the internet stone age and haven’t changed much since then. In form, they’re like a series of linked, themed chatrooms representing a virtual space. Unfortunately they’re so old that you have to connect to them with a dedicated client, and interact with people using arcane text commands.

I’ve decided to make a web based MUCK system. Linked chatrooms should be simple enough to do quickly and complex enough to show my skills, I hope.

To begin with, I’ll make a simple chatroom. Then I’ll add in the account system, and finally set up connections. I can build other MUCK features on top of that; they usually have programmable objects in MUCKs that say or do things when you interact with them. Though, I might just expose the client interface, so that people can make chatbots to do that with whatever they’re familiar with. But one step at a time.

My first chatroom will be done MVC Style. The Model and Controller will be PHP classes while the view will be done with JQuery and AJAX.

I’ll post more on here when I hit a stumbling block but for now I’m just setting up the basics.

Posted September 2, 2013 by Arthur Payne in WebMUCK

Tagged with , , , , , , ,

Ludum Dare 27 – Episode 2   Leave a comment

After leaving the college I spent some time relaxing, to shake off what anxiety had built. Then I procrastinated for an hour, and finally went out to do some more work. I’m only just reinstalling Eclipse again, and it’s already four, and less than an hour before the cafe I’m working at closes.

Hmph, no different here.
“Once Eclipse restarts, you must specify the location of your Android SDK directory:

In the “Welcome to Android Development” window that appears, select Use existing SDKs.”

And yet no such window appears. Maybe I should just download the version of Eclipse already set up to use Android and hope that works with the other things I need?

Blah, now I can’t even delete the eclipse folder. I’ve gotta restart my system…

Okay, restarted and starting on my fourth? Eclipse install of the day. It’s strange though, the file I’m downloading is half the size of what the ADT thing installed before. Did I install two copies without it overwriting maybe? Oh well…

Also, hey Google, you should make it so that when you close a window it gets moved to the top of your history. When the tabs I had open are things I have to dig through my history to find? I don’t like that.

Alright out of time at this place, gotta find another place.

Posted August 24, 2013 by Arthur Payne in Ludum Dare 27

Tagged with , , ,