What with being on holiday last week, this week has been a bit slow. I did notice today that I´ve spent most of the week doing things like going through the weblogs for the month, checking refering pages, seeing what the new PRs are, updating page titles to match incoming links, setting up new links… blah, blah, blah.
I think the word for this is "Web Master". So not what I signed on for. I was supposed to be a Web Developer. You know, massive amounts of database driven code, 404 redirects, that kind of thing.
So I´m throwing in the towel. Time to spend the next few months doing that again. Screw the PR, it´ll sort itself out!
Just knocked up the site for Mark´s 3D Modelling company. Quite like doing these simple (ish) sites as it´s a good distraction. Also since we can now knock these up using pure CSS layouts the ratio of actual text to code is higher which is just a good thing from both a bandwidth and search engine points of view.
Time to go outside for a ciggy
I finally gave in and decided to get a new MP3 player since my other one is one of the first out that was basically a CD player that plays CDRs of MP3s (thats a lot of acronyms) with about a 2 hour battery life. So I had a look around to see what was out there, check out the formats they play and the online shops they are compatible with.
Finally decided to go with the masses and become a poddie! I went and bought one of the 512MB iPod Shuffles. They are nice and small, have a good 12 hours of battery life and hold a good 8 albums of music. I could have gone for one of the iPod Minis but I don´t need that much space and since it´s a hard drive based player I wouldn´t be able to use it at the gym without knackering it.
Also, since I barely go for a day without using my laptop it means that I can swap albums over and charge it up while I´m checking my email and stuff. This means that the reduced storage space really doesn´t bother me at all.
The only problem I´ve read about them so far is that it ties you in with iTunes. What with DRM, limitations on players and amounts of PCs you can play the music on and all that crap, I think that all the online music shops are just as bad as each other. The iTunes software does let you import your own MP3s though, so for the moment I think I´ll stick with buying CDs online and then ripping the tracks myself. Takes a little longer but it means I don´t have morons telling me what to do with my paid for music.
Oh yeah, did I mention they´re dirt cheap?
I´ve been on holiday for a week and just got back today. I was in France skiing and cos I´ve got a 3 phone, I couldn´t get a signal out there or check my email. Turned my phone on today and had 5 texts and 7 voicemails. Not too bad.
Got to work and 3 hours later I´ve nearly finished sorting through the 160 emails I got. And thats just to delete the ones I don´t have to do anything about!
I´m going to move and live on the top of a mountain…
I´ve wrote a bit before about PHP and SQL output caching but it was based around caching it within the server/network of the host. This is good thing for the project I was considering it for since it was necessary for the pages that change regularly.
There are, however, caching servers (such as Squid) that take copies of pages to save bandwidth and server load. These servers are generally set up to ignore .php pages since they are generally dynamic by nature, which is a good thing.
It did occure to me that I could reduce server load on some sites that don´t change that often by getting these servers to cache the sites. All I would need to do is send the content type header as html instead of php and the servers should keep a copy. It could be done through the server configuration or something like
header(´Content-type text/html´);
should do it. Only thinking out load really, might give it a try and see what happens.
…. is in a word, the biggest waste of time since Stevie Wonder´s visit to a mime feastival. I was trying most of yesterday to create a drop down menu in a combination of Javascript and CSS for Island Leisure and after much messing around with a free menu I came accross, gave up.
The menu in question works fine but when I tried to insert it into the page I wanted (nothing fancy, just a table or two and a bit of CSS) it all went horribly wrong. I finally got it working in IE6 and thought that all was well, but then I loaded up Firefox and the positioning was all wrong.
Sod it. I decided to stop messing around and use the Milonic DHTML menu. I´ve used it before on a non-profit project and had no problems at all. I figured paying the ?20 ish was a lot better than me spending hours going through code trying to get it working.
Lesson learned
I work for a number of computers doing various things, one of which is Premier Computers which provides various computing and networking services. Because of this it gets around that I "do computers", which is pretty much true but not my main job. Anyway, a friend of mine asked if I could set up a wireless network so they could share his ADSL connection around their house.
I know he lives in an old stone farm house so i decided to go round and check it out along with the PCs to check if they would take the wireless cards. There didn´t seem to be any problems, all the PCs had a spare PCI slot and were running XP. Plus the computers were on the same floor in adjoining rooms so the walls wouldn´t pose much of a problem.
I got the stuff and went round to set it up. I replaced the USB ADSL modem with a new router and set that up. The first PC was online! Then went and set up the access point, linked it to the router and checked it all with my laptop. So far, so good. All that was left to do was shove a couple of wireless cards in the other two PCs and job done.
Thats when the problems started. Thecard installed without a problem but I couldn´t find the access point. I got my laptop and loaded up NetStumbler to check the signal. I wandered around for a bit and the signal was ok until I went near the PC.
"erm, whats behind there" I asked pointing at a wall in between the PC and the access point.
"oh, a wardrobe with mirrored doors"
"great…"
So time to move the furniture around. Still couldn´t get a signal in the room anywhere. Ok, time to shift it to the main room and see if its actually working at all. And that would be: No.
Right, next PC. It turned out it had 98 on it (I couldn´t be bothered to check). Hmm, this should be interesting. After 20 mins of messing about with it I decided to give up trying to get it to recognise the card and go home to sulk.
Turns out that when I tried the cards in a test machine at work today, the 98 one is actually broke, but the other works fine. Time to try some other cards and see if they work!
Like a lot of people in web development I taught myself instead of doing courses or reading books (ok, I read one but didn´t finish it). With an internet connection you can find out most of the stuff on t´internet somewhere.
Point is as you learn more and just get more experienced then you start improving and doing things different. A project I´ve been working on for nearly two years, Find Locally has now got to the release stage and is a huge amount of code.
When I started it I broke up the files into folders such as "home", "images" and "content" and let all the files use the require() function to pull in header and footer files from one directory. This was all done using relative paths so that i could work on it using several development servers with different document roots.
Now that it´s ready to go live I´ve decided firstly to switch to absolute paths in the template files and also to change some of the paths, e.g. from http://findderby.co.uk/home/mission.php to http://findderby.co.uk/about as it´s more user and search engine friendly. Since I´d gone over to absolute paths for images etc, this wasn´t too bad as it meant updating some links in the template files and some random 404 and header() stuff (since I couldn´t be bothered to create new folders, I just required them from the document root on a 404 error).
The problem came when I looked at one of the files I hadn´t updated. It was throwing up the usual error message when PHP can´t find the file used in a require() funtion. Found out this was the database connection file require()d in the template file as the paths had changed.
Luckiy I remembered that include() doesn´t throw up errors if it can´t find a file. So I simply put two includes in, one for each of the two types of file. This meant that the code I needed got executed and the one with the wrong path just got ignored. Quite a good work around if anyone find themselves in a similar situation. Remember though, if an error occurs in an include() file it will carry on so probably not best to use it for critical code.
Don´t you just just love my long rambling stories when I could probably sumarise the entire site into a <ul>
Phew, thats a bit of a mouthful for a page title. Chances are if you´ve come accross this from a search engine you´re trying to figure out how to make a session enabled site more search engine friendly.
I´m just about to do this as I´m about to start on a new project with an ecommerce section (I actually started it about a year ago for Premier Computers but got…. sidetracked). The generally accepted and most reliable way of doing a shopping cart in PHP is to use sessions to store the users information such as basket items in a session array and then simply track them using the session ID.
This is fine when the user has cookies enabled as the variable is stored there. This is the case for over 90% (don´t email me with 100s of statistics – I don´t care) of users. As for the others, well in most server default setups the server will tack on the session ID to the end of all URLs if cookies aren´t being accepted. This is fine as it means this people can still use the site. The problem comes with bots that won´t accept cookies and therefore have the session ID in the URL of all your sites pages. In technical terms, this is "bad", as some won´t follow and the others that do rate the page as temporary or secure.
Luckily if its that important you can alter the settings to turn off this behaviour. You can either change php.ini or if you´re on Apache, you can put this in a .htaccess file in the site root:
"php_flag session.use_trans_sid Off"
"php_flag session.use_only_cookies On".
Gonna have a play around and set up some temporary page setups and see whcih googlebot likes the most. I´ll get back to you with what I find out.
We try to put as much effort into Search Engine Optimisation as we can since there´s no point in having a series of web ventures if no-one knows they even exist. When it comes down to it only the people who wrote the algorithm that the search engines use know how it works. You have to use a lot of trial and error, research and time to get a formula that works.
Google is still the worlds most used search engine so if you can get on to the front page for your search terms then your doing well. The other big search engines (MSN, Yahoo) use different algorithms and seem to put more emphasis on the content in the page, but google seems to put more emphasis on the page title and incoming links to the page.
So the way to get to the top is to have links all over the place with the link text made up of the same keywords as the page they link to. Its a bit more complicated than that since you have to take PR (not Public Relations…) into account but it works.
Now back to the web development bit since that is the point of this whole website… programming "tidbits". If you have a large database driven site the chance is that a template is used to generate the internal pages, so the page title is something along the lines of "company name: company motto" and depending on how your code is made up then dynamically shoving this in might not be possible.
<american-infomercial-voice>Fortunately there is an answer</american-infomercial-voice> in the form of javascript. By shoving a script tag in the page after you´ve gotten your content from the db then you can use document.title = "Database driven page title"; in the script tags to change the page title after it loads. It works in all the browsers I´ve tried it in and also in Google, Yahoo and MSN.