-
+165
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
<div style="font-size:30px; text-align: center;padding-top: 50px;">Число установок принципиально новой OS<br><b><span id="installCount">10324435</span></b></div>
<script type="text/javascript">
var memCount = 10584471;
var memPerSec = 1.38176367782;
function updateCount() {
next = -(1000 / memPerSec)*Math.log(Math.random());
memCountString = '' + memCount;
len = memCountString.length;
memCountString = memCountString.substr(0,len-6)+'<span style="font-size:30px"> </span>'+memCountString.substr(len-6,3)+'<span style="font-size:30px"> </span>'+memCountString.substr(len-3,3);
document.getElementById('installCount').innerHTML = memCountString;
memCount = memCount + 1;
setTimeout(updateCount, next);
}
updateCount();
</script>
Помните на сайте знаменитой , принципиально новой http://bolgenos.ru/ есть табло сколько человек скачало ?
Выше скрипт ЩИТалки :)
Мало того что обман , так ещё и кривой
TIMHOK,
05 Июня 2010
-
−172
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
private static function copyByteArray(source:ByteArray, destination:ByteArray, length:uint = 0):void
{
var oldPosition:int = source.position;
source.position = 0;
destination.position = 0;
var i:uint = 0;
while (source.bytesAvailable > 0 && i < length)
{
destination.writeByte(source.readByte());
i++;
}
source.position = oldPosition;
destination.position = 0;
}
Только вы не думайте, что это школьная лаба. Это все он же родимый, Flex framework, mx.utils.Base64Decoder, прошу любить и жаловать! :)
Для тех, кто не в курсе, у ByteArray есть "родные" методы readBytes и writeBytes которые делают то, что описано в этом методе, ну только в пару раз быстрее...
wvxvw,
05 Июня 2010
-
+157
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
//sort rr
unsigned int i = 0;
unsigned int random = time(NULL);
unsigned int nummx = rr->size();
while (nummx > 0){
unsigned long numsame=1;
i = 0;
for (unsigned int j = 1;j < nummx;++j)
if ((*rr)[j].m_pref > (*rr)[i].m_pref){
i = j;
numsame = 1;
}else if ((*rr)[j].m_pref == (*rr)[i].m_pref){
++numsame;
random = random * 69069 + 1;
if ((random / 2) < (2147483647 / numsame))
i = j;
}
swap((*rr)[i],(*rr)[--nummx]);
}
Что делает код - достоверно неизвестно. Скорее всего, что-то сортирует и одновременно перемешивает.
gpr,
05 Июня 2010
-
+159
- 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
function countInt(int32)
{
var n = int32;
if (n == 0) n = 1;
n = Math.abs(n);
var len = 0;
while (n > 0)
{
len++;
n = n / 10;
n = parseInt(n);
}
return len;
}
function zeroAdder(int32)
{
var str = '';
if (countInt(int32) == 1) str = '0';
str = str + int32;
return str;
}
function pasteDT()
{
d = new Date();
$('#element_4_1').attr('value',zeroAdder(d.getDate()));
$('#element_4_2').attr('value',zeroAdder(d.getMonth()+1));
$('#element_4_3').attr('value',zeroAdder(d.getFullYear()));
$('#element_5_1').attr('value',zeroAdder(d.getHours()));
$('#element_5_2').attr('value',zeroAdder(d.getMinutes()));
}
Короче код для заполнения полей формы датой и временем.
Функция countInt - исчисляет количество цифр в целом числе, даже в отрицательном.
Функция zeroAdder - добавляет 0, если допустим первое число (1). Преобразовывает его в строку '01'.
Как вы увидели, я использую jQuery, хотя Prototype как-то удобнее.
increazon,
05 Июня 2010
-
+170
- 1
- 2
require_once('configure.php');
require('configure.php');
надо быть _увереным_ в своем коде
sogekoder,
05 Июня 2010
-
+162
- 1
- 2
- 3
- 4
$res = $db->loadResult();
if($res); else return false;
if($res!=$user->id) return false;
return true;
vsu,
04 Июня 2010
-
+112
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
public static string ConvertBase64ToString(string b64)
{
string Value = b64;
if (Value != null && Value.Length > 0)
{
System.Text.ASCIIEncoding encoder = new System.Text.ASCIIEncoding();
System.Text.Decoder decoder = encoder.GetDecoder();
byte[] bytes = Convert.FromBase64String(Value);
int charCount = decoder.GetCharCount(bytes, 0, bytes.Length);
char[] chars = new char[charCount];
decoder.GetChars(bytes, 0, bytes.Length, chars, 0);
string results = new String(chars);
return results;
}
return string.Empty;
}
не говоря уже про локальную переменную Value, весь блок заменяется на
return System.Text.ASCIIEncoding.ASCII.GetStrin g(Convert.FromBase64String(Value));
eval_2009,
04 Июня 2010
-
+180
- 1
/^[a|b|c|d|e|f|g|h|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|@|\.|-]*$/gim
Проверка валидности E-Mail от местного умельца.
eval,
04 Июня 2010
-
+74
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
private void StreamToBytes()throws Exception
{
int i;
InputStream in=getStream();
ArrayList<Integer> byt=new ArrayList<Integer>();
while((i=in.read())!=-1)
{
byt.add(i);
}
in.close();
b=new byte[byt.size()];
for(int j=0;j<b.length;j++)
{
b[j]=byt.get(j).byteValue();
}
}
хуита,
04 Июня 2010
-
−92
- 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
def get_next_line(max_level, current_level, current_line_items)
next_line_items = []
result_string = ''
if current_level == 1
next_line_items.push(1)
result_string = "1\n"
else
current_line_number = false
current_line_number_count = 0
current_index = 0
current_line_items.each do |line_number|
if current_index == 0
current_line_number = line_number
current_line_number_count = 1
else
if line_number == current_line_number
current_line_number_count = current_line_number_count + 1
else
next_line_items.push(current_line_number_count)
next_line_items.push(current_line_number)
current_line_number_count = 1
current_line_number = line_number
end
end
if current_index >= current_line_items.length - 1
next_line_items.push(current_line_number_count)
next_line_items.push(current_line_number)
end
current_index = current_index + 1
end
result_string = next_line_items.join(' ') + "\n"
end
if current_level < max_level
result_string = result_string + get_next_line(max_level, current_level + 1, next_line_items).to_s
end
# return result
result_string
end
puts 'Input max level:'
level = gets
puts ''
puts get_next_line(level.to_i, 1, [])
реальное тестовое задание кандитата.
задача - вывести несколько членов последовательности
1
11
21
1211
....
malleus,
04 Июня 2010