Search Results

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

Page 84/1708 | < Previous Page | 80 81 82 83 84 85 86 87 88 89 90 91  | Next Page >

  • str_replace() with associative array

    - by Qiao
    You can use arrays with str_replace(): $array_from = array ('from1', 'from2'); $array_to = array ('to1', 'to2'); $text = str_replace ($array_from, $array_to, $text); But what if you have associative array? $array_from_to = array ( 'from1' => 'to1'; 'from2' => 'to2'; ); How can you use it with str_replace()? Speed matters - array is big enough.

    Read the article

  • slicing 2d numpy array

    - by MedicalMath
    I have a 2d numpy array called FilteredOutput that has 2 columns and 10001 rows, though the number of rows is a variable. I am trying to take the 2nd column of FilteredOutput and use it to populate a new 1d numpy array called timeSeriesArray using the following line of code: timeSeriesArray=p.array(FilteredOutput[:,0]) I got this syntax from the following link. But the problem is that I am getting the following error message: TypeError: list indices must be integers, not tuple Can anyone show me the proper syntax for populating the 1d array timeSeriesArray with the contents of the second column of the 2d array FilteredOutput?

    Read the article

  • str_replace() with two-dimensional array

    - by Qiao
    You can use arrays with str_replace(): $array_from = array ('from1', 'from2'); $array_to = array ('to1', 'to2'); $text = str_replace ($array_from, $array_to, $text); But what if you have two-dimensional array? $array_from_to = array ( 'from1' => 'to1'; 'from2' => 'to2'; ); How can you use it with str_replace()? Speed matters - array is big enough.

    Read the article

  • Turn database result into array

    - by Industrial
    Hi everyone, I have just made the update/add/delete part for the "Closure table" way of organizing query hierarchical data that are shown on page 70 in this slideshare: http://www.slideshare.net/billkarwin/sql-antipatterns-strike-back My database looks like this: Table Categories: ID Name 1 Top value 2 Sub value1 Table CategoryTree: child parent 1 1 2 2 2 1 However, I have a bit of an issue getting the full tree back as an multidimensional array from a single query. Here's what I would like to get back: array ( 'topvalue' = array ( 'Subvalue', 'Subvalue2', 'Subvalue3' = array ('Subvalue 1', 'Subvalue 2', 'Subvalue 3' ) ); ); Update: Found this link, but I still have a hard time to convert it into an array: http://karwin.blogspot.com/2010/03/rendering-trees-with-closure-tables.html

    Read the article

  • Android use of an string array on another method

    - by spagi
    Hi all. Im trying to make an activity that has a multiple choice dialog after you push a button. In there you select from a list of things. But these things are received from a web method before the dialog appears. So I create a string array after I receive them inside the onCreate to initialise it there with the correct size. But my dialog method then cant get the array because propably its out of its scope. My code looks like this @Override protected Dialog onCreateDialog(int id) //Here is where the array is loaded to the multiple select dialog etc @Override public void onCreate(Bundle savedInstanceState) //Here is where i initialise the array and get its contents etc I cant initialise my array when the class starts because I dont know its size yet. This has to do something with the scopes of my variables and I am pretty confused

    Read the article

  • C - Discard the edges of an arbitrary level of a multidimensional array

    - by Medivh
    I have some geographical data, that I'm trying to parse into a usable format. The data is kept in NetCDF files, and is read out as a multidimensional array. My problem comes because the source of the geographical data has a strip of longitude on each side of the grid that overlaps the other side. That is, I have a longitude point of -1 degree, and another of 361 degrees. Unfortunately, I've got time, latitude, and sometimes height as dimensions in this array as well, and I have no way of predicting in advance where each dimension will be in the list (or if it's a three dimensional array, or a four dimensional array). Further complicating the problem, the array can be of floats, doubles or integers, so I have to pass it around as a void. Are there any NetCDF tools that I can use to pre-prepare the files? If not, how would you suggest I go about stripping the excess longitudes?

    Read the article

  • Making a PHP object behave like an array?

    - by Mark Biek
    I'd like to be able to write a PHP class that behaves like an array and uses normal array syntax for getting & setting. For example (where Foo is a PHP class of my making): $foo = new Foo(); $foo['fooKey'] = 'foo value'; echo $foo['fooKey']; I know that PHP has the _get and _set magic methods but those don't let you use array notation to access items. Python handles it by overloading __getitem__ and __setitem__. Is there a way to do this in PHP? If it makes a difference, I'm running PHP 5.2.

    Read the article

  • PHP array of object(stdClass) fusion/intersect?

    - by Gremo
    $arr1 is an associative array of anonymus objects: array 15898 => object(stdClass)[8] public 'date' => int $arr2 is another associative array with two (or more, it's not fixed) properties: array 15898 => object(stdClass)[10] public 'fruits' public 'drinks' I can't find any function for intersect and content fusion when dealing with objects. Basically i'd like to obtain: array 15898 => object(stdClass)[8] public 'date' => int public 'fruits' public 'drinks' Question is: is this even possible?

    Read the article

  • Array with mutiple types?

    - by aleluja
    Hello, I was wondering if there is a way to make an array which would have mutiple types of data fields. So far i was using aMyArray: array of array [0..1] of TPoint; But now, it is not enough for me. I need to add 3 more elements to the existing 2 "Point" elements making it an array like aMyArray: array of (TPoint,TPoint,real,real,real) So each element of aMyArray would have 5 'children', 2 of which are of a TPoint type and 3 of them are 'real' type. Is this possible to implement somehow?

    Read the article

  • Codeignitor Global Array Declaration

    - by Ajith
    I have a sequence of number like follows 1 - 25, 2 - 60, 3 - 80, 4 - 100 and so on which means that if input is 1 output will be 25 and so on...I need to store it in global array.I would like to use it in multiple pages also.In codeigniter where i can declare a global array and store all these? I am trying like as follows in constants.php $CONFIDENCEVALUE = array(); $CONFIDENCEVALUE[] = array('1'=>25,'2'=>'60','3'=>80,'4'=>100); If it is correct how can access these array value in required pages.Help me please.I am not an expert with codeignitor.Thanks

    Read the article

  • Array with multiple types?

    - by aleluja
    Hello, I was wondering if there is a way to make an array which would have multiple types of data fields. So far I was using aMyArray: array of array [0..1] of TPoint; But now, it is not enough for me. I need to add 3 more elements to the existing 2 "Point" elements making it an array like aMyArray: array of (TPoint,TPoint,real,real,real) So each element of aMyArray would have 5 'children', 2 of which are of a TPoint type and 3 of them are 'real' type. Is this possible to implement somehow?

    Read the article

  • PHP oop build array

    - by Industrial
    Hi! If I would need to build up an array with OOP based PHP, would this be the proper way to do it? class MyClass { $array = array(); function addElement($value) { $this->array[] = $value; } function fetch() { $return = $this->memcached->getMulti($this->array); return $return; } } PHP file where it will be used: <?php $this->myClass->addElement('key1'); $this->myClass->addElement('key1'); $this->myClass->addElement('key1'); $var = $this->myClass->fetch(); Thanks a lot

    Read the article

  • Perl, `push` to array reference

    - by Mike
    Is it possible to push to an array reference in Perl? Googling has suggested I deference the array first, but this doesn't really work. It pushes to the deferenced array, not the referenced array. For example, my @a = (); my $a_ref = [@a]; push(@$a_ref,"hello"); print $a[0]; @a will not be updated and this code will fail because the array is still empty (I'm still learning Perl references, so this might be an incredibly simple question. Sorry if so)

    Read the article

  • PHP sort multidimensional array by value

    - by stef
    How can I sort this array by the value of the "order" key? Even though the values are currently sequential, they will not always be. Array ( [0] => Array ( [hashtag] => a7e87329b5eab8578f4f1098a152d6f4 [title] => Flower [order] => 3 ) [1] => Array ( [hashtag] => b24ce0cd392a5b0b8dedc66c25213594 [title] => Free [order] => 2 ) [2] => Array ( [hashtag] => e7d31fc0602fb2ede144d18cdffd816b [title] => Ready [order] => 1 ) )

    Read the article

  • PHP - Get values from Array

    - by danit
    I am trying to get a record from a database using an sql lookup (sql1). This then returns as an array which is fine, but I need to use part of the array for my next stage. $opt=get_records_sql($sql1); //Diags for SQL content print_object($opt); $n = count($opt); if (empty($opt)) { echo 'No options selected'; } else { $optno = $opt["subjectid"]; // Diags of $optno echo '<br>$optno = '.$optno; As you can see, I tried to use this: $opt["subjectid"] as subjectid is the fieldname that I am trying to access and I was under the impression that this was correct for accessing an array, but I get the following error: Notice: Undefined index: subjectid Array contents: Array ( [1] => stdClass Object ( [uname] => JHollands06 [tutor] => M LSt [subjectid] => 1 [year] => 2010 [optid] => 1 ) )

    Read the article

  • PHP, ANT and virtualhosts

    - by dbasch
    Hi all, I use the following standard folder structure with my projects: workspace myproject conf development.properties production.properties src build.xml build.properties build myproject Unfortunately, working with scripted languages nullifies the concept of separating the "workspace" from the "build". In my development environment, I use a virtual-host for each project. The virtual-host for a project is configured during the "deploytodevelopment" ANT task. Which method would you recommend for integrating PHP into my build process? Change the virtual-hosts setup to point to the workspace/myproject/src folder. Edit the PHP in the workspace/myproject/src folder. or Check out another working copy of the myproject/src folder to the build/myproject folder. Change the virtual-hosts setup to point to the build/myproject folder. Edit the PHP in the build/myproject folder.

    Read the article

  • Installing multiple php versions plus extensions on freebsd

    - by jgtumusiime
    I'm a currently learning how to work with freebsd. Lately I have been trying to run multiple php versions along with their respective packages. However, I seem to be running into issues while making installations. The default location for my php installation is /usr/local/etc/, however I want to be able to install php5.2, php5.3 and php5.4 in /usr/local/etc/php52, /usr/local/etc/php53 and /usr/local/etc/php54 respectively. Using ports I simply achieved this by doing cd /usr/ports/lang/php5x && make PREFIX="/usr/local/etc/php5x" install clean. The problem now is: How do I do the same for extensions of all my PHP versions? When I try installing php-extensions like so: cd /usr/ports/lang/php5x-extension && make PREFIX="/usr/local/etc/php5x/lib/php" install clean, I get this error ... ===> PHPizing for php53-bcmath-5.3.17 env: /usr/local/bin/phpize: No such file or directory *** Error code 127 Stop in /usr/ports/math/php53-bcmath. *** Error code 1 Stop in /usr/ports/lang/php53-extensions. My PHPize is located in /usr/local/etc/php5x/bin/phpize So how do I get make or whatever to look for phpize in the right path? Is there a cleaner, may be simpler way of maintaining multiple php installations? I need to achieve this because of compatibility issues from some legacy code that runs on 5.2 and breaks on 5.3. Thank you. ================= So I successfully installed an configured freebsd jail and I would like to install software within my jail but I cannot connect to the network. Here is my rc.conf jail_enable="YES" # Set to NO to disable starting of any jails jail_list="mambo2" # Space separated list of names of jails jail_mambo2_rootdir="/usr/jails/j01" # jail's root directory jail_mambo2_hostname="mambo2.ug" # jail's hostname jail_mambo2_ip="192.168.100.174" # jail's IP address jail_mambo2_devfs_enable="YES" # mount devfs in the jail jail_mambo2_devfs_ruleset="mambo2_ruleset" # devfs ruleset to apply to jail here is my jail ifconfig output mambo2# ifconfig rl0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500 options=8<VLAN_MTU> ether 00:c1:28:00:48:db media: Ethernet autoselect (100baseTX <full-duplex>) status: active plip0: flags=108810<POINTOPOINT,SIMPLEX,MULTICAST,NEEDSGIANT> metric 0 mtu 1500 lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384 mambo2# I created a /etc/resolv.conf for nameservers mambo2# cat /etc/resolv.conf nameserver 192.168.100.251 nameserver 8.8.8.8 mambo2# Here is a list of jails running [root@mambo /usr/home/jtumusiime]# jls JID IP Address Hostname Path 5 192.168.100.174 mambo2.ug /usr/jails/j01 my host has 4 ip addresses, 3 public and one private: 192.168.100.173 I tried creating a jail using ezjail and this does not work out. [root@mambo /usr/home/jtumusiime]# ezjail-admin update -p -i Error: Cannot find your copy of the FreeBSD source tree in . Consider using 'ezjail-admin install' to create the base jail from an ftp server. [root@mambo /usr/home/jtumusiime]# I have an updated copy of freebsd 7.1 source in /usr/src/ and I did #make buildworld while building the first jail mambo2 Here is an excerpt of ouput of ezjail-admin install ... 221 Goodbye. Trying 193.162.146.4... Connected to ftp.freebsd.org. 220 ftp.beastie.tdk.net FTP server (Version 6.00LS) ready. 331 Guest login ok, send your email address as password. 230 Guest login ok, access restrictions apply. Remote system type is UNIX. Using binary mode to transfer files. 200 Type set to I. 550 pub/FreeBSD-Archive/old-releases/i386/7.1-RELEASE/base: No such file or directory. 221 Goodbye. Could not fetch base from ftp.freebsd.org. Maybe your release (7.1-RELEASE) is specified incorrectly or the host ftp.freebsd.org does not provide that release build. Use the -r option to specify an existing release or the -h option to specify an alternative ftp server. Querying your ftp-server... The ftp server you specified (ftp.freebsd.org) seems to provide the following builds: Trying 193.162.146.4... total 10 drwxrwxr-x 13 1006 1006 512 Feb 20 2011 8.2-RELEASE drwxrwxr-x 13 1006 1006 512 Apr 10 2012 8.3-RELEASE lrwxr-xr-x 1 1006 1006 16 Jan 7 2012 9.0-RELEASE -> i386/9.0-RELEASE drwxrwxr-x 7 1006 1006 1024 Feb 19 2012 ISO-IMAGES -rw-rw-r-- 1 1006 1006 637 Nov 23 2005 README.TXT drwxrwxr-x 5 1006 1006 512 Nov 2 02:59 i386 I do not want to upgrade my freebsd installation. I have googled around; but all on vail

    Read the article

  • Installing PHP extensions on Linux

    - by EmmyS
    Please bear with me; I'm a developer, not a server admin. My company wants to explore using Magento. They've handed me a pre-configured Linux server with apache and PHP installed, but when I try to run the Magento setup, it tells me that there are PHP extensions that need to be loaded. I can edit the php.ini file, but have no idea where to get the extensions or how to install them, and there's no one here who knows, either. Can anyone give me a hand? I need the PDO_MySQL, mcrypt, and GD extensions. I've searched and found sites that talk about downloading from the terminal and compiling code, but it's all way over my head. Is there an easy way to do this?

    Read the article

  • SSL for PHP on Windows Server 2003

    - by otobrglez
    Hi All! I have Windows Server 2003 R2 with Apache 2.2.4 and PHP 5.2.6. I want to access pages over https (SSL). And i get this error (Zend Framework GData): Unable to find the socket transport "ssl" - enter code here did you forget to enable it when you configured PHP? So what i did. I went to php.ini and i uncomented the line extension=php_openssl.dll I also installed Win32 OpenSSL. But nothing works. What sould i do?

    Read the article

  • How to setup VIM for php development?

    - by Ashwin kumar
    I have been trying a lot (but not smartly) to figure out setting up VIM, ctags, omnicomple for PHP development. On Googling I found this file. But have no clue how to use it. What have I done until now? Here it is: I am on Fedora 17 64-bit OS Logged in as root Found my VIM version to be VIM - Vi IMproved 7.3 (2010 Aug 15, compiled May 8 2012 15:05:51) Followed the install details as here http://www.vim.org/scripts/script.php?script_id=3171 install details Place in $HOME/.vim/autoload/phpcomplete.vim and enable the php ftplugin What else I am missing? How do I start using omnicomplete. (this is the first time I am using omnicomplete) Why didn't I try IDE's? I have a single core machine running LAMP stack. Didn't wanted to slow down everything and hence sticking to command line environment.

    Read the article

  • Cant get php script to connect to asterisk internal mysql database

    - by Bilbo
    Im trying to get a PHP script to connect to Asterisks internal sql database. I tried the to use the standard method for example $con = mysqli_connect("192.168.1.126","root","mysql","asterisk"); However when I log into the asterisk server to access the mysql database all i need it to type "mysql" and im logged in. Im wondering is it possible for my php script to connect to asterisk internal database. //edit The following mysql error is shown Warning: mysqli_connect(): (HY000/2003): Can't connect to MySQL server on '192.168.1.126' (111) in /var/www/html/project/sipSubScript.php on line 6 Failed to connect to MySQL: Can't connect to MySQL server on '192.168.1.126' (111)

    Read the article

  • PHP vs Batch file for mysql cronjob?

    - by mysqllearner
    Hi, My server details: OS: Windows Server 2003 IIS6 Plesk 8.xx installed (currently using Plesk to set the cronjob) I need your advice. I have 2 methods: Method 1: Using php + mysqldump, create databases backup files into gzip, and then send email with attachment (each databases has around about 25mb) Method 2: Using batch + mysqldump, create databases backup files into gzip, and then send email with attachment (same, each databases has around about 25mb) My questions: Whats the difference of using php file and batch file for cronjob? Which method is better in term of backup speed and send email, and (maybe)safety (e.g., lesser file corrupt occurance)? If i set the cronjob hourly, will it effect my web performances? I mean, lets say my website has 100++ users online now, and each user making transaction to MySQL, when I perform backup at my web peak hour, will it decrease the performances, like the loading speed, prone to errors etc?? (sorry for my bad english) P.S: If you need my php and batch file code, please ask me to post it here. I didnt post it now is because, its very simple and standard code.

    Read the article

  • application/x-httpd-php opening rather than pages?

    - by GuyNoir
    For some reason, no matter what page I try to open (.php, .html, .html, etc) my server trys to save it, rather than displaying the page. However, I do get the "It Works!" page for the main domain, it's only when I try to display a page on a sub-directory that it fails. I researched the problem, and I placed a .htaccess file in the directory of the pages that I'm attempting open with the code: AddType application/x-httpd-php5 .php .html .htm AddHandler applicaton/x-httpd-php5 .php .htm .html .my I'm running the latest version of apache and php5 which is installed as the "php5" module. Any help? http://i.stack.imgur.com/fh6dj.png

    Read the article

  • Sending mail via php in EC2

    - by william007
    I have used the following code for sending mail using php using amazon ec2, but I only see 'aatest' as the result, and doesn't get any incoming email. Btw, I have already included ses.php, and have validated the email [email protected], and double confirm that accesskey, and accesskey are the correct one. Can anyone suggest way for debugging it? require_once('ses.php'); $con=new SimpleEmailService('accesskey','accesskey'); print_r('aa'.$con->listVerifiedEmailAddresses()); $m = new SimpleEmailServiceMessage(); $m->addTo('[email protected]'); $m->setFrom('[email protected]'); $m->setSubject('Hello, world!'); $m->setMessageFromString('This is the message body.'); print_r($con->sendEmail($m)); echo 'test';

    Read the article

  • how can I effect DNS Caching on PHP/Memcache application

    - by Niro
    In a very high loaded Ubuntu/PHP web server I found that the PHP line: $memcache-connect("int-aws_ec2.memcached.myapp.net",11211); sometimes takes ~5 secs. Replacing the url with the ip address decreases the server load from ~20 to 0 My question is - where are the settings that effect the DNS caching for this? Is it in the server level or the memcache library ? How can I change it ? Additional info: Ubuntu 10.04 lucid PHP: 5.3.2-1ubuntu4.10 Apache/2.2.14 (Ubuntu) Amazon EC2 Even more info per Celada's comment: The DNS handling for the memcache server is done by scalr (the platform I use to manage the cloud resources). They have a client located on the instances and their own DNS servers. /etc/nsswitch.conf - hosts: files dns /etc/resolv.conf: nameserver 172.16.0.23 domain ec2.internal search ec2.internal The domain is not in hosts.conf To check if I run nscd I used /etc/init.d/nscd stop and received 'no such file' so i guess I dont run nscd. Thanks !

    Read the article

< Previous Page | 80 81 82 83 84 85 86 87 88 89 90 91  | Next Page >