#1 21.07.10 19:32
Кто в коде разбирается...
...скажите, как эта хрень циферки меняет? От фонаря?
http://www.worldometers.info/ru/
Offline
#2 21.07.10 19:57
Re: Кто в коде разбирается...
отключись от интернета и узнай)) Если без него меняться будут, то я думаю от фонаря. Ну или у тебя супер комп и к нему информация из внешнего мира без интернета поступает)))
Offline
#3 21.07.10 20:26
Re: Кто в коде разбирается...
Siron написал(а):
...скажите, как эта хрень циферки меняет? От фонаря?
берётся статистика за год, вычисляется приращение в секунду, строится прогноз.
Offline
#4 21.07.10 20:48
Re: Кто в коде разбирается...
Обычный счётчик, который построен по заранее известным цифрам, и каким-то прогнозам.
Offline
#5 21.07.10 20:49
Re: Кто в коде разбирается...
тупой Javascript, выполняется на клиенте, без доступа в инет
Offline
#6 21.07.10 20:51
Re: Кто в коде разбирается...
Вконтакте таким же образом своих "зарегистрированных пользователей" накручивает. Просто посчитали сколько примерно регистрируется, и вывели среднюю цифру, иногда может корректируют погрешность.
Offline
#7 21.07.10 21:14
Re: Кто в коде разбирается...
$up написал(а):
берётся статистика за год, вычисляется приращение в секунду, строится прогноз.
Это мне кэп уже рассказал, я про код.
Muxa написал(а):
упой Javascript, выполняется на клиенте, без доступа в инет
Tomahawk написал(а):
Вконтакте таким же образом своих "зарегистрированных пользователей" накручивает.
Во.
Offline
#8 21.07.10 21:19
Re: Кто в коде разбирается...
только контакт использует случайные числа, а тут просто равномерное приращение
Offline
#10 21.07.10 21:28
Re: Кто в коде разбирается...
контакт:
Код: "javascript":
var memCount = 81701229; var memPerSec = 0.5; function updateCount() { next = -(1000 / memPerSec)*Math.log(Math.random()); memCountString = '' + memCount; len = memCountString.length; memCountString = memCountString.substr(0,len-6)+'<span style="font-size:60%"> </span>'+memCountString.substr(len-6,3)+'<span style="font-size:60%"> </span>'+memCountString.substr(len-3,3); ge('memCount').innerHTML = memCountString; memCount = memCount + 1; setTimeout(updateCount, next); } addEvent(window, 'load', updateCount);
Offline
#11 21.07.10 21:30
#12 21.07.10 21:31
#13 21.07.10 21:33
#14 21.07.10 21:38
#15 22.07.10 01:01
Re: Кто в коде разбирается...
Siron написал(а):
Это мне кэп уже рассказал, я про код.
Код::
function timeRemaining() {
var now = new Date();
var newyears = new Date("January 1, 2000");
var todaysdate = new Date("January 1, 2000");
var may4 = new Date("May 4, 1999");
var currentPop;
var BirthsInYear;
newyears.setFullYear(now.getFullYear());
secsSince = Math.round(now.getTime() - newyears.getTime())/1000;
secsSincePop = Math.round(now.getTime() - may4.getTime())/1000;
todaysdate.setMonth(now.getMonth());
todaysdate.setDate(now.getDate());
todaysdate.setFullYear(now.getFullYear());
secsToday = (now.getTime()-todaysdate.getTime())/1000;
// test to see what page is loaded, then activate the appropriate worldometers
// NOTE: if you startup more than 20, they go to slow
switch (document.title) {
case 'Worldometers':
{
// population
current_population = string( Math.round( (secsSincePop) * 2.48573 + 5979540016 - (secsToday) * 2.48573) + Math.round((secsToday) * 4.41461) - Math.round((secsToday) * 1.92888) ) ;
births_this_year = string(Math.round( (secsSince) * 4.41461 - (secsToday) * 4.41461) + (secsToday) * 4.41461);
births_today = string((secsToday) * 4.41461);
dth1s_this_year = string(Math.round( (secsSince) * 1.92888 - (secsToday) * 1.92888) + (secsToday) * 1.92888);
dth1s_today = string((secsToday) * 1.92888);
absolute_growth = string( Math.round((secsToday) * 4.41461) - Math.round((secsToday) * 1.92888) );
document.worldometers.elements["current_population"].value = current_population;
document.worldometers.elements["births_this_year"].value = births_this_year;
document.worldometers.elements["births_today"].value = births_today;
document.worldometers.elements["dth1s_this_year"].value = dth1s_this_year;
document.worldometers.elements["dth1s_today"].value = dth1s_today;
document.worldometers.elements["absolute_growth"].value = absolute_growth;
// econ
gov_expenditures_education = string((secsSince) * .07894);
gov_expenditures_military = string((secsSince) * .04373);
countries_un = string((secsSince) / (secsSince) * 192);
automobile_produced_this_year = string((secsSince) * 1.648);
bicycle_produced_this_year = string((secsSince) * 3.46);
computers_sold_this_year = string((secsSince) * 9.069);
document.worldometers.elements["gov_expenditures_education"].value = gov_expenditures_education;
document.worldometers.elements["gov_expenditures_military"].value = gov_expenditures_military;
document.worldometers.elements["countries_un"].value = countries_un;
document.worldometers.elements["automobile_produced_this_year"].value = automobile_produced_this_year;
document.worldometers.elements["bicycle_produced_this_year"].value = bicycle_produced_this_year;
document.worldometers.elements["computers_sold_this_year"].value = computers_sold_this_year;
// education
books_published = string((secsSince) * .03);
newspapers_circulated = string((secsSince) * 16.6);
movie_attendance = string((secsSince) * 403);
internet_download = string((secsSince) * 963);
document.worldometers.elements["books_published"].value = books_published;
document.worldometers.elements["newspapers_circulated"].value = newspapers_circulated;
document.worldometers.elements["movie_attendance"].value = movie_attendance;
document.worldometers.elements["internet_download"].value = internet_download;
// enviornment
forest_loss = string((secsSince) * .36);
soil_erosion = string((secsSince) * .2);
topsoil_erosion = string((secsSince) * 747.5);
co2_emissions = string((secsSince) * 708);
desert_land_formed = string((secsSince) * .47);
earth_travel = string((secsSince) * 18.5);
weight_of_earth = string(6575000+ (secsSince * .0012));
age_of_earth = string((secsSince * .000000031)+4527642531);
lightning_strikes = string((secsSince) * 100);
human_biological_waste = string((secsSince) * 4.123148);
fish_caught = string((secsSince) * 2.9);
document.worldometers.elements["forest_loss"].value = forest_loss;
document.worldometers.elements["soil_erosion"].value = soil_erosion;
document.worldometers.elements["topsoil_erosion"].value = topsoil_erosion;
document.worldometers.elements["co2_emissions"].value = co2_emissions;
document.worldometers.elements["desert_land_formed"].value = desert_land_formed;
document.worldometers.elements["earth_travel"].value = earth_travel;
document.worldometers.elements["weight_of_earth"].value = weight_of_earth;
document.worldometers.elements["age_of_earth"].value = age_of_earth;
document.worldometers.elements["lightning_strikes"].value = lightning_strikes;
document.worldometers.elements["human_biological_waste"].value = human_biological_waste;
document.worldometers.elements["fish_caught"].value = fish_caught;
// food
food_production = string((secsSince) * 166.47);
calories_consumed = string((secsSince) * 197.12037);
protein_consumed = string((secsSince) * 5.28808);
dth1_hunger = string((secsToday) * 0.33);
spending_on_weight_loss = string((secsSince) * 1268.4);
document.worldometers.elements["food_production"].value = food_production;
document.worldometers.elements["calories_consumed"].value = calories_consumed;
document.worldometers.elements["protein_consumed"].value = protein_consumed;
document.worldometers.elements["dth1_hunger"].value = dth1_hunger;
document.worldometers.elements["spending_on_weight_loss"].value = spending_on_weight_loss;
// water
water_consumed = string((secsSince) * .133);
water_disax = string((secsSince) * 0.16);
nowater_population = string(secsSince * 5.28 + 1300370016);
document.worldometers.elements["water_consumed"].value = water_consumed;
document.worldometers.elements["water_disax"].value = water_disax;
document.worldometers.elements["nowater_population"].value = nowater_population;
// energy
energy_production = string((secsSince) * 377.9);
energy_consumption = string((secsSince) * 358.3);
oil_consumption = string((secsSince) * 138.174);
coal_consumption = string((secsSince) * 114.63);
solar_energy = string((secsSince) * 86899);
document.worldometers.elements["energy_production"].value = energy_production;
document.worldometers.elements["energy_consumption"].value = energy_consumption;
document.worldometers.elements["oil_consumption"].value = oil_consumption;
document.worldometers.elements["coal_consumption"].value = coal_consumption;
document.worldometers.elements["solar_energy"].value = solar_energy;
// health
dth1s_communicable_disaxs = string((secsSince) * .55);
dth1s_children = string((secsSince) * .35);
ab = string((secsSince) * 1.46);
abi = string((secsSince) * .04);
dth1s_maternal = string((secsSince) * .02);
infections_hiv = string((secsSince * .1)+30000000);
dth1s_ads = string((secsSince * .05)+6400000);
dth1s_cancer = string((secsSince) * .2);
dth1s_malarial = string((secsSince) * .032);
dth1s_cigarettes = string((secsSince) * .1);
cigarettes_produced = string((secsSince) * .175514);
dth1s_pesticide = string((secsSince) * .0006);
teenage_moms = string((secsSince) * .5);
healthcare_spending = string((secsSince) * .037835);
drug_spending = string((secsSince) * .031710);
alcohol_tobacco_spending = string((secsSince) * .004184);
perfume_spending = string((secsSince) * .000152);
document.worldometers.elements["dth1s_communicable_disaxs"].value = dth1s_communicable_disaxs;
document.worldometers.elements["dth1s_children"].value = dth1s_children;
document.worldometers.elements["ab"].value = ab;
document.worldometers.elements["abi"].value = abi;
document.worldometers.elements["dth1s_maternal"].value = dth1s_maternal;
document.worldometers.elements["infections_hiv"].value = infections_hiv;
document.worldometers.elements["dth1s_ads"].value = dth1s_ads;
document.worldometers.elements["dth1s_cancer"].value = dth1s_cancer;
document.worldometers.elements["dth1s_malarial"].value = dth1s_malarial;
document.worldometers.elements["dth1s_cigarettes"].value = dth1s_cigarettes;
document.worldometers.elements["cigarettes_produced"].value = cigarettes_produced;
document.worldometers.elements["dth1s_pesticide"].value = dth1s_pesticide;
document.worldometers.elements["teenage_moms"].value = teenage_moms;
document.worldometers.elements["healthcare_spending"].value = healthcare_spending;
document.worldometers.elements["drug_spending"].value = drug_spending;
document.worldometers.elements["alcohol_tobacco_spending"].value = alcohol_tobacco_spending;
document.worldometers.elements["perfume_spending"].value = perfume_spending;
// other
dth1s_cars = string((secsSince) * .00861);
document.worldometers.elements["dth1s_cars"].value = dth1s_cars;
break;
}
}
timerID = setTimeout("timeRemaining()", 1);
timerRunning = true;
}Offline
#16 22.07.10 13:58
Re: Кто в коде разбирается...
T!nk@ff написал(а):
откуда такая инфа?)
когда обсуждали контакт, я смотрела код и для интереса открыла 2 окна контакта (можно ещё с некоторым перерывом). Исходные данные там вроде реальные, а счетчик из-за рандомности в один и тот же момент времени показывает разные циферки.
А на этом сайте мне лень было смотреть код, и я так же открыла 2 разных окна - счетчики в разных окнах всегда показывали одно и то же, ну и на глаз видна нереальная равномерность.
Offline
#17 20.09.10 01:03
Re: Кто в коде разбирается...
Ребята, подскажите, плиз,
скто знает, как установить этот код себе в вордпресс?
Исправлено galyna (20.09.10 01:03)
Offline

