Notka.eu - short notes

Hello visitor

This site is under development - meaning its content will be changing as the time passes.
At the moment you can visit my blog - It is dedicated to web development using the following tools/techiques:

  • html, css, javascript (particulary YUI library)
  • php, perl, mysql
  • Drupal CMF
  • image manipulation and processing
  • RIA, SOA

Simple MySql UNION usage

CREATE TABLE ABCDE (
 val varchar(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8

CREATE TABLE CDEFG (
 val varchar(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8

---ABCDE contains 'A','B','C','D','E'
---CDEFG contains 'C','D','E','F','G'

SELECT ABCDE.val
FROM ABCDE
LEFT JOIN CDEFG ON ABCDE.val = CDEFG.val
WHERE CDEFG.val IS NULL 
UNION 
SELECT CDEFG.val
FROM CDEFG
LEFT JOIN ABCDE ON CDEFG.val = ABCDE.val
WHERE ABCDE.val IS NULL 

---produces 'A','B','F','G'

Imagemagick and perl example

Digging in my old scripts I have found something like this. It uses Image::Magic module to produce resized version of images (+thumbnail) it has found in script directory - you must upload them on server in the place. In order to change execution parameters you must edit the following script variables (I know - ugly way): $im (subdir where output images are put), $width, $height and $small_size (width or height of thumbnail, depends on which one is greater).

Building Tesseract Ocr from SVN on Ubuntu Oneric

  1. Install Leptonica from source (version: 1.68 at this moment), in the following steps:
    • sudo apt-get install autoconf automake libtool libleptonica libleptonica-dev libpng12-dev libjpeg62-dev libtiff4-dev
      Notice: libpng12-dev, libjpeg62-dev, libtiff4-dev are needed if you want Leptonica (and of course Tesseract) to be compiled with

Some MySQL SQL

SELECT @rownum:=@rownum+1, id FROM (SELECT @rownum:=0) r, some_table

For each 'id' we produce corresponding row number. However...., SQL standard doesn't quarantee that records will be returned in order they were added. You may get right results form this query (especially when there are only a few records added) but it doesn't mean it will always work as expected. This query is wrong one. So what about ...

add-edit-input : My new project on GitHub

It's the new Era of web development and my project presents some new concepts.
It's YUI3 based browser widget and server-side php/mysql back-end you can "build from blocks".

Example:
http://notka.eu/pub/add-edit-input/

Link:
https://github.com/d-adamkiewicz/add-edit-input

YUI3 Snippets using JSFiddle.net

search2 - MS Windows command line utility written in python

Recently I wrote python script (and created project on github),
- its description from README file:

"this is multipurpose MS Windows command line utility (Python 3 script)
which needs at least two parameters: file pattern and search dir
it always scans 'search_dir' directory and saves list of full
pathnames that matches the pattern to output file
it also can:
- copy
- move
files of given pattern preserving original directory tree

Python and pyTenjin templating engine

Some time ago I interested in python because of xml.etree.ElementTree module which is very good tool if you want to read and modify XML files.
Later I discovered yaml module which is simple and effective tool for manipulation of YAML files.

Recently I needed to put some values fetched from YAML files into html pages - I recalled myself plTenjin templating engine I've used in perl and the fact that there is its python version - pyTenjin. It's very fast templating engine look: tenjin

Syndicate content