Hoekstra (UK)

Home

How to drop all tables in a MySQL database

  • Print
  • Email

... without destroying the database. 

You can do it all in the shell:

  • Create a SQL script from the database to drop all the tables
  • Execute the SQL script against the database

mysql -u[pwd] -p[user] [dbname] -s -e 'show tables' | sed -e 's/^/drop table /' -e 's/$/;/' > dropalltables.sql
mysql -u[pwd] -p[user] [dbname] < dropalltables.sql

How to Dedupe a table in MySQL

  • Print
  • Email

A quick and dirty way of stripping duplicate records out of a MySQL table!, if your table has no indexes or constraints:

Assuming the name of the offending table is customers:

CREATE TABLE customer_dedupe AS SELECT DISTINCT * FROM customers;
RENAME TABLE customers TO customers_dupe;
RENAME TABLE customers_dedupe TO customers;

Done!

But what if your original table had indexes?

Read more: How to Dedupe a table in MySQL

String-Matching help for SQL Server

  • Print
  • Email

The task of matching strings between heterogeneous systems, especially that of matching personal or company names or addresses, is not easy with SQL Server's limited set of built-in string SQL functions. Here is a C# CLR-Assembly (with source code) for SQL Server with some advanced string-handling functions that may help:

  • LTrim - like Oracle's LTRIM function.

  • InitCap - like Oracle's INITCAP function

  • FlattenCharSet - Replace western characters with diacritics with best-choice, non-diacritic characters

  • StripPunctuationMarks - Remove all punctiation marks from the given string.

 

Read more: String-Matching help for SQL Server

AVI to DVD conversion

  • Print
  • Email

Directly Burn DVD's from .avi files

Here is a quick and simple-to-use utility to convert an AVI file to the weird intermediate files and to then write them all to a DVD. It is called avi2dvd and is written in BASH-shell. It is unlikely to run on Windows.

More about it here at https://sourceforge.net/projects/avi2dvd

How to open .bin & .cue Files?

  • Print
  • Email

So, you downloaded a torrent expecting a nice AVI- or MPG-file for instant-action AV entertainment, and all you got was a big .bin file and a funny little .cue file? Here's the Linux-way of how to extract the content from them:

Read more: How to open .bin & .cue Files?

How to open .daa Files?

  • Print
  • Email

Yet another bespoke file format that unsuccessfully attempts to futher the agenda of vendor lock-in: If you are running Windows, you need to purchase PowerISO from poweriso.com , if you are running X86-based Linux flavour, the same people offer a free program to read and write .daa files. Go figure...

Read more: How to open .daa Files?

How to open .nrg Files?

  • Print
  • Email

A well-meaning person gives you a .nrg file and you will not invest in a piece of expensive bespoke software to read it. After all, you run free, open-source software and never have and never will pay for software. What to do with this stupid .nrg file?

Read more: How to open .nrg Files?

Unix Utilies for Windows

  • Print
  • Email
If you want to install Perl on Windows or do anything vaguely sophisticated in the brain-dead command line shell of Windows (a.k.a. the DOS prompt), then you need a collection of commonly used UNIX utilities that can run under Windows.

I have put together such a collection of the most popular UNIX utilities and a few other command-line programs. Most of these are GPL-licensed (i.e. open source) and the remaining few are free-ware (but not open source). Either way, you can do with these programs whatever you want.

You can download the bundle of utilities from here.

These utilities are particularly useful for installing Perl on your Windows PC. Download Perl for Windows from http://www.activeperl.com. 

Read more: Unix Utilies for Windows

Product Quickcode Generator

  • Print
  • Email

How to generate a Base36 quick code sequence using the SHA2 hash

On a 'slowish' 2GHz machine it can generate 20,000 quickcodes per minute. The spread of the resulting quickcodes is near-perfectly even, which means that substrings of the quickcode can be used to construct a hashed directory tree for holding, for example, the huge amount of product image files associated with a product catalog. Using a hashed directory tree is a quick and efficient method to host millions of separate files for quick, random access, as most file systems only perform optimally with less than 1,000 contained in a directory

This deterministic techique uses a hash of the sequential Integer Id of an item to generate a typical product quickcode for it, as found in many shopping catalogues. Example of how a quickcode is generated from its primary key integer Id:

  • 1 => 8M9LFLN2
  • 2 => HZ40H3K0
  • 3 => 02LUJYQ2
  • etc..

You can download the Base36 Quickcode Generator test script, which demonstrates an implementation in Perl and MySQL.

Read more: Product Quickcode Generator

Page 2 of 3

  • 1
  • 2
  • 3
  • You are here:  
  • Home

Main Menu

  • Home
  • Software
    • SSIS
    • SSRS
    • Oracle
    • Linux HowTo's
    • Scheduler
    • Perl
    • Windows
    • Joomla
    • MySQL
  • Idle thoughts...
    • Rubbish Jokes
    • Philosophy
    • Travel
  • Evil Food Recipes
  • Languages
    • Afrikaans
    • Deutsch

Movie Posters

Dracula [1931].png

Back to Top

© 2022 Hoekstra (UK)