-
+134
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
using System;
class ololo
{
static void Main()
{
int ru, en;
for (ru = 7700; ru < 8025; ru += 25)
for (en = 3220; en < 4050; en += 50)
Console.WriteLine("Ру " + ru + " и En " + en);
}
}
Нужно было посчитать одновременно от 7700 до 8025 и от 3220 до 4050, в итоге получилось так.
EVjGeNiX,
08 Января 2015
-
+73
- 1
- 2
- 3
- 4
@Override public int hashCode()
{
return id.hashCode(); // id - Integer !!!
}
Хэшкод интегера
sarvigalava,
08 Января 2015
-
+51
- 1
auto a = []{return 1;}();
http://rextester.com/NQVDP75721
LispGovno,
08 Января 2015
-
+46
- 1
- 2
- 3
- 4
- 5
- 6
- 7
extern QString code2text(unsigned long code)
{
if (code == 0) return QString::fromUtf8("Операция успешно завершена");
if (code == 1) return QString::fromUtf8("Неверная функция");
//over 3400 строк
return QString("%1").arg(code);
}
как это сделать по человечески?
полная версия https://github.com/kin63camapa/softodrom/blob/master/softodrom/errcodes.cpp
kin63camapa,
07 Января 2015
-
+155
- 1
- 2
- 3
- 4
- 5
if (!self.options.cat_main) {
counter = self.renderSingleGame(game_id, cat, cat.name, counter);
} else if (cat_id === self.options.cat_main) {
counter = self.renderSingleGame(game_id, cat, cat.name, counter);
}
гениально!
beatmasta,
07 Января 2015
-
+46
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
In file included from ./boost/bind/bind.hpp:29:0,
from ./boost/bind.hpp:22,
from ./boost/multi_index/sequenced_index.hpp:50,
from ./boost/property_tree/ptree.hpp:23,
from ./boost/log/utility/setup/settings.hpp:26,
from ./boost/log/utility/setup/from_settings.hpp:25,
from libs/log/src/init_from_stream.cpp:19:
./boost/bind/arg.hpp: In constructor ‘boost::arg<I>::arg(const T&)’:
./boost/bind/arg.hpp:37:22: warning: typedef ‘T_must_be_placeholder’ locally defined but not used [-Wunused-local-typedefs]
typedef char T_must_be_placeholder[ I == is_placeholder<T>::value? 1: -1 ];
Выхлоп при компиляции зломерзкого (из-за громоздкости разумеется) boost. Шаблоны такие шаблоны. А всё из-за того, что надо поставить на ix2 deluge т.к встроенная качалка торрентов не умеет качать торренты (там можно только указать ограничение скорости и порты, но добавить torrent или magnet некуда).
mittorn,
07 Января 2015
-
+162
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
class StupidClass
{
public function __toString()
{
return 'this';
}
public function hax()
{
return $this === $$$$$$this;
}
}
var_dump((new StupidClass)->hax()); // true
Уииии
Fike,
06 Января 2015
-
+129
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
<macrodef name="foreach">
<attribute name="target"/>
<attribute name="file-property"/>
<element name="files"/>
<element name="args"/>
<sequential>
<local name="foreach.files"/>
<local name="foreach.target"/>
<local name="foreach.file-property"/>
<local name="foreach.args"/>
<property name="foreach.target" value="@{target}"/>
<property name="foreach.file-property" value="@{file-property}"/>
<pathconvert property="foreach.files">
<files/>
</pathconvert>
<propertyset id="foreach.args">
<args/>
</propertyset>
<property name="foreach.args" refid="foreach.args"/>
<property name="foreach.target" value="@{target}"/>
<!-- there is no better way to do this at the moment
property names and values should not contain comma-space and equals signs
-->
<script language="javascript"><![CDATA[
var files = project.getProperty("foreach.files").split(":"),
args = project.getProperty("foreach.args").split(", "),
task = project.createTask("antcall"), arg;
task.target = project.getProperty("foreach.target");
for (var a in args) {
arg = task.createParam();
arg.setName(a.split("=")[0]);
arg.setValue(String(a.split("=")[1]));
}
for (var f in files) {
arg = task.createParam();
arg.setName(project.getProperty("foreach.file-property"));
arg.setValue(String(files[f]));
task.perform();
}
]]></script>
</sequential>
</macrodef>
<!-- пример использования: -->
<target name="transcode-font-helper">
<property name="font.face.local" value="${font.face}"/>
<foreach target="transcode-font" file-property="font.raw.source">
<files>
<fileset dir="${basedir}/fonts">
<include name="*/${font.face.local}/*.otf"/>
<include name="*/${font.face.local}/*.ttf"/>
</fileset>
</files>
<args>
<propertyref name="font.face.local"/>
</args>
</foreach>
</target>
А ведь если подумать: собрали все самое лучше, что есть в современном программировании - Ява, ХМЛ и ж.скрипт. Потом выбросили условные операторы, итерацию и операции со строкам - потому что не нужны. И получилась замечательная система для сборки проектов.
wvxvw,
06 Января 2015
-
+155
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
<?php
function load ($file) {
static $files = null;
$files or $files = [];
if (!isset($files[$file])) {
require($file);
$files[$file] = true;
}
}
$times = 1000000;
$time1 = microtime(true);
for ($i = 0; $i < $times; $i ++) {
require_once('inc.php');
}
$end1 = microtime(true) - $time1;
$time2 = microtime(true);
for ($i = 0; $i < $times; $i ++) {
load('inc.php');
}
$end2 = microtime(true) - $time2;
echo "require_once = $end1 vs \nload = $end2";
Вот это да... require_once работает в ~8 раз медленнее чем функция load. Вывод:
require_once = 16.962311029434 vs
load = 2.6861710548401
Содежания файла inc.php:
<?php echo 'Hello, world!';
volter9,
06 Января 2015
-
+151
- 1
- 2
- 3
- 4
- 5
- 6
- 7
$friends = mysql_query("(SELECT * FROM `friends` WHERE `from` LIKE '{$act}' AND `to` LIKE '{$act}' AND `isaccepted` = '1') UNION (SELECT `id` , `name` , `surname` FROM `users_info`);");
$friend = array();$loop=0;
while($fetch = mysql_fetch_assoc($friends)) {
if ($fetch['from'] == $act) $search=$fetch['to']; else $search=$fetch['from'];
$friend[$loop]=mysql_fetch_assoc(mysql_query("SELECT `id`,`name`,`surname` FROM `users_info` where `id`='{$search}'"));
$loop++;
}
Почему не работает?
yanislavb,
05 Января 2015