Twelve Dozen

Just another WordPress weblog

Archive for the ‘Uncategorized’ Category

FTP / ZIP from the command line

http://www.howtogeek.com/howto/windows/how-to-automate-ftp-uploads-from-the-windows-command-line/

http://www.codejacked.com/zip-up-files-from-the-command-line/

  • 0 Comments
  • Filed under: Uncategorized
  • Convert databases to xml

    http://www.softsilver.com/downloads.asp

  • 0 Comments
  • Filed under: Uncategorized
  • Drupal – Format Comments

    Remove (Not Verified) – http://drupal.org/node/99409

    Remove Submitted By – http://www.kirkdesigns.co.uk/format-submitted-text-drupal-6-nodes-and-comments

    Add Comments Header – http://drupal.org/node/76716

  • 0 Comments
  • Filed under: Uncategorized
  • File Permisions

    Good file permissions tutorial -
    http://www.interspire.com/content/articles/12/1/FTP-and-Understanding-File-Permissions

    FTP overwrite problems using Virtualmin setup –
    http://www.virtualmin.com/node/9885

  • 0 Comments
  • Filed under: Uncategorized
  • Backing up large MySQL database

    Linux to the rescue. This sure beats using Export from PhpMyAdmin, it can be slow and may time out with large databases.

    mysqldump -a -u USER -p DBNAME > /path/to/backupname.sql

    http://www.metatitan.com/mysql/6/how-to-backup-and-restore-large-databases-in-mysql.html

  • 0 Comments
  • Filed under: Uncategorized
  • Setting up SSL on your server

    Check your SSL certificate – http://www.digicert.com/help/

    Setting up SSL on apache:
    http://onlamp.com/pub/a/onlamp/2008/03/04/step-by-step-configuring-ssl-under-apache.html

  • 0 Comments
  • Filed under: Uncategorized
  • Jquery slide show for Drupal

    If you need a slideshow for your Drupal website, I recommend using JCarousel Lite – http://gmarwaha.com/jquery/jcarousellite/

    It has lots of parameters to tweak depending on how you want to set it up. It’s easy to get working.

    One slight issue (well major issue really until I fixed it), that I had using this with Drupal was that initially I needed to press F5 to refresh the browser before the images would display.

    The fix for it was to surround the code with $(document).ready(function () { }

    Here’s my code:

    <script type=”text/javascript”>
    $(document).ready(function () {
    $(”.carousel”).jCarouselLite({
    btnNext: “.next”,
    btnPrev: “.prev”,
    scroll: 1,
    auto: 1200,
    speed: 1600,
    visible: 1
    });
    });
    </script>

  • 0 Comments
  • Filed under: Uncategorized
  • FILES=”test.xml”
    # for loop read each file
    for f in $FILES
    do
    INF=”$f”
    OUTF=”$f.out.tmp”
    # replace javascript
    sed ‘//d;//d’ $INF > $OUTF
    /bin/cp $OUTF $INF
    /bin/rm -f $OUTF
    done

    http://en.kioskea.net/faq/sujet-1451-sed-delete-one-or-more-lines-from-a-file

    http://www.oracle.com/technology/pub/articles/dulaney_sed.html

  • 0 Comments
  • Filed under: Uncategorized
  • Convert CSV to XML using Perl

    In my quest to convert a CSV file to XML I’ve found the best advice seems to be to use Perl.

    Do I have Perl installed on my linux server?
    http://www.cyberciti.biz/faq/how-do-i-find-out-what-perl-modules-already-installed-on-my-system/

    Enter the following command in shell -
    $ instmodsh

    To find the version of perl -
    http://www.cyberciti.biz/faq/how-can-i-find-out-perl-version/
    $ perl -v

    Here’s my findings:

    I’ve been following a tutorial in a book called XML and Perl by Mark Riehl and Ilya Sterin, which is a very good read for a XML and Perl newbie like me.

    Anyway, I’m using Linux Debian with Perl installed but no other Perl modules. Here’s what I did:

    Installing Perl modules on linux debian

    http://www.cyberciti.biz/faq/how-do-i-install-a-perl-module/

    perl -MCPAN -e shell

    This should display this:

    CPAN is the world-wide archive of perl resources. It consists of about
    100 sites that all replicate the same contents all around the globe.
    Many countries have at least one CPAN site already. The resources
    found on CPAN are easily accessible with the CPAN.pm module. If you
    want to use CPAN.pm, you have to configure it properly.

    If you do not want to enter a dialog now, you can answer ‘no’ to this
    question and I’ll try to autoconfigure. (Note: you can revisit this
    dialog anytime later by typing ‘o conf init’ at the cpan prompt.)

    Are you ready for manual configuration? [yes]

    Note: This took a long time and lots of files were installed

    To install Perl modules:

    Here is how you would install XML::SAX using CPAN.pm in the shell mode:
    >perl −MCPAN −e shell
    CPAN>install XML::SAX

    To convert CSV and Excel files to XML you will need to install the modules:

    XML::SAXDriver::CSV
    XML::SAXDriver::Excel

    Issues:

    Text::CSV_XS – This module is required

    Unfortunately there was a problem installing the required SAX modules so I needed a new approach. I did manage to install some modules using this method though.

    I then found this post http://www.xml.com/pub/a/2001/06/13/perlxml.html

    The initial code had a spelling mistake $xsl needs to be $xls

    I created a new directory and then created a new Perl file, test.pl


    use XML::Excel;

    my $file = ‘inventory.xls’;
    my @columns = (’key’, ‘lname’, ’size’, ‘form’);

    my $xls = XML::Excel->new({column_headings => \@columns});print $file;

    $xls->parse_doc($file);
    $xls->declare_xml({version => ‘1.0′,
    standalone => ‘yes’});

    $xls->print_xml(’test.xml’,
    {file_tag    => ‘inventory’,
    parent_tag  => ‘entry’}
    );

    Then I uploaded the Excel file inventory.xls to the same directory. Finally I executed the Perl script:

    # perl test.pl

    And it output the XML file test.xml as required.

  • 0 Comments
  • Filed under: Uncategorized
  • Audio Player for Drupal

    Recently, I’ve changed the way I’ve been creating websites in Drupal. Instead of trying to make everything as easily as possible for clients to add content to their websites I’m actually more inclined to think that this can make creating sites more complicated. I know there are a plethora of Drupal modules available for almost everything, I’ve found that sometimes installing a module for every little task for the website can make things more complicated instead of less. So when wanting to add an MP3 player to a recent website project I’ve opted to use the 1 Pixel Out plug-in and simply add the javascript code direct to the ’source code’.

    Here’s a simple tutorial that I followed.

    http://www.macloo.com/examples/audio_player/

  • 0 Comments
  • Filed under: Uncategorized