Twelve Dozen

Just another WordPress weblog

Archive for the ‘Uncategorized’ Category

Add VAT to postage?

This is an unusual one. In the e-commerce system I use, Trading Eye, it’s always bugged me that we had to input the Post & Packaging less VAT. The system then adds VAT on at the check out. When someone pointed out this may be illegal I’ve been tasked with finding out if that is the case.

Here’s my findings:

Summary: Adding VAT to P&P is standard practice as it’s classed as a service and is therefore VAT-able.

  • Filed under: Uncategorized
  • Form Date Picker – jQuery

    I wanted to find a better solution to inputting dates on a form than expecting users to manually input dates.
    I searched for AJAX date pickers and there were a number of options, although a lot of them were calendars and not specific date pickers. I’d heard a lot about jQuery so I decided to give that a go.

    It was very easy to install. Download jQuery. Add the js files to the header of my page. Add the css class to the form input tag.
    In MySQL I was using Date as the field type so I need to adjust the format of the form field to match the date input i.e. 2009-09-01
    Reading the jQuery documents this was fairly simple:
    $(’.datepicker’).datepicker({ dateFormat: ‘yy-mm-dd’ });

    Thinking about it now I could probably use a fairly simple dropdown option for year – month – day, but it’s fun to learn to use jQuery.

  • Filed under: Uncategorized
  • Problem: Copying the result from a formula field as a numeric value and not the formula. For example if your calculating the combined total of 2 fields and you then want to copy that result for use elsewhere. If you simply use copy and paste what you actually copy is the formula that you’ve used to get the result.
    Solution: Use copy paste-special the results onto another worksheet. In the paste-special options there should be lots of values and tick boxes. If you untick the option for ‘formula’ when you paste it should just be the result without the formula.

  • Filed under: Uncategorized
  • CVS to MySQL

    To upload data from Excel into a MySQL database the easiest option to export the data as a CSV file. Make sure the columns of data match the fileds in the database, minus the id field, if you have one, as this will be automated.
    Your csv line have to be something like this “Rei”,”New Tokyo 6″,”11234″, or like mine it may be “Rei”,”New Tokyo 6″,11234. Only the text fields enclosed with quotes.
    I used PHP MyAdmin, so choose the import tab. Select the CSV file to import. Choose CSV and update the options like so:
    fields terminated by ‘,’
    enclosed by ‘”‘
    lines terminated by ‘\n’

    That should work. If you’re using the command line to manage MySQL try:
    load data local infile ‘uniq.csv’ into table tblUniq
    fields terminated by ‘,’
    enclosed by ‘”‘
    lines terminated by ‘\n’
    (uniqName, uniqCity, uniqComments)

    Explanation here:

  • Filed under: Uncategorized
  • Upgrading Python

    I’ve been having problems with an old version of Python on my server. I searched online for a solution but found very little help upgrading Python. There was some suggestions to use virtualenv to have a sandbox Python environment. This was to use different versions of Python at the same time so an upgrade wouldn’t break anything using the older version. I couldn’t get virtualenv to install properly.

    In the end I decided to bite the bullet and upgrade version 2.3 to 2.5 using the following instructions.

    So far all is good on my server, nothing is broken.

    From the book – Gray Hat Python, 1st Edition

    To install Python 2.5 for Linux, you will be downloading and compiling from source. This gives you full control over the installation while preserving the existing Python installation that is present on a Red Hat–based system. The installation assumes that you will be executing all of the following commands as the root user.

    The first step is to download and unzip the Python 2.5 source code. In a command-line terminal session, enter the following:

    # cd /usr/local/
    # wget
    # tar -zxvf Python-2.5.1.tgz
    # mv Python-2.5.1 Python25
    # cd Python25

    You have now downloaded and unzipped the source code into /usr/local/Python25. The next step is to compile the source code and make sure the Python interpreter works:

    # ./configure --prefix=/usr/local/Python25
    # make && make install
    # pwd
    # python
    Python 2.5.1 (r251:54863, Mar 14 2012, 07:39:18)
    [GCC 3.4.6 20060404 (Red Hat 3.4.6-8)] on Linux2
    Type "help", "copyright", "credits" or "license" for more information.

    You are now inside the Python interactive shell, which provides full access to the Python interpreter and any included libraries. A quick test will show that it’s correctly interpreting commands:

    >>> print "Hello World!"
    Hello World!
    >>> exit()

    Excellent! Everything is working the way you need it to. To ensure that your user environment knows where to find the Python interpreter automatically, you must edit the /root/.bashrc file. I personally use nano to do all of my text editing, but feel free to use whatever editor you are comfortable with. Open the /root/.bashrc file, and at the bottom of the file add the following line:

    export PATH=/usr/local/Python25/:$PATH

    Installing virtualenv

    Yeah you will need to install easy_install be able to install it
    and do a

    sudo python

    easy_install virtualenv
    virtualenv virtualenvironment –python=python2.5 –no-site-packages
    This will create a sandbox of python2.5 where virtualenvironment is a folder where your sandbox environment resides
    then to activate it type
    source virtualenvironment/bin/activate
    you should see the shell prompt with new info showing that you are in the new python environment
    to be sure type
    which python
    to deactivate type
    The jobs a good un.
  • Filed under: Uncategorized
  • Server Monitoring

    I recently sent out a request to a tech list for suggestions for ways to monitor my web server. Here’s the results.

    I’ve just found out about a new monitoring idea someone at work is looking into using twitter. They have created an account for system updates then set up other accounts to follow this and send out sms messages.

    The script uses curl and is a one liner:
    curl –basic –user username:password –data status=”$* ” -o /dev/null
    You then just call the script with the tweet as the parameters, e.g.
    # system down
    We looked around and found this product

    Its very good – sends emails on any failure, can monitor stacks of ports / devices – we get it to send SMS’s for escalations outside office hours etc – Runs on Windows as a service with a web interface.
    I think there are probably cheaper options that do online monitoring but we monitor quite a lot of sites so it was better to host our own software.
    Adam // Internetware

    nagios works very well in this type of situation…in addition to
    failure reporting you can get it to run remote tasks in the case of
    failure such as ask it to restart mysqld or kick an email queue.

    To be honest, if I cant locate an issue with a server in four hours I
    usually decommission it, format and start again.

    Ross Cooney

    I’ve been running quite happily with Server Density ( which has an iPhone app which sends Push Notifications when there’s an alert triggered (you set up your own thresholds on there). It’s a lightweight Python agent which sends load/disk/network/apache data back to SD servers as frequently as you like.

    Coupled with a Pingdom account which texts me everytime the server is unreachable, you know exactly when things have fallen over. And it means if Push Notifications don’t get through (romaing/network coverage issues etc) then you can still be alerted.
    SD also has an API you can build into your own services as well. Which is nice :)

    Andrew Waters

  • Filed under: Uncategorized
  • eview for that TOEFL

    For those who are striving inside of finishing of ones own constructed challenge for your personal college or university, people are pleased to offer you with specialist having any crafting be prepared. see it here The service plan comes up with an built many-year appearance for the huge current market of educational coming up with not to mention prides itself on extremely rewarding these text preferences of scholars across the world. If composing works is simply not very well ones own robusto, or maybe you will most certainly be rather constrained on just for duration these days, alternatively there may be each contributing factor you will cant perform ones assignment your business, do not hesitate to acquire your current composition of our own enterprise. What We Offer When you purchase documents on the web during Our very own agency, you’re warranted these uncomplicated: Totally previous combined with plagiarism-free subject material; Best making consultants; Timely delivery; Individual approach to each acquire; Proper style and design; Round-the-clock help; Easy monthly payment; User-friendly this mobile phone. Exactly why You Your services make use of mainly strongly opted for and also registered internet writers to work for united states. Thus, our business relating to veteran experts will how your job report could be killed towards the highest possible level coupled with discovers this qualifications you actually give to us. Also, you can choose the article author in your essay or dissertation your lifestyle in accordance with your preferences and wishes the person knowledge, structure, or demo. Ensuring that abdominal muscles option, for only a outstanding fees in $5, you may gather two to three making instances of the suitable ghost writer. Together with adjusting your main choosing report for your guidelines you happen to be specify out of your college/university teacher, an individual’s report would be substantially checked out for the purpose of plagiarism together with the specially designed trendy computer programs to assure that the actual crafting happens to be innovative.

    We talk about plenty of his circumstances.

    Get a Price Words of wisdom When you’re currently uncertain of regardless of we’ve been the area for a control, may want to talk to the value offer with regards to your paper and become this responses with 15-20 instants into your e-mail or maybe a contact (no matter that suits you). Somewhat will is in fact display certain requirements and directions for use on your pieces of paper additionally the time frame 1 of three get together. Never introductory homework is suggested for you. Straightforward Charge Independent of the above mentioned many advantages you get of choosing your main papers provided by united states of america, present a huge range of money options to be sure that your take advantage of is completed for the most excellent benefit. Go ahead and shop for the main dissertation coming up with services around. Approval stated!

  • Filed under: Uncategorized