Archive for October, 2006

pixelDepth update

I updated pixelDepth this morning. All the links are search engine friendly, and the CSS works in IE 7 now.

I just checked the site, logged into the control area only to find over 115 guests online. I doubt these are all real people, most likely search engine bots. I checked the stats, and it seems it is bots doing it.

Yahoo! Slurp seems to be the main one, loads of IP’s with that agent.

Hopefully with the SEO I have done, it will improve pixelDepth’s position in search results.

ProBoards UBBC add() function

Something I was not aware of when I coded the UBBC function for ProBoards was that in Firefox, if you write a long post where a scrollbar shows up, and you are scrolled down, then when clicking on a smiley or UBBC tag, then it resets the scrolling position.

Here’s the bug report…

Bugzilla Bug 231389: Textarea scrolls to top after changing its .value, regardless of cursor position

It wasn’t until recently that I was aware of it, thanks to Eton Bones on the Support Forum at ProBoards. I saw a few fixes, most of them were the same, but I decided to fix it differently by using setSelectionRange().

Updated script can be found here: ubbc.js

Fixes a few other things as well.

Craig updated the script last night, so hopefully there will be no further problems.

Notepad in PHP-GTK

Like I said in my last entry about PHP-GTK, I’m really loving it. It’s so easy to learn.

Yesterday I thought I would test my skills and see if I could write a notepad application, which I have done, though it is no where near finished. Here is a screen shot of it…

Notepad

I added auto save feature that saves the window size and window location. So when you next open it, it remembers where it last was, and what size it was. Pretty cool stuff.

Something that took me a while to work out was how to read text from the text view (GtkTextView) widget. I had to read up on the buffer class, once you get the hand of it, it’s very easy. In case anyone else is interested, this is how I done it…

$GtkTextViewObj -> get_buffer() -> get_text($GtkTextViewObj -> get_buffer() -> get_start_iter(), GtkTextViewObj -> get_buffer() -> get_end_iter())

I’m sure there must be a shorter way than that, but that’s all I could find.

Fun stuff :)

globalStorage, how it could become a problem.

With Javascript 1.7 being implemented in Firefox 2.0, new features are now available to developers. One of these features is session and persistent data storage on the client side using the new DOM Storage API. We have the ability to store session data, or persistent data, which is really cool from a developers point of few, something I will be making use of, and already have put to use in a project.

Now comes the problem for remotely hosted forum services like ProBoards / InvisionFree / insert other here. When you sign up for a forum, you are given a sub domain name like http://username.server.com or http://server.domain.com/user/. So for example if you register a ProBoards forum, you will get something like http://username.proboardsXX.com where XX is the server number. One server could have thousands of forums.

Throughout this I will be using ProBoards as an example, but the same problem exists for other hosting services most likely.

Now, when you set a session variable, it can only be accessed on the forum it is set, which is a good thing, so no danger there. But if we use the persistent API (global storage), we can set the global storage domain to the server (i.e proboards17.com), we can then store any information we want, good thing about this is we can store information and recall it next time the user visits, and this includes closing the browser, as the data is persistent. Cool right? Nope, not really, let me explain…

Lets say I have a forum on server 77, and someone is using a hack of mine from the database (Javascript code that gets placed in the header or footer), and they are also on server 77. The hack doesn’t even need to be in a remote JS file, it can just be a simple “Total visits to this forum” counter for the member, they wouldn’t know what the code really does, because what it would be doing, is storing the username and password in the storage object. Now let’s say that user visits my forum (also on server 77), I then have easy access to record that users username and password from the forum the hack was being used at, I could then send that data to a database to record it.

Isn’t a great deal that can be done to prevent it. Maybe there should be a global flag that can be only used once in the document, this flag could be set to 0 or 1 (false / true) and would be set in the head tag, as most hosting services only allow code inputting inside the body tag. So the flag would not be changeable else where in the document, thus preventing attacks.

Your thoughts?

Chris’ blog

He has one, read it…

http://blog.iycatacombs.com/

Also has some useful JavaScript snippets.

I should probably copy him and add all mine to a page :P

PHP-GTK I’m loving it

I had tried PHP-GTK 1 before, and never really got into it, I gave it about a day. But now I have decided to go back to it, and have been playing around with it the last couple of days, and I must say, I’m really enjoying it.

Once you have everything installed and running, it’s so easy to start writing your applications. The main downfall of it at the moment, is that there is no compiler for PHP-GTK 2, so distributing your applications is a bit awkward at the moment. Saying that, there is a free compiler in the works called “PriadoBlender”, at the moment the developer is working on 1.5 (I believe) which will support PHP-GTK 2. I can’t wait, that means you can compile your application into an exe file and then give it out, so whoever downloads it doesn’t need to install GTK and PHP.

So yeah, in the mean time I’m just trying stuff out, getting to know the classes / methods / properties. Yesterday I created a program called “Hasher” just to test it out. The program is useless, but it was fun to try…

Hasher

Anyone else tried PHP-GTK?

Categories

I’ve gone through all the entries in my blog and put them into categories to keep everything tidy. No idea why I never done this before.

PHP-GTK

Yesterday I decided that I may start to learn PHP-GTK again, but properly this time. I want to create desktop applications, but I do not wish to learn anything like C++, and because I already know PHP very well, all I need to learn is the GTK side of things, which is easier said then done. There isn’t many tutorials at the moment, and the official documentation has not been completed, but it’s slowly getting popular I think, just need a good compiler to create standalone applications. Saying that, there is one out there, only problem is it doesn’t support PHP-GTK2, though I heard there will be a release sometime soon.

Here is an example of what the code looks like…

class hello extends GtkWindow {

   public function __construct(){
      parent::__construct();

      $this -> create_app();
      $this -> set_destroy();
      $this -> show();
   }

   public function set_destroy(){
      $this -> connect_simple(”destroy”, array(
         ”gtk”,
         ”main_quit”
      ));
   }

   public function create_app(){
      $this -> set_title(”Hello World”);
      $this -> set_position(Gtk::WIN_POS_CENTER);      

      $lbl = new GtkLabel(”Hello World”);
      
      $this -> add($lbl);
   }

   public function show(){
      $this -> show_all();

      Gtk::main();
   }
}

new hello();

?>
What better way to start than with “Hello World” :p.

I’m not sure what the limits are, but I’ve seen a web browser application done with it that embeds a Mozilla browser window using GtkMozEmbed…

http://www.mozilla.org/unix/gtk-embedding.html

So yeah, pretty cool stuff, something I want to get my teeth into :)

Hush Hush

A few months ago I was working for JV Trading, though not officially, as I wasn’t on the books. My job was basically doing anything, most of the work was hard manual labour. The place I was working at was a nightclub that was getting completely redone, inside and out, a lot of money being spent on it. As for why my job ended, don’t ask, lets just say that the person I was working for doesn’t have a sense of humour and didn’t like people standing up for them self by talking back, which is what I done.

Anyway…they opened the club last night with the new name called “Hush Hush”, which I’m not really liking myself. I heard that there has been problems with the toilets and the pipes. The toilets were leaking sewage, and the pipes that go from the pumps to the bar were squirting over the customers. Why? Because it was all a rushed job, regardless if it looks all nice, the job was rushed, which is no fault to the contractors. That’s what I heard from my source :P.

I also noticed that they have a new website, and all I can say to the company who were paid to create it needs to fire the PHP programmer. I haven’t looked for any exploits, and won’t bother, but from a quick look around, there is no form validation done server side, they rely on client side validation (yes JavaScript). So I went to the signup form, clicked submit, and there I was, already logged in without having to provide any information, same applies to every other form on there.

Here is the link if you wish to check it out…

http://www.hushhushlounge.co.uk

mod_rewrite

Yesterday I thought that maybe pixelDepth should have search engine friendly URL’s, specially for the tutorials so it would be…

http://pixeldepth.net/tutorials/1/36546543/Introduction_To_PHP/

Instead of…

http://pixeldepth.net/index.php?action=tutorials&category=1&id=36546543

I thought I may as well do the whole site, which is what have been doing, but it’s taking so long to do, so many links and other things to change, I wish there was an easier way.

I hope to have it done for this weekend, will need a few people to test it for any invalid URL’s. Hopefully the keywords in the URL’s will bring in a bit more traffic and get higher up in the searh engines.

What are your thoughts on SEO?