Long Time No See...

16/03/2012

Well, it's been a while since i wrote here. i had an initial flurry of interest in writing posts, and then uni and IRL events distracted me from it. but, never mind. I suddenly feel like i should stop neglecting this blog. So here's a post. I wouldn't expect posts in the future to be on any kind of schedule. I'll add a post when I feel like adding a post.

So, until next time, when i can actually think of a subject to blog about... code away.

If you'd like to keep up with my posts, the easiest way is by subscribing to my RSS feed, or by simply checking the site every so often.

__________________________

Click to show/hide Comments. (0 Comments)
____________________

From The Ground Up

02/08/2011

Many blogs out there are based upon particular named blogging platforms (such as wordpress), either self-hosted or otherwise... paid for and free... each one has its own particular feature set, made to be useable by anyone who may pick it up as their blogging platform. This blog however is not based upon any regular content management system. It's different.

When I first began to think about writing a blog, I knew that it'd be a fairly techie one, centred around programming and general geekery... so I started to look around at the available platforms. Yes, some are very nice. I'd even go so far as to say some are fully featured. But I wanted to have something I completely understood the working of. Something simple, yet effective, and something I could use as a personal project and build upon whenever the feeling struck me. Something that I could code my own features into. So I resolved to write my own blogging platform from scratch.

Now, before I begin to explain my discoveries fully, I must make you aware of one fact: I didn't like mySQL at all when I started. In Fact, I made it my mission to try and make the site work without using it at all. This did not happen, as i will explain later.

The process of creation began with an attempt to carve out a good-looking site in HTML5 and CSS3, without creating huge differences between browsers. Of course that was impossible in a major sense, as any user browsing using Internet Explorer 8 or lower will find that the CSS image content doesnt load properly. Not a problem for me though...All the more reason for you to switch to a decent browser to view the site. (If you already use chrome, or Firefox 5+, give yourself a pat on the back!) A fix for various object placement problems between browsers was relatively simple too: rather than using the "margin-top" css property, use the "top" property. every browser interprets it the same way.

For those who have never designed a site before, I'll tell you one of the most difficult things you can be tasked with doing: creating a colour scheme which fits the subject matter, whilst also allowing for ease of reading. I knew I wanted the main colours of the site to be green and black/grey... but every combination I tried ended up looking very jarring, or being hard on the eyes while reading. That was when I was shown a wonderful tool: Colour Scheme Designer. Many scheme designers out there only allow you to select one colour, or only allow for a certain set of colours. this tool allows any set of colours from the colour wheel to be selected in different combinations, and it will suggest a colour scheme based upon your selections. Very useful.

After this, every feature of the site was slowly added whenever I felt I had the spare time and motivation to do so. This began with a basic "About" page, and a system for displaying posts that I'd added. All Still in pure PHP. This carried on as I added more posts, dynamically changing menus, a visitors' book, external links, an email form (which doesnt disclose my personal address) and pagination to the blog.

At this point, I decided I could no longer completely do without SQL. Using it would simply make comments on posts easier to code, as everything could be stored in one database and displayed when needed. I tackled it full-force and created the comments/feedback system you can see on every post now. SQL is not as bad as i first thought.

And the most recent feature addition I've made is the picture gallery. This is the only part I did not code from scratch. I don't know jquery well enough to create something so fancy myself. A good friend of mine recommended this type of gallery: Colorbox. It's a very versatile and easy to set up jquery tool. I even used it to show the contact email form on the homepage. I highly reccommend it.

Now that the site is all working, "what have you learned from this?" I hear you say. I've learned that a lot more code goes into these blogging systems than you expect. I've also learned just how useful and powerful SQL and jquery can be as tools for developing sites with rich content. I found that HTML5 and CSS3, even as the unfinished standards that they are, are very powerful, with many uses, and interesting new features such as box-shadows and in-built animation, transformations, and gradient generation. Mostly though, I had fun. Creating a blogging platform is great fun for a web coder, and I recommend this as a project for those who either want to learn the ins and outs of any web programming language, or simply want a challenge to take up their spare time. Trust me, it draws upon plenty of that!

So, until next time... code away.

If you'd like to keep up with my posts, the easiest way is by subscribing to my RSS feed, or by simply checking the site every so often.

__________________________

Click to show/hide Comments. (0 Comments)
____________________

PHP problems

22/07/2011 03:20

In the process of building this site, I decided that I'd try to challenge myself to create a php-only system for showing pages of five posts at a time. Eventually though, I decided I'd abandon that idea, showing only the latest six posts on the main blog page, and allowing readers to view a "Post Archive". All after I stumbled into a problem in php which I couldnt find a way around:

I'll start by explaining what I ran into: Usually the way a "for" loop works in php, is as follows:

$arr = (one, two, three);

for($I=0;$I<=2;$I++)
{

echo $arr[$I];

}

That loop, as written, would echo each of the values within the array, in order from 0, to 2. The first line declares an array variable, with values "one", "two", and "three". Then, the line beginning "for()" is the for loop itself. The variable $I is declared within the loop to tell the loop how many times to iterate. $I increases by one each time the loop is iterated. Note that, within the loop, $I is called to select which value from the array will be echoed. This is all well and good. At least this works.

The theory I had was, that I'd use a predefined variable (cookie or otherwise) which I'd be able to change when a "next" button was pressed. Once declared, I'd use that variable to iterate a for loop AND to select which posts should be shown from an array of values. That way, when the button was pressed, I could add five to the predeclared value, and the page would re-render, causing the next five posts stored in the array to show on the page. Similar would be true with a "previous posts" button, by taking five from the variable.

I continued to write up a piece of code, which, in theory, should have worked: I created the array of posts, then I declared the cookie value, and made a copy of it into another variable to use in the for-loop iterator. This value would be copied every time a page loads, in order that it could be reset at any point, including loading the homepage, or pressing a "most recent posts" button... After this, I used the value in the for loop, trying to call it again to show each post from the array.... but nothing would show on the page. Nothing. I tested the loop with a generic $I variable instead to see if that would work. It did.

Poo.

I tried many different versions of the code, but no matter what, I couldn't get ANY variables which were declared outside of the loop to work within it to display the array contents.

After many tries I decided to change my plans and write the system I have now, which I'll not divulge in detail right now.

I'll probably write something similar into the code again sometime, as I've been thinking of ways to improve the way I wrote it, which may or may not work in reality. But I'll probably wait till I've got a good few more posts before I do that. For now, it doesnt really matter.

I really hope that all this makes sense to others and not just me.

To be completely honest, despite small problems like this, I do love to work in php, as it's so easy to use. It's a pity it's a web only language. Typical, right?

Anyway:until next time...Have fun.

     ::EDIT:: I've found out that the way I was doing it was not good. I was attempting to create a pagination script at the time, and now I know an easier way of making pages and I may include it in my site sometime, but not yet.

     ::EDIT2:: I've added a pagination system to my site now, using $_GET variables. much much easier than what I was attempting before. dont know why I made it so hard for myself before.

If you'd like to keep up with my posts, the easiest way is by subscribing to my RSS feed, or by simply checking the site every so often.

__________________________

Click to show/hide Comments. (0 Comments)
____________________

Google+...+1?

18/07/2011 16:07

Over the last week or two, since the launch of Google+, I've heard a lot of praise for the service, and also a lot of complaints. So I thought I'd make a post about it.

To begin, let's cover the issues: Many people don't necessarily complain about google plus, but simply don't see the point when facebook has a monopoly works and there are a lot of people on it. I will not argue with these people, as they do have a point. The one problem with facebook though is privacy: facebook makes everything you post public by default. That's not a good thing, as users could easily, unknowingly, share something embarrassing with the world. The following statement is taken from the terms and conditions of facebook:

"By posting User Content to any part of the Site, you automatically grant, and you represent and warrant that you have the right to grant, to the Company an irrevocable, perpetual, non-exclusive, transferable, fully paid, worldwide license (with the right to sublicense) to use, copy, publicly perform, publicly display, reformat, translate, excerpt (in whole or in part) and distribute such User Content for any purpose, commercial, advertising, or otherwise, on or in connection with the Site or the promotion thereof, to prepare derivative works of, or incorporate into other works, such User Content, and to grant and authorize sublicenses of the foregoing. You may remove your User Content from the Site at any time. If you choose to remove your User Content, the license granted above will automatically expire, however you acknowledge that the Company may retain archived copies of your User Content."

I admit that was a large section to paste, but the point is, that essentially means that, even if you make an image private on facebook, they may use it publicly anyway. Contrary to popular belief, they do not "own" your images (as made clear in a later part of the TnC) in any real sense as you can remove them at anytime, but they may even continue to use archived copies after removal. They can sell your photo for advertising or other things too. unlike google+ (click image for a readable size):

The content of that image explains itself in terms of their policy and is all very good... but this image as a link is also an example of a flaw in google+: If a person has access to the direct link to any image (as above), even if the image is private or not shared, they can view it. Thankfully the image is licensed by the creator under creative commons so I can show it to you. This means that it's possible your images could end up shared if anyone managed to obtain a direct link to your content. This could be possible via Man In The Middle (MiTM) attacks on the site traffic (or the mobile "instant" upload traffic), via any vulnerability in the service which may eventually be found (the service is still in BETA after all!), or via a URL prediction alrogithm created by a malicious user.

To protect yourself against these attacks there are various things you can do: for MiTM, avoid any places where another person connected to the same network may intercept your web traffic (such as public wifi access points, or shared work connections), and turn on SSL via google mail settings (browser settings >> always use HTTPS.) This does not make you impossible to attack by MiTM, but it makes it a little harder for an attacker to read your traffic. Especially true if you share an image with a friend, as their connection may not have HTTPS enabled and, as the image will show up in their shared posts' images, their traffic could be sniffed...etc.

It is pretty much impossible to protect yourself against future 0-day vulnerabilities found in the site, or against url prediction algorithms as those are problems on the server side and would have to be fixed by google themselves.

To be completely honest though, it's probably not a big deal, as the rest of google+'s privacy and security seems fine to me. Perhaps I'm not looking closely enough at the code...we'll see over time. Also, either way, the direct image link problem is not only a problem with g+... facebook has the same problem and it seems to not be a big deal for them. So, who cares, eh?

Until next time...Have fun.

If you'd like to keep up with my posts, the easiest way is by subscribing to my RSS feed, or by simply checking the site every so often.

__________________________

Click to show/hide Comments. (0 Comments)
____________________

Graffiti and gaming

18/07/2011 03:07

The last few days have been interesting. Very interesting. Most of the time because I've been playing various games in the aftermath of the steam sale...

Magicka - Such an awesome game. But in order to play it well, you need to learn to touch type with your left hand, otherwise you'll find it hard to pass the first level or two due to the speed and accuracy required. Fantastic idea, though the game code obviously needs optimisation.

Just Cause 2 - Oh MAN! It's like Grand Theft Auto, on steroids, which are on steroids!! with rockets, and grappling hooks, and cars and planes and explosions! it's crazy, and great to take out a little stress on.

There have been some things of interest IRL too, though, with considerably less explosions:

Firstly, I have GOT to reset my sleeping pattern. Right now, it's less of a pattern and more of a... splatter. There is very little rhyme or reason to it. It Needs a full reset. And secondly, I was on my way into town, and I saw, in spray paint on the side of the shopping centre, a URL relating to a movement of anonymous. I seriously didnt expect to see that kind of thing sprayed on the walls in such a public place. I've poked around looking at the URL and all related to it and it's all leading pretty much to a publicity stunt in the streets on the night of the 30th july. Let's hope it's nothing more than that...

I'll apologize for the chatty nature of this post now, as I just felt like writing. With a little luck I might have some actual content of interest for you next time.

If you'd like to keep up with my posts, the easiest way is by subscribing to my RSS feed, or by simply checking the site every so often. And with a little luck I might just entertain you for the short while you are reading.

Until next time...Have fun.

__________________________

Click to show/hide Comments. (0 Comments)
____________________

The Hardest Part

14/07/2011

I'm overwhelmed: Despite the fact that I have made various small posts as tests of particular features, and as a way of keeping track of what I've been programming, and even though this is meant to be a tech blog, I have no idea what I'm going to write this first full length post about!

But, ohmygosh, it's already falling from my brain onto the page. Ah well, I've begun...so hi there. I'm Pr3fatum, and I'm an ethical hacking student from the United Kingdom who's new to blogging (see the About Me section for a smaller introduction.) I like to program, to play videogames, to watch anime, to watch doctor who...heck, I'm an all-out geek. If it's geeky you can probably bet I like it.

Oh. And I hate apple...well, I guess, not apple themselves, but their business model, their software, their methods... agh, who am I kidding? I hate them. I don't like microsoft much either, but at least I can put up with their OS (by which I mean Windows 7). At least it's not -quite- as restrictive as apple's software.

Enough of this overblown introduction though, as I fear I'll begin to ramble. There will be a miriad of subjects discussed in this blog, from technical geeky stuff, to music; From current affairs to interesting/useful content from the web. I might throw in a rant or two if I'm in a particularly rage-worthy mood. If you'd like to keep up with my posts, the easiest way is by subscribing to my RSS feed, or by simply checking the site every so often. And with a little luck I might just entertain you for the short while you are reading. I plan on making a new post weekly, at least.

Until next time...Have fun.

__________________________

Click to show/hide Comments. (2 Comments)
____________________




If you enjoy any of my work, and believe that it's worth buying me a beer/coffee/something, I'd appreciate a donation using the button below. Even as little as $1/1GBP helps:

You don't need a paypal account to donate.
Just use the continue button on the bottom left of the paypal page to use a regular card instead.