
crashmaster
Members-
Posts
169 -
Joined
-
Last visited
Never
Everything posted by crashmaster
-
Thanks, you helped me ))) Yes, your function is pretty simple )) Thanks a lot))
-
What do you think about this fn ?? $a[0] = -7; $a[1] = 5; $a[2] = 1; $a[3] = 2; $a[4] = -4; $a[5] = 3; $a[6] = 0; //Dumping input array echo '<pre>'; print_r($a); echo '</pre><hr>'; function equi($a,$index=0) { //<______________ARRAY OF NUMBERS_______________>/// //<-------R--<==== |EQ index| =====>----R------>/// //<---|lower_ind|---|EQ index|---|higher_ind|--->/// $lower_indexes = $higher_indexes = intval(0); //SUM OF INDEXES $lower_values = $higher_values = array(); //ELEMENTS OF (HIGHER|LOWER) INDEXES SUM foreach ($a as $k=>$v) { //Counting SUM of |lower_ind| if ($k < $index) { $lower_indexes = $lower_indexes + $v; $lower_values[] = 'A['.$k.']'; } //Counting SUM of |higher_ind| if ($k > $index) { $higher_indexes = $higher_indexes + $v; $higher_values[] = 'A['.$k.']'; } } echo 'SEARCHING INDEX IS: <strong>'.$index.'</strong><br>'; echo 'SUM OF <strong>LOWER</strong> INDEXES ('.implode(' + ',$lower_values).') IS: '.$lower_indexes.'<br>'; echo 'SUM OF <strong>HIGHER</strong> INDEXES ('.implode(' + ',$higher_values).') IS: '.$higher_indexes.'<br>'; //Searching EQ index if ($lower_indexes == $higher_indexes) { echo '<font color="red"><strong><u>EQUILIBRIUM INDEX IS: '.$index.'</u></strong></font>.'; } else { echo 'Not found.'; } //How many times are allowed to run program in cycle (till end of array indexes) $steps = (count($a) - 1); if ($index < $steps) { echo ' Searching again with new index <b>'.($index + 1).'</b>...<br>-----------------------------------------<br>'; $index++; equi($a,$index); } else { echo '<hr>Program STOP...'; } } //Run equi($a);
-
Hi there, i have a task, to write function in php. Who can help me? There is a task: Equilibrium (EQ) Index of a sequence (array) is an index such that the sum of elements at lower indexes is equal to the sum of elements at higher indexes. For example, in array A: Array: A[0] = -7 A[1] = 1 A[2] = 5 A[3] = 2 A[4] = -4 A[5] = 3 A[6] = 0 3 is an EQ index, beacuse: A[0] + A[1] + A[2] = A[4] + A[5] + A[6] 6 is also EQ index, coz: A[0] + A[1] + A[2] + A[3] + A[4] + A[5] = 0 (sum of zero elements is zero) 7 is not an EQ index, because it is not a valid index of array A Assume the sum of zero elements is equal zero. Write a function.
-
Hi there, I am quite new in CSS, and need help from prof. I was wondered by nice, good looking drop down menus. There are lot of stuff in internet about it... But now I have a job, and should make DROP UP menu. I dont know how to style it only in CSS, so I also used JS. You can see it here (http://fmark.dnbstep.cz). Everything looks good, but in IE - menu is blinking. I dont know how to fix it... Do you have any idea ?? P.S. If you have a better (more simple) solution, than mine (CSS [positioning by moving element by >position: absolute; top:10...etc<] + JavaScript [jquery]), post it. I will be very grateful ;-) Thanks a lot, cya
-
Hi there, design critique please =) [attachment deleted by admin]
-
Hi there, have problem with one thing. I have a database table with similar structure for ex.: id | name _______ 1 | Cat 2 | Dog 3 | Wolf 4 | Elephant 5 | Tiger 6 | Lion 7 | Bird All I want to do is: how, by 1 simple query, select an animal with id = 4 and also how to get one previous and one next animal id ?? thanks for reply )
-
Particulaty you are right, butproblem was somewhere else. The problem was in variable "i" In both functions "i" was not declared as local var, so it caused problems )) FOR EVERYBODY !! USE VAR DECLArATION !!!
-
I dont want to believe, that nobody knows answer... Is it so complicated ???
-
quite stupid idea to use PHP function oin JS.. try to avoid it..can cause TOO MANY problems..
-
I can recommend you to use another slider.. For example jquery Carousel I used it here: http://iloveparties.cz/ and never has a problem with IE
-
IE - means Internet Explorer ?? where is the problem ?
-
Hi there, I have one problem, and even dont know what causes it. Have 1 form, and JS 3 scripts. This function creates from special chars (like "ý", "ě", "š", "ž", etc.) their char codes entities ("ý", "ě", "š", "ž") function toEntity(str) { var str; var return_str; for(i=0; i<str.length; i++){ if(str.charCodeAt(i)>127){ return_str += '&#' + str.charCodeAt(i) + ';'; } else { return_str += str.charAt(i); } } return return_str; } This function gets each Object value and applies toEntity function to it function preajax_data_parse (data) { var data; for (i=0; i < data.length; i++) { data[i].value = toEntity(data[i].value); } return data; } This function creates an object from the form, applies preajax_data_parse function, and the alert object values after parsing. function do_it() { arr = $('#form').serializeArray(); arr = preajax_data_parse(arr) alert(dumpObject(arr)) } Var dumping function for debuggin function dumpObject(obj, maxDepth) { var dump = function(obj, name, depth, tab){ if (depth > maxDepth) { return name + ' - Max depth\n'; } if (typeof(obj) == 'object') { var child = null; var output = tab + name + '\n'; tab += '\t'; for(var item in obj){ child = obj[item]; if (typeof(child) == 'object') { output += dump(child, item, depth + 1, tab); } else { output += tab + item + ': ' + child + '\n'; } } } return output; } return dump(obj, '', 0, ''); } HTML <form method="post" id="form"> <textarea name="q"></textarea><br> <input type="text" name="z"><br> <input type="button" onclick="do_it()" value="Do it!"> </form> The problem: When I call function do_it() => parser preajax_data_parse() doesnt parse second Object value (input tag value), and something going wrong with first value (textarea tah value) (undefined is shown)... Look at screenshot and you will understand [attachment deleted by admin]
-
[using JQuery] Hi there, I am trying to find some plugin, which can make AJAX request's by parsing ANCHOR value, from URL... For example I have an ajax gallery and I want to make navigation like this www.example.com/gallery.php#photo=1 www.example.com/gallery.php#photo=2 www.example.com/gallery.php#photo=3 Any suggestions ?
-
maybe by using another scripting language ?
-
What do you think about design?? radio.dnbstep.cz
-
Hi there, is there any possibility to get local IP by php script /? For example: my external IP is : 81.0.3.216 and local ip is: 192.168.5.22 there is no problem to get external ip, but how to get LOCAL ip ??? Any ideas ??
-
Hi there, can anyone explain me, why this code doesn't work?? RewriteCond %{HTTP_HOST} ^dogs\.csfauna\.cz$ [NC] RewriteRule ^(.*)$ /index.php?page=ads¶ms=mammals-dogs [QSA,NC,L]
-
Hello, thank you for your critique, I appreciate it. So: 1) Page has been validated. 2) Can you recommend me, how to use wordwrap and ignore HTML ? Because I have a script, which makes from plain text -> url. ANd if I use normal PHP wordwrap, somwtimes it breaks line in a bad place, and parts of HTML code are visible. 3) H1 tags - I will fix it. I've read, my website can be penalized by searchengine bot 4) css sprite sheets - will fix it...
-
THanks, I added a little JS script, for preloading top img )
-
thx, man )) Any other opinion ?)
-
Hi, maybe some of you remember my previous post about dnbstep.cz - now I've translated (about 90%) my web in english. Critique please: www.dnbstep.org
-
Hey.. I really need this...
-
is it so difficult question ???
-
Sry, I've posted post before finish it
-
Hi there, I am not an amateur in PHP, but 1 thing I can't understand is output buffer. I've read a few tutorials, but I can't understand 1 thing. I need to understand this (will explain in example): For example I have an index page, where is <title>Hello, it's index page</title> Index page uses this code to include content: index.php $page = strip_tags($_GET['page']); if (file_exists('pages/'.$page.'.php')) { include('pages/'.$page.'.php'); } else { include('pages/404.php'); } When I set address to index.php?page=video&video_id=10 script video.php is included in index.php. For example, every video has it's own "description", which I get from database, by mysql_query in video.php video.php $id = intval($_GET['video_id']); $desc = mysql_result(mysql_query("SELECT description FROM videos WHERE id=$id LIMIT 1"),0,0); One thing I cannt understand is, how to put $desc from video.php to <title></title> of index.php by using output buffer. Can anybody help me?