Search Results

Search found 15007 results on 601 pages for 'array'.

Page 12/601 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • pre_replace multi-dimensional array problem

    - by Martin
    I want to replace word groups by links. I use a multi-dimensional array to define these (in the real world there will be thousands of them). Here's the code: $text = "<html><body><pre> Here is Foo in text. Now come Baz? and Bar-X. Replace nothing here: Foo (followed by brackets). </pre></body></html>"; $s = array( array("t" => "Foo", "u" => "http://www.foo.com", "c" => "foo"), array("t" => "Baz?", "u" => "http://www.baz.net", "c" => "test"), array("t" => "Bar-X", "u" => "http://www.baz.org", "c" => "test") ); foreach ($s as $i => $row) { $replaced = preg_replace('/(?=\Q'.$row["t"].'\E[^(]+$)\b\Q'.$row["t"].'\E\b/m', '<a href="'.$row["u"].'" class="'.$row["c"].'">'.$row["t"].'</a>', $text); } echo $replaced; ?> The problem is that only one array element is replaced and not all. It's something about $text in peg_replace(). Anyone got a hint for me? Thanks!

    Read the article

  • Read from plist insted of Code array

    - by BoSoud
    Hi Guys am Using [URL="http://www.iphonesdkarticles.com/2009/01/uitableview-searching-table-view.html"]UITableView - Searching table view[/URL] its really nice easy tutorial but i really have bad time try to read from plist that what i did change - (void)viewDidLoad { [super viewDidLoad]; //Initialize the array. listOfItems = [[NSMutableArray alloc] init]; TableViewAppDelegate *AppDelegate = (TableViewAppDelegate *)[[UIApplication sharedApplication] delegate]; listOfItems = [AppDelegate.data objectForKey:@"Countries"]; //Initialize the copy array. copyListOfItems = [[NSMutableArray alloc] init]; //Set the title self.navigationItem.title = @"Countries"; //Add the search bar self.tableView.tableHeaderView = searchBar; searchBar.autocorrectionType = UITextAutocorrectionTypeNo; searching = NO; letUserSelectRow = YES; } and This How i read plist from My AppDelegate.m - (void)applicationDidFinishLaunching:(UIApplication *)application { NSString *Path = [[NSBundle mainBundle] bundlePath]; NSString *DataPath = [Path stringByAppendingPathComponent:@"Data.plist"]; NSDictionary *tempDict = [[NSDictionary alloc] initWithContentsOfFile:DataPath]; self.data = tempDict; [tempDict release]; // Configure and show the window [window addSubview:[navigationController view]]; [window makeKeyAndVisible]; } and this my plist <plist version="1.0"> <dict> <key>Countries</key> <array> <array> <string>USA</string> </array> <dict/> </array> </dict> </plist> and i get this error *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSCFArray objectForKey:]: unrecognized selector sent to instance 0x1809dc0' help please am stock with this

    Read the article

  • powershell missing member methods in array

    - by Andrew
    Hi Guys I have (yet another) powershell query. I have an array in powershell which i need to use the remove() and split commands on. Normally you set an array (or variable) and the above methods exist. On the below $csv2 array both methods are missing, i have checked using the get-member cmd. How can i go about using remove to get rid of lines with nan. Also how do i split the columns into two different variables. at the moment each element of the array displays one line, for each line i need to convert it into two variables, one for each column. timestamp Utilization --------- ----------- 1276505880 2.0763250000e+00 1276505890 1.7487730000e+00 1276505900 1.6906890000e+00 1276505910 1.7972880000e+00 1276505920 1.8141900000e+00 1276505930 nan 1276505940 nan 1276505950 0.0000000000e+00 $SystemStats = (Get-F5.iControl).SystemStatistics $report = "c:\snmp\data" + $gObj + ".csv" ### Allocate a new Query Object and add the inputs needed $Query = New-Object -TypeName iControl.SystemStatisticsPerformanceStatisticQuery $Query.object_name = $i $Query.start_time = $startTime $Query.end_time = 0 $Query.interval = $interval $Query.maximum_rows = 0 ### Make method call passing in an array of size one with the specified query $ReportData = $SystemStats.get_performance_graph_csv_statistics( (,$Query) ) ### Allocate a new encoder and turn the byte array into a string $ASCII = New-Object -TypeName System.Text.ASCIIEncoding $csvdata = $ASCII.GetString($ReportData[0].statistic_data) $csv2 = convertFrom-CSV $csvdata $csv2

    Read the article

  • Array values changing unexpectedly

    - by Lizard
    I am using cakephp 1.2 and I have an array that appears to have a value change even though that variable is not being manipulated. Below is the code to that is causing me trouble. PLEASE NOTE - UPDATE Changing the variable name makes no difference to the outcome, The values get changed somewhere between the two print_r calls, and I can't see why the $this-find would do this . echo "Start of findCountByString()"; print_r($myArr); $test = $this->find('count', array( 'conditions' => $conditions, 'joins' => array('LEFT JOIN `articles_entities` AS ArticleEntity ON `ArticleEntity`.`article_id` = `Article`.`id`'), 'group' => 'Article.id' )); echo "End of findCountByString()"; print_r($myArr); I am getting the following output: Start of findCountByString() Array ( [0] => 4bdb1d96-c680-4c2c-aae7-104c39d70629 [1] => 4bdb1d6a-9e38-479d-9ad4-105c39d70629 [2] => 4bdb1b55-35f0-4d22-ab38-104e39d70629 [3] => 4bdb25f4-34d4-46ea-bcb6-104f39d70629 ) End of findCountByString() Array ( [0] => 4bdb1d96-c680-4c2c-aae7-104c39d70629 [1] => 4bdb1d6a-9e38-479d-9ad4-105c39d70629 [2] => 4bdb1b55-35f0-4d22-ab38-104e39d70629 [3] => '4bdb25f4-34d4-46ea-bcb6-104f39d70629' # This is now in inverted commas ) The the value in my array have changed, and I don't know why? Any suggestions?

    Read the article

  • Recursive function for multidimensional array

    - by moja
    This is my code, and I need your help to understand it. <?php $tree = array( array( 'name' => 'Item-1', 'children' => array()), array('name' => 'Item-2', 'children' => array( array('name' => 'Item-2-1', 'children' => array()), )), array('name' => 'Item-3', 'children' => array( array('name' => 'Item-3-1', 'children' => array()), array('name' => 'Item-3-2', 'children' => array( array('name' => 'Item-3-2-1', 'children' => array()), array('name' => 'Item-3-2-2', 'children' => array()), array('name' => 'Item-3-2-3', 'children' => array( array('name' => 'Item-3-2-3-1', 'children' => array()), )), )), )), ); What i need is one recursive function, which will return all names (name). For example: Item-1 Item-2 Item-2-1 Item-3 Item-3-1 Item-3-2 ........ Thanks for your help.

    Read the article

  • RAID Array performance on an HP Proliant ML350 G5 Smart Array E200i

    - by Nate Pinchot
    We have a client who is complaining about performance of an application which utilizes an MS SQL database. They do not believe the performance issues are the fault of the application itself. The Smart Array E200i RAID controller has 128MB cache and we have the cache set to 75% read/25% write. The disk array set to enable write caching. Recently we ran a disk performance test using SQLIO based on this guide. We used a 10 GB file for the test found that the average sequential read rate was ~60 MB/sec (megabytes/sec) and the average random read rate was ~30 MB/sec. Are these numbers on par for what the server should be performing? Better than on par? Horrible? Amazing?

    Read the article

  • matlab - int array to binary array

    - by asel
    hi, currently in matlab i have int array a=[3,4,5,6,7]; i want to convert it to binary array with four bits each. for the above int array i would get the following binary array abinary=[0,0,1,1, 0,1,0,0, 0,1,0,1, 0,1,1,0, 0,1,1,1]; is there any fast way to do it? thanks a lot!

    Read the article

  • PHP: Condense array of similar strings into one merged array

    - by Matt Andrews
    Hi everyone. Working with an array of dates (opening times for a business). I want to condense them to their briefest possible form. So far, I started out with this structure Array ( [Mon] => 12noon-2:45pm, 5:30pm-10:30pm [Tue] => 12noon-2:45pm, 5:30pm-10:30pm [Wed] => 12noon-2:45pm, 5:30pm-10:30pm [Thu] => 12noon-2:45pm, 5:30pm-10:30pm [Fri] => 12noon-2:45pm, 5:30pm-10:30pm [Sat] => 12noon-11pm [Sun] => 12noon-9:30pm ) What I want to achieve is this: Array ( [Mon-Fri] => 12noon-2:45pm, 5:30pm-10:30pm [Sat] => 12noon-11pm [Sun] => 12noon-9:30pm ) I've tried writing a recursive function and have managed to output this so far: Array ( [Mon-Fri] => 12noon-2:45pm, 5:30pm-10:30pm [Tue-Fri] => 12noon-2:45pm, 5:30pm-10:30pm [Wed-Fri] => 12noon-2:45pm, 5:30pm-10:30pm [Thu-Fri] => 12noon-2:45pm, 5:30pm-10:30pm [Sat] => 12noon-11pm [Sun] => 12noon-9:30pm ) Can anybody see a simple way of comparing the values and combining the keys where they're similar? My recursive function is basically two nested foreach() loops - not very elegant. Thanks, Matt EDIT: Here's my code so far, which produces the 3rd array above (from the first one as input): $last_time = array('t' => '', 'd' => ''); // blank array for looping $i = 0; foreach($final_times as $day=>$time) { if($last_time['t'] != $time ) { // it's a new time if($i != 0) { $print_times[] = $day . ' ' . $time; } // only print if it's not the first, otherwise we get two mondays } else { // this day has the same time as last time $end_day = $day; foreach($final_times as $day2=>$time2) { if($time == $time2) { $end_day = $day2; } } $print_times[] = $last_time['d'] . '-' . $end_day . ' ' . $time; } $last_time = array('t' => $time, 'd' => $day); $i++; }

    Read the article

  • strange array in php

    - by tunpishuang
    here i wrote a function , it's general purpose is to get an array of the depIds under the parent root $depId. i use recursion method to get the array. public function getEmpsByDep($depId){ $query = "select * from ".SQLPREFIX."department where id_parent=".$depId; $stmt=$this->db->query($query); while(($row=$this->db->fetch_assoc($stmt))==true) { if($this->hasChildNode($row['DEPID'])) { $depId = $row['DEPID']; self::getEmpsByDep($depId); } else { $arr[]=$row['DEPID']; } } return ($arr); } while i think it should return a 1D array of the depid.but it return a strange 2D array like this: array(4) { [0]=> string(2) "11" [1]=> string(2) "12" [2]=> string(2) "13" [3]=> string(2) "14" } array(3) { [0]=> string(2) "19" [1]=> string(2) "20" [2]=> string(2) "21" } array(3) { [0]=> string(2) "15" [1]=> string(2) "16" [2]=> string(2) "17" } array(8) { [0]=> string(1) "2" [1]=> string(1) "4" [2]=> string(1) "5" [3]=> string(1) "6" [4]=> string(1) "7" [5]=> string(1) "8" [6]=> string(1) "9" [7]=> string(2) "10" } here is the table structure and data sample: $query[]="create table ".$sqltblpre."department( depId number(10) not null primary key, depName varchar2(50) not null, id_parent number(10) )"; //department(?????) $index=1; $query[] = "INSERT INTO ".$sqltblpre."department values(".$index++.",'??',0)"; //1 $query[] = "INSERT INTO ".$sqltblpre."department values(".$index++.",'???',0)"; //2 $query[] = "INSERT INTO ".$sqltblpre."department values(".$index++.",'???',0)"; //3 $query[] = "INSERT INTO ".$sqltblpre."department values(".$index++.",'???',0)"; //4 $query[] = "INSERT INTO ".$sqltblpre."department values(".$index++.",'???',0)"; //5 $query[] = "INSERT INTO ".$sqltblpre."department values(".$index++.",'???',0)"; //6 $query[] = "INSERT INTO ".$sqltblpre."department values(".$index++.",'?????',0)"; $query[] = "INSERT INTO ".$sqltblpre."department values(".$index++.",'????',0)"; $query[] = "INSERT INTO ".$sqltblpre."department values(".$index++.",'????',0)"; $query[] = "INSERT INTO ".$sqltblpre."department values(".$index++.",'????',0)"; $query[] = "INSERT INTO ".$sqltblpre."department values(".$index++.",'??',1)"; $query[] = "INSERT INTO ".$sqltblpre."department values(".$index++.",'??',1)"; $query[] = "INSERT INTO ".$sqltblpre."department values(".$index++.",'???',1)"; $query[] = "INSERT INTO ".$sqltblpre."department values(".$index++.",'??',1)"; $query[] = "INSERT INTO ".$sqltblpre."department values(".$index++.",'??',3)"; $query[] = "INSERT INTO ".$sqltblpre."department values(".$index++.",'???',3)"; $query[] = "INSERT INTO ".$sqltblpre."department values(".$index++.",'???',3)"; $query[] = "INSERT INTO ".$sqltblpre."department values(".$index++.",'???',3)"; //18 $query[] = "INSERT INTO ".$sqltblpre."department values(".$index++.",'??',18)"; $query[] = "INSERT INTO ".$sqltblpre."department values(".$index++.",'???',18)"; $query[] = "INSERT INTO ".$sqltblpre."department values(".$index++.",'??',18)"; so in a word, how can i get the 1D array thought the right code of this function?

    Read the article

  • perl sorting an array of hashes

    - by srk
    use strict; my @arr; $arr[0][0]{5} = 16; $arr[0][1]{6} = 11; $arr[0][2]{7} = 25; $arr[0][3]{8} = 31; $arr[0][4]{9} = 16; $arr[0][5]{10} = 17; sort the array based on hash values so this should change to $arr[0][0]{6} = 11; $arr[0][1]{9} = 16; $arr[0][2]{5} = 16; $arr[0][3]{10} = 17; $arr[0][4]{7} = 25; $arr[0][5]{8} = 31; first sort on values in the hash.. when the values are same reverse sort based on keys... Please tell me how to do this.. Thank you

    Read the article

  • Array on servers which receive several hundred GB of data a day

    - by Matthew
    This is hopefully a simple question. Right now we are deploying servers which will serve as data warehouses. I know with raid 5 the best practice is 6 disks per raid 5. However, our plan is to use RAID 10 (both for performance and safety). We have a total of 14 disks (16 actually, but two are being used for OS). Keeping in mind that performance is very much an issue, which is better - doing several raid 1's? Do one large raid 10? One large raid 10 had been our original plan, but I want to see if anyone has any opinions I haven't thought of. Please note: This system was designed for using Raid 1+0, so losing half of the raw storage capacity is not an issue. Sorry i hadn't mentioned that initially. The concern is more whether or not we want to use one large Raid 1+0 containing all 14 disks, or several smaller raid 1+0's and then stripe across them using LVM. I know the best practice for higher raid levels is to never use more than 6 disks in an array.

    Read the article

  • cannot convert from 'cli::array<Type> ^' to 'cli::array<Type> ^[]'

    - by user1576628
    I'm pretty new to C++/CLI and I am trying to convert a System::String to a System::Char array. Here's what I have so far: private: System::Void modeToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) { Mode frmMode; if(frmMode.ShowDialog() == System::Windows::Forms::DialogResult::OK){ array <Char>^ load [] = gcnew array<Char>(txtbxName->Text->ToCharArray()); } } txtbxName is a textbox inside a the form. Supposedly, this should work, but I get the compiler error: error C2440: cannot convert from 'cli::array<Type> ^' to 'cli::array<Type> ^[]' for the fourth line of the snippet.

    Read the article

  • Ruby Built In Method to Create Multidimensional Array From Single Dimensioned Array

    - by Ell
    If I have an array like this: [0, 1, 2, 3, 4, 5], is there a built in method to create this: [[0, 1, 2], [3, 4, 5]] given a width of 3? If there is no built in method, how could I improve on this? def multi_to_single(array, width) return [].tap{|md_array| (array.length.to_f / width).ceil.times {|y| row = (array[(y*width), width]) md_array.push( row + Array.new(width - row.length)) } } end I feel like I have missed something obvious because I haven't programmed ruby in a while! Thanks in advance, ell. EDIT: It needs to be in the core library, so no ruby on rails or anything.

    Read the article

  • Best way to deallocate an array of array in javascript

    - by andre.dias
    What is the best way to deallocate an array of array in javascript to make sure no memory leaks will happen? var foo = new Array(); foo[0] = new Array(); foo[0][0] = 'bar0'; foo[0][1] = 'bar1'; foo[1] = new Array(); ... delete(foo)? iterate through foo, delete(foo[index]) and delete(foo)? 1 and 2 give me the same result? none?

    Read the article

  • Convert PHP array into Key => Value Array

    - by Feature
    Total PHP Noob and I couldn't find an answer to this specific problem. Hope someone can help! $myvar is an array that looks like this: Array ( [aid] = Array ( [0] = 2 [1] = 1 ) [oid] = Array( [0] = 2 [1] = 1 ) ) And I need to set a new variable (called $attributes) to something that looks like this: $attributes = array($myvar['aid'][0] => $myvar['oid'][0], $myvar['aid'][1] => $myvar['oid'][1], etc...); And, of course, $myvar may contain many more items... How do I iterate through $myvar and build the $attributes variable?

    Read the article

  • PHP Session Array Value keeps showing as "Array"

    - by Nerathas
    Hello, When sending data from a form to a second page, the value of the session is always with the name "Array" insteed of the expected number. The data should get displayed in a table, but insteed of example 1, 2, 3 , 4 i get : Array, Array, Array. (A 2-Dimensional Table is used) Is the following code below a proper way to "call" upon the stored values on the 2nd page from the array ? $test1 = $_SESSION["table"][0]; $test2 = $_SESSION["table"][1]; $test3 = $_SESSION["table"][2]; $test4 = $_SESSION["table"][3]; $test5 = $_SESSION["table"][4]; What exactly is this, and how can i fix this? Is it some sort of override that needs to happen? Best Regards.

    Read the article

  • What is the fastest way to Initialize a multi-dimensional array to non-default values in .NET?

    - by AMissico
    How do I initialize a multi-dimensional array of a primitive type as fast as possible? I am stuck with using multi-dimensional arrays. My problem is performance. The following routine initializes a 100x100 array in approx. 500 ticks. Removing the int.MaxValue initialization results in approx. 180 ticks just for the looping. Approximately 100 ticks to create the array without looping and without initializing to int.MaxValue. Routines similiar to this are called a few hundred-thousand to several million times during a "run". The array size will not change during a run and arrays are created one-at-a-time, used, then discarded, and a new array created. A "run" which may last from one minute (using 10x10 arrays) to forty-five minutes (100x100). The application creates arrays of int, bool, and struct. There can be multiple "runs" executing at same time, but are not because performance degrades terribly. I am using 100x100 as a base-line. I am open to suggestions on how to optimize this non-default initialization of an array. One idea I had is to use a smaller primitive type when available. For instance, using byte instead of int, saves 100 ticks. I would be happy with this, but I am hoping that I don't have to change the primitive data type. public int[,] CreateArray(Size size) { int[,] array = new int[size.Width, size.Height]; for (int x = 0; x < size.Width; x++) { for (int y = 0; y < size.Height; y++) { array[x, y] = int.MaxValue; } } return array; } Down to 450 ticks with the following: public int[,] CreateArray1(Size size) { int iX = size.Width; int iY = size.Height; int[,] array = new int[iX, iY]; for (int x = 0; x < iX; x++) { for (int y = 0; y < iY; y++) { array[x, y] = int.MaxValue; } } return array; } Down to approximately 165 ticks after a one-time initialization of 2800 ticks. (See my answer below.) If I can get stackalloc to work with multi-dimensional arrays, I should be able to get the same performance without having to intialize the private static array. private static bool _arrayInitialized5; private static int[,] _array5; public static int[,] CreateArray5(Size size) { if (!_arrayInitialized5) { int iX = size.Width; int iY = size.Height; _array5 = new int[iX, iY]; for (int x = 0; x < iX; x++) { for (int y = 0; y < iY; y++) { _array5[x, y] = int.MaxValue; } } _arrayInitialized5 = true; } return (int[,])_array5.Clone(); } Down to approximately 165 ticks without using the "clone technique" above. (See my answer below.) I am sure I can get the ticks lower, if I can just figure out the return of CreateArray9. public unsafe static int[,] CreateArray8(Size size) { int iX = size.Width; int iY = size.Height; int[,] array = new int[iX, iY]; fixed (int* pfixed = array) { int count = array.Length; for (int* p = pfixed; count-- > 0; p++) *p = int.MaxValue; } return array; }

    Read the article

  • Array comparion for multidimensinal array in php

    - by Learner
    Array 1 = pr($plan_data); Array ( [0] => Array ( [AveragePrice] => 9.631161 [EFLUrl] => http://www.championenergyservices.com/register/EFL_API.asp?rateid=161456 [EarlyTerminationFee] => 150 [HurricaneRecovery] => 0.132 [MeterSurcharge] => 3.05 [OffCycle] => 5 [PUCAssessment] => 0.00167 [PlanDescription] => Savings Champ-6 [PlanId] => 57 [PlanIssueDate] => 12/10/2012 [PlanMonthlyFee] => 0 [PlanName] => PN1058 [PlanRate] => 9.3 [PlanRenewablePercent] => 7.2 [PlanTerm] => 6 [PriorityMoveIn] => 36 [ProviderDisplayName] => CenterPoint Energy [ProviderId] => 21 [ProviderInternalName] => CNP_COAST [RateId] => 161456 [RegularMoveIn] => 16 [TDSPPassThrough] => 0.03791 [TOCUrl] => http://www.championenergyservices.com/register/termsandconditions.asp?rateid=161456 [YRACUrl] => http://www.championenergyservices.com/register/\affiliatefiles\YRAC.PDF [provider] => ces [ProductType] => Fixed [Rep] => Champion Energy Services [Zone] => 77479 ) [1] => Array ( [AveragePrice] => 10.1311693 [EFLUrl] => http://www.championenergyservices.com/register/EFL_API.asp?rateid=161458 [EarlyTerminationFee] => 150 [HurricaneRecovery] => 0.132 [MeterSurcharge] => 3.05 [OffCycle] => 5 [PUCAssessment] => 0.00167 [PlanDescription] => Savings Champ-12 [PlanId] => 59 [PlanIssueDate] => 12/10/2012 [PlanMonthlyFee] => 0 [PlanName] => PN1060 [PlanRate] => 9.8 [PlanRenewablePercent] => 7.2 [PlanTerm] => 12 [PriorityMoveIn] => 36 [ProviderDisplayName] => CenterPoint Energy [ProviderId] => 21 [ProviderInternalName] => CNP_COAST [RateId] => 161458 [RegularMoveIn] => 16 [TDSPPassThrough] => 0.03791 [TOCUrl] => http://www.championenergyservices.com/register/termsandconditions.asp?rateid=161458 [YRACUrl] => http://www.championenergyservices.com/register/\affiliatefiles\YRAC.PDF [provider] => ces [ProductType] => Fixed [Rep] => Champion Energy Services [Zone] => 77479 ) [2] => Array ( [AveragePrice] => 10.4311743 [EFLUrl] => http://www.championenergyservices.com/register/EFL_API.asp?rateid=161459 [EarlyTerminationFee] => 150 [HurricaneRecovery] => 0.132 [MeterSurcharge] => 3.05 [OffCycle] => 5 [PUCAssessment] => 0.00167 [PlanDescription] => Green Power-12 [PlanId] => 60 [PlanIssueDate] => 12/10/2012 [PlanMonthlyFee] => 0 [PlanName] => PN1061 [PlanRate] => 10.1 [PlanRenewablePercent] => 100 [PlanTerm] => 12 [PriorityMoveIn] => 36 [ProviderDisplayName] => CenterPoint Energy [ProviderId] => 21 [ProviderInternalName] => CNP_COAST [RateId] => 161459 [RegularMoveIn] => 16 [TDSPPassThrough] => 0.03791 [TOCUrl] => http://www.championenergyservices.com/register/termsandconditions.asp?rateid=161459 [YRACUrl] => http://www.championenergyservices.com/register/\affiliatefiles\YRAC.PDF [provider] => ces [ProductType] => Fixed [Rep] => Champion Energy Services [Zone] => 77479 ) ) Array 2 = pr($temp_val); Array ( [0] => Array ( [id] => 6 [PlanId] => 60 [PlanName] => Bounce 12 + A/C Protection [PlanDescription] => Bounce 12 + A/C Protection - CNP [PlanTerm] => 12 [PlanRate] => [RateId] => [PlanIssueDate] => [PlanMonthlyFee] => [EarlyTerminationFee] => 200.00000 [AveragePrice] => 12.00000 [HurricaneRecovery] => [PlanRenewablePercent] => [ProviderDisplayName] => [ProviderId] => 1 [provider] => bounce [ProductZoneId] => 353 [Zone] => 77479 [ProviderInternalName] => [RegularMoveIn] => [PriorityMoveIn] => [OffCycle] => [TDSPPassThrough] => [PUCAssessment] => [EFLUrl] => [EFLLinkUrl] => http://www.bounceenergy.com/efls/bounce12.pdf [TOCUrl] => [TOCLUrl] => http://www.bounceenergy.com/terms-of-service-fixed.pdf [YRACUrl] => [YRACLUrl] => http://www.bounceenergy.com/yraac.pdf [REP_Name] => [REP_PUCT] => [customer_service_email] => [toll_free_number] => [status] => active [created] => 2012-12-14 12:40:05 [modified] => 2012-12-14 ) [1] => Array ( [id] => 18 [PlanId] => 17 [PlanName] => Online Only - 12 [PlanDescription] => Online Only - 12 [PlanTerm] => 12 [PlanRate] => [RateId] => 386 [PlanIssueDate] => [PlanMonthlyFee] => 100.00000 [EarlyTerminationFee] => 175.00000 [AveragePrice] => 10.00000 [HurricaneRecovery] => [PlanRenewablePercent] => [ProviderDisplayName] => [ProviderId] => 2 [provider] => fulcrum [ProductZoneId] => [Zone] => 77479 [ProviderInternalName] => [RegularMoveIn] => [PriorityMoveIn] => [OffCycle] => [TDSPPassThrough] => [PUCAssessment] => [EFLUrl] => [EFLLinkUrl] => [TOCUrl] => [TOCLUrl] => [YRACUrl] => [YRACLUrl] => [REP_Name] => [REP_PUCT] => [customer_service_email] => [toll_free_number] => [status] => active [created] => 2012-12-14 12:40:15 [modified] => 2012-12-14 ) ) I want to compare this two array and if any key value is different i want to take it an different array.. $result_val= array_diff_assoc($plan_data, $temp_val); Please help me out !!

    Read the article

  • PHP: Count values of array

    - by poru
    I know the function count() of php, but what's the function for counting how often a value appear in an array? Example: $array = array( [0] => 'Test', [1] => 'Tutorial', [2] => 'Video', [3] => 'Test', [4] => 'Test' ); Now I want to count how often "Test" appears.

    Read the article

  • Sparse O(1) array with indices being consecutive products

    - by Kos
    Hello, I'd like to pre-calculate an array of values of some unary function f. I know that I'll only need the values for f(x) where x is of the form of a*b, where both a and b are integers in range 0..N. The obvious time-optimized choice is just to make an array of size N*N and just pre-calculate just the elements which I'm going to read later. For f(a*b), I'd just check and set tab[a*b]. This is the fastest method possible - however, this is going to take a lot of space as there are lots of indices in this array (starting with N+1) which will never by touched. Another solution is to make a simple tree map... but this slows down the lookup itself very heavily by introducing lots of branches. No. I wonder - is there any solution to make such an array less sparse and smaller, but still quick branchless O(1) in lookup?

    Read the article

  • getjson jquery parsing an array

    - by Ozaki
    TLDR: Want to get each heading from an array and insert it into a div without knowing what is inside the div using Jquery - getJSON. I have JSON array lets say: jsonfeed({ "items": [ { "d":{"title":"034324324-22344231-10"} }, { "d"{"title":"23423404-3423422-10"} }, { "d"{"title":"0234234324-32432422-10"} }, { "d"{"title":"0234234324-223534534-10"} ] }) And I want to parse it as for each "title" to insert it into a div. Trying along the lines of $.getJSON(url, function(data){ $.each(data.items, function(i,item){ $('#testfield').html('<p>' + item.d.title + '</p>'); }); }); to no avail. I am using Getjson in other places but in cases where I know what request I am making. e.g: $('#livetime').html(data.Time); Which is all working perfectly fine but in this case I need to get the details out of the array without knowing what is inside the array I'm sure there is something simple that I'm missing here or doing wrong ^^.

    Read the article

  • PHP Key name array

    - by Sean McRaghty
    I have an array $data fruit => apple, seat => sofa, etc. I want to loop through so that each key becomes type_key[0]['value'] so eg type_fruit[0]['value'] => apple, type_seat[0]['value'] => sofa, and what I thought would do this, namely foreach ($data as $key => $value) { # Create a new, renamed, key. $array[str_replace("/(.+)/", "type_$1[0]['value']", $key)] = $value; # Destroy the old key/value pair unset($array[$key]); } print_r($array); Doesn't work. How can I make it work? Also, I want everything to be in the keys (not the values) to be lowercase: is there an easy way of doing this too? Thanks.

    Read the article

  • Pass array of data to jQuery function

    - by ILMV
    Here's the story... I have a jQuery function that does something, this function is referenced very regularly. One of the input parameters is an array, this array data is hard coded and thus I want to pass the data like this: (this is how I would do it using PHP) myFunction(Array("1"=>"a","2"=>"b","3"=>"c")); Instead of $arr=Array("1"=>"a","2"=>"b","3"=>"c"); myFunction($arr); So how do I achieve this with my jQuery function, I want this to be a one liner if possible.

    Read the article

  • Find Shortest element in Array

    - by Ani
    I have a Array string[] names = { "Jim Rand", "Barry Williams", "Nicole Dyne", "Peter Levitt", "Jane Jones", "Cathy Hortings"}; Is there any way to find which is the shortest(Length wise) element in this array and then store rest of elements in a different array. Thanks, Ani

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >