Search Results

Search found 42698 results on 1708 pages for 'php in array'.

Page 115/1708 | < Previous Page | 111 112 113 114 115 116 117 118 119 120 121 122  | Next Page >

  • Array indexOf implementation for Internet Explorer

    - by Daemon
    There are plenty of solutions on how to get the indexOf implementation into the Array prototype so that it works under Internet Explorer, however I've stumbled upon an issue that doesn't seem to be addressed anywhere I've looked so far. Using the pretty well agreed upon implementation at MDC, I have the following code that's being problematic now: // indexOf support for IE (from MDC) if (!Array.prototype.indexOf) { Array.prototype.indexOf = function(elt /*, from*/) { var len = this.length >>> 0; var from = Number(arguments[1]) || 0; from = (from < 0) ? Math.ceil(from) : Math.floor(from); if (from < 0) from += len; for (; from < len; from++) { if (from in this && this[from] === elt) return from; } return -1; }; } var i = [1,2,3,4]; for (j in i) { alert(i[j]); } I am expecting to receive 4 alerts, each one containing one of the elements of the array. In Firefox and Chrome, that's exactly what I see, however in IE8 I get an additional alert containing the indexOf function code. What can be done to avoid this?

    Read the article

  • Forcing user to new page in php. (PHP newbie)

    - by JohnC
    Hello I'm a newbie web programmer. My background is writing Windows applications with sql. I'm putting together my 1st data entry screens in Php. I have a search form that links to a form that displays records in a grid. On each row of the grid I have a delete url to allow the user to remove a record. This links to a form delete.php (which calls the sql to remove the record). Ideally I would like to automatically take the user back to the search form rather than forcing the user to click on a link to do so. I have used ob_start with the header to do this elsewhere but cannot get it to work on this page. Is there another way to do it? (Using php 5 as part of LAMP) file delete.php <?php $id = $_GET['recordID']; //ob_start(); require_once('connections/local.php'); mysql_select_db($database_local, $local); mysql_query("DELETE FROM user_access WHERE id = {$id}") or die(mysql_error()); echo("Record ".$id." deleted"); echo("<br>"); //header("location:http://localhost/search7.htm); //ob_flush(); echo("<a href=\"http://localhost/search7.htm\">Search for Members</a>"); ?>

    Read the article

  • Classify data (cell array) based on years in MATLAB

    - by user2991243
    Suppose that we have this cell array of data : a={43 432 2006; 254 12 2008; 65 35 2000; 64 34 2000; 23 23 2006; 64 2 2010; 32 5 2006; 22 2 2010} Last column of this cell array is years. I want classify data(rows) based on years like this : a_2006 = {43 432 2006; 32 5 2006; 32 5 2006} a_2008 = {254 12 2008}; a_2000 = {65 35 2000; 64 34 2000} a_2010 = {64 2 2010; 22 2 2010} I have different years in column three in every cell array (this cell array is a sample) so I want an automatic method to determine the years and classify them to a_yearA , a_yearB etc. or other naming that I can distinguish years and call data years easily. How can I do this? Thanks.da

    Read the article

  • Trouble decoding JSON string with PHP

    - by Anthony
    I'm trying to send an array of objects from JS to PHP using JSON. I have an array of players as follows: var player; var players = new Array(); //loop for number of players player = new Object(); player.id = theID; players[i] = player; Then my AJAX call looks like this: JSONplayers = JSON.stringify(players); $.ajax({ type: "POST", url: "php/ajax_send_players.php", data: { "players" : JSONplayers } On the PHP side the decode function looks like this $players = $_REQUEST['players']; echo var_dump($players); $players = json_decode($players); echo 'players: ' .$players. '--'. $players[0] . '--'. $players[0]->id; Debugging in chrome, the JSON players var looks like this before it is sent: JSONplayers: "[{"id":"Percipient"},{"id":"4"}]" And when I vardump in PHP it looks OK, giving this: string(40) "[{\"id\":\"Percipient\"},{\"id\":\"4\"}]" But I can't access the PHP array, and the echo statement about starting with players: outputs this: players: ---- Nothing across the board...maybe it has something to do with the \'s in the array, I am new to this and might be missing something very simple. Any help would be greatly appreciated. note I've also tried json_decode($players, true) to get it as an assoc array but get similar results.

    Read the article

  • Displaying data from a linked table and displaying it as a list with HTML/PHP/MySQL

    - by user1672694
    I have three tables. students studentID | FirstName | LastName | Email | Form course CCode | Title courseenrolement courseenrolementid | studentID | ccode | complete | scode With the website, I have a page where I can view all the current enrolements and I wish to be able to view the list displaying the first name, surname and course title. I know I could do it with the following SQL (for the names): SELECT FirstName, LastName FROM student, courseenrolement WHERE courseenrolement.studentID = student.studentID But I am unsure how to get this to work using HTML/PHP. At present I only know how to display the studentID and CCode from the courseenrolement table using the following code: <ul> <?php foreach ($courseenrolements as $ce): ?> <li> <form action="" method="post"> <div> <?php htmlout($ce['studentID']); ?> <?php htmlout($ce['CCode']); ?> <input type="hidden" name="courseenrolementid" value="<?php echo $ce['courseenrolementid']; ?>"> <input type="submit" name="action" value="Edit"> <input type="submit" name="action" value="Delete"> </div> </form> </li> <?php endforeach; ?> </ul> which displays this: But I would like the names and course title. I managed to get it to show the names etc in the dropdown on the 'Add new' form, so I would assume it will be similar, but just unsure on how exactly. Thanks in advance

    Read the article

  • [java] Returning the element number of the longest string in an array

    - by JohnRoberts
    Hoookay, so. I'm trying to get the longestS method to take the user-inputted array of strings, then return the element number of the longest string in that array. I got it to the point where I was able to return the number of chars in the longest string, but I don't believe that will work for what I need. My problem is that I keep getting incompatible type errors when trying to figure this out. I don't understand the whole data type thing with strings yet. It's confusing me how I go about return a number of the array yet the array is of strings. The main method is fine, I got stuck on the ???? part. { public static void main(String [] args) { Scanner inp = new Scanner( System.in ); String [] responseArr= new String[4]; for (int i=0; i<4; i++) { System.out.println("Enter string "+(i+1)); responseArr[i] = inp.nextLine(); } int highest=longestS(responseArr); } public static int longestS(String[] values) { int largest=0 for( int i = 1; i < values.length; i++ ) { if ( ????? ) } return largest; } }

    Read the article

  • finding common prefix of array of strings

    - by bumperbox
    I have an array like this $sports = array( 'Softball - Counties', 'Softball - Eastern', 'Softball - North Harbour', 'Softball - South', 'Softball - Western' ); and i would like to find the longest common part of the string so in this instance, it would be 'Softball - '; I am thinking that I would follow the this process $i = 1; // loop to the length of the first string while ($i < strlen($sports[0]) { // grab the left most part up to i in length $match = substr($sports[0], 0, $i); // loop through all the values in array, and compare if they match foreach ($sports as $sport) { if ($match != substr($sport, 0, $i) { // didn't match, return the part that did match return substr($sport, 0, $i-1); } } // foreach // increase string length $i++; } // while // if you got to here, then all of them must be identical Questions is there a built in function or much simpler way of doing this ? for my 5 line array that is probably fine, but if i were to do several thousand line arrays, there would be a lot of overhead, so i would have to be move calculated with my starting values of $i, eg $i = halfway of string, if it fails, then $i/2 until it works, then increment $i by 1 until we succeed. so that we are doing the least number of comparisons to get a result If there a formula/algorithm out already out there for this kind of problem ? thanks alex

    Read the article

  • PHP JQuery: Where to specify uploadify destination folder

    - by Eamonn
    I have an uploadify script running, basic setup. Works fine when I hard code the destination folder for the images into uploadify.php - now I want to make that folder dynamic. How do I do this? I have a PHP variable $uploadify_path which contains the path to the folder I want. I have switched out my hard coded $targetPath = path/to/directory for $targetPath = $uploadify_path in both uploadify.php and check_exists.php, but it does not work. The file upload animation runs, says it is complete, yet the directory remains empty. The file is not hiding out somewhere else either. I see there is an option in the Javascript to specify a folder. I tried this also, but to no avail. If anyone could educate me on how to pass this variable destination to uploadify, I'd be very grateful. I include my current code for checking (basically default): The Javascript <script type="text/javascript"> $(function() { $('#file_upload').uploadify({ 'swf' : 'uploadify/uploadify.swf', 'uploader' : 'uploadify/uploadify.php', // Put your options here }); }); </script> uploadify.php $targetPath = $_SERVER['DOCUMENT_ROOT'] . $uploadify_path; // Relative to the root if (!empty($_FILES)) { $tempFile = $_FILES['Filedata']['tmp_name']; $targetFile = $targetPath . $_FILES['Filedata']['name']; // Validate the file type $fileTypes = array('jpg','jpeg','gif','png'); // File extensions $fileParts = pathinfo($_FILES['Filedata']['name']); if (in_array($fileParts['extension'],$fileTypes)) { move_uploaded_file($tempFile,$targetFile); echo '1'; } else { echo 'Invalid file type.'; } }

    Read the article

  • Flex + PHP + ValueObjects

    - by Tempname
    I have a php/flex value object that I am using to transmit data to/from in my application. Everything works great php-flex, but I am having an issue with flex-php. In my MergeTemplateService.php service I have the following code. This is the method that flex hits directly: function updateTemplate($valueObject){ $object = DAOFactory::getMergeTemplateDAO()->update($valueObject); return $object; } I am passing a value object that from flex looks like this: (com.rottmanj.vo::MergeTemplateVO)#0 communityID = 0 creationDate = (null) enterpriseID = 0 lastModifyDate = (null) templateID = 2 templateName = "My New Test Template" userID = 0 The issue I am having is that my updateTemplate method sees the value object as an array and not an object. In my amfphp globals.php I have set my voPath as: $voPath = "services/class/dto/"; Any help with this is greatly appreciated Here are my two value objects: AS3 VO: package com.rottmanj.vo { [RemoteClass(alias="MergeTemplate")] public class MergeTemplateVO { public var templateID:int; public var templateName:String; public var communityID:int; public var enterpriseID:int; public var userID:int; public var creationDate:String; public var lastModifyDate:String public function MergeTemplateVO(data:Object = null):void { if(data != null) { templateID = data.templateID; templateName = data.templateName; communityID = data.communityID; enterpriseID = data.enterpriseID; userID = data.userID; creationDate = data.creationDate; lastModifyDate = data.lastModifyDate; } } } } PHPVO: <?php class MergeTemplate{ var $templateID; var $templateName; var $communityID; var $enterpriseID; var $userID; var $creationDate; var $lastModifyDate; var $_explictType = 'MergeTemplate'; } ?>

    Read the article

  • Somewhat lost with jquery + php + json

    - by Luis Armando
    I am starting to use the jquery $.ajax() but I can't get back what I want to...I send this: $(function(){ $.ajax({ url: "graph_data.php", type: "POST", data: "casi=56&nada=48&nuevo=98&perfecto=100&vales=50&apenas=70&yeah=60", dataType: "json", error: function (xhr, desc, exceptionobj) { document.writeln("El error de XMLHTTPRequest dice: " + xhr.responseText); }, success: function (json) { if (json.error) { alert(json.error); return; } var output = ""; for (p in json) { output += p + " : " + json[p] + "\n"; } document.writeln("Results: \n\n" + output); } }); }); and my php is: <?php $data = $_POST['data']; function array2json($data){ $json = $data; return json_encode($json); } ?> and when I execute this I come out with: Results: just like that I used to have in the php a echo array2json statement but it just gave back gibberish...I really don't know what am I doing wrong and I've googled for about 3 hours just getting basically the same stuff. Also I don't know how to pass parameters to the "data:" in the $.ajax function in another way like getting info from the web page, can anyone please help me? Edit I did what you suggested and it prints the data now thank you very much =) however, I was wondering, how can I send the data to the "data:" part in jQuery so it takes it from let's say user input, also I was checking the php documentation and it says I'm allowed to write something like: json_encode($a,JSON_HEX_TAG|JSON_HEX_APOS|JSON_HEX_QUOT|JSON_HEX_AMP) however, if I do that I get an error saying that json_encode accepts 1 parameter and I'm giving 2...any idea why? I'm using php 5.2

    Read the article

  • how to use a PHP Constant that gets pulled from a database

    - by Ronedog
    Can you read out the name of a PHP constant from a database and use it inside of a php variable, to display the value of the constant for use in a menu? For example here's what I'm trying to accomplish In SQL: select menu_name AS php_CONSTANT where menu_id=1 the value returned would be L_HOME which is the name of a CONSTANT in a php config page. The php config page looks like this define('L_HOME','Home'); and gets loaded before the database call. The php usage would be $db_returned_constant which has a value of L_HOME that came from the db call, then I would place this into a string such as $string = '<ul><li>' . $db_returned_constant . '</li></ul>' and thus return a string that looks like $string = '<ul><li><a href="#" onclick="path_from_db">Home</a></li></ul>'. To sum up what I'm trying to do Load a config file based on the language preference query the db to return the menu name, which is the name of a CONSTANT in the config file loaded in step one, and also retrieve the menu_link which is used in the "onclick" event. Use a php variable to hold the name of the CONSTANT Place the variable into a string that gets echo'd out to create the menu displaying the value of the CONSTANT. I hope this makes enough sense...is it even possible to use a constant like this? Thanks.

    Read the article

  • .NET HttpModule does not send form variables to PHP file on RewritePath()

    - by jammus
    Hello friends. We have an application running on IIS 6 which uses a custom HttpModule to rewrite urls. This works great (well done us) except in the case where the Context.RewritePath destination is a .php file. The php file is executed as expected, however the $_POST collection is empty meaning it cannot access any forms which are submitted to rewritten urls. The problem does not exist when rewriting to .aspx files as the Request.Form collection is fine. My question therefore has two parts: Why is the $_POST collection not being populated? Is there a way to ensure that the .php $_POST collection is correctly populated after a rewrite? I don't have much to show in the way of code. There's just a simple: context.RewritePath(newPath); once the HttpModule has figured out where to send the request. Edit: Interestingly, if I do var_dump(file_get_contents('php://input')); in the PHP file (method described here) the contents of the form is displayed. So the data is reaching the PHP script but not the $_POST array.

    Read the article

  • PHP IDE with Integrated Web Server

    - by seth
    Note: This is not another "What is the best PHP IDE?" question. I'm looking for a PHP IDE with a specific feature, namely an integrated / embedded (php enabled) web server; ideally with xdebug pre-bundled. I already know that Aptana 1.5 has this functionality (and some older versions of Zend Studio as well), but Aptana 1.5 hasn't been supported for quite some time and as we make the transition to PHP 5.3 and beyond, it's usefulness will diminish significantly. I've looked at some options including Eclipse PDT and NetBeans, but it seems every PHP IDE relies on a separate local/remote web server to actually interpret the code. I know installing a web server locally is fairly trivial, but this is for a classroom solution, where installing, configuring, and maintaining a web server on 1000 machines is simply not feasible. A remote server solution will also not work due to the need to use debugging functionality (xdebug currently requires a hardcoded IP for the debug client). This seems like such an obvious feature/plugin for a PHP IDE, but my research thus far has turned up no results.

    Read the article

  • Display two array's in the same table

    - by Naeem Ahmed
    $row = $query->fetchAll(PDO::FETCH_ASSOC); $num_rows = count($row); for ($i = 0; $i < $num_rows; $i++) { $title = htmlspecialchars($row[$i]['title']); $author =htmlspecialchars($row[$i]['author']); $school =htmlspecialchars($row[$i]['school']); $solution = $row[$i]['solution']; $notes = $row[$i]['notes']; $ad = array($title, $price, $author, $school, $contact, $content, $date); $inlcude = array($solutions, $notes); $field = 0; echo "<table border='1'>"; // foreach($inlcude as $in) This failled miserably foreach ($ad as $post) { if ($field < 3) //The first three values are placed in the first row { echo "<td>$post</td>"; } if ($field >= 3) { echo "<tr><td>$post</td><td>$in</td></tr>"; } $field++; } echo '</table>'; } I have two arrays and I would like to display them in different columns in my table. $ad displays perfectly fine but I'm having trouble displaying the contents in $inlcude in the second column. I've tried putting another foreach loop to iterate through contents of the second array but that really screws up my table by placing random values in different places on the table. Besides the foreach loop, I don't know of any other way to iterate through the array. Any suggestions would be appreciated.Thanks!

    Read the article

  • Is this 2D array initialization a bad idea?

    - by Brendan Long
    I have something I need a 2D array for, but for better cache performance, I'd rather have it actually be a normal array. Here's the idea I had but I don't know if it's a terrible idea: const int XWIDTH = 10, YWIDTH = 10; int main(){ int * tempInts = new int[XWIDTH * YWIDTH]; int ** ints = new int*[XWIDTH]; for(int i=0; i<XWIDTH; i++){ ints[i] = &tempInts[i*YWIDTH]; } // do things with ints delete[] ints[0]; delete[] ints; return 0; } So the idea is that instead of newing a bunch of arrays (and having them placed in different places in memory), I just point to an array I made all at once. The reason for the delete[] (int*) ints; is because I'm actually doing this in a class and it would save [trivial amounts of] memory to not save the original pointer. Just wondering if there's any reasons this is a horrible idea. Or if there's an easier/better way. The goal is to be able to access the array as ints[x][y] rather than ints[x*YWIDTH+y].

    Read the article

  • PHP active page code - I can't figure out parse error

    - by dmschenk
    I'm trying to build an active page menu with PHP and MySQL and am having a difficult time fixing the error. In the while statement I have an if statement that is giving me fits. Basically I think I'm saying that "thispage" is equal to the "title" based on pageID and as the menu is looped through if "thispage" is equal to "title" then echo id="active". Thanks <?php mysql_select_db($database_db_connection, $db_connection); $query_rsDaTa = "SELECT * FROM pages WHERE pagesID = 4"; $rsDaTa = mysql_query($query_rsDaTa, $db_connection) or die(mysql_error()); $row_rsDaTa = mysql_fetch_assoc($rsDaTa); $totalRows_rsDaTa = mysql_num_rows($rsDaTa); $query_rsMenu = "SELECT * FROM menu WHERE online = 1 ORDER BY menuPos ASC"; $rsMenu = mysql_query($query_rsMenu, $db_connection) or die(mysql_error()); $thisPage = ($row_rsDaTa['title']); ?> <link href="../css/MainStyle.css" rel="stylesheet" type="text/css" /> <h2><?php echo $thisPage; ?></h2> <div id="footcontainer"> <ul id="footlist"> <?php while($row_rsMenu = mysql_fetch_assoc($rsMenu)) { echo (" <li" . <?php if ($thisPage==$row_rsDaTa['title']) echo id="active"; ?> . "<a href=\"../" . $row_rsMenu['menuURL'] . "\">" . $row_rsMenu['menuName'] . "</a></li>\n"); } echo "</ul>\n"; ?> </div> <?php mysql_free_result($rsMenu); mysql_free_result($rsDaTa); ?>

    Read the article

  • trouble connecting to MySql DB (PHP)

    - by user332817
    Hi I have the following PHP code to connect to my db. <?php ob_start(); $host="localhost"; // Host name $username="root"; // Mysql username $password=""; // Mysql password $db_name="test"; // Database name $tbl_name="members"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); ?> however I get the following error: Warning: mysql_connect() [function.mysql-connect]: [2002] A connection attempt failed because the connected party did not (trying to connect via tcp://localhost:3306) in C:\Program Files (x86)\EasyPHP-5.3.2i\www\checklogin.php on line 11 Warning: mysql_connect() [function.mysql-connect]: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. in C:\Program Files (x86)\EasyPHP-5.3.2i\www\checklogin.php on line 11 Fatal error: Maximum execution time of 30 seconds exceeded in C:\Program Files (x86)\EasyPHP-5.3.2i\www\checklogin.php on line 11 I am able to add a db/tables via phpmyadmin but I cant connect using php. here is a screenshot of my phpmyadmin page: http://img294.imageshack.us/img294/1589/sqls.jpg any help would be appreciated, thanks in advance.

    Read the article

  • URL routing in an MVC framework - PHP

    - by Walderman
    I'm developing an MVC framework in PHP from scratch; mostly for the learning experience but this could easily end up in a live project. I went through this tutorial as a base and I've expanded from there. Requests are made like this: examplesite.com/controller/action/param1/param2/ and so on... And this is my .htaccess file: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?rt=$1 [L,QSA] So all requests go to index.php and they are routed to the correct controller and action from there. If no controller or action is given, then the default 'index' is assumed for both. I have an index controller with an index action, which is supposed to be the home page of my site. I can access it by going to examplesite.com (since the index part is assumed). It has some images, a link to a stylesheet, and some scripts. They are linked with paths relative to index.php. I thought this would be fine since all request go to index.php and all content is simply included in this page using php. This works if I go to examplesite.com. I will see all of the images and styles, and scripts will run. However, if I go to examplesite.com/index, I am routed to the correct part of the site, but all of the links don't work. Does the browser think I am in a different folder? I would like to be able to use relative paths for all of the content in my site, because otherwise I need to use absolute paths everywhere to make sure things will show up. Is this possible?

    Read the article

  • Mimic Coldfusion's debug output in PHP?

    - by TekiusFanatikus
    I'm trying to mimic Coldfusion's debug output in PHP. Here's an example of what it looks like (ie. Execution Time section): I've turned to XDebug. Ideally, the exception stack error output would be what I'd be looking for. However, it only shows up when an exception occurs. I also tried something like (in our CMS-ish app) this (original question here): $content.= "<?php xdebug_start_trace('e:/xdebug/trace');?>"; $content.= "<?php require('".$page['file_'.LG]."'); ?>"; $content.= "<?php xdebug_stop_trace();?>"; ... $content.= "<?php echo readfile('e:/xdebug/trace.xt');?>"; However, I get an insane, browser crashing HTML table dropped at the bottom of page. Not very efficient. My php.ini config: xdebug.trace_format = 2 xdebug.collect_vars = 1 xdebug.collect_params = 4 xdebug.dump_globals = 1 xdebug.dump.SERVER = 'REQUEST_URI' xdebug.show_local_vars = 1 xdebug.show_mem_delta = 1 I'm just wondering if someone has already done something similar?

    Read the article

  • Consuming PHP webservice with .Net C#, error with array

    - by Faber
    I've a problem calling a PHP Web Service from .Net application. This is the XML response and I think there is a problem with the return node <?xml version="1.0" encoding="ISO-8859-1"?> <SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Body> <ns1:infoprodottoResponse xmlns:ns1="http://wan3.edc.it"> <result xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType=":[0]"></result> <error xsi:type="xsd:string">8u9lvDe3RBiGuXyL9lvM2tODlRMtcN77ya3S2LDEWEetBeRz/k4mXkK4hSqpgZOKilHYXgycj6Jtu8iBTfR1FQ==</error> <token xsi:type="xsd:string">5o58H00T96AWedhG1tnSc4xR+yXg7PQfQzXYVpri2AY=</token> </ns1:infoprodottoResponse> </SOAP-ENV:Body> In result node the SOAP-ENC:arrayType attribute hasn't declared the array type. The array type must be declare if the SOAP-ENC:arrayType is present, isn't it? It must be declared also if the array is empty?

    Read the article

  • Array indexOf implentation for Internet Explorer

    - by Daemon
    There are plenty of solutions on how to get the indexOf implementation into the Array prototype so that it works under Internet Explorer, however I've stumbled upon an issue that doesn't seem to be addressed anywhere I've looked so far. Using the pretty well agreed upon implementation at MDC, I have the following code that's being problematic now: // indexOf support for IE (from MDC) if (!Array.prototype.indexOf) { Array.prototype.indexOf = function(elt /*, from*/) { var len = this.length >>> 0; var from = Number(arguments[1]) || 0; from = (from < 0) ? Math.ceil(from) : Math.floor(from); if (from < 0) from += len; for (; from < len; from++) { if (from in this && this[from] === elt) return from; } return -1; }; } var i = [1,2,3,4]; for (j in i) { alert(i[j]); } I am expecting to receive 4 alerts, each one containing one of the elements of the array. In Firefox and Chrome, that's exactly what I see, however in IE8 I get an additional alert containing the indexOf function code. What can be done to avoid this?

    Read the article

  • Ruby method Array#<< not updating the array in hash

    - by Mladen Jablanovic
    Inspired by http://stackoverflow.com/questions/2552363/how-can-i-marshal-a-hash-with-arrays I wonder what's the reason that Array#<< won't work properly in the following code: h = Hash.new{Array.new} #=> {} h[0] #=> [] h[0] << 'a' #=> ["a"] h[0] #=> [] # why?! h[0] += ['a'] #=> ["a"] h[0] #=> ["a"] # as expected Does it have to do with the fact that << changes the array in-place, while Array#+ creates a new instance?

    Read the article

  • PHP, MySQL: Security concern; Page loads in a weird way

    - by Devner
    Hi all, I am testing the security of my website. I am using the following URL to load a PHP page in my website, on localhost: http://localhost/domain/user/index.php/apple.php When I do this, the page is not loading normally; Instead the images, icons used in the page simply vanish/disappear from the page. Only text appears. And also on any link I click on this page, it brings me to this same page again without navigating to the required page. So if I have hyperlinks to other pages, such as "SEARCH", which points to search.php, instead of navigating to the search.php page, it refreshes the index.php page and just appends the page name of the destination page to the end of the URL. For example, say I used the link above. It then loads the index.php page minus the images at it's will. When I click on the "Search" link to navigate to the search page, I see the following in the URL: http://localhost/domain/user/index.php/search.php I have a redirection configured to a 404 error page in my .htaccess file, but the page does not redirect to the 404 error page. Notice the search.php towards the end of the URL above. Any other link that I click, reloads the index.php page and just appends the destination page name to the end of the URL like I have shown above. I was expecting to see a 404 Error but that does not happen. The URL should not even be able to load the page because I do NOT have a "index.php" folder in my website. What can I do to solve this? All help is appreciated. Thank you.

    Read the article

< Previous Page | 111 112 113 114 115 116 117 118 119 120 121 122  | Next Page >