This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @static Вызов хранимой процедуры | |
* @param $sp_name Название хранимой процедуры | |
* @param $params | |
* @return array | |
*/ | |
public static function Query($sp_name, $params) | |
{ | |
// Получаем CommandBuilder | |
$b = Yii::app()->db->getCommandBuilder(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function user_browser($agent) | |
{ | |
preg_match("/(MSIE|Opera|Firefox|Chrome|Version|Opera Mini|Netscape|Konqueror|SeaMonkey|Camino|Minefield|Iceweasel|K-Meleon|Maxthon)(?:\/| )([0-9.]+)/", $agent, $browser_info); // регулярное выражение, которое позволяет отпределить 90% браузеров | |
list(, $browser, $version) = $browser_info; // получаем данные из массива в переменную | |
if (preg_match("/Opera ([0-9.]+)/i", $agent, $opera)) return 'Opera ' . $opera[1]; // определение _очень_старых_ версий Оперы (до 8.50), при желании можно убрать | |
if ($browser == 'MSIE') { // если браузер определён как IE | |
preg_match("/(Maxthon|Avant Browser|MyIE2)/i", $agent, $ie); // проверяем, не разработка ли это на основе IE | |
if ($ie) return $ie[1] . ' based on IE ' . $version; // если да, то возвращаем сообщение об этом | |
return 'IE ' . $version; // иначе просто возвращаем IE и номер версии | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title></title> | |
<style type="text/css"> | |
div { | |
border: 1px #000000 solid; /* Для всех div-ов делаем границу */ | |
} | |
</style> | |
</head> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title></title> | |
<style type="text/css"> | |
div { | |
border: 1px #000000 solid; /* Для всех div-ов делаем границу */ | |
} | |
#common_div { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package converttodb; | |
import java.io.File; | |
import java.io.FileNotFoundException; | |
import java.io.UnsupportedEncodingException; | |
import java.util.Scanner; | |
/** | |
* Разбор описания одного устройства (из текстового файла в объект). | |
* На входе - текстовый файл. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package converttodb; | |
import org.junit.Test; | |
import java.io.FileNotFoundException; | |
import java.io.UnsupportedEncodingException; | |
import static junit.framework.Assert.assertEquals; | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.File; | |
import java.io.FileInputStream; | |
import java.io.FileOutputStream; | |
import java.io.IOException; | |
import java.nio.channels.FileChannel; | |
import java.util.Scanner; | |
/** | |
* Преобразование исходников | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Вычисление MD5-хеша | |
* | |
* @param str Строка, для которой считаем MD5-хеш сумму | |
* @return MD5-хеш строки | |
*/ | |
public static String MD5(String str) { | |
try { | |
java.security.MessageDigest md = java.security.MessageDigest.getInstance("MD5"); | |
byte[] array = md.digest(str.getBytes()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <sys/ioctl.h> | |
#include <net/if.h> | |
#include <unistd.h> | |
#include <netinet/in.h> | |
#include <string.h> | |
int main() | |
{ | |
struct ifreq ifr; | |
struct ifconf ifc; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Округление сумм и другие операции с бонусами | |
*/ | |
public class BonusUtil { | |
/** | |
* Округление суммы до двух знаков после запятой. | |
* По правилам математики (к ближайшему). | |
* | |
* @param sum Сумма | |
* @return Округлённая сумма |
OlderNewer