WEBLOG (3) WEBLOG – Page 3 – My IT experience

Child resize according to parent resize

It is incredible how well nowadays browsers handle resizing of elements.

The simplest way you could get a resize on a child element when the parent has been resized is to create two css rules:


.parent {
width:100px;
height: 50px;
}

.child {
position: absolute;
width:100%;
height:100%;
}

Of course the parent element should contain the child element.

Simple postgres SQL query to search for a column name within a DB schema

The query is as simple as that:

SELECT *
FROM information_schema.columns
WHERE column_name = ‘search_for_me’

SQL to query equally named colons on DB

Handy dandy SQL query to find non-foreign-key related searches:

SELECT
TABLE_TYPE,
isColumns.TABLE_NAME,
COLUMN_NAME,
COLUMN_TYPE,
COLUMN_KEY,
IS_NULLABLE,
COLUMN_DEFAULT
FROM
INFORMATION_SCHEMA.COLUMNS as isColumns
inner join INFORMATION_SCHEMA.TABLES as isTables on ( isColumns.table_name = isTables.table_name )
WHERE
isColumns.table_schema = ‘YOURDATABASA’ AND
column_name LIKE ‘%WILD%’;

SQL variable in a statement, select all table fields in a single result *

Here is a short SQL statement that could save you a lot of time if you are trying to get an unknown set of fields from a given table in a single result.

SET @fields = (SELECT GROUP_CONCAT( `COLUMN_NAME`)
FROM `information_schema`.`COLUMNS`
WHERE `TABLE_SCHEMA` = ‘YOURDB’ AND `TABLE_NAME` = ‘YORTABLE’ GROUP BY `TABLE_NAME` )
COLLATE utf8_general_ci;
set @sql = CONCAT(‘SELECT GROUP_CONCAT(‘,@fields, ‘) FROM YORTABLE LIMIT 1’);
PREPARE test_sql FROM @sql;
execute test_sql;

How to style a file form field?!

After an agonizing evening of research and tests solution was finally found. Simplest way to edit a file form field style is inserting the following css code in you css style:

input[type=”file”] {
text-align: right;
opacity: 0.8;
font-size:9px;
float:left;
max-width:400px;
size:10;
}

Replace “file” part with any field name you want to edit its style easily.

Categories