A coders path.
Visitors
Today:5
Total:2183
Themes
Color:

Forum in PHP Saturday 4th of June 2011

Sections

Introduction

The forum that is introduced in the this blog post was made many year ago. It relies on a database handling object such as the one shown in the entry MySQL Databaseclass. This reliance on a database handling object should in theory mean that it would be possible to change the database layer without changing in the forum. This however assumes that the layer understands SQL. Also this forum only implement the logic of the forum system. It is entirely without any interface.
Read more...
Exspand Comment(0)

Name:
Message:
Tags:php, forum

Memory game Friday 3rd of June 2011

Sections

The game

The memory game is the classic game where a number of cards paired is layed out randomly on a table with their backside up. Each player then flip two cards and if the cards are the same he gets one point (the pair of cards). This implementation of the game in javascript is single player and don't actually count the number of pairs removed. When clicking two of the images they turn and after some time if they are the same they become another image and if the ain't they revert back to the normal backside image. The game is implemented so it makes use of existing HTML this means that if javascript is disabled the viewer still sees something namely the original hteml.
Example:The game
No alt. No alt. No alt. No alt. No alt. No alt. No alt. No alt.
No alt. No alt.
Read more...
Exspand Comment(0)

Name:
Message:
Tags:game, javascript

jQuery UI Tournament Tuesday 31st of May 2011

Introduction The widget introduced in this entry is able to take a normal HTML list and make a tournament display looking like the one displayed below. The coloring is dependent on the jQuery UI theme used.
Example:Tournament
    • Team A
      Best Team
    • Team B
      Ok Team
    • Team C
      Average Team
    • Team D
      Bottom Team
    • Team E
      Looser Team
    • Team F
      Not worth mentioning Team
    • Team G
      Ungraded
    • Team H
      Unknown
    • Team B
      Team A vs Team B
      Score 0 - 2
    • Team C
      Team C vs Team D
      Score 1 - 0
    • Team E
      Team E vs Team F
      Score 3 - 1
    • Team G
      Team G vs Team H
      Score 2 - 0
    • Team C
      Team B vs Team C
      Score 1 - 2
    • Team E
      Team E vs Team G
      Score 1 - 0
    • Team C
      Team C vs Team E
      Score 3 - 0
Read more...
Exspand Comment(0)

Name:
Message:
Tags:jquery, jquery.ui, widget.tournament

Pollsystem in PHP and MySQL Monday 23rd of May 2011

Sections

Introduction

The goal of the blog post is to show how a pollsystem handling multiple polls and logging of voters can be implemented in PHP using an MySQL database. The codes are given followed by examples of actually using the system. The core solution introduced in this entry does not provide any builtin interface, so users would have to provide that. The idea here is that without an interface it is easier to reuse the system in different settings. The entry does however show a simple user interface in the examples.
Read more...
Exspand Comment(0)

Name:
Message:
Tags:php, mysql, poll

Comment System Tuesday 17th of May 2011

Sections

Introduction

The following post introduces the comment system used on this page. As with most comment systems it is essentialy a very simplified one forum multiple thread forum. All blogposts are one thread and the comments in them are post to that thread. However since the Comment system itself only knows the id of a thread it does not require to know where that id come from. The system does not come with any predefined user interface. So it is entirely backend. This make it simpler to use the system in different places. But it also adds more requirements in the sense that the UI have to be specified. The system also require Database classes implementing a specified interface. An example of such a class is given in MySQL Databaseclass.
Read more...
Exspand Comment(0)

Name:
Message:
Tags:php, comment

MySQL Databaseclass Tuesday 17th of May 2011

Sections

Introduction

The classes introduced in this section is used to hide the mysql API function used in PHP from the code and make it object oriented. If mysqli or pdo i avaible it is better to use either of those proable. The reasons I once made this class was it encapsulated the API so in theory it would be possible to later change to another API by simply implementing a class for it. It made it easier to iterate over the mysql result cause it was implemented in the retuned object that it could be used for as and iterator. It made it easier to print the query and/or error when the queries failed. The following shows and example of use. It is assumed the classes are in the db.php file
Example:Using DB and DBResult.
include ("db.php"); $db = new DB(); $db->setPass("XXXXX"); $db->setHost("XXXXX"); $db->setName("XXXXX"); $db->setUser("XXXXX"); $dbo = $db->query("SELECT * FROM table"); if(!$dbo->isError()){ foreach($dbo as $row){ print_r($row); } }
Read more...
Exspand Comment(0)

Name:
Message:
Tags:php, mysql, database.api

LaTeX hyphenations tool Thursday 12th of May 2011

Sections

Introduction

The tool I introduce in this blog post does, in my experience, make it easier to handel custom hyphenating a LaTeX document. The normal hyphenation command in LaTeX:
Example:The LaTeX hyphenation command.
hyphenation{split-me-at-strokes}
The command tells the LaTeX compiler that it may only split the word splitmeatstrokes where there is a - in the hyphenation command. Now you may ask how can it possibly get simpler to write hyphenations and the answer is it can't. The problem my tool makes simpler is controlling and expanding collections of hyphenations. When writing larger teksts/reports you look through the produced document to see if ur satisfied with the word breaks- If you not satisfied with a word break you switch to the LaTeX file and type in a hyphenation command. This mean you have to switch between to large viewing areas. My program solve this by being a relatively small window, can be placed besides a PDF reader window. Another problem is if you have already made a hyphenation command for the word. You will essentially overwrite the existing hyphenation with a new one. My program list the existing hyphenations alphabeticly, so you can see how you have broken words that is the same or similar. It also simplify writing a hyphenation a bit by removing the latex command syntax. So you only have to write:
Example:The LaTeX hyphenation command.
split-me-at-strokes
The program is written in Python, so a Python interpreter is required. The program window. No alt.
Read more...
Exspand Comment(0)

Name:
Message:
Tags:LaTeX, Python, hyphenation

DocWriter Wednesday 11th of May 2011

Sections

Introduction

I have been working on at script that can take a tekst file written in one format and convert it into another format. The result of the experiment i a generator. That lets the user set the reader and writer of the class. The idea is that it lets the user set readers, that can read differently formatted classes. These readers then reads in the data in the text file and decipher it into a datastucture. A writer is then given this datastructure and writes out a string based that is the result of applying the writer to the datastructure given. This build makes it possible to make several readers that can read differently formatted text and turn it into the same datastructure. And it makes it possible to make several writers than can be given the same datastructure but write out the different formatted texts. The reason for me implementing this is that it saves med from writing the class documenations shown on this page in the somewhat tag intensive BB-code used in the page but instead write it in a neat and simpler format.
Read more...
Exspand Comment(0)

Name:
Message:
Tags:php, document.generator, text.formatter

AjaxCall Monday 9th of May 2011

I have created the following AJAX encapsulating class in JavaScript. The idea of the class is to encapsulate AJAX in a single object. That handles both sending the request to the server and delegating the result. The objekt uses the eventhandling concept to call functions when the state of the request changes. In the following example it is assumed, that the class code is in the "ajax.js" file. The example loads the url text.xml and alerts it contents:
Example:Using AjaxCall
<html> <head> <script src="ajax.js" type="text/javascript"></script> <script type="text/javascript"> var aj = new AjaxCall(); aj.url = "test.xml"; aj.onloaded = function(o){ alert(o.getAsText()); } aj.execute(); </script> </head> </html>
AjaxCall   Show detailedShow code
+ onuninitialized : Function
+ onopen : Function
+ onsent : Function
+ onreceiving : Function
+ onloaded : Function
+ onloadedOk : Function
+ asynchronous : boolean
+ url : string
- _request : Object
+ method : String
- _params : Object
+ piggyback : Mixed
+ mimetype : String
+  getAsXML(): XML
+  getAsText(): string
+  addParam(string, mixed)
+  getParam(string): mixed
+  execute()
-  _readystatechange()

Exspand Comment(0)

Name:
Message:
Tags:javascript, ajax

CSS gallery Wednesday 30th of March 2011

Sections

The showing

The following gallery is created only using HTML and CSS. The features of the gallery is as follows:
  • Thumbnails
  • Full images
  • Default image
In my opinion this gallery should never ever be used on any page. The reason for this is that the gallery loads all pictures in at once. For that very reason the gallery can only be viewed in isolation mode.
Read more...
Exspand Comment(1)
Abobeembory Saturday 2nd of April 2011
Tak for de interessante oplysninger

Name:
Message:
Tags:css, gallery
Entries this month
None