Jump to content

crashmaster

Members
  • Posts

    169
  • Joined

  • Last visited

    Never

About crashmaster

  • Birthday 12/13/1987

Contact Methods

  • Website URL
    http://www.dnbstep.cz
  • ICQ
    308700731

Profile Information

  • Gender
    Male
  • Location
    Czech Republic, Prague

crashmaster's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. Thanks, you helped me ))) Yes, your function is pretty simple )) Thanks a lot))
  2. 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);
  3. 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.
  4. 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
  5. Hi there, design critique please =) [attachment deleted by admin]
  6. 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 )
  7. 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 !!!
  8. I dont want to believe, that nobody knows answer... Is it so complicated ???
  9. quite stupid idea to use PHP function oin JS.. try to avoid it..can cause TOO MANY problems..
  10. 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
  11. IE - means Internet Explorer ?? where is the problem ?
  12. 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 ("&#253;", "&#283;", "&#353;", "&#382;") 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]
  13. [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 ?
  14. maybe by using another scripting language ?
  15. What do you think about design?? radio.dnbstep.cz
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.