Posts for the 'Websites' Category

  1. 100 things that you didn’t know about 2007

    For once BBC news comes up with something interesting, a list of 100 things that you didn’t know about 2007:

    http://www.bbc.co.uk/blogs/magazinemonitor/2008/01/100_things_we_didnt_know_last_3.shtml

    Some that I like include:

    Newcastle is the noisiest place in England.
    Only about half of China’s population can speak the national language, Mandarin.
    There is mobile phone reception from the summit of Mount Everest.
    Denmark is the happiest country in Europe; Italy the unhappiest.
    Cats can be police constables

    Incidentally I am now posting this from the latest version of MarsEdit to which I have just upgraded. Best blogging software I have found yet.

    By timc3 on the
    January 7th, 2008
  2. John Battelle’s Searchblog: Predictions 2008

    This is quite interesting, though I had hoped that he would say Myspace would disappear. Heres hoping.

    John Battelle’s Searchblog: Predictions 2008: “This year I am going to organize my predictions by companies (just the big ones) and trends. I’m focusing on advertising and search markets and the largest companies in that space, as that seems to be what’s on our collective minds these days, and it’s what I seem to have focused on in the past, as I read through my past prediction posts.

    So what are the trends in 2008?”

    By timc3 on the
    January 2nd, 2008
  3. Django and OSX

    Those who have been here before know that I am a big fan of the Django python webframework, and also a big fan of OS X. So I thought that I would install Django on my MacBook Pro.

    I did have it all installed on my G4 laptop, but I am going to be using it with at least two different databases on this machine. I am not going to give a complete, what I typed style install, just an overview because it is fairly easy.

    1. Install latest version 2.4.* of Python from http://www.pythonmac.org
    2. Check out the development version of Django from http://www.djangoproject.com/download/ (I checked it out in /django – probably not the best place to put it.)
    3. Install latest stable version (5.1) of MySQL from http://www.mysql.com/
    4. Install latest stable version of MySQL tools http://www.mysql.com/products/tools/administrator/
    5. Install MySQLdb from http://www.pythonmac.org/packages/py24-fat/index.html
    6. Create a symlink so Python can find django: ln -s /django/django_src/django/ /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/django
    7. Then I followed some instructions on blog.vixiom.com to add the path that I need.
    8. edit your .bash_profile file in your home directory with the following path: /django/django_src/django/bin/:/Library/Frameworks/Python.framework/Versions/Current/bin:

    Now that should be everything needed to start running with Django and MySQL. PostGreSQL is of course the better database but for the testing work that I am doing my webhost at the moment doesn’t support PostgreSQL..

    By timc3 on the
    July 9th, 2007
  4. upgraded wordpress

    Just a quickone, but I have upgraded wordpress on this site to version 2.2.1 which should be the very latest. I had it stuck at a very old version before so it should operate better now, and also I should have all the latest bug fixes.

    By timc3 on the
    July 3rd, 2007
  5. YUI and Camino

    So I have been adding some AJAX goodness to the new site that I am building (all will be revealed soon after testing!) and after some help choosing a framework I decided upon Yahoo’s YUI.

    It helps that some others are already looking at this library, but I am so far having trouble with Camino.

    Camino is my favorite browser on the Mac by far, so of the niceness of the Gecko browsing engine along with better Mac integration but should I support it. I want to degrade it nicely, turning it over to my normal XHTML forms but I have yet to find a way. So I am going down the route of trying to find out manually.

    Even though its a minor browser I still feel that I should do my best, to find out how I decided to look at the stats for this site over the past 2 months to see using what and this is the result:

    Firefox: 52.38%
    Internet Explorer: 34.21%
    Safari: 6.24%
    Opera: 3.53%
    Mozilla: 1.89%
    Konqueror: 0.72%
    Camino: 0.69%
    Netscape: 0.24%
    Mozilla Compatible Agent: 0.07%
    Galeon: 0.03%

    So quite minor, but I like Camino so I should, and I like Opera so I just need to check that on a Mac, but I wouldn’t be surprised if that figure is me!

    updates to come.

    By timc3 on the
    October 15th, 2006
  6. Django site comments and all!

    I haven’t been posted that much here recently and thats because I have been doing other things and working on other sites. I have also built a new server for home, which will be detailed later, but first and foremost I am still playing with Django and build a site using it.

    I have had enough with doing WordPress sites, and although I do know it fairly well I wanted to write something a bit more tailored to the application. And its a good test for the plans I have for other applications later on.

    Django I am enjoying, but its not with out frustration. And although in parts it is amazingly well documented for a framework thats been in the public eye for a relatively shorttime it does miss out on the docs in some parts. I am finding that some things are overdocumented and its hard to find relatively simple bits of information and others such as the comment system just isn’t documented.

    Although they are quite upfront about the comment system needing documents, it is an area that slows down the production pipeline quite alot, to the point where its as slow going as any other development. I suppose I can’t complain too much but still I hope this gets addressed reasonably quickly. I should put down my own experiences with the comment system at this point for others to use, but it should be noted that I don’t know much at all and this is only my findings and what I have so far:

    1. The Django comment system is broken up into three areas – Comments, Karma and Freecomment and if you are interested in what these contain then looking at the database should be your first port of call.
    2. Free comments and comments are different though in some cases if you are using a template or method using free_ then you can sometimes safely omit free_ and get the standard comment system.
    3. The standard comment system is based around logged on users, while freecomments seems to be open to all.
    4. At the moment due to the lack of documentation the two best places to find out information is from the django source itself /django/contrib/comments and in the sourcecode posted by Jeff Croft for his Lost-Theories website.

    Here you can see the django comments tables in MySQL (my host doesn’t yet support PostGreSQL, so I develop in the same database I am going to host on).

    MySQL view of the comments system

    So this has lead me to get a working but rough comments module into my test site. I am using a mixture of my own views and generics like most, and I have created my own templates for the tables in my model.

    In the details page for one model, I am pulling out some information from the post like so:

    {% block content %}
    {{ object.article_body|escape|linebreaks }}
    {% endblock %}

    Then I am referring to the comments. My model is called Post so that is what I am pulling the comments out for:

    {% block metacontent %}
    {% load comments.comments %}
    {% get_comment_list for website.post object.id as comment_list %}
    {% ifequal post.get_comment_count 0 %}
    No one has posted any comments yet. Perhaps you'd like to be the first?
    {% endifequal %}
    {% for comment in comment_list %}
    {{ comment.comment }}
    {% endfor %}

    Then I pull in the standard comment form:

    {% comment_form for website.post object.id%}

    In your templates directory you can then create a subdirectory called “comments” and the commenting system will search in here first for the comments templates before using its own.

    I copied the form.html template in here and modified it, and then I also created templates for posted.html and preview.html. If you are looking for ideas for these two again Jeff Croft’s source code for Lost-Theories is very helpful.

    And this is as far as I have got so far. In the future I would love to extend it with the Karma system but there is alot more to do to get this site up and running.

    By timc3 on the
    October 8th, 2006
  7. Dreamhost backup plans

    I have been looking at how I backup my data at home, and one thing that always comes to mind is how to get these backups of site, and preferrably into a different geographical area easily.

    Well Amazon S3 storage was always on my mind, but recently dreamhost have gone crazy with their storage offerings.  I know have over 400Gb of space with over 4Tb of transfer for a small outlay each month.

    A cost comparison has been done here by Joseph Scott showing how the two compare:

    http://joseph.randomnetworks.com/archives/2006/10/03/amazon-s3-vs-dreamhost/

    I am going to be looking at implementing something with dreamhost I think, I am not a major corporation, I am a home user with some data so I think dreamhost will be fine.

    Bacula and Backuppc are two projects that run on Debian that I will be checking out, and first and foremost I want to make sure that my data is encrypted quite strongly.  Though I am probably going to put up my photo archive just as is, to have easy access when needed.  More posts to come on this.

    By timc3 on the
    October 8th, 2006
  8. Almost finished a site!

    Along time ago I wrote a list of things that I need to complete, well I have managed to get one thing done on the list, and that was a site I was building for a friend.  Its almost complete from his designs, though I have yet to get feedback.  The site is in Norwegian, for a Norwegain company and it is:

    http://www.nord-vesteiendom.as/

    Screenshot of Nord-VestEiendom

    Its a really simple site on the outside, showcasing new house builds, and all the import information will be uploaded in PDFs shortly.  As normal I built the whole thing on top of WordPress 2, with a custom template which actually contains quite a bit more custom PHP than the simplicity of the site actually reveals.  But Wordpress lets anyone update the site, add in pictures which are formatted properly and then attach PDFs.

    I will be of course putting in more information about the build in my portfolio site.  Now on to build http://jeanettemagnussen.com

    By timc3 on the
    August 12th, 2006
  9. django with apache2

    One thing that I feel is harder than it should be with django is getting it working with Apache2. Sure the built in webserver is nice for development, but there comes a time when you need to step up and use a webserver for development that you can also deploy the site upon.

    I have used Apache a lot in the past, but recently I have decided to move over to installing everything the Debian way, and this will reflect that. I am going to use python2.3, Apache2 and the version of mod_python that is in stable. You can follow the instructions if you have installed Apache2 and mod_python in otherways after this step if you wish.
    To get Apache2 on Debian with mod_python, simply:

    1. apt-get install apache2
    2. apt-get install libapache2-mod-python

    For the rest of the tutorial, I am assuming that you have Django setup correctly, and working with your database. If not, I recommend installing the development version. It is easy to update using svn and there are some features that are better than the stable version I find. Once you have done this you can start to build your site. From then on you can create your apache virtualhost file:

    I have decided to run my django site on a different port, but of course you can run it on different ipaddresses, and with different hostheaders. All you need to do is follow the apache 2 documentation for this. I feel this is already well documented so I will just show how I did it by running on different ports:

    1. Edit the ports file for apache2 to tell it to listen on more than one port:
      vi /etc/apache2/ports.conf
    2. Add this line to tell it to listen on port 8000:
      Listen 8000
    3. Create a new sites file for this new virtual host:
      vi /etc/apache2/sites-available/djangosite
    4. Now we need to put in the configuration details:
      <virtualhost *:8000>

      <location "/">
      SetHandler mod_python
      PythonHandler django.core.handlers.modpython
      PythonPath "['/home/tim/dev/projects/'] + sys.path"
      SetEnv DJANGO_SETTINGS_MODULE djangosite.settings
      PythonDebug On
      </location>

      Alias /media "/var/www/djangosite/media"
      <location "/media/">
      SetHandler None
      </location>

      <locationmatch "\.(jpg|gif|png)$">
      SetHandler None
      </locationmatch>

      </virtualhost>

      This gives us several things:

      • Sets up a virtualhost to listen on port 8000.
      • For the virtual host use mod_python.
      • PythonHandler is told to use Django.
      • Our PythonPath is updated with our site files, in my case my django projects are located in /home/tim/dev/projects/ so this is what I use. Point this to where your django files are kept.
      • Let django know to use the settings file for this project
      • The we setup an alias to serve the media files, as they don’t need to be served through mod_python we turn the handler off for the /media/ location. I will setup my media files in /var/www/djangosite/media
      • Finally tell apache2 not to use mod_python to serve image files.

    5. Now save this file, and enable the site:
      a2ensite djangosite
    6. Now create the webhosting directory, and the symbolic link for the admin directory, and check the permissions:
      mkdir /var/www/djangosite/
      cd /var/www/djangosite/
      ln -s /usr/lib/python2.3/site-packages/django/contrib/admin/media/
      chmod -R 755 /var/www/djangosite
    7. The stop and start apache2 on your server (this is for Debian using init.d scripts, but whatever you do stopping then starting is better than a simple reload).
      /etc/init.d/apache2 stop; /etc/init.d/apache2 start

    Once you have done that, check your site by point a webbrowser to the the machine that you have apache2 running on, but at port 8000 for instance if it is a localhost, tryhttp://127.0.0.1:8000.

    One thing that I haven’t talked about is where it is best to place all the files used in creating a django site, and I have yet to read any documentation about this. This is why in the above I am point it to a dev subdirectory from my home directory. I don’t think this is a good idea for a production site, and perhaps it should go in somewhere off /var.

    One thing is for sure, creating seperate directories for media and the actual files is a good idea, and you if you follow the django instructions you can take them up on the recommendation of using a seperate lightweight webserver to just serve these files.

    By timc3 on the
    July 26th, 2006