📜 ⬆️ ⬇️

In a nutshell about the very different

So, I will write about how to fix jitter in IE when emulating position: absolute; (without a background image), arrange a declination of words, solve problems with questions in Mysql and about other unimportant, but sometimes useful tricks.
If you are a mature web-technologist, you can not read: you will not find anything new.



IE Fixed Fix

The jitter of a fixed block fixed with top: expression () in IE can be fixed like this:
body {_filter: true; }
')
Quick csv creation

You can save the table from Mysql directly into a csv file (it can be easily opened using Excel) by the following query:
SELECT * INTO OUTFILE '/tmp/table.csv'
FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\ n'
FROM users WHERE 1

Graduation # 1

Calculating endings in Javascript, algorithm # 1

function xform (c, str1, str2, str5) {
c = Math.abs (c)% 100;
if (c> 10 && c <20) return str5;
c% = 10;
if (c> 1 && c <5) return str2;
if (c == 1) return str1;
return str5;
}

Using:
str = x + xform (x, "apple", "apples", "apples")

Graduation # 2

Calculating endings in php, algorithm # 2 (Attention! Only suitable when the amount goes over 20, for example, in a blog)
<? php
$ words = array ("words", "word", "words", "words", "words", "words", "words", "words", "words", "words");

//Using:
$ a = 71;
print $ words [substr ($ a, -1)];
?>
Habrasoobshchestvom decided that the algorithm is shit.
Of the advantages: the absence of any If-s, and in general, just like a stub.

Mysql and dates

You can insert dates in MySQL queries like this:
INSERT into `dates` (dat) values ​​(STR_TO_DATE ('12 -31-2004 ','% m-% d-% Y '))

Escaping quotes

If you recently (or a long time ago) switched to php5 denwer 3 from denwer-2, or switched to a new hosting service, and in the scripts instead of strings like “string”, “string ka” began to appear, the line in will help. htaccess:
php_flag magic_quotes_gpc off
php_flag magic_quotes_runtime off
Just be careful not to break your site.
(Well, or correct the script)

"Questions"

If suddenly the script “instead of characters began to display question marks, and the encoding is cp1251, but still questions”, then write in the $ config.php file (you have it, I'm sure)

mysql_select_db ($ database);

mysql_query ("set character_set_client = 'cp1251'");
mysql_query ("set character_set_results = 'cp1251'");
mysql_query ("set collation_connection = 'cp1251_general_ci'");
Go to utf

IE text selection

If in the layered layout, when selecting text in IE, half a page is selected instead of the desired text, the line at the beginning of the page helps:
<? XML VERSION = "1.0" ENCODING = "windows-1251"?>
(I understand that it is bydlomethod, but it works)
Alternative method:
“Use body {position: relative;} easier and more harmless.”, Thanks Chizh

Again encoding

If in PHP you got a string in a variable, for example, like this:
"Ѕµ‚ ± µ · ѓјЅ ‹ј Ѕіґµ їѕєѕЏ" (this happens when Opera sends data through XMLHttpRequest),
then the function will help
function Encode ( $str, $type )
{
static $conv='';
if (!is_array ( $conv ))
{
$conv=array ();
for ( $x=128; $x <=143; $x++ )
{
$conv['utf'][]=chr(209).chr($x);
$conv['win'][]=chr($x+112);
}
for ( $x=144; $x <=191; $x++ )
{
$conv['utf'][]=chr(208).chr($x);
$conv['win'][]=chr($x+48);
}
$conv['utf'][]=chr(208).chr(129);
$conv['win'][]=chr(168);
$conv['utf'][]=chr(209).chr(145);
$conv['win'][]=chr(184);
}
if ( $type=='w' )
return str_replace ( $conv['utf'], $conv['win'], $str );
elseif ( $type=='u' )
return str_replace ( $conv['win'], $conv['utf'], $str );
else
return $str;
}



Called as follows:
$ str = Encode ($ str, 'w');

Remote editing Mysql

If you need to fix the database, phpMyAdmin causes vomiting (sometimes, yes), and the Mysql port is closed, then download navicat , take the ntunnel_mysql.php file from the folder where you installed it, upload it to the server, and specify the address in the connection properties.
The program works for 30 days. (I learned to write quacks on it, but quack, of course, did not spread and did not use it)

UPD: Russian Subdomains

To make a Russian-speaking subdomain level 3, you need:
1. Open Firefox, type in the address bar something like: habrakhabr.ru
2. Firefox will write that "Firefox cannot find the server www.xn--80aaacc1gd7ae.ru ."
3. Create a subdomain named "xn - 80aaacc1gd7ae". Works in some blog services where the username is a subdomain.
Example: damirko.ramainen.ru

A few words about MS Word

Finally, some information garbage:
To pull images from a .docx or .pptx file, you can rename them to a .zip file and open it with any archiver.
In the archive, among other things, there will be pictures.
In order for Word 2003 or Word XP to open docx files (Word 2007), install the FileFormatConverters extension, install it on top of Office, and it will begin to understand the new format.

Important news

And in cmd.exe there is a calculator:
Z:> set / a 1 + 1

Source: https://habr.com/ru/post/47088/


All Articles