Jump to content


  • Posts

  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

phdphd's Achievements

Advanced Member

Advanced Member (4/5)




Community Answers

  1. Thanks a lot kicken for your clear and detailed answer!
  2. Hi All, I have the following autocomplete function : when the user enters at least one character, some js code triggers a query that retrieves all matching values from a database and displays them in a scrolling box. The js code that builds the list of items looks like this : list.append('<div onclick=" myfunction('+records[i].id+')">'+records[i].label+''); where id and label represent the 2 fields of the result set. When the user clicks an item, it triggers a js function that submits the form. That function simply starts like this function myfunction(a) { where a is the id of the selected item. All that works very well. Now I want to put the label in the input so that the choice of the user appears in there just before the form is submitted. So I made the two following changes : list.append('<div onclick=" myfunction('+records[i].id+','+records[i].label+')">'+records[i].label+''); and function myfunction(a,b) { document.getElementById('id_of_the_input').value=b; It does not work. The debugger says «Uncaught ReferenceError: XXXX is not defined » where XXXX is the string of the label. But if instead I use list.append('<div onclick=" myfunction('+records[i].id+','+records[i].id+')">'+records[i].label+''); Then the Id will appear in the input. I do not understand why the Id is taken into account, but not the label, since they are both processed at the same time when building the list of items. Thanks !
  3. Hi All, I am presently using a Debian VPS to which, if I need, I can add another disk. In my website, users can upload images, that are then stored in the primary disk into a child directory of a directory called httpdocs. Instead of the primary disk, would it be possible to have them stored in a secondary disk ? I am asking this because I am not sure that a user connected to my website is allowed to run a PHP script intended to write a file in a directory that actually does not belong to the httpdocs directory. Thanks
  4. The maximum number of subarrays is 12, and each may contain up to 20 values.
  5. Hi All, Suppose I have the following array, with a series of subarrays. Is there a quicker/better way than the one below to delete the subarrays whose ALL values are contained in another subarray ? Thanks! $global_array = array( $sub_array1 = array ( 0 => 8661, 1 => 8662 ), $sub_array2 = array ( 0 => 8662 ), $sub_array3 = array ( 0 => 8667, 1 => 8770 ), $sub_array4 = array ( 0 => 8672, 1 => 8770, 2 => 8772, ), $sub_array5 = array ( 0 => 8706, 1 => 8707, 2 => 8805, ), $sub_array6 = array ( 0 => 8707, 1 => 8805 ), $sub_array7 = array ( 0 => 8714, 1 => 8811, 2 => 8816, ), $sub_array8 = array ( 0 => 8718, 1 => 8720, 2 => 8816, ), $sub_array9 = array ( 0 => 8720 ), $sub_array10 = array ( 0 => 8724, 1 => 8726, 2 => 8727, ), $sub_array11 = array ( 0 => 8726, 1 => 8727 ), $sub_array12 = array ( 0 => 8727 ) ); print_r($global_array); $tobedeleted=array(); foreach ($global_array as $k=>$v ){ foreach ($global_array as $k2=>$v2){ if(($k<>$k2) &&(count($global_array[$k])<=count($global_array[$k2]))) { $count=count(array_diff($global_array[$k], $global_array[$k2])); if($count==0 && !in_array($k,$tobedeleted)) { $tobedeleted[]=$k; } } } } print_r($tobedeleted); foreach ($tobedeleted as $k=>$v ) { unset ($global_array[$v]); } print_r($global_array);
  6. Hi All, I want to insert a Google static map. I noticed that there may be some loss of information (e.g., loss of the name of narrow streets) when using lower value for the size attribute of the map. For example, http://maps.googleapis.com/maps/api/staticmap?&size=600x600 may show more details than http://maps.googleapis.com/maps/api/staticmap?&size=150x150. On the other hand I want the static map to display on smartphones, adjusted to their width. With some JS I could get the width of the smartphone and inject it in the size attribute, but that could lead to some loss of details. So here is my question : is it possible to load the map, say, at 600x600, then shrink it to the width of the smartphone (in the same way as shrinking a jpg image where details are not lost, but just rescaled) ? Thanks !
  7. Thanks. mysqldump -uroot -p --databases db_name --routines --events --result-file=file_name.sql did the trick.
  8. Hi All, I am in the process of moving my database from a local Windows system to a Debian VPS server. So far to back up my database I have been using this syntax : mysqldump -uroot -p --databases database_name --routines --events> filename.sql In this page http://www.it-iss.com/mysql/mysql-copying-a-database-users-and-privileges-between-two-servers/ the author recommends to use also the --result-file to prevent line end issues when moving from a Windows system to a Linux system. Would the right syntax be as follows then ? mysqldump -uroot -p --databases database_name --result-file= filename.sql --routines --events Thanks!
  9. Well, so far, I tried nothing, as for spanish lists of words. It is just that googling terms like "SPANISH_COLLATION" gives no result. For example, when properly ordered in Spanish, "lleno" would come after "lomo", and "chico" after "cosa", since the alphabet order in Spanish is "a, b, c, ch, d, ....k, l, ll, m, n, ...z"
  10. Hi All, I want to display lists of words (utf8 encoded) correctly ordered in Spanish, where "ch" and "ll" are considered as letters in the alphabet. For French, I use the following : $col = new Collator('fr_FR'); $col->setAttribute(Collator::FRENCH_COLLATION, Collator::ON); $col->asort(<array-to-sort>); What would be the equivalent for spanish? Thanks!
  11. Hi All, I have a page organized in tabs, each with its own div. I have a js that displays a given div when the user clicks the matching tab. There is a leaflet map in the first div, built from thousands of markers. There is a login form in the other div. Displaying a div by clicking its tab works great. If the user fails the login process, the page is reloaded and he is redirected back to the login div (and a message displays about the error that occured). Now here is the issue. Suppose the login process fails. If the user clicks the map tab, he will see a badly-formed map, like shrinked in the upper left corner of its container. My feeling is that the js that deals with the tabs runs before the end of the execution of the js that builds the map. The body has an onload="init()" associated with the tabs script. Thus I guess the tabs script would run only after the page has loaded. Since this does not seem to take into accound the map DOM, I tried and found a solution by applying a short settimeout (500 ms) in the tab js, more precisely to the function that grabs the tab links and content divs from the page. Now if the user fails the login process and clicks the map tab, he will see a well-formed and fully interactive map. However I think this is just a workaround. Is there a better solution? Thanks !
  12. You are right. My mistake. I am using phpMyAdmin. I should have made the tests through SQL statements instead of inserting a row via the Insert tab or editing a value via the View tab.
  13. Hi All, I have a table to which I added 2 computed columns like this : ALTER TABLE foo add number2 DECIMAL GENERATED ALWAYS AS (number*2) STORED, add nombre3 DECIMAL GENERATED ALWAYS AS (number*3) STORED Two issues : 1. Updating a value in "number" column does not updates "number2" and "number3" columns 2. Inserting a new row generates the error "the value specified for generated column is not allowed". Thanks!
  14. Hi All, I am presently working on media queries. Is there a reliable way to assess the physical width in inches of the screen ? On my 17-inches laptop, at a 1920-px resolution, I have a web page that displays a series of divs, with 4 divs per row. At a 1366-px resolution, the same page will display 3 divs per row. (Reducing the divs’ size in order to have 4 divs per row would make them less readible.) However, there are screen devices wider than 17 inches, but with a 1366-px resolution. On those screens, displaying 4 divs per row, instead of 3, would be appropriate. Is it possible to play with the physical size of screens in inches ? Thanks !
  15. Hi All, Just wondering whether it is possible to resize a jpg image to a specific size in bytes (while preserving height/width ratio). Thanks for any clues!
  • 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.